member_webapp/@overflow/sensor/service/sensor.service.ts
2018-06-12 14:45:21 +09:00

42 lines
1.4 KiB
TypeScript

import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc';
// import { PageParams, Page } from 'app/commons/model';
import { Sensor, SensorItem } from '@overflow/commons-typescript/model/sensor';
import { Domain } from '@overflow/commons-typescript/model/domain';
import { Target } from '@overflow/commons-typescript/model/target';
import { Page, PageParams } from '@overflow/commons-typescript/core/model';
@Injectable()
export class SensorService {
public constructor(
private rpcService: RPCService,
) {
}
public readAllByDomainID(domainID: number, pageParams: PageParams): Observable<Page<Sensor>> {
return this.rpcService.call('SensorService.readAllByDomainID', domainID, 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);
// }
public read(id: number): Observable<Sensor> {
return this.rpcService.call<Sensor>('SensorService.read', id);
}
}