Working example of web bluetooth
This commit is contained in:
parent
f23e5ad679
commit
d70d66e3dc
@ -1502,7 +1502,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="hub.js.html">hub.js</a>,
|
||||
<a href="hub.js.html#sunlight-1-line-170">line 170</a>
|
||||
<a href="hub.js.html#sunlight-1-line-171">line 171</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-178">line 178</a>
|
||||
<a href="hub.js.html#sunlight-1-line-179">line 179</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-146">line 146</a>
|
||||
<a href="hub.js.html#sunlight-1-line-147">line 147</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-114">line 114</a>
|
||||
<a href="hub.js.html#sunlight-1-line-115">line 115</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-132">line 132</a>
|
||||
<a href="hub.js.html#sunlight-1-line-133">line 133</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-159">line 159</a>
|
||||
<a href="hub.js.html#sunlight-1-line-160">line 160</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</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-170">line 170</a>
|
||||
<a href="hub.js.html#sunlight-1-line-171">line 171</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-178">line 178</a>
|
||||
<a href="hub.js.html#sunlight-1-line-179">line 179</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-146">line 146</a>
|
||||
<a href="hub.js.html#sunlight-1-line-147">line 147</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-114">line 114</a>
|
||||
<a href="hub.js.html#sunlight-1-line-115">line 115</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-132">line 132</a>
|
||||
<a href="hub.js.html#sunlight-1-line-133">line 133</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-159">line 159</a>
|
||||
<a href="hub.js.html#sunlight-1-line-160">line 160</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-170">line 170</a>
|
||||
<a href="hub.js.html#sunlight-1-line-171">line 171</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-178">line 178</a>
|
||||
<a href="hub.js.html#sunlight-1-line-179">line 179</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-146">line 146</a>
|
||||
<a href="hub.js.html#sunlight-1-line-147">line 147</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-114">line 114</a>
|
||||
<a href="hub.js.html#sunlight-1-line-115">line 115</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-132">line 132</a>
|
||||
<a href="hub.js.html#sunlight-1-line-133">line 133</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-159">line 159</a>
|
||||
<a href="hub.js.html#sunlight-1-line-160">line 160</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</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-170">line 170</a>
|
||||
<a href="hub.js.html#sunlight-1-line-171">line 171</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-178">line 178</a>
|
||||
<a href="hub.js.html#sunlight-1-line-179">line 179</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-146">line 146</a>
|
||||
<a href="hub.js.html#sunlight-1-line-147">line 147</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-114">line 114</a>
|
||||
<a href="hub.js.html#sunlight-1-line-115">line 115</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-132">line 132</a>
|
||||
<a href="hub.js.html#sunlight-1-line-133">line 133</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-159">line 159</a>
|
||||
<a href="hub.js.html#sunlight-1-line-160">line 160</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</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-170">line 170</a>
|
||||
<a href="hub.js.html#sunlight-1-line-171">line 171</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-178">line 178</a>
|
||||
<a href="hub.js.html#sunlight-1-line-179">line 179</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-146">line 146</a>
|
||||
<a href="hub.js.html#sunlight-1-line-147">line 147</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-114">line 114</a>
|
||||
<a href="hub.js.html#sunlight-1-line-115">line 115</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-132">line 132</a>
|
||||
<a href="hub.js.html#sunlight-1-line-133">line 133</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-159">line 159</a>
|
||||
<a href="hub.js.html#sunlight-1-line-160">line 160</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</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-170">line 170</a>
|
||||
<a href="hub.js.html#sunlight-1-line-171">line 171</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-178">line 178</a>
|
||||
<a href="hub.js.html#sunlight-1-line-179">line 179</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-146">line 146</a>
|
||||
<a href="hub.js.html#sunlight-1-line-147">line 147</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-114">line 114</a>
|
||||
<a href="hub.js.html#sunlight-1-line-115">line 115</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-132">line 132</a>
|
||||
<a href="hub.js.html#sunlight-1-line-133">line 133</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-159">line 159</a>
|
||||
<a href="hub.js.html#sunlight-1-line-160">line 160</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
@ -149,7 +149,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-45">line 45</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-31">line 31</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -316,7 +316,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-91">line 91</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-77">line 77</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -427,7 +427,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-83">line 83</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-69">line 69</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -585,7 +585,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-100">line 100</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-86">line 86</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -693,7 +693,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-56">line 56</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-42">line 42</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -781,7 +781,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-71">line 71</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-57">line 57</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -939,7 +939,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-148">line 148</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-130">line 130</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-170">line 170</a>
|
||||
<a href="hub.js.html#sunlight-1-line-171">line 171</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-178">line 178</a>
|
||||
<a href="hub.js.html#sunlight-1-line-179">line 179</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-146">line 146</a>
|
||||
<a href="hub.js.html#sunlight-1-line-147">line 147</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-114">line 114</a>
|
||||
<a href="hub.js.html#sunlight-1-line-115">line 115</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-132">line 132</a>
|
||||
<a href="hub.js.html#sunlight-1-line-133">line 133</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-159">line 159</a>
|
||||
<a href="hub.js.html#sunlight-1-line-160">line 160</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
@ -335,7 +335,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="hub.js.html">hub.js</a>,
|
||||
<a href="hub.js.html#sunlight-1-line-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -3853,7 +3853,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="poweredup-node.js.html">poweredup-node.js</a>,
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-148">line 148</a>
|
||||
<a href="poweredup-node.js.html#sunlight-1-line-130">line 130</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</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-215">line 215</a>
|
||||
<a href="hub.js.html#sunlight-1-line-216">line 216</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-227">line 227</a>
|
||||
<a href="hub.js.html#sunlight-1-line-228">line 228</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
@ -104,6 +104,12 @@ var HubType;
|
||||
HubType[HubType["POWERED_UP_REMOTE"] = 4] = "POWERED_UP_REMOTE";
|
||||
HubType[HubType["DUPLO_TRAIN_HUB"] = 5] = "DUPLO_TRAIN_HUB";
|
||||
})(HubType = exports.HubType || (exports.HubType = {}));
|
||||
// tslint:disable-next-line
|
||||
exports.HubTypeNames = Object.keys(HubType).reduce((result, item) => {
|
||||
// @ts-ignore
|
||||
result[HubType[item]] = item;
|
||||
return result;
|
||||
}, {});
|
||||
/**
|
||||
* @typedef DeviceType
|
||||
* @property {number} UNKNOWN 0
|
||||
@ -142,6 +148,12 @@ var DeviceType;
|
||||
DeviceType[DeviceType["DUPLO_TRAIN_BASE_SPEEDOMETER"] = 44] = "DUPLO_TRAIN_BASE_SPEEDOMETER";
|
||||
DeviceType[DeviceType["POWERED_UP_REMOTE_BUTTON"] = 55] = "POWERED_UP_REMOTE_BUTTON";
|
||||
})(DeviceType = exports.DeviceType || (exports.DeviceType = {}));
|
||||
// tslint:disable-next-line
|
||||
exports.DeviceTypeNames = Object.keys(DeviceType).reduce((result, item) => {
|
||||
// @ts-ignore
|
||||
result[DeviceType[item]] = item;
|
||||
return result;
|
||||
}, {});
|
||||
/**
|
||||
* @typedef Color
|
||||
* @property {number} BLACK 0
|
||||
@ -172,6 +184,12 @@ var Color;
|
||||
Color[Color["WHITE"] = 10] = "WHITE";
|
||||
Color[Color["NONE"] = 255] = "NONE";
|
||||
})(Color = exports.Color || (exports.Color = {}));
|
||||
// tslint:disable-next-line
|
||||
exports.ColorNames = Object.keys(Color).reduce((result, item) => {
|
||||
// @ts-ignore
|
||||
result[Color[item]] = item;
|
||||
return result;
|
||||
}, {});
|
||||
/**
|
||||
* @typedef ButtonState
|
||||
* @property {number} PRESSED 0
|
||||
|
@ -356,7 +356,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-89">line 89</a>
|
||||
<a href="consts.js.html#sunlight-1-line-107">line 107</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -571,7 +571,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-89">line 89</a>
|
||||
<a href="consts.js.html#sunlight-1-line-107">line 107</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -954,7 +954,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-59">line 59</a>
|
||||
<a href="consts.js.html#sunlight-1-line-71">line 71</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1337,7 +1337,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-59">line 59</a>
|
||||
<a href="consts.js.html#sunlight-1-line-71">line 71</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1816,7 +1816,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-21">line 21</a>
|
||||
<a href="consts.js.html#sunlight-1-line-27">line 27</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2295,7 +2295,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-21">line 21</a>
|
||||
<a href="consts.js.html#sunlight-1-line-27">line 27</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2510,7 +2510,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-105">line 105</a>
|
||||
<a href="consts.js.html#sunlight-1-line-123">line 123</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2725,7 +2725,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="consts.js.html">consts.js</a>,
|
||||
<a href="consts.js.html#sunlight-1-line-105">line 105</a>
|
||||
<a href="consts.js.html#sunlight-1-line-123">line 123</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
@ -195,7 +195,8 @@ class Hub extends events_1.EventEmitter {
|
||||
* @returns {Promise} Resolved upon successful disconnect.
|
||||
*/
|
||||
async disconnect() {
|
||||
await this._bleDevice.disconnect();
|
||||
this.emit("disconnect");
|
||||
this._bleDevice.disconnect();
|
||||
}
|
||||
/**
|
||||
* Subscribe to sensor notifications on a given port.
|
||||
|
@ -85,13 +85,6 @@
|
||||
<article>
|
||||
<pre
|
||||
class="sunlight-highlight-javascript linenums">"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const boostmovehub_1 = require("./boostmovehub");
|
||||
const duplotrainbase_1 = require("./duplotrainbase");
|
||||
@ -99,8 +92,6 @@ const nobledevice_1 = require("./nobledevice");
|
||||
const puphub_1 = require("./puphub");
|
||||
const pupremote_1 = require("./pupremote");
|
||||
const wedo2smarthub_1 = require("./wedo2smarthub");
|
||||
const utils_1 = require("./utils");
|
||||
const Consts = __importStar(require("./consts"));
|
||||
const events_1 = require("events");
|
||||
const Debug = require("debug");
|
||||
const debug = Debug("poweredup");
|
||||
@ -109,12 +100,7 @@ let ready = false;
|
||||
let wantScan = false;
|
||||
let discoveryEventAttached = false;
|
||||
const startScanning = () => {
|
||||
if (utils_1.isBrowserContext) {
|
||||
noble.startScanning([Consts.BLEService.WEDO2_SMART_HUB, Consts.BLEService.LPF2_HUB]);
|
||||
}
|
||||
else {
|
||||
noble.startScanning();
|
||||
}
|
||||
};
|
||||
noble.on("stateChange", (state) => {
|
||||
ready = (state === "poweredOn");
|
||||
@ -214,10 +200,6 @@ class PoweredUP extends events_1.EventEmitter {
|
||||
return;
|
||||
}
|
||||
peripheral.removeAllListeners();
|
||||
// noble.stopScanning();
|
||||
// if (!isBrowserContext) {
|
||||
// startScanning();
|
||||
// }
|
||||
device.on("discoverComplete", () => {
|
||||
hub.on("connect", () => {
|
||||
debug(`Hub ${hub.uuid} connected`);
|
||||
|
File diff suppressed because one or more lines are too long
@ -132,7 +132,7 @@ class WeDo2SmartHub extends hub_1.Hub {
|
||||
await super.connect();
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB);
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_2);
|
||||
if (!utils_1.isBrowserContext) {
|
||||
if (!utils_1.isWebBluetooth) {
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_3);
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_4);
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_5);
|
||||
@ -149,7 +149,7 @@ class WeDo2SmartHub extends hub_1.Hub {
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_PORT_TYPE, this._parsePortMessage.bind(this));
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_SENSOR_VALUE, this._parseSensorMessage.bind(this));
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_BUTTON, this._parseSensorMessage.bind(this));
|
||||
if (!utils_1.isBrowserContext) {
|
||||
if (!utils_1.isWebBluetooth) {
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_BATTERY, this._parseBatteryMessage.bind(this));
|
||||
this._bleDevice.readFromCharacteristic(Consts.BLECharacteristic.WEDO2_BATTERY, (err, data) => {
|
||||
if (data) {
|
||||
@ -166,7 +166,7 @@ class WeDo2SmartHub extends hub_1.Hub {
|
||||
this._bleDevice.subscribeToCharacteristic("00002a19-0000-1000-8000-00805f9b34fb", this._parseHighCurrentAlert.bind(this));
|
||||
}
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_HIGH_CURRENT_ALERT, this._parseHighCurrentAlert.bind(this));
|
||||
if (!utils_1.isBrowserContext) {
|
||||
if (!utils_1.isWebBluetooth) {
|
||||
this._bleDevice.readFromCharacteristic(Consts.BLECharacteristic.WEDO2_FIRMWARE_REVISION, (err, data) => {
|
||||
if (data) {
|
||||
this._parseFirmwareRevisionString(data);
|
||||
|
@ -3,12 +3,39 @@ body {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
div {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
div#current_color {
|
||||
position: absolute;
|
||||
top: 61px;
|
||||
left: 120px;
|
||||
}
|
||||
|
||||
div#color {
|
||||
border: 1px solid #666666;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
left: 92px;
|
||||
}
|
||||
|
||||
table td {
|
||||
width: 150px;
|
||||
padding: 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
table td.disconnect_btn {
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
table td.disconnect_btn a {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table thead.headings td {
|
||||
background-color: #666666;
|
||||
color: #ffffff;
|
78
examples/web_bluetooth.html
Normal file
78
examples/web_bluetooth.html
Normal file
@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Web Bluetooth node-poweredup Example</title>
|
||||
<script src="../dist/browser/poweredup.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="./web_bluetooth.css" />
|
||||
<script>
|
||||
|
||||
const poweredUP = new PoweredUP.PoweredUP();
|
||||
|
||||
poweredUP.on("discover", async (hub) => { // Wait to discover hubs
|
||||
|
||||
await hub.connect(); // Connect to hub
|
||||
console.log(`Connected to ${hub.name}!`);
|
||||
|
||||
hub.on("disconnect", () => {
|
||||
console.log("Hub disconnected");
|
||||
});
|
||||
|
||||
renderHub(hub);
|
||||
|
||||
});
|
||||
|
||||
let color = 1;
|
||||
setInterval(() => {
|
||||
|
||||
const hubs = poweredUP.getConnectedHubs(); // Get an array of all connected hubs
|
||||
document.getElementById("color").style.backgroundColor = PoweredUP.Consts.ColorNames[color];
|
||||
hubs.forEach((hub) => {
|
||||
hub.setLEDColor(color); // Set the color
|
||||
})
|
||||
color++;
|
||||
if (color > 10) {
|
||||
color = 1;
|
||||
}
|
||||
|
||||
}, 2000);
|
||||
|
||||
const renderHub = function (hub) {
|
||||
const element = document.createElement("tr");
|
||||
element.setAttribute("id", `hub-${encodeURIComponent(hub.uuid)}`);
|
||||
element.innerHTML = `<td>${hub.name}</td><td>${PoweredUP.Consts.HubTypeNames[hub.type]}</td><td class="disconnect_btn"><a href="#" onclick="disconnect('${encodeURIComponent(hub.uuid)}');">Disconnect</a></td>`;
|
||||
document.getElementById("hubs").appendChild(element);
|
||||
}
|
||||
|
||||
const scan = function () {
|
||||
if (PoweredUP.isWebBluetooth) {
|
||||
poweredUP.scan(); // Start scanning for hubs
|
||||
} else {
|
||||
alert("Your browser does not support the Web Bluetooth specification.");
|
||||
}
|
||||
}
|
||||
|
||||
const disconnect = function (uuid) {
|
||||
poweredUP.getConnectedHubByUUID(decodeURIComponent(uuid)).disconnect();
|
||||
document.getElementById(`hub-${uuid}`).remove();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div><h1>Web Bluetooth node-poweredup Example</h1></div>
|
||||
<div>
|
||||
<a class="button" href="#" onclick="scan();">Add new Hub</a>
|
||||
</div>
|
||||
<div id="current_color">
|
||||
<span>Current Color: </span><div id="color"> </div>
|
||||
</div>
|
||||
<div>
|
||||
<table id="hubs">
|
||||
<thead class="headings"><td>Name</td><td>Type</td></thead>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -17,6 +17,14 @@ export enum HubType {
|
||||
}
|
||||
|
||||
|
||||
// tslint:disable-next-line
|
||||
export let HubTypeNames = Object.keys(HubType).reduce((result: {[hubType: string]: string}, item) => {
|
||||
// @ts-ignore
|
||||
result[HubType[item]] = item;
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
|
||||
/**
|
||||
* @typedef DeviceType
|
||||
* @property {number} UNKNOWN 0
|
||||
@ -56,6 +64,14 @@ export enum DeviceType {
|
||||
}
|
||||
|
||||
|
||||
// tslint:disable-next-line
|
||||
export let DeviceTypeNames = Object.keys(DeviceType).reduce((result: {[deviceType: string]: string}, item) => {
|
||||
// @ts-ignore
|
||||
result[DeviceType[item]] = item;
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
|
||||
/**
|
||||
* @typedef Color
|
||||
* @property {number} BLACK 0
|
||||
@ -87,6 +103,14 @@ export enum Color {
|
||||
}
|
||||
|
||||
|
||||
// tslint:disable-next-line
|
||||
export let ColorNames = Object.keys(Color).reduce((result: {[color: string]: string}, item) => {
|
||||
// @ts-ignore
|
||||
result[Color[item]] = item;
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
|
||||
/**
|
||||
* @typedef ButtonState
|
||||
* @property {number} PRESSED 0
|
||||
|
@ -133,7 +133,8 @@ export class Hub extends EventEmitter {
|
||||
* @returns {Promise} Resolved upon successful disconnect.
|
||||
*/
|
||||
public async disconnect () {
|
||||
await this._bleDevice.disconnect();
|
||||
this.emit("disconnect");
|
||||
this._bleDevice.disconnect();
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,5 +7,7 @@ import { PUPHub } from "./puphub";
|
||||
import { PUPRemote } from "./pupremote";
|
||||
import { WeDo2SmartHub } from "./wedo2smarthub";
|
||||
|
||||
import { isWebBluetooth } from "./utils";
|
||||
|
||||
// @ts-ignore
|
||||
window.PoweredUP = { PoweredUP, Hub, WeDo2SmartHub, BoostMoveHub, PUPHub, PUPRemote, DuploTrainBase, Consts };
|
||||
window.PoweredUP = { PoweredUP, Hub, WeDo2SmartHub, BoostMoveHub, PUPHub, PUPRemote, DuploTrainBase, Consts, isWebBluetooth };
|
||||
|
@ -74,10 +74,9 @@ export class NobleDevice extends EventEmitter implements IBLEDevice {
|
||||
|
||||
public disconnect () {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._noblePeripheral.connect((err: string) => {
|
||||
this._noblePeripheral.disconnect();
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,8 +8,6 @@ import { PUPHub } from "./puphub";
|
||||
import { PUPRemote } from "./pupremote";
|
||||
import { WeDo2SmartHub } from "./wedo2smarthub";
|
||||
|
||||
import { isBrowserContext } from "./utils";
|
||||
|
||||
import * as Consts from "./consts";
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
@ -23,11 +21,7 @@ let wantScan = false;
|
||||
let discoveryEventAttached = false;
|
||||
|
||||
const startScanning = () => {
|
||||
if (isBrowserContext) {
|
||||
noble.startScanning([Consts.BLEService.WEDO2_SMART_HUB, Consts.BLEService.LPF2_HUB]);
|
||||
} else {
|
||||
noble.startScanning();
|
||||
}
|
||||
};
|
||||
|
||||
noble.on("stateChange", (state: string) => {
|
||||
@ -149,10 +143,6 @@ export class PoweredUP extends EventEmitter {
|
||||
}
|
||||
|
||||
peripheral.removeAllListeners();
|
||||
// noble.stopScanning();
|
||||
// if (!isBrowserContext) {
|
||||
// startScanning();
|
||||
// }
|
||||
|
||||
device.on("discoverComplete", () => {
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
// @ts-ignore
|
||||
export const isBrowserContext = (typeof navigator !== "undefined" && navigator && navigator.bluetooth);
|
||||
export const isWebBluetooth = (typeof navigator !== "undefined" && navigator && navigator.bluetooth);
|
||||
|
@ -7,7 +7,7 @@ import * as Consts from "./consts";
|
||||
|
||||
import Debug = require("debug");
|
||||
import { IBLEDevice } from "./interfaces";
|
||||
import { isBrowserContext } from "./utils";
|
||||
import { isWebBluetooth } from "./utils";
|
||||
const debug = Debug("wedo2smarthub");
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ export class WeDo2SmartHub extends Hub {
|
||||
await super.connect();
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB);
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_2);
|
||||
if (!isBrowserContext) {
|
||||
if (!isWebBluetooth) {
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_3);
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_4);
|
||||
await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_5);
|
||||
@ -71,7 +71,7 @@ export class WeDo2SmartHub extends Hub {
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_PORT_TYPE, this._parsePortMessage.bind(this));
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_SENSOR_VALUE, this._parseSensorMessage.bind(this));
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_BUTTON, this._parseSensorMessage.bind(this));
|
||||
if (!isBrowserContext) {
|
||||
if (!isWebBluetooth) {
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_BATTERY, this._parseBatteryMessage.bind(this));
|
||||
this._bleDevice.readFromCharacteristic(Consts.BLECharacteristic.WEDO2_BATTERY, (err, data) => {
|
||||
if (data) {
|
||||
@ -87,7 +87,7 @@ export class WeDo2SmartHub extends Hub {
|
||||
this._bleDevice.subscribeToCharacteristic("00002a19-0000-1000-8000-00805f9b34fb", this._parseHighCurrentAlert.bind(this));
|
||||
}
|
||||
this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_HIGH_CURRENT_ALERT, this._parseHighCurrentAlert.bind(this));
|
||||
if (!isBrowserContext) {
|
||||
if (!isWebBluetooth) {
|
||||
this._bleDevice.readFromCharacteristic(Consts.BLECharacteristic.WEDO2_FIRMWARE_REVISION, (err, data) => {
|
||||
if (data) {
|
||||
this._parseFirmwareRevisionString(data);
|
||||
|
47
test.html
47
test.html
@ -1,47 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>node-poweredup Web Bluetooth Test</title>
|
||||
<script src="./dist/browser/poweredup.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="./test.css" />
|
||||
<script>
|
||||
|
||||
const poweredUP = new PoweredUP.PoweredUP();
|
||||
|
||||
console.log("Looking for Hubs...");
|
||||
|
||||
poweredUP.on("discover", async (hub) => { // Wait to discover hubs
|
||||
|
||||
await hub.connect(); // Connect to hub
|
||||
console.log(`Connected to ${hub.name}!`);
|
||||
|
||||
hub.on("disconnect", () => {
|
||||
console.log("Hub disconnected");
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
const scan = async function () {
|
||||
poweredUP.scan(); // Start scanning for hubs
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div><h1>Web Bluetooth node-poweredup Test Suite</h1></div>
|
||||
<div>
|
||||
<a class="button" href="#" onclick="scan();">Add new Hub</a>
|
||||
</div>
|
||||
<div>
|
||||
<table id="log">
|
||||
<thead class="headings"><td>Hub</td><td>Event</td><td>Port/Button</td><td>Values</td></thead>
|
||||
<tr><td>NK_WeDo2_1</td><td>Attach</td><td>A</td><td>Train Motor</td></tr>
|
||||
<tr><td>NK_WeDo2_1</td><td>Button</td><td>GREEN</td><td>Down</td></tr>
|
||||
<tr><td>NK_WeDo2_1</td><td>Button</td><td>GREEN</td><td>Up</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user