2018-04-06 11:02:18 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Observable } from 'rxjs/Observable';
|
|
|
|
|
|
|
|
import 'rxjs/add/operator/map';
|
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
import { RPCService } from '@loafer/ng-rpc';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
// import { PageParams, Page } from 'app/commons/model';
|
2018-05-02 08:09:39 +00:00
|
|
|
import { SensorItem } from '@overflow/commons-typescript/model/sensor-item';
|
|
|
|
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
|
|
|
import { Domain } from '@overflow/commons-typescript/model/domain';
|
|
|
|
import { Target } from '@overflow/commons-typescript/model/target';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class SensorService {
|
|
|
|
|
|
|
|
public constructor(
|
|
|
|
private rpcService: RPCService,
|
|
|
|
) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
// public readAllByDomain(domain: Domain, pageParams: PageParams): Observable<Page> {
|
|
|
|
// return this.rpcService.call('SensorService.readAllByDomain', domain, pageParams);
|
|
|
|
// }
|
2018-04-06 11:02:18 +00:00
|
|
|
|
|
|
|
public registSensorConfig(sensor: Sensor, sensorItems: SensorItem[]): Observable<Sensor> {
|
|
|
|
return this.rpcService.call('SensorService.registSensorConfig', sensor, sensorItems, null);
|
|
|
|
}
|
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
// public readAllByInfra(infraId: string, pageParams: PageParams): Observable<Page> {
|
|
|
|
// return this.rpcService.call('SensorService.readAllByInfra', infraId, pageParams);
|
|
|
|
// }
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
// public readAllByTarget(target: Target, pageParams: PageParams): Observable<Page> {
|
|
|
|
// return this.rpcService.call('SensorService.readAllByTarget', target, pageParams);
|
|
|
|
// }
|
2018-04-18 11:28:53 +00:00
|
|
|
|
|
|
|
public read(id: string): Observable<Sensor> {
|
|
|
|
return this.rpcService.call<Sensor>('SensorService.read', id);
|
|
|
|
}
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|