Library will now throw error if your firmware is too old
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Nathan Kellenicki 2019-04-15 10:46:32 -07:00
parent 5ad9bc5748
commit 2e6d2b0dbc
26 changed files with 107 additions and 73 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
dist/
.vscode/
*.tgz
**/.DS_store

View File

@ -4451,7 +4451,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -4622,7 +4622,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -4817,7 +4817,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -5140,7 +5140,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-296">line 296</a>
<a href="lpf2hub.js.html#sunlight-1-line-300">line 300</a>
</li>
</ul>
</dd>
@ -5311,7 +5311,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-351">line 351</a>
<a href="lpf2hub.js.html#sunlight-1-line-355">line 355</a>
</li>
</ul>
</dd>
@ -5506,7 +5506,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-339">line 339</a>
<a href="lpf2hub.js.html#sunlight-1-line-343">line 343</a>
</li>
</ul>
</dd>
@ -5585,7 +5585,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -3938,7 +3938,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -4109,7 +4109,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-399">line 399</a>
<a href="lpf2hub.js.html#sunlight-1-line-403">line 403</a>
</li>
</ul>
</dd>
@ -4188,7 +4188,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -2467,7 +2467,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -3198,7 +3198,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -3360,7 +3360,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -3546,7 +3546,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -3855,7 +3855,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-296">line 296</a>
<a href="lpf2hub.js.html#sunlight-1-line-300">line 300</a>
</li>
</ul>
</dd>
@ -4017,7 +4017,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-351">line 351</a>
<a href="lpf2hub.js.html#sunlight-1-line-355">line 355</a>
</li>
</ul>
</dd>
@ -4179,7 +4179,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-399">line 399</a>
<a href="lpf2hub.js.html#sunlight-1-line-403">line 403</a>
</li>
</ul>
</dd>
@ -4365,7 +4365,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-339">line 339</a>
<a href="lpf2hub.js.html#sunlight-1-line-343">line 343</a>
</li>
</ul>
</dd>
@ -4444,7 +4444,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -153,7 +153,7 @@
<ul class="dummy">
<li>
<a href="puphub.js.html">puphub.js</a>,
<a href="puphub.js.html#sunlight-1-line-15">line 15</a>
<a href="puphub.js.html#sunlight-1-line-19">line 19</a>
</li>
</ul>
</dd>
@ -1124,7 +1124,7 @@
<ul class="dummy">
<li>
<a href="puphub.js.html">puphub.js</a>,
<a href="puphub.js.html#sunlight-1-line-188">line 188</a>
<a href="puphub.js.html#sunlight-1-line-192">line 192</a>
</li>
</ul>
</dd>
@ -1904,7 +1904,7 @@
<ul class="dummy">
<li>
<a href="puphub.js.html">puphub.js</a>,
<a href="puphub.js.html#sunlight-1-line-134">line 134</a>
<a href="puphub.js.html#sunlight-1-line-138">line 138</a>
</li>
</ul>
</dd>
@ -2532,7 +2532,7 @@
<ul class="dummy">
<li>
<a href="puphub.js.html">puphub.js</a>,
<a href="puphub.js.html#sunlight-1-line-197">line 197</a>
<a href="puphub.js.html#sunlight-1-line-201">line 201</a>
</li>
</ul>
</dd>
@ -2789,7 +2789,7 @@
<ul class="dummy">
<li>
<a href="puphub.js.html">puphub.js</a>,
<a href="puphub.js.html#sunlight-1-line-154">line 154</a>
<a href="puphub.js.html#sunlight-1-line-158">line 158</a>
</li>
</ul>
</dd>
@ -3030,7 +3030,7 @@
<ul class="dummy">
<li>
<a href="puphub.js.html">puphub.js</a>,
<a href="puphub.js.html#sunlight-1-line-56">line 56</a>
<a href="puphub.js.html#sunlight-1-line-60">line 60</a>
</li>
</ul>
</dd>
@ -4451,7 +4451,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -4622,7 +4622,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -4817,7 +4817,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -5140,7 +5140,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-296">line 296</a>
<a href="lpf2hub.js.html#sunlight-1-line-300">line 300</a>
</li>
</ul>
</dd>
@ -5335,7 +5335,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-339">line 339</a>
<a href="lpf2hub.js.html#sunlight-1-line-343">line 343</a>
</li>
</ul>
</dd>
@ -5414,7 +5414,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -3135,7 +3135,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -3330,7 +3330,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -3409,7 +3409,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -1018,7 +1018,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -5158,7 +5158,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -353,7 +353,7 @@ exports.BoostMoveHub = BoostMoveHub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -506,7 +506,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -677,7 +677,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -872,7 +872,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -1195,7 +1195,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-296">line 296</a>
<a href="lpf2hub.js.html#sunlight-1-line-300">line 300</a>
</li>
</ul>
</dd>
@ -1366,7 +1366,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-351">line 351</a>
<a href="lpf2hub.js.html#sunlight-1-line-355">line 355</a>
</li>
</ul>
</dd>
@ -1561,7 +1561,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-339">line 339</a>
<a href="lpf2hub.js.html#sunlight-1-line-343">line 343</a>
</li>
</ul>
</dd>
@ -1732,7 +1732,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -1903,7 +1903,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-399">line 399</a>
<a href="lpf2hub.js.html#sunlight-1-line-403">line 403</a>
</li>
</ul>
</dd>
@ -2536,7 +2536,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -2698,7 +2698,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -2884,7 +2884,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -3193,7 +3193,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-296">line 296</a>
<a href="lpf2hub.js.html#sunlight-1-line-300">line 300</a>
</li>
</ul>
</dd>
@ -3355,7 +3355,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-351">line 351</a>
<a href="lpf2hub.js.html#sunlight-1-line-355">line 355</a>
</li>
</ul>
</dd>
@ -3517,7 +3517,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-399">line 399</a>
<a href="lpf2hub.js.html#sunlight-1-line-403">line 403</a>
</li>
</ul>
</dd>
@ -3703,7 +3703,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-339">line 339</a>
<a href="lpf2hub.js.html#sunlight-1-line-343">line 343</a>
</li>
</ul>
</dd>
@ -4200,7 +4200,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -4371,7 +4371,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-306">line 306</a>
<a href="lpf2hub.js.html#sunlight-1-line-310">line 310</a>
</li>
</ul>
</dd>
@ -4566,7 +4566,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -4889,7 +4889,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-296">line 296</a>
<a href="lpf2hub.js.html#sunlight-1-line-300">line 300</a>
</li>
</ul>
</dd>
@ -5084,7 +5084,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-339">line 339</a>
<a href="lpf2hub.js.html#sunlight-1-line-343">line 343</a>
</li>
</ul>
</dd>
@ -5255,7 +5255,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-184">line 184</a>
<a href="lpf2hub.js.html#sunlight-1-line-187">line 187</a>
</li>
</ul>
</dd>
@ -5450,7 +5450,7 @@
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-322">line 322</a>
<a href="lpf2hub.js.html#sunlight-1-line-326">line 326</a>
</li>
</ul>
</dd>
@ -6681,7 +6681,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -300,7 +300,7 @@ var BLECharacteristic;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -300,7 +300,7 @@ exports.DuploTrainBase = DuploTrainBase;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -3272,7 +3272,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -458,7 +458,7 @@ exports.Hub = Hub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -308,7 +308,7 @@ console.log(&quot;Scanning for Hubs...&quot;);</code></pre><p>More examples are
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -228,6 +228,9 @@ class LPF2Hub extends hub_1.Hub {
});
}
}
_checkFirmware(version) {
return;
}
_parseMessage(data) {
if (data) {
this._messageBuffer = Buffer.concat([this._messageBuffer, data]);
@ -288,6 +291,7 @@ class LPF2Hub extends hub_1.Hub {
const major = data.readUInt8(8) >>> 4;
const minor = data.readUInt8(8) &amp; 0xf;
this._firmwareInfo = { major, minor, bugFix, build };
this._checkFirmware(this.firmwareVersion);
// Battery level reports
}
else if (data[3] === 0x06) {
@ -542,7 +546,7 @@ exports.LPF2Hub = LPF2Hub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -269,7 +269,7 @@ exports.PoweredUP = PoweredUP;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -85,6 +85,9 @@
<article>
<pre
class="sunlight-highlight-javascript linenums">"use strict";
var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) {
return (mod &amp;&amp; mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this &amp;&amp; this.__importStar) || function (mod) {
if (mod &amp;&amp; mod.__esModule) return mod;
var result = {};
@ -93,6 +96,7 @@ var __importStar = (this &amp;&amp; this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const compare_versions_1 = __importDefault(require("compare-versions"));
const lpf2hub_1 = require("./lpf2hub");
const port_1 = require("./port");
const Consts = __importStar(require("./consts"));
@ -307,6 +311,11 @@ class PUPHub extends lpf2hub_1.LPF2Hub {
}
});
}
_checkFirmware(version) {
if (compare_versions_1.default("1.1.00.0004", version) === 1) {
throw new Error(`Your Powered Up Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
}
}
}
exports.PUPHub = PUPHub;
//# sourceMappingURL=puphub.js.map</pre>
@ -354,7 +363,7 @@ exports.PUPHub = PUPHub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -238,7 +238,7 @@ exports.PUPRemote = PUPRemote;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

File diff suppressed because one or more lines are too long

View File

@ -540,7 +540,7 @@ exports.WeDo2SmartHub = WeDo2SmartHub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Apr 12th 2019
on Mon Apr 15th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

7
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "node-poweredup",
"version": "2.2.0",
"version": "2.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1042,6 +1042,11 @@
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
"dev": true
},
"compare-versions": {
"version": "3.4.0",
"resolved": "https://npm-registry.rancher.sie.sony.com/c/compare-versions/_attachments/compare-versions-3.4.0.tgz",
"integrity": "sha512-tK69D7oNXXqUW3ZNo/z7NXTEz22TCF0pTE+YF9cxvaAM9XnkLo1fV621xCLrRR6aevJlKxExkss0vWqUCUpqdg=="
},
"component-emitter": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "node-poweredup",
"version": "2.2.0",
"version": "2.3.0",
"description": "A Javascript module to interface with LEGO Powered Up components.",
"homepage": "https://github.com/nathankellenicki/node-poweredup/",
"main": "dist/node/index-node.js",
@ -16,6 +16,7 @@
"author": "Nathan Kellenicki <nathan@kellenicki.com>",
"license": "MIT",
"dependencies": {
"compare-versions": "^3.4.0",
"debug": "^4.1.1",
"noble": "1.9.1",
"noble-mac": "git+https://github.com/Timeular/noble-mac.git#af4418e"

View File

@ -160,6 +160,11 @@ export class LPF2Hub extends Hub {
}
protected _checkFirmware (version: string) {
return;
}
private _parseMessage (data?: Buffer) {
if (data) {
@ -230,6 +235,7 @@ export class LPF2Hub extends Hub {
const major = data.readUInt8(8) >>> 4;
const minor = data.readUInt8(8) & 0xf;
this._firmwareInfo = { major, minor, bugFix, build };
this._checkFirmware(this.firmwareVersion);
// Battery level reports
} else if (data[3] === 0x06) {

View File

@ -1,3 +1,4 @@
import compareVersion from "compare-versions";
import { Peripheral } from "noble";
import { LPF2Hub } from "./lpf2hub";
@ -238,4 +239,11 @@ export class PUPHub extends LPF2Hub {
}
protected _checkFirmware (version: string) {
if (compareVersion("1.1.00.0004", version) === 1) {
throw new Error(`Your Powered Up Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
}
}
}