本文整理汇总了TypeScript中node-zway.DeviceApi类的典型用法代码示例。如果您正苦于以下问题:TypeScript DeviceApi类的具体用法?TypeScript DeviceApi怎么用?TypeScript DeviceApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DeviceApi类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(
id: string,
host: string = 'localhost',
user: string = 'admin',
password: string = 'password',
port: number = 8083) {
this._deviceApi = new DeviceApi({host, port, user, password});
this._deviceApi.poll(5000);
}
示例2: getLockDevice
getLockDevice(deviceId: number) : IDevice {
return this._deviceApi.getDevice(deviceId, CLASS_LOCK);
}
示例3: getDevice
getDevice(deviceId: number) : IDevice {
return this._deviceApi.getDevice(deviceId);
}
示例4: onAlarmEvent
onAlarmEvent(deviceId: number, callback: EventCallback<AlarmEvent>) : void {
// console.log('alarm callback', callback);
// console.log('on', this._deviceApi.on.toString());
this._deviceApi.on(deviceId, String(CLASS_ALARM), '*', callback);
}
示例5: onLockEvent
onLockEvent(deviceId: number, callback: EventCallback<LockEvent>) : void {
// console.log('lock callback', callback);
// console.log('on', this._deviceApi.on.toString());
this._deviceApi.on(deviceId, String(CLASS_LOCK), '*', callback);
}
示例6: onSensorMultiEvent
onSensorMultiEvent(deviceId: number, callback: DeviceEventCallback) : void {
this._deviceApi.on(deviceId, String(CLASS_SENSOR_MULTI), '*', callback);
}
示例7: onSensorBinaryEvent
onSensorBinaryEvent(deviceId: number, callback: DeviceEventCallback) : void {
this._deviceApi.on(deviceId, String(CLASS_SENSOR_BINARY), '*', callback);
}
示例8: start
start() {
this._deviceApi.refresh();
}
示例9: getSensorDevice
getSensorDevice(deviceId: number) : IDevice {
return this._deviceApi.getDevice(deviceId, [CLASS_SENSOR_BINARY, CLASS_SENSOR_MULTI, CLASS_BATTERY]);
}