From 577dd00365965933f2c81ec1638d5d324a39d4fa Mon Sep 17 00:00:00 2001 From: Nathan Kunicki Date: Thu, 26 Jul 2018 18:15:54 +0100 Subject: [PATCH] Fixed optional callbacks when activating port devices --- lpf2hub.ts | 4 ++-- wedo2hub.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lpf2hub.ts b/lpf2hub.ts index e88678f..8a56b3d 100644 --- a/lpf2hub.ts +++ b/lpf2hub.ts @@ -159,12 +159,12 @@ export class LPF2Hub extends Hub { } - protected _activatePortDevice (port: number, type: number, mode: number, format: number, callback: () => void) { + protected _activatePortDevice (port: number, type: number, mode: number, format: number, callback?: () => void) { this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, Buffer.from([0x0a, 0x00, 0x41, port, mode, 0x01, 0x00, 0x00, 0x00, 0x01]), callback); } - protected _deactivatePortDevice (port: number, type: number, mode: number, format: number, callback: () => void) { + protected _deactivatePortDevice (port: number, type: number, mode: number, format: number, callback?: () => void) { this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, Buffer.from([0x0a, 0x00, 0x41, port, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), callback); } diff --git a/wedo2hub.ts b/wedo2hub.ts index 91ec104..58570a1 100644 --- a/wedo2hub.ts +++ b/wedo2hub.ts @@ -128,12 +128,12 @@ export class WeDo2Hub extends Hub { } - protected _activatePortDevice (port: number, type: number, mode: number, format: number, callback: () => void) { + protected _activatePortDevice (port: number, type: number, mode: number, format: number, callback?: () => void) { this._writeMessage(Consts.BLECharacteristics.WEDO2_PORT_TYPE_WRITE, Buffer.from([0x01, 0x02, port, type, mode, 0x01, 0x00, 0x00, 0x00, format, 0x01]), callback); } - protected _deactivatePortDevice (port: number, type: number, mode: number, format: number, callback: () => void) { + protected _deactivatePortDevice (port: number, type: number, mode: number, format: number, callback?: () => void) { this._writeMessage(Consts.BLECharacteristics.WEDO2_PORT_TYPE_WRITE, Buffer.from([0x01, 0x02, port, type, mode, 0x01, 0x00, 0x00, 0x00, format, 0x00]), callback); }