40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
|
import { Injectable } from '@angular/core';
|
||
|
import { Observable } from 'rxjs/Observable';
|
||
|
|
||
|
import 'rxjs/add/operator/map';
|
||
|
|
||
|
import { RPCService } from '@loafer/ng-rpc/service';
|
||
|
|
||
|
import { PageParams, Page } from 'app/commons/model';
|
||
|
import { SensorItem } from 'packages/sensor-item/model/SensorItem';
|
||
|
import { Sensor } from '../model';
|
||
|
import { Domain } from 'packages/domain/model';
|
||
|
import { Target } from 'packages/target/model';
|
||
|
|
||
|
|
||
|
@Injectable()
|
||
|
export class SensorService {
|
||
|
|
||
|
public constructor(
|
||
|
private rpcService: RPCService,
|
||
|
) {
|
||
|
|
||
|
}
|
||
|
|
||
|
public readAllByDomain(domain: Domain, pageParams: PageParams): Observable<Page> {
|
||
|
return this.rpcService.call('SensorService.readAllByDomain', domain, pageParams);
|
||
|
}
|
||
|
|
||
|
public registSensorConfig(sensor: Sensor, sensorItems: SensorItem[]): Observable<Sensor> {
|
||
|
return this.rpcService.call('SensorService.registSensorConfig', sensor, sensorItems, null);
|
||
|
}
|
||
|
|
||
|
public readAllByInfra(infraId: string, pageParams: PageParams): Observable<Page> {
|
||
|
return this.rpcService.call('SensorService.readAllByInfra', infraId, pageParams);
|
||
|
}
|
||
|
|
||
|
public readAllByTarget(target: Target, pageParams: PageParams): Observable<Page> {
|
||
|
return this.rpcService.call('SensorService.readAllByTarget', target, pageParams);
|
||
|
}
|
||
|
}
|