Add data layer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
21
projects/common/src/fm/services/senml-service.ts
Normal file
21
projects/common/src/fm/services/senml-service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { IJsonline } from '../models/json-line';
|
||||
import { ISenMLItem } from '../models/senml-item';
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user