WeDo 2.0 unsubscribing
This commit is contained in:
parent
c5146bd315
commit
077a7376c0
@ -107,11 +107,15 @@ export class Device extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
public unsubscribe (mode: number) {
|
||||
this._ensureConnected();
|
||||
}
|
||||
|
||||
public receive (message: Buffer) {
|
||||
this.emitGlobal("receive", message);
|
||||
}
|
||||
|
||||
public emitGlobal (event: string, ...args: any) {
|
||||
public emitGlobal (event: string, ...args: any[]) {
|
||||
this.emit(event, ...args);
|
||||
if (this.hub.listenerCount(event) > 0) {
|
||||
this.hub.emit(event, this, ...args);
|
||||
|
@ -289,6 +289,11 @@ export class BaseHub extends EventEmitter {
|
||||
}
|
||||
|
||||
|
||||
public unsubscribe (portId: number, deviceType: number, mode: number) {
|
||||
// NK Do nothing here
|
||||
}
|
||||
|
||||
|
||||
protected _attachDevice (device: Device) {
|
||||
this._attachedDevices[device.portId] = device;
|
||||
/**
|
||||
|
@ -141,8 +141,8 @@ export class WeDo2SmartHub extends BaseHub {
|
||||
}
|
||||
|
||||
|
||||
protected _deactivatePortDevice (port: number, type: number, mode: number, format: number, callback?: () => void) {
|
||||
this.send(Buffer.from([0x01, 0x02, port, type, mode, 0x01, 0x00, 0x00, 0x00, format, 0x00]), Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE, callback);
|
||||
public unsubscribe (portId: number, deviceType: number, mode: number) {
|
||||
this.send(Buffer.from([0x01, 0x02, portId, deviceType, mode, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user