UNPKG

@iotize/device-client.js

Version:

IoTize Device client for Javascript

46 lines (45 loc) 1.29 kB
import { Observable } from 'rxjs'; import { MonitorInterface } from '../../monitor/monitor.interface'; export interface VariableMonitorOptions { period?: number; forceChange?: boolean; duration?: number; } export declare type VariableMonitorEventType = "START" | "STOP" | "PAUSE" | "READ_ERROR" | "READ_SUCCESS"; export interface VariableMonitorEvent<PayloadType = any> { type: VariableMonitorEventType; payload: PayloadType; } export interface VariableMonitoringUpdate<DataType> { update(totalMs: number): Promise<DataType>; } export declare enum VariableMonitorState { START = 0, PAUSE = 1, STOP = 2 } export interface VariableMonitor<DataType> extends MonitorInterface<DataType> { start(options?: VariableMonitorOptions): this; /** * Stop monitoring * It will terminates values and event streams (complete will be called on your subsriptions) */ stop(): this; /** * Pause monitoring */ pause(): this; /** * Values stream */ values(): Observable<DataType>; /** * Event stream */ events(): Observable<VariableMonitorEvent>; /** * * @param notify a new value */ notifyNewValue(value: DataType): void; }