2020-06-29 13:44:23 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { IJsonline } from '../models/json-line';
|
|
|
|
import { ISenMLItem } from '../models/senml-item';
|
2020-06-29 13:51:08 +00:00
|
|
|
import { IDataLayer } from '../models/data.layer';
|
2020-06-29 13:44:23 +00:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root',
|
|
|
|
})
|
|
|
|
export class SenmlService {
|
|
|
|
constructor() {
|
|
|
|
}
|
|
|
|
|
|
|
|
getSenMLItem(name:string,jsonLine:IJsonline): ISenMLItem {
|
|
|
|
if (jsonLine) {
|
|
|
|
var senmlPack = jsonLine.data as ISenMLItem[];
|
|
|
|
var temp = senmlPack.filter((i) => i.u == name);
|
|
|
|
if (temp.length == 1) return temp[0];
|
|
|
|
return null;
|
|
|
|
}
|
2020-06-29 13:51:08 +00:00
|
|
|
}
|
2020-06-29 13:44:23 +00:00
|
|
|
|
|
|
|
}
|