本文整理匯總了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]);
}