From d62f8535a21bc59d00b99d1cfb7612f752cbd35b Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Wed, 16 Jan 2019 11:55:43 -0800 Subject: [PATCH] Initial pass at getting the firmware version --- src/lpf2hub.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index a88828b..2423d07 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -41,6 +41,7 @@ export class LPF2Hub extends Hub { this._subscribeToCharacteristic(characteristic, this._parseMessage.bind(this)); this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x01, 0x02, 0x02])); // Activate button reports this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x01, 0x03, 0x05])); // Get firmware version + this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x01, 0x06, 0x02])); // Get battery level? this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x3b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate current reports this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x3c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate voltage reports if (this.type === Consts.HubType.DUPLO_TRAIN_HUB) { @@ -177,6 +178,8 @@ export class LPF2Hub extends Hub { private _parseDeviceInfo (data: Buffer) { + console.log(data); + if (data[3] === 2) { if (data[5] === 1) { /**