Kinda working, but on connect of second device

This commit is contained in:
Nathan Kellenicki 2019-02-07 11:58:58 -08:00
parent edf5606814
commit 3db4391041
28 changed files with 214 additions and 113 deletions

View File

@ -1376,7 +1376,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-103">line 103</a>
<a href="hub.js.html#sunlight-1-line-104">line 104</a>
</li>
</ul>
</dd>
@ -1502,7 +1502,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-167">line 167</a>
<a href="hub.js.html#sunlight-1-line-168">line 168</a>
</li>
</ul>
</dd>
@ -1674,7 +1674,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-175">line 175</a>
<a href="hub.js.html#sunlight-1-line-176">line 176</a>
</li>
</ul>
</dd>
@ -3499,7 +3499,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-143">line 143</a>
<a href="hub.js.html#sunlight-1-line-144">line 144</a>
</li>
</ul>
</dd>
@ -3719,7 +3719,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-111">line 111</a>
<a href="hub.js.html#sunlight-1-line-112">line 112</a>
</li>
</ul>
</dd>
@ -3895,7 +3895,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-129">line 129</a>
<a href="hub.js.html#sunlight-1-line-130">line 130</a>
</li>
</ul>
</dd>
@ -4072,7 +4072,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-156">line 156</a>
<a href="hub.js.html#sunlight-1-line-157">line 157</a>
</li>
</ul>
</dd>
@ -4280,7 +4280,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -4969,7 +4969,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</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 Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -1376,7 +1376,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-103">line 103</a>
<a href="hub.js.html#sunlight-1-line-104">line 104</a>
</li>
</ul>
</dd>
@ -1502,7 +1502,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-167">line 167</a>
<a href="hub.js.html#sunlight-1-line-168">line 168</a>
</li>
</ul>
</dd>
@ -1674,7 +1674,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-175">line 175</a>
<a href="hub.js.html#sunlight-1-line-176">line 176</a>
</li>
</ul>
</dd>
@ -3162,7 +3162,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-143">line 143</a>
<a href="hub.js.html#sunlight-1-line-144">line 144</a>
</li>
</ul>
</dd>
@ -3382,7 +3382,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-111">line 111</a>
<a href="hub.js.html#sunlight-1-line-112">line 112</a>
</li>
</ul>
</dd>
@ -3558,7 +3558,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-129">line 129</a>
<a href="hub.js.html#sunlight-1-line-130">line 130</a>
</li>
</ul>
</dd>
@ -3735,7 +3735,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-156">line 156</a>
<a href="hub.js.html#sunlight-1-line-157">line 157</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 Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -1096,7 +1096,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-103">line 103</a>
<a href="hub.js.html#sunlight-1-line-104">line 104</a>
</li>
</ul>
</dd>
@ -1208,7 +1208,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-167">line 167</a>
<a href="hub.js.html#sunlight-1-line-168">line 168</a>
</li>
</ul>
</dd>
@ -1366,7 +1366,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-175">line 175</a>
<a href="hub.js.html#sunlight-1-line-176">line 176</a>
</li>
</ul>
</dd>
@ -1525,7 +1525,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-143">line 143</a>
<a href="hub.js.html#sunlight-1-line-144">line 144</a>
</li>
</ul>
</dd>
@ -1731,7 +1731,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-111">line 111</a>
<a href="hub.js.html#sunlight-1-line-112">line 112</a>
</li>
</ul>
</dd>
@ -1893,7 +1893,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-129">line 129</a>
<a href="hub.js.html#sunlight-1-line-130">line 130</a>
</li>
</ul>
</dd>
@ -2056,7 +2056,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-156">line 156</a>
<a href="hub.js.html#sunlight-1-line-157">line 157</a>
</li>
</ul>
</dd>
@ -2250,7 +2250,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -2388,7 +2388,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</a>
</li>
</ul>
</dd>
@ -2467,7 +2467,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -1173,7 +1173,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-103">line 103</a>
<a href="hub.js.html#sunlight-1-line-104">line 104</a>
</li>
</ul>
</dd>
@ -1294,7 +1294,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-167">line 167</a>
<a href="hub.js.html#sunlight-1-line-168">line 168</a>
</li>
</ul>
</dd>
@ -1461,7 +1461,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-175">line 175</a>
<a href="hub.js.html#sunlight-1-line-176">line 176</a>
</li>
</ul>
</dd>
@ -2275,7 +2275,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-143">line 143</a>
<a href="hub.js.html#sunlight-1-line-144">line 144</a>
</li>
</ul>
</dd>
@ -2490,7 +2490,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-111">line 111</a>
<a href="hub.js.html#sunlight-1-line-112">line 112</a>
</li>
</ul>
</dd>
@ -2661,7 +2661,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-129">line 129</a>
<a href="hub.js.html#sunlight-1-line-130">line 130</a>
</li>
</ul>
</dd>
@ -2833,7 +2833,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-156">line 156</a>
<a href="hub.js.html#sunlight-1-line-157">line 157</a>
</li>
</ul>
</dd>
@ -3036,7 +3036,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -3693,7 +3693,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</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 Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -1376,7 +1376,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-103">line 103</a>
<a href="hub.js.html#sunlight-1-line-104">line 104</a>
</li>
</ul>
</dd>
@ -1502,7 +1502,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-167">line 167</a>
<a href="hub.js.html#sunlight-1-line-168">line 168</a>
</li>
</ul>
</dd>
@ -1674,7 +1674,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-175">line 175</a>
<a href="hub.js.html#sunlight-1-line-176">line 176</a>
</li>
</ul>
</dd>
@ -3242,7 +3242,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-143">line 143</a>
<a href="hub.js.html#sunlight-1-line-144">line 144</a>
</li>
</ul>
</dd>
@ -3462,7 +3462,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-111">line 111</a>
<a href="hub.js.html#sunlight-1-line-112">line 112</a>
</li>
</ul>
</dd>
@ -3638,7 +3638,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-129">line 129</a>
<a href="hub.js.html#sunlight-1-line-130">line 130</a>
</li>
</ul>
</dd>
@ -3815,7 +3815,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-156">line 156</a>
<a href="hub.js.html#sunlight-1-line-157">line 157</a>
</li>
</ul>
</dd>
@ -4023,7 +4023,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -4712,7 +4712,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</a>
</li>
</ul>
</dd>
@ -5157,7 +5157,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -1214,7 +1214,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-103">line 103</a>
<a href="hub.js.html#sunlight-1-line-104">line 104</a>
</li>
</ul>
</dd>
@ -1340,7 +1340,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-167">line 167</a>
<a href="hub.js.html#sunlight-1-line-168">line 168</a>
</li>
</ul>
</dd>
@ -1512,7 +1512,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-175">line 175</a>
<a href="hub.js.html#sunlight-1-line-176">line 176</a>
</li>
</ul>
</dd>
@ -2359,7 +2359,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-143">line 143</a>
<a href="hub.js.html#sunlight-1-line-144">line 144</a>
</li>
</ul>
</dd>
@ -2579,7 +2579,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-111">line 111</a>
<a href="hub.js.html#sunlight-1-line-112">line 112</a>
</li>
</ul>
</dd>
@ -2755,7 +2755,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-129">line 129</a>
<a href="hub.js.html#sunlight-1-line-130">line 130</a>
</li>
</ul>
</dd>
@ -2932,7 +2932,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-156">line 156</a>
<a href="hub.js.html#sunlight-1-line-157">line 157</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 Wed Feb 6th 2019
on Thu Feb 7th 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 Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -1339,7 +1339,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-103">line 103</a>
<a href="hub.js.html#sunlight-1-line-104">line 104</a>
</li>
</ul>
</dd>
@ -1460,7 +1460,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-167">line 167</a>
<a href="hub.js.html#sunlight-1-line-168">line 168</a>
</li>
</ul>
</dd>
@ -1627,7 +1627,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-175">line 175</a>
<a href="hub.js.html#sunlight-1-line-176">line 176</a>
</li>
</ul>
</dd>
@ -3337,7 +3337,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-143">line 143</a>
<a href="hub.js.html#sunlight-1-line-144">line 144</a>
</li>
</ul>
</dd>
@ -3552,7 +3552,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-111">line 111</a>
<a href="hub.js.html#sunlight-1-line-112">line 112</a>
</li>
</ul>
</dd>
@ -3723,7 +3723,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-129">line 129</a>
<a href="hub.js.html#sunlight-1-line-130">line 130</a>
</li>
</ul>
</dd>
@ -3895,7 +3895,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-156">line 156</a>
<a href="hub.js.html#sunlight-1-line-157">line 157</a>
</li>
</ul>
</dd>
@ -4098,7 +4098,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -4569,7 +4569,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</a>
</li>
</ul>
</dd>
@ -5158,7 +5158,7 @@
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -351,7 +351,7 @@ exports.BoostMoveHub = BoostMoveHub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -335,7 +335,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -1024,7 +1024,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</a>
</li>
</ul>
</dd>
@ -2065,7 +2065,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -2203,7 +2203,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</a>
</li>
</ul>
</dd>
@ -2374,7 +2374,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -3031,7 +3031,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</a>
</li>
</ul>
</dd>
@ -4029,7 +4029,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -4718,7 +4718,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</a>
</li>
</ul>
</dd>
@ -5621,7 +5621,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-212">line 212</a>
<a href="hub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
@ -6092,7 +6092,7 @@
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-224">line 224</a>
<a href="hub.js.html#sunlight-1-line-225">line 225</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 Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -282,7 +282,7 @@ var BLECharacteristic;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 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 Wed Feb 6th 2019
on Thu Feb 7th 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 Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -174,11 +174,12 @@ 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._isConnecting) {
if (this._bleDevice.connecting) {
return connectReject("Already connecting");
}
else if (this._isConnected) {
else if (this._bleDevice.connected) {
return connectReject("Already connected");
}
this._isConnecting = true;
@ -445,7 +446,7 @@ exports.Hub = Hub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -314,7 +314,7 @@ poweredUP.scan(); // Start scanning for Hubs</code></pre><p>More examples are av
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -505,7 +505,7 @@ exports.LPF2Hub = LPF2Hub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -286,7 +286,7 @@ exports.PoweredUP = PoweredUP;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -308,7 +308,7 @@ exports.PUPHub = PUPHub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 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 Wed Feb 6th 2019
on Thu Feb 7th 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

@ -542,7 +542,7 @@ exports.WeDo2SmartHub = WeDo2SmartHub;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Feb 6th 2019
on Thu Feb 7th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>

View File

@ -3,12 +3,12 @@
"version": "1.9.1",
"description": "A Node.js module to interface with LEGO Powered UP components.",
"homepage": "https://github.com/nathankellenicki/node-poweredup/",
"main": "dist/index-node.js",
"main": "dist/node/index-node.js",
"types": "dist/index-node.d.ts",
"scripts": {
"build:node": "tslint -c tslint.json \"./src/*.ts\" && tsc",
"build:browser": "webpack --mode=production",
"docs": "jsdoc -d docs -c jsdoc.conf.json -t ./node_modules/ink-docstrap/template -R README.md dist/consts.js dist/poweredup-node.js dist/lpf2hub.js dist/wedo2smarthub.js dist/boostmovehub.js dist/puphub.js dist/pupremote.js dist/duplotrainbase.js dist/hub.js dist/consts.js",
"docs": "jsdoc -d docs -c jsdoc.conf.json -t ./node_modules/ink-docstrap/template -R README.md dist/node/consts.js dist/node/poweredup-node.js dist/node/lpf2hub.js dist/node/wedo2smarthub.js dist/node/boostmovehub.js dist/node/puphub.js dist/node/pupremote.js dist/node/duplotrainbase.js dist/node/hub.js dist/node/consts.js",
"all": "npm run build:node && npm run docs",
"prepublishOnly": "npm run build:node"
},

View File

@ -15,9 +15,14 @@ export class BLEDevice extends EventEmitter {
private _uuid: string;
private _name: string = "";
private _listeners: {[uuid: string]: any} = {};
private _characteristics: {[uuid: string]: Characteristic} = {};
private _writeQueue: Promise<any> = Promise.resolve();
private _queue: Promise<any> = Promise.resolve();
private _mailbox: Buffer[] = [];
private _connected: boolean = false;
private _connecting: boolean = false;
constructor (device: any) {
@ -51,13 +56,27 @@ export class BLEDevice extends EventEmitter {
}
public get connecting () {
return this._connecting;
}
public get connected () {
return this._connected;
}
public connect () {
return new Promise((resolve, reject) => {
if (this._noblePeripheral) {
this._connecting = true;
this._noblePeripheral.connect((err: string) => {
this._connecting = false;
this._connected = true;
return resolve();
});
} else {
this._connected = true;
return resolve();
}
});
@ -134,21 +153,36 @@ export class BLEDevice extends EventEmitter {
}
});
} else if (this._webBLEServer) {
if (this._listeners[uuid]) {
// @ts-ignore
this._characteristics[uuid].removeEventListener("characteristicvaluechanged", this._listeners[uuid]);
}
// @ts-ignore
this._characteristics[uuid].addEventListener("characteristicvaluechanged", (event) => {
this._listeners[uuid] = (event) => {
const buf = Buffer.alloc(event.target.value.buffer.byteLength);
const view = new Uint8Array(event.target.value.buffer);
for (let i = 0; i < buf.length; i++) {
buf[i] = view[i];
}
return callback(buf);
});
};
// @ts-ignore
this._characteristics[uuid].addEventListener("characteristicvaluechanged", this._listeners[uuid]);
for (const data of this._mailbox) {
callback(data);
}
this._mailbox = [];
// @ts-ignore
this._characteristics[uuid].startNotifications();
}
}
public rejectFromCharacteristic (uuid: string, data: Buffer) {
this._mailbox.push(data);
}
public readFromCharacteristic (uuid: string, callback: (err: string | null, data: Buffer | null) => void) {
if (this._noblePeripheral) {
uuid = this._sanitizeUUID(uuid);
@ -175,7 +209,7 @@ export class BLEDevice extends EventEmitter {
this._characteristics[uuid].write(data, false, callback);
} else {
// @ts-ignore
this._writeQueue = this._writeQueue.then(() => this._characteristics[uuid].writeValue(data)).then(() => {
this._queue = this._queue.then(() => this._characteristics[uuid].writeValue(data)).then(() => {
if (callback) {
callback();
}

View File

@ -118,10 +118,11 @@ export class Hub extends EventEmitter {
* @returns {Promise} Resolved upon successful connect.
*/
public connect () {
console.log(this.name);
return new Promise(async (connectResolve, connectReject) => {
if (this._isConnecting) {
if (this._bleDevice.connecting) {
return connectReject("Already connecting");
} else if (this._isConnected) {
} else if (this._bleDevice.connected) {
return connectReject("Already connected");
}
this._isConnecting = true;

View File

@ -11,6 +11,7 @@ import * as Consts from "./consts";
import { EventEmitter } from "events";
import Debug = require("debug");
import { LPF2Hub } from "./lpf2hub";
const debug = Debug("poweredup");
@ -98,6 +99,42 @@ export class PoweredUP extends EventEmitter {
}
private _determineLPF2HubType (device: BLEDevice) {
return new Promise((resolve, reject) => {
let buf: Buffer = Buffer.alloc(0);
device.subscribeToCharacteristic(Consts.BLECharacteristic.LPF2_ALL, (data: Buffer) => {
buf = Buffer.concat([buf, data]);
const len = buf[0];
if (len >= buf.length) {
const message = buf.slice(0, len);
buf = buf.slice(len);
if (message[2] === 0x01 && message[3] === 0x0b) {
process.nextTick(() => {
switch (message[5]) {
case Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID:
resolve(Consts.HubType.POWERED_UP_REMOTE);
break;
case Consts.BLEManufacturerData.BOOST_MOVE_HUB_ID:
resolve(Consts.HubType.BOOST_MOVE_HUB);
break;
case Consts.BLEManufacturerData.POWERED_UP_HUB_ID:
resolve(Consts.HubType.POWERED_UP_HUB);
break;
case Consts.BLEManufacturerData.DUPLO_TRAIN_HUB_ID:
resolve(Consts.HubType.DUPLO_TRAIN_HUB);
break;
}
});
} else {
device.rejectFromCharacteristic(Consts.BLECharacteristic.LPF2_ALL, message);
}
}
});
device.writeToCharacteristic(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x05, 0x00, 0x01, 0x0b, 0x05]));
});
}
private async _discoveryEventHandler (server: BluetoothRemoteGATTServer) {
const device = new BLEDevice(server);
@ -119,7 +156,30 @@ export class PoweredUP extends EventEmitter {
// tslint:disable-next-line
} catch (error) {}
hub = new WeDo2SmartHub(device, this.autoSubscribe);
if (isLPF2Hub) {
// @ts-ignore
hubType = await this._determineLPF2HubType(device);
}
switch (hubType) {
case Consts.HubType.WEDO2_SMART_HUB:
hub = new WeDo2SmartHub(device, this.autoSubscribe);
break;
case Consts.HubType.BOOST_MOVE_HUB:
hub = new BoostMoveHub(device, this.autoSubscribe);
break;
case Consts.HubType.POWERED_UP_HUB:
hub = new PUPHub(device, this.autoSubscribe);
break;
case Consts.HubType.POWERED_UP_REMOTE:
hub = new PUPRemote(device, this.autoSubscribe);
break;
case Consts.HubType.DUPLO_TRAIN_HUB:
hub = new DuploTrainBase(device, this.autoSubscribe);
break;
default:
return;
}
device.on("discoverComplete", () => {

View File

@ -6,24 +6,29 @@
<script src="./dist/bundle.js"></script>
<script>
const poweredUP = new PoweredUP.PoweredUP();
const scan = async function () {
localStorage.debug = "";
const poweredUP = new PoweredUP.PoweredUP();
poweredUP.scan(); // Start scanning for hubs
poweredUP.on("discover", async (hub) => { // Wait to discover hubs
hub.on("attach", (port, device) => {
console.log("ATTACH", port, device);
});
hub.on("button", (button, state) => {
console.log("BUTTON", button, state);
})
hub.on("distance", (port, distance) => {
console.log("DISTANCE", port, distance);
});
await hub.connect(); // Connect to hub
console.log(`Connected to ${hub.name}!`);
await hub.sleep(2000);
console.log(hub.firmwareVersion);
hub.setLEDColor(PoweredUP.Consts.Color.RED);
hub.rampMotorSpeed("A", 0, 100, 10000);
hub.on("disconnect", () => {
console.log("Hub disconnected");
})

View File

@ -11,7 +11,7 @@
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist", /* Redirect output structure to the directory. */
"outDir": "./dist/node", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "removeComments": true, /* Do not emit comments to output. */

View File

@ -20,7 +20,7 @@ module.exports = {
extensions: [".ts", ".js"]
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist")
filename: "poweredup.js",
path: path.resolve(__dirname, "dist", "browser")
}
};