From 1538a47d8a3b4f32dee3b8527e46e8919688b980 Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Mon, 18 Mar 2019 17:40:17 -0700 Subject: [PATCH] Fixed merge conflicts --- docs/BoostMoveHub.html | 34 +++++++++++------------ docs/DuploTrainBase.html | 30 ++++++++++----------- docs/Hub.html | 34 +++++++++++------------ docs/LPF2Hub.html | 34 +++++++++++------------ docs/PUPHub.html | 34 +++++++++++------------ docs/PUPRemote.html | 30 ++++++++++----------- docs/PoweredUP.html | 2 +- docs/WeDo2SmartHub.html | 34 +++++++++++------------ docs/boostmovehub.js.html | 2 +- docs/classes.list.html | 22 +++++++-------- docs/consts.js.html | 2 +- docs/duplotrainbase.js.html | 2 +- docs/global.html | 2 +- docs/hub.js.html | 54 +++++-------------------------------- docs/index.html | 2 +- docs/lpf2hub.js.html | 2 +- docs/puphub.js.html | 2 +- docs/pupremote.js.html | 2 +- docs/quicksearch.html | 2 +- docs/wedo2smarthub.js.html | 2 +- 20 files changed, 143 insertions(+), 185 deletions(-) diff --git a/docs/BoostMoveHub.html b/docs/BoostMoveHub.html index 311d335..acbbfab 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 @@ @@ -3499,7 +3499,7 @@ @@ -3719,7 +3719,7 @@ @@ -3895,7 +3895,7 @@ @@ -4072,7 +4072,7 @@ @@ -4280,7 +4280,7 @@ @@ -4969,7 +4969,7 @@ @@ -5585,7 +5585,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/DuploTrainBase.html b/docs/DuploTrainBase.html index c4cf859..788b317 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 @@ @@ -3162,7 +3162,7 @@ @@ -3382,7 +3382,7 @@ @@ -3558,7 +3558,7 @@ @@ -3735,7 +3735,7 @@ @@ -4188,7 +4188,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/Hub.html b/docs/Hub.html index fca24e1..60e4cb5 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 @@ @@ -2467,7 +2467,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/LPF2Hub.html b/docs/LPF2Hub.html index 7e5c833..a3b7cdc 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 @@ @@ -2275,7 +2275,7 @@ @@ -2490,7 +2490,7 @@ @@ -2661,7 +2661,7 @@ @@ -2833,7 +2833,7 @@ @@ -3036,7 +3036,7 @@ @@ -3693,7 +3693,7 @@ @@ -4444,7 +4444,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/PUPHub.html b/docs/PUPHub.html index 4f1c8ee..04fb070 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 @@ @@ -3242,7 +3242,7 @@ @@ -3462,7 +3462,7 @@ @@ -3638,7 +3638,7 @@ @@ -3815,7 +3815,7 @@ @@ -4023,7 +4023,7 @@ @@ -4712,7 +4712,7 @@ @@ -5157,7 +5157,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/PUPRemote.html b/docs/PUPRemote.html index ce53f0b..1d828c2 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 @@ @@ -2359,7 +2359,7 @@ @@ -2579,7 +2579,7 @@ @@ -2755,7 +2755,7 @@ @@ -2932,7 +2932,7 @@ @@ -3409,7 +3409,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/PoweredUP.html b/docs/PoweredUP.html index 6d0d8d5..6e25b6f 100644 --- a/docs/PoweredUP.html +++ b/docs/PoweredUP.html @@ -1018,7 +1018,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/WeDo2SmartHub.html b/docs/WeDo2SmartHub.html index dd9322e..8b4b380 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 @@ @@ -1218,7 +1218,7 @@ @@ -1339,7 +1339,7 @@ @@ -1460,7 +1460,7 @@ @@ -1627,7 +1627,7 @@ @@ -3337,7 +3337,7 @@ @@ -3552,7 +3552,7 @@ @@ -3723,7 +3723,7 @@ @@ -3895,7 +3895,7 @@ @@ -4098,7 +4098,7 @@ @@ -4569,7 +4569,7 @@ @@ -5158,7 +5158,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/boostmovehub.js.html b/docs/boostmovehub.js.html index 53ce8aa..0cc78ff 100644 --- a/docs/boostmovehub.js.html +++ b/docs/boostmovehub.js.html @@ -351,7 +351,7 @@ exports.BoostMoveHub = BoostMoveHub; Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/classes.list.html b/docs/classes.list.html index a148f25..3c350f1 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -335,7 +335,7 @@ @@ -1024,7 +1024,7 @@ @@ -2065,7 +2065,7 @@ @@ -2203,7 +2203,7 @@ @@ -2374,7 +2374,7 @@ @@ -3031,7 +3031,7 @@ @@ -4029,7 +4029,7 @@ @@ -4718,7 +4718,7 @@ @@ -5621,7 +5621,7 @@ @@ -6092,7 +6092,7 @@ @@ -6681,7 +6681,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/consts.js.html b/docs/consts.js.html index dd176e9..627e1f4 100644 --- a/docs/consts.js.html +++ b/docs/consts.js.html @@ -300,7 +300,7 @@ var BLECharacteristic; Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/duplotrainbase.js.html b/docs/duplotrainbase.js.html index 29c81f5..abc2847 100644 --- a/docs/duplotrainbase.js.html +++ b/docs/duplotrainbase.js.html @@ -300,7 +300,7 @@ exports.DuploTrainBase = DuploTrainBase; Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/global.html b/docs/global.html index c2a8878..3aa556a 100644 --- a/docs/global.html +++ b/docs/global.html @@ -3272,7 +3272,7 @@ Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/hub.js.html b/docs/hub.js.html index bdf931a..a7035a0 100644 --- a/docs/hub.js.html +++ b/docs/hub.js.html @@ -177,58 +177,16 @@ class Hub extends events_1.EventEmitter { * @returns {Promise} Resolved upon successful connect. */ connect() { - return new Promise((connectResolve, connectReject) => { - const self = this; - if (this._isConnecting) { + return new Promise(async (connectResolve, connectReject) => { + if (this._bleDevice.connecting) { return connectReject("Already connecting"); } - else if (this._isConnected) { + else if (this._bleDevice.connected) { return connectReject("Already connected"); } this._isConnecting = true; - this._peripheral.connect((err) => { - this._rssi = this._peripheral.rssi; - const rssiUpdateInterval = setInterval(() => { - this._peripheral.updateRssi((err, rssi) => { - if (!err) { - if (this._rssi !== rssi) { - this._rssi = rssi; - } - } - }); - }, 2000); - self._peripheral.on("disconnect", () => { - clearInterval(rssiUpdateInterval); - this._isConnecting = false; - this._isConnected = false; - this.emit("disconnect"); - }); - self._peripheral.discoverServices([], (err, services) => { - if (err) { - this.emit("error", err); - return; - } - debug("Service/characteristic discovery started"); - const servicePromises = []; - services.forEach((service) => { - servicePromises.push(new Promise((resolve, reject) => { - service.discoverCharacteristics([], (err, characteristics) => { - characteristics.forEach((characteristic) => { - this._characteristics[characteristic.uuid] = characteristic; - }); - return resolve(); - }); - })); - }); - Promise.all(servicePromises).then(() => { - debug("Service/characteristic discovery finished"); - this._isConnecting = false; - this._isConnected = true; - this.emit("connect"); - return connectResolve(); - }); - }); - }); + await this._bleDevice.connect(); + return connectResolve(); }); } /** @@ -491,7 +449,7 @@ exports.Hub = Hub; Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/index.html b/docs/index.html index b4d0ebe..d8d7484 100644 --- a/docs/index.html +++ b/docs/index.html @@ -320,7 +320,7 @@ console.log("Scanning for Hubs...");

More examples are Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/lpf2hub.js.html b/docs/lpf2hub.js.html index 14ca47a..a911a94 100644 --- a/docs/lpf2hub.js.html +++ b/docs/lpf2hub.js.html @@ -503,7 +503,7 @@ exports.LPF2Hub = LPF2Hub; Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/puphub.js.html b/docs/puphub.js.html index bbf87f0..d607e32 100644 --- a/docs/puphub.js.html +++ b/docs/puphub.js.html @@ -308,7 +308,7 @@ exports.PUPHub = PUPHub; Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/pupremote.js.html b/docs/pupremote.js.html index a9c8e3c..54b6563 100644 --- a/docs/pupremote.js.html +++ b/docs/pupremote.js.html @@ -238,7 +238,7 @@ exports.PUPRemote = PUPRemote; Documentation generated by JSDoc 3.5.5 - on Wed Feb 13th 2019 + on Mon Mar 18th 2019 using the DocStrap template. diff --git a/docs/quicksearch.html b/docs/quicksearch.html index 52e499e..90ab2e5 100644 --- a/docs/quicksearch.html +++ b/docs/quicksearch.html @@ -7,7 +7,7 @@