diff --git a/docs/BoostMoveHub.html b/docs/BoostMoveHub.html
index fdb0003..921e057 100644
--- a/docs/BoostMoveHub.html
+++ b/docs/BoostMoveHub.html
@@ -327,7 +327,7 @@
@@ -460,7 +460,7 @@
@@ -593,7 +593,7 @@
@@ -726,7 +726,7 @@
@@ -859,7 +859,7 @@
@@ -992,7 +992,7 @@
@@ -1250,7 +1250,7 @@
@@ -1376,7 +1376,7 @@
@@ -1502,7 +1502,7 @@
@@ -1674,7 +1674,7 @@
@@ -2075,7 +2075,7 @@
@@ -2294,7 +2294,7 @@
@@ -3201,7 +3201,7 @@
@@ -3322,7 +3322,7 @@
@@ -3499,7 +3499,7 @@
@@ -3719,7 +3719,7 @@
@@ -3895,7 +3895,7 @@
@@ -4072,7 +4072,7 @@
@@ -4280,7 +4280,7 @@
@@ -4451,7 +4451,7 @@
@@ -4622,7 +4622,7 @@
@@ -4817,7 +4817,7 @@
@@ -4969,7 +4969,7 @@
@@ -5140,7 +5140,7 @@
@@ -5311,7 +5311,7 @@
@@ -5506,7 +5506,7 @@
diff --git a/docs/DuploTrainBase.html b/docs/DuploTrainBase.html
index 7ce2fbe..835617e 100644
--- a/docs/DuploTrainBase.html
+++ b/docs/DuploTrainBase.html
@@ -327,7 +327,7 @@
@@ -460,7 +460,7 @@
@@ -593,7 +593,7 @@
@@ -726,7 +726,7 @@
@@ -859,7 +859,7 @@
@@ -992,7 +992,7 @@
@@ -1250,7 +1250,7 @@
@@ -1376,7 +1376,7 @@
@@ -1502,7 +1502,7 @@
@@ -1674,7 +1674,7 @@
@@ -2452,7 +2452,7 @@
@@ -2864,7 +2864,7 @@
@@ -2985,7 +2985,7 @@
@@ -3162,7 +3162,7 @@
@@ -3382,7 +3382,7 @@
@@ -3558,7 +3558,7 @@
@@ -3735,7 +3735,7 @@
@@ -3938,7 +3938,7 @@
@@ -4109,7 +4109,7 @@
diff --git a/docs/Hub.html b/docs/Hub.html
index 1d43619..8bf8e93 100644
--- a/docs/Hub.html
+++ b/docs/Hub.html
@@ -307,7 +307,7 @@
@@ -426,7 +426,7 @@
@@ -545,7 +545,7 @@
@@ -664,7 +664,7 @@
@@ -783,7 +783,7 @@
@@ -902,7 +902,7 @@
@@ -984,7 +984,7 @@
@@ -1096,7 +1096,7 @@
@@ -1208,7 +1208,7 @@
@@ -1366,7 +1366,7 @@
@@ -1525,7 +1525,7 @@
@@ -1731,7 +1731,7 @@
@@ -1893,7 +1893,7 @@
@@ -2056,7 +2056,7 @@
@@ -2250,7 +2250,7 @@
@@ -2388,7 +2388,7 @@
diff --git a/docs/LPF2Hub.html b/docs/LPF2Hub.html
index ccda6e6..a3c0ff1 100644
--- a/docs/LPF2Hub.html
+++ b/docs/LPF2Hub.html
@@ -316,7 +316,7 @@
@@ -444,7 +444,7 @@
@@ -572,7 +572,7 @@
@@ -700,7 +700,7 @@
@@ -828,7 +828,7 @@
@@ -956,7 +956,7 @@
@@ -1052,7 +1052,7 @@
@@ -1173,7 +1173,7 @@
@@ -1294,7 +1294,7 @@
@@ -1461,7 +1461,7 @@
@@ -1619,7 +1619,7 @@
@@ -1829,7 +1829,7 @@
@@ -1991,7 +1991,7 @@
@@ -2103,7 +2103,7 @@
@@ -2275,7 +2275,7 @@
@@ -2490,7 +2490,7 @@
@@ -2661,7 +2661,7 @@
@@ -2833,7 +2833,7 @@
@@ -3036,7 +3036,7 @@
@@ -3198,7 +3198,7 @@
@@ -3360,7 +3360,7 @@
@@ -3546,7 +3546,7 @@
@@ -3693,7 +3693,7 @@
@@ -3855,7 +3855,7 @@
@@ -4017,7 +4017,7 @@
@@ -4179,7 +4179,7 @@
@@ -4365,7 +4365,7 @@
diff --git a/docs/PUPHub.html b/docs/PUPHub.html
index 5870be1..8d2da95 100644
--- a/docs/PUPHub.html
+++ b/docs/PUPHub.html
@@ -327,7 +327,7 @@
@@ -460,7 +460,7 @@
@@ -593,7 +593,7 @@
@@ -726,7 +726,7 @@
@@ -859,7 +859,7 @@
@@ -992,7 +992,7 @@
@@ -1250,7 +1250,7 @@
@@ -1376,7 +1376,7 @@
@@ -1502,7 +1502,7 @@
@@ -1674,7 +1674,7 @@
@@ -2075,7 +2075,7 @@
@@ -2294,7 +2294,7 @@
@@ -2944,7 +2944,7 @@
@@ -3065,7 +3065,7 @@
@@ -3242,7 +3242,7 @@
@@ -3462,7 +3462,7 @@
@@ -3638,7 +3638,7 @@
@@ -3815,7 +3815,7 @@
@@ -4023,7 +4023,7 @@
@@ -4194,7 +4194,7 @@
@@ -4365,7 +4365,7 @@
@@ -4560,7 +4560,7 @@
@@ -4712,7 +4712,7 @@
@@ -4883,7 +4883,7 @@
@@ -5078,7 +5078,7 @@
diff --git a/docs/PUPRemote.html b/docs/PUPRemote.html
index d2140bc..364dc0e 100644
--- a/docs/PUPRemote.html
+++ b/docs/PUPRemote.html
@@ -327,7 +327,7 @@
@@ -460,7 +460,7 @@
@@ -593,7 +593,7 @@
@@ -726,7 +726,7 @@
@@ -859,7 +859,7 @@
@@ -992,7 +992,7 @@
@@ -1088,7 +1088,7 @@
@@ -1214,7 +1214,7 @@
@@ -1340,7 +1340,7 @@
@@ -1512,7 +1512,7 @@
@@ -2061,7 +2061,7 @@
@@ -2182,7 +2182,7 @@
@@ -2359,7 +2359,7 @@
@@ -2579,7 +2579,7 @@
@@ -2755,7 +2755,7 @@
@@ -2932,7 +2932,7 @@
@@ -3135,7 +3135,7 @@
@@ -3330,7 +3330,7 @@
diff --git a/docs/WeDo2SmartHub.html b/docs/WeDo2SmartHub.html
index 33d4cdf..968d9cb 100644
--- a/docs/WeDo2SmartHub.html
+++ b/docs/WeDo2SmartHub.html
@@ -320,7 +320,7 @@
@@ -448,7 +448,7 @@
@@ -576,7 +576,7 @@
@@ -704,7 +704,7 @@
@@ -832,7 +832,7 @@
@@ -960,7 +960,7 @@
@@ -1092,7 +1092,7 @@
@@ -1218,7 +1218,7 @@
@@ -1339,7 +1339,7 @@
@@ -1460,7 +1460,7 @@
@@ -1627,7 +1627,7 @@
@@ -1809,7 +1809,7 @@
@@ -2043,7 +2043,7 @@
@@ -2205,7 +2205,7 @@
@@ -2415,7 +2415,7 @@
@@ -2653,7 +2653,7 @@
@@ -2891,7 +2891,7 @@
@@ -3053,7 +3053,7 @@
@@ -3165,7 +3165,7 @@
@@ -3337,7 +3337,7 @@
@@ -3552,7 +3552,7 @@
@@ -3723,7 +3723,7 @@
@@ -3895,7 +3895,7 @@
@@ -4098,7 +4098,7 @@
@@ -4260,7 +4260,7 @@
@@ -4422,7 +4422,7 @@
@@ -4569,7 +4569,7 @@
@@ -4731,7 +4731,7 @@
@@ -4893,7 +4893,7 @@
@@ -5079,7 +5079,7 @@
diff --git a/docs/classes.list.html b/docs/classes.list.html
index 32bd40b..b7460bc 100644
--- a/docs/classes.list.html
+++ b/docs/classes.list.html
@@ -335,7 +335,7 @@
@@ -506,7 +506,7 @@
@@ -677,7 +677,7 @@
@@ -872,7 +872,7 @@
@@ -1024,7 +1024,7 @@
@@ -1195,7 +1195,7 @@
@@ -1366,7 +1366,7 @@
@@ -1561,7 +1561,7 @@
@@ -1732,7 +1732,7 @@
@@ -1903,7 +1903,7 @@
@@ -2065,7 +2065,7 @@
@@ -2203,7 +2203,7 @@
@@ -2374,7 +2374,7 @@
@@ -2536,7 +2536,7 @@
@@ -2698,7 +2698,7 @@
@@ -2884,7 +2884,7 @@
@@ -3031,7 +3031,7 @@
@@ -3193,7 +3193,7 @@
@@ -3355,7 +3355,7 @@
@@ -3517,7 +3517,7 @@
@@ -3703,7 +3703,7 @@
@@ -4029,7 +4029,7 @@
@@ -4200,7 +4200,7 @@
@@ -4371,7 +4371,7 @@
@@ -4566,7 +4566,7 @@
@@ -4718,7 +4718,7 @@
@@ -4889,7 +4889,7 @@
@@ -5084,7 +5084,7 @@
@@ -5255,7 +5255,7 @@
@@ -5450,7 +5450,7 @@
@@ -5621,7 +5621,7 @@
@@ -5783,7 +5783,7 @@
@@ -5945,7 +5945,7 @@
@@ -6092,7 +6092,7 @@
@@ -6254,7 +6254,7 @@
@@ -6416,7 +6416,7 @@
@@ -6602,7 +6602,7 @@
diff --git a/docs/hub.js.html b/docs/hub.js.html
index e636b96..f9fe130 100644
--- a/docs/hub.js.html
+++ b/docs/hub.js.html
@@ -118,6 +118,9 @@ class Hub extends events_1.EventEmitter {
this._isConnected = false;
this.autoSubscribe = !!autoSubscribe;
this._bleDevice = device;
+ device.on("disconnect", () => {
+ this.emit("disconnect");
+ });
}
/**
* @readonly
@@ -174,7 +177,6 @@ class Hub extends events_1.EventEmitter {
* @returns {Promise} Resolved upon successful connect.
*/
connect() {
- console.log(this.name);
return new Promise(async (connectResolve, connectReject) => {
if (this._bleDevice.connecting) {
return connectReject("Already connecting");
diff --git a/docs/lpf2hub.js.html b/docs/lpf2hub.js.html
index 75ca22f..2b520ff 100644
--- a/docs/lpf2hub.js.html
+++ b/docs/lpf2hub.js.html
@@ -113,18 +113,16 @@ class LPF2Hub extends hub_1.Hub {
await super.connect();
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.LPF2_HUB);
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.LPF2_ALL, this._parseMessage.bind(this));
- setTimeout(() => {
- 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])); // Request firmware version
- this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x01, 0x06, 0x02])); // Activate battery level reports
- this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x3c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate voltage reports
- this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x3b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate current reports
- if (this.type === Consts.HubType.DUPLO_TRAIN_HUB) {
- this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01]));
- }
- this.emit("connect");
- return resolve();
- }, 1000);
+ this.emit("connect");
+ resolve();
+ 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])); // Request firmware version
+ this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x01, 0x06, 0x02])); // Activate battery level reports
+ this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x3c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate voltage reports
+ this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x3b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate current reports
+ if (this.type === Consts.HubType.DUPLO_TRAIN_HUB) {
+ this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01]));
+ }
});
}
/**
diff --git a/docs/quicksearch.html b/docs/quicksearch.html
index ff24e3a..3a9e2c5 100644
--- a/docs/quicksearch.html
+++ b/docs/quicksearch.html
@@ -7,7 +7,7 @@
+