Compare commits
371 Commits
feature/fi
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
60a42dfc47 | ||
|
7ebc37a369 | ||
2fc1622c25 | |||
505bbdc648 | |||
69ee57e6ff | |||
e0ae64e7f3 | |||
|
abecb5385b | ||
|
2b03176509 | ||
|
d117fe10ff | ||
|
3bba7c7e73 | ||
|
333d300fc4 | ||
|
d3ccc7ac41 | ||
|
a613e9956d | ||
|
e4c68e5749 | ||
|
72ef125d4f | ||
|
a8a27eaeaa | ||
|
ce0f4509be | ||
|
f71411aacd | ||
|
e877dbf65e | ||
|
4836695840 | ||
|
57ee61e620 | ||
|
32fe39fd8c | ||
|
ddb71b5d05 | ||
fe80b0fd81 | |||
|
a833732f8c | ||
|
e6c575a0da | ||
322b269e5a | |||
|
f0169117b5 | ||
a0279a1fb6 | |||
7b1795c967 | |||
de6f60b42c | |||
9845a0b118 | |||
70c753c660 | |||
|
48a8aea80a | ||
|
aabf02580e | ||
|
0877d068a5 | ||
|
7782d64003 | ||
|
4cc92c6d37 | ||
|
d51851d058 | ||
|
02215ccf40 | ||
|
07edc32a8a | ||
|
f570afba08 | ||
|
52ee5d04c7 | ||
4bfa4d15e5 | |||
6b44373930 | |||
0577491a8c | |||
7b1fdb42e7 | |||
e3259f4ba7 | |||
10a0a9457a | |||
24e8d00db4 | |||
e0ec800dcc | |||
60dee2c62d | |||
671c2d21db | |||
0e5f94e189 | |||
2e43ee7cf0 | |||
6a02a89e5e | |||
|
fbf5b5ccf3 | ||
093cdc0c00 | |||
|
88ace0f66f | ||
dbe7f1999b | |||
7e8eaf6598 | |||
08489819ec | |||
|
a51aac1066 | ||
a3f66d5df0 | |||
04e8798c6a | |||
e6a174e53a | |||
|
01d229823e | ||
51edf0b933 | |||
42dae48639 | |||
df4ea5dd86 | |||
5094c8269f | |||
e88cec2635 | |||
4f1e48a6b0 | |||
1193df20df | |||
e016f14059 | |||
be8495a2f2 | |||
7d0c4f73ba | |||
38bdea2642 | |||
2dec413e94 | |||
d1fe3a49e4 | |||
224415801f | |||
|
7bc9603952 | ||
7852fa5823 | |||
7b0e46e645 | |||
34ffc7816c | |||
7bd7d3ce6d | |||
f64b141227 | |||
|
15c3f4defc | ||
d86c3f69f8 | |||
6e29cb9914 | |||
8d5a3438a3 | |||
|
8401297b3f | ||
|
b2eebfa442 | ||
|
4394030f6b | ||
db492be169 | |||
89a47944a5 | |||
|
511f503912 | ||
6bdd454772 | |||
9b4d496f34 | |||
afe4eadf08 | |||
8cbd0b8879 | |||
dee732c8ca | |||
e6c6a3c18f | |||
1b2c988409 | |||
2e2f565ed7 | |||
|
93d6a9e45a | ||
bce589a751 | |||
6decc7139b | |||
bcc59ce81c | |||
9234e9af34 | |||
974b32e98c | |||
a7992bf20e | |||
0a9f200e97 | |||
b219dcf60b | |||
e526e32146 | |||
a8126b2f3e | |||
|
b24946ca43 | ||
|
7ad17ccfcf | ||
be7490cc9f | |||
6305662d38 | |||
b66eb5befa | |||
b9972b0527 | |||
6343c97175 | |||
4bf26cf158 | |||
48532ab56f | |||
45670f57c7 | |||
04313c746d | |||
97d0c407cf | |||
3145fec599 | |||
232ef6835e | |||
0ec0692aad | |||
32b7ba3d45 | |||
a2cee6566d | |||
|
74418453d3 | ||
854666fd06 | |||
|
232edb2ffb | ||
|
78d769a269 | ||
8b16d1012b | |||
7b0d981327 | |||
28fd0b5578 | |||
ecbf489148 | |||
d98af00775 | |||
91a0c02972 | |||
a34c4223fb | |||
e721e0f5bf | |||
c0009f8f08 | |||
e34eea98ba | |||
c6f8015154 | |||
407accedc8 | |||
ef315676b0 | |||
d329ce6191 | |||
225b60f752 | |||
0c3ff8b00a | |||
dfd22b1d3d | |||
ea20b1bee0 | |||
5fde49c0c2 | |||
63f1c10fcc | |||
56eaa7ca49 | |||
74be8a752b | |||
f7e86d32cf | |||
b43b59e526 | |||
bf721eddf6 | |||
875293a742 | |||
afa7c74f82 | |||
673f5ffcb6 | |||
9f087e3e1a | |||
077a7376c0 | |||
290f469b47 | |||
c5146bd315 | |||
9113d22766 | |||
579f82334c | |||
2dabeddbab | |||
035017617e | |||
bc644c85b2 | |||
705fbd341a | |||
a5a9b2e880 | |||
6e77d697fc | |||
195c0d5123 | |||
6d23179be6 | |||
2e06a17e5d | |||
c1b8697a56 | |||
de4feb0b89 | |||
364089b703 | |||
ffd3cceab8 | |||
36c34a9743 | |||
388bce170c | |||
04b79ade47 | |||
df70d8a8a4 | |||
225f331811 | |||
406e9e99bc | |||
37be7f85b6 | |||
023b141c4d | |||
2a67242f34 | |||
31ac93275c | |||
81cbdac591 | |||
198d637ef9 | |||
6a7c4899b4 | |||
77d99f6b39 | |||
6beeda5df7 | |||
59179652dd | |||
1793eb05e0 | |||
5c03e5c3b6 | |||
7fdc754084 | |||
e624efd067 | |||
f9cea9a6bf | |||
a02249f696 | |||
d382c3d9f2 | |||
93a1369e84 | |||
8ffc60b924 | |||
4af1d3d69b | |||
d453fe52fb | |||
eb6b20adbb | |||
138e1cc041 | |||
5a3211a560 | |||
0d076aa7e1 | |||
396765c8ea | |||
|
0e121a4f92 | ||
|
55bcafa637 | ||
|
abd21a88b2 | ||
|
31b8eb6ec8 | ||
|
0ebaecd1b4 | ||
984ae53213 | |||
1d885ff244 | |||
e96b7bd47d | |||
|
b88d282ae2 | ||
3a816b9f11 | |||
2482422302 | |||
|
89ad6fe39b | ||
|
655b21c0e9 | ||
64e5743893 | |||
70beaad4fa | |||
|
49f43f5dff | ||
|
e72f3f72f5 | ||
|
1d575cf63c | ||
|
7c23bd437f | ||
|
e65c8eb71e | ||
|
abbbd218ee | ||
|
5f13c98529 | ||
|
3ab3f97122 | ||
|
a9fe059b3c | ||
|
8346988604 | ||
|
522a8c2e23 | ||
|
8e144c8311 | ||
|
243d65699f | ||
|
f43863bd51 | ||
|
545e8ee177 | ||
|
d2f71aa993 | ||
0fbd27d41f | |||
7255c83ae9 | |||
8ff0664641 | |||
6315f54a23 | |||
fedc2bd6e4 | |||
892d8bf37e | |||
01cd067460 | |||
4135f6e427 | |||
c383f53025 | |||
3dc1076a88 | |||
4e91e0d5a1 | |||
73dd34449a | |||
491a8ab340 | |||
be132bd9e8 | |||
2797081091 | |||
e179be89fb | |||
e3b65c07b6 | |||
77c470f616 | |||
dc360be318 | |||
a610d0a35a | |||
a85b3d6ad2 | |||
6d3aa19663 | |||
|
63e2552604 | ||
|
172c1b826c | ||
|
ef73b3bde2 | ||
|
1e40bdd537 | ||
|
00e6840c32 | ||
|
822d3da5d9 | ||
|
98f1ca84b0 | ||
|
c7a5efcc78 | ||
|
0b1c5008f3 | ||
|
3bbca30296 | ||
|
05daa648cb | ||
|
a1026547cf | ||
|
e5bba46b80 | ||
|
41ca97e31a | ||
9a9d3ee4d5 | |||
17a64c51dd | |||
732c3626b5 | |||
348037a2ab | |||
6651b79188 | |||
373737ddaf | |||
cc1571dc26 | |||
7b61b6981a | |||
ac4bcbaca0 | |||
46c4b4dacb | |||
e5bca563f7 | |||
|
37d5ccc2e7 | ||
b82ce97259 | |||
b80023bb7f | |||
2c08e8b3ee | |||
a394882dcc | |||
e959230a22 | |||
7a647da798 | |||
1dc583e5f2 | |||
2e6d2b0dbc | |||
5ad9bc5748 | |||
8066824f90 | |||
42f34269f2 | |||
5308e782da | |||
7261599fca | |||
e588419245 | |||
cd613cc72b | |||
992591a54e | |||
33fb7f4907 | |||
e311b6a737 | |||
c965826b93 | |||
b9ab15a0c9 | |||
d782eadb5b | |||
ad870c1035 | |||
2f7f58ba02 | |||
a3ddb3e273 | |||
1538a47d8a | |||
9d07d005ae | |||
c0f2bc9c0c | |||
d70d66e3dc | |||
f23e5ad679 | |||
7bded4fbf5 | |||
d71cda7cbc | |||
4e63fb945e | |||
99cbec0926 | |||
228b02735d | |||
1ff3d2c8c3 | |||
2e68ae5409 | |||
6f8f5bbaf8 | |||
130be13b3e | |||
57ceb4cbcc | |||
3db4391041 | |||
edf5606814 | |||
e7b5e977d9 | |||
5efc38b213 | |||
f9b99e0481 | |||
79542acef1 | |||
|
4f21d3f63b | ||
0a3018af9c | |||
f009bc3e2a | |||
aaccfb7182 | |||
31795fa4b4 | |||
|
c077d63333 | ||
d4c28982c4 | |||
72a9a161ed | |||
a0fea26a6a | |||
f178c0ab5f | |||
9ced6da24e | |||
666e55b6e3 | |||
748c886df5 | |||
ffcfcde55f | |||
ba44189faa | |||
6d5ad34401 | |||
4185f79c52 | |||
bbcade6bb3 | |||
ccb4fced4f | |||
787195324a | |||
40cd244086 | |||
cdb2562d20 | |||
110f65b291 | |||
adaac287cc | |||
4216b19238 | |||
55f26fab6f | |||
86e84395e1 | |||
3a0b9d1b4e | |||
8180c6b99c | |||
557ce1d104 | |||
|
eddeaa3ad5 |
@ -1,54 +0,0 @@
|
||||
version: 2
|
||||
|
||||
defaults: &defaults
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/node:8.11.4
|
||||
|
||||
jobs:
|
||||
build:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "package.json" }}
|
||||
- v1-dependencies-
|
||||
- run: sudo apt-get install -y bluetooth bluez libbluetooth-dev libudev-dev
|
||||
- run: npm install
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-dependencies-{{ checksum "package.json" }}
|
||||
- run: npm run all
|
||||
- persist_to_workspace:
|
||||
root: ~/repo
|
||||
paths: .
|
||||
deploy:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/repo
|
||||
- run:
|
||||
name: Authenticate with registry
|
||||
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
|
||||
- run:
|
||||
name: Publish package
|
||||
command: npm publish
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build-deploy:
|
||||
jobs:
|
||||
- build:
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- deploy:
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
23
.drone.yml
Normal file
23
.drone.yml
Normal file
@ -0,0 +1,23 @@
|
||||
pipeline:
|
||||
|
||||
install:
|
||||
image: node:20.12.2
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt-get install -y bluetooth bluez libbluetooth-dev libudev-dev
|
||||
- git submodule update --init --recursive
|
||||
- npm install
|
||||
|
||||
build:
|
||||
image: node:20.12.2
|
||||
commands:
|
||||
- npm run all
|
||||
|
||||
publish:
|
||||
image: plugins/npm
|
||||
username: nathankellenicki
|
||||
token:
|
||||
from_secret: NPM_TOKEN
|
||||
when:
|
||||
ref:
|
||||
- refs/tags/v*
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ node_modules/
|
||||
dist/
|
||||
.vscode/
|
||||
*.tgz
|
||||
**/.DS_store
|
||||
|
0
.gitmodules
vendored
Normal file
0
.gitmodules
vendored
Normal file
40
.jsdoc.json
Normal file
40
.jsdoc.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"tags": {
|
||||
"allowUnknownTags": true,
|
||||
"dictionaries": ["jsdoc"]
|
||||
},
|
||||
"source": {
|
||||
"include": [ "README.md", "dist/node" ],
|
||||
"includePattern": ".js$"
|
||||
},
|
||||
"plugins": ["plugins/markdown"],
|
||||
"templates": {
|
||||
"referenceTitle": "node-poweredup Reference",
|
||||
"logoFile": "",
|
||||
"cleverLinks": false,
|
||||
"monospaceLinks": false,
|
||||
"dateFormat": "ddd MMM Do YYYY",
|
||||
"outputSourceFiles": true,
|
||||
"outputSourcePath": true,
|
||||
"systemName": "node-poweredup",
|
||||
"footer": "",
|
||||
"copyright": "node-poweredup by Nathan Kellenicki licensed under the MIT license.",
|
||||
"navType": "vertical",
|
||||
"theme": "simplex",
|
||||
"linenums": true,
|
||||
"collapseSymbols": false,
|
||||
"inverseNav": true,
|
||||
"protocol": "html://",
|
||||
"methodHeadingReturns": false
|
||||
},
|
||||
"markdown": {
|
||||
"parser": "gfm",
|
||||
"hardwrap": true
|
||||
},
|
||||
"opts": {
|
||||
"destination": "./docs/",
|
||||
"encoding": "utf8",
|
||||
"private": true,
|
||||
"recurse": true
|
||||
}
|
||||
}
|
12
.npmignore
12
.npmignore
@ -1,17 +1,5 @@
|
||||
boostmovehub.ts
|
||||
consts.ts
|
||||
duplotrainbase.ts
|
||||
hub.ts
|
||||
index.ts
|
||||
lpf2hub.ts
|
||||
port.ts
|
||||
poweredup.ts
|
||||
puphub.ts
|
||||
pupremote.ts
|
||||
package-lock.json
|
||||
tsconfig.json
|
||||
tslint.json
|
||||
utils.ts
|
||||
wedo2smarthub.ts
|
||||
.vscode/
|
||||
examples/
|
93
ABOUT.md
93
ABOUT.md
@ -1,93 +0,0 @@
|
||||
[](https://circleci.com/gh/nathankellenicki/node-poweredup)
|
||||
[](https://gitter.im/node-poweredup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||

|
||||
|
||||
# **node-poweredup** - A Node.js module to interface with LEGO Powered UP components.
|
||||
|
||||
### Introduction
|
||||
|
||||
LEGO Powered UP is the successor to Power Functions, the system for adding electronics to LEGO models. Powered UP is a collection of ranges - starting with LEGO WeDo 2.0 released in 2016, LEGO Boost released in 2017, and LEGO Powered UP released in 2018. It also includes the 2018 Duplo App-Controlled Train sets.
|
||||
|
||||
Powered UP has a few improvements over Power Functions:
|
||||
|
||||
1. The use of Bluetooth Low Energy makes it easy to control from a computer, and even write code for.
|
||||
|
||||
2. The ability to use sensors to react to events happening in the real world opens up a whole new world of possibilities.
|
||||
|
||||
3. As Powered UP hubs and remotes pair with each other, the system allows for a near unlimited number of independently controlled models in the same room. Power Functions was limited to 8 due to the use of infra-red for communication.
|
||||
|
||||
### Installation
|
||||
|
||||
Node.js v8.0 required.
|
||||
|
||||
```javascript
|
||||
npm install node-poweredup --save
|
||||
```
|
||||
|
||||
node-poweredup uses the Noble BLE library by Sandeep Mistry. On macOS everything should function out of the box. On Linux and Windows there are [certain dependencies which may need installed first](https://github.com/noble/noble#prerequisites).
|
||||
|
||||
Note: node-poweredup has been tested on macOS 10.13 and Debian/Raspbian on the Raspberry Pi 3 Model B.
|
||||
|
||||
### Compatibility
|
||||
|
||||
While most Powered UP components and Hubs are compatible with each other, there are exceptions. For example, there is limited backwards compatibility between newer components and the WeDo 2.0 Smart Hub. However WeDo 2.0 components are fully forwards compatible with newer Hubs.
|
||||
|
||||
| Device Name | Product Code | Type | WeDo 2.0 Smart Hub | Boost Move Hub | Powered UP Hub | Availability |
|
||||
| ------------------------------- | ------------ | ------------- | ------------------ | -------------- | -------------- | ------------ |
|
||||
| WeDo 2.0 Tilt Sensor | <a href="https://brickset.com/sets/45305-1/">45305</a> | Sensor | Yes | Yes | Yes | <a href="https://brickset.com/sets/45300-1/">45300</a> |
|
||||
| WeDo 2.0 Motion Sensor | <a href="https://brickset.com/sets/45304-1/">45304</a> | Sensor | Yes | Yes | Yes | <a href="https://brickset.com/sets/45300-1/">45300</a> |
|
||||
| WeDo 2.0 Medium Motor | <a href="https://brickset.com/sets/45303-1/">45303</a> | Motor | Yes | Yes | Yes | <a href="https://brickset.com/sets/45300-1/">45300</a><br /> <a href="https://brickset.com/sets/76112-1/">76112</a> |
|
||||
| Boost Color and Distance Sensor | <a href="https://brickset.com/sets/88007-1/">88007</a> | Sensor | *Partial* | Yes | Yes | <a href="https://brickset.com/sets/17101-1/">17101</a> |
|
||||
| Boost Tacho Motor | <a href="https://brickset.com/sets/88008-1/">88008</a> | Motor/Sensor | *Partial* | Yes | *Partial* | <a href="https://brickset.com/sets/17101-1/">17101</a> |
|
||||
| Powered UP Train Motor | <a href="https://brickset.com/sets/88011-1/">88011</a> | Motor | Yes | Yes | Yes | <a href="https://brickset.com/sets/60197-1/">60197</a><br /><a href="https://brickset.com/sets/60198-1/">60198</a> |
|
||||
| Powered UP LED Lights | <a href="https://brickset.com/sets/88005-1/">88005</a> | Light | Yes | Yes | Yes | <a href="https://brickset.com/sets/88005-1/">88005</a> |
|
||||
|
||||
In addition, the Hubs themselves have certain built-in features which this library exposes.
|
||||
|
||||
| Hub Name | Product Code | Built-In Features | Availability |
|
||||
| ------------------ | ------------ | ---------------------- | ------------ |
|
||||
| WeDo 2.0 Smart hub | <a href="https://brickset.com/sets/45301-1/">45301</a> | RGB LED<br />Piezo Buzzer<br />Button | <a href="https://brickset.com/sets/45300-1/">45300</a> |
|
||||
| Boost Move Hub | <a href="https://brickset.com/sets/88006-1/">88006</a> | RGB LED<br />Tilt Sensor<br />2x Tacho Motors<br />Button | <a href="https://brickset.com/sets/17101-1/">17101</a> |
|
||||
| Powered UP Hub | <a href="https://brickset.com/sets/88009-1/">88009</a> | RGB LED<br />Button | <a href="https://brickset.com/sets/60197-1/">60197</a><br /><a href="https://brickset.com/sets/60198-1/">60198</a><br /><a href="https://brickset.com/sets/76112-1/">76112</a> |
|
||||
| Powered UP Remote | <a href="https://brickset.com/sets/88010-1/">88010</a> | RGB LED<br />Left and Right Control Buttons<br />Button | <a href="https://brickset.com/sets/60197-1/">60197</a><br /><a href="https://brickset.com/sets/60198-1/">60198</a> |
|
||||
| Duplo Train Base | 28743 | RGB LED/Headlights<br />Speaker<br />Speedometer<br />Motor<br />Color and Distance Sensor<br />Button | <a href="https://brickset.com/sets/10874-1/">10874</a><br /><a href="https://brickset.com/sets/10875-1/">10875</a> |
|
||||
|
||||
|
||||
### Known Issues and Limitations
|
||||
|
||||
* The Boost Color and Distance sensor only works in color mode with the WeDo 2.0 Smart Hub.
|
||||
|
||||
* When used with the WeDo 2.0 Smart Hub, the Boost Tacho Motor does not support rotating the motor by angle.
|
||||
|
||||
* When used with the Powered UP Hub, the Boost Tacho Motor does not support rotating the motor by angle. It also does not support rotation detection.
|
||||
|
||||
* Plugging two Boost Tacho Motors into the Powered UP Hub will crash the Hub (This requires a firmware update from LEGO to fix).
|
||||
|
||||
### Usage
|
||||
|
||||
```javascript
|
||||
const PoweredUP = require("node-poweredup");
|
||||
const poweredUP = new PoweredUP.PoweredUP();
|
||||
|
||||
poweredUP.on("discover", async (hub) => { // Wait to discover a Hub
|
||||
await hub.connect(); // Connect to the Hub
|
||||
await hub.sleep(3000); // Sleep for 3 seconds before starting
|
||||
|
||||
while (true) { // Repeat indefinitely
|
||||
hub.setMotorSpeed("B", 75); // Start a motor attached to port B to run a 3/4 speed (75) indefinitely
|
||||
await hub.setMotorSpeed("A", 100, 2000); // Run a motor attached to port A for 2 seconds at maximum speed (100) then stop
|
||||
await hub.sleep(1000); // Do nothing for 1 second
|
||||
await hub.setMotorSpeed("A", -50, 1000); // Run a motor attached to port A for 1 second at 1/2 speed in reverse (-50) then stop
|
||||
await hub.sleep(1000); // Do nothing for 1 second
|
||||
}
|
||||
});
|
||||
|
||||
poweredUP.scan(); // Start scanning for Hubs
|
||||
```
|
||||
|
||||
More examples are available in the "examples" directory.
|
||||
|
||||
### Credits
|
||||
|
||||
Thanks go to Jorge Pereira ([@JorgePe](https://github.com/JorgePe)), Sebastian Raff ([@hobbyquaker](https://github.com/hobbyquaker)), Valentin Heun ([@vheun](https://github.com/vheun)), Johan Korten ([@jakorten](https://github.com/jakorten)), and Andrey Pokhilko ([@undera](https://github.com/undera)) for their various works, contributions, and assistance on figuring out the LEGO Boost, WeDo 2.0, and Powered UP protocols.
|
||||
|
129
abandonware-noble.d.ts
vendored
Normal file
129
abandonware-noble.d.ts
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
declare module "@abandonware/noble" {
|
||||
// Type definitions for noble
|
||||
// Project: https://github.com/sandeepmistry/noble
|
||||
// Definitions by: Seon-Wook Park <https://github.com/swook>
|
||||
// Shantanu Bhadoria <https://github.com/shantanubhadoria>
|
||||
// Luke Libraro <https://github.com/lukel99>
|
||||
// Dan Chao <https://github.com/bioball>
|
||||
// Michal Lower <https://github.com/keton>
|
||||
// Rob Moran <https://github.com/thegecko>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import events = require("events");
|
||||
|
||||
export function startScanning(callback?: (error?: Error) => void): void;
|
||||
export function startScanning(serviceUUIDs: string[], callback?: (error?: Error) => void): void;
|
||||
export function startScanning(serviceUUIDs: string[], allowDuplicates: boolean, callback?: (error?: Error) => void): void;
|
||||
export function stopScanning(callback?: () => void): void;
|
||||
|
||||
export function on(event: "stateChange", listener: (state: string) => void): events.EventEmitter;
|
||||
export function on(event: "scanStart", listener: () => void): events.EventEmitter;
|
||||
export function on(event: "scanStop", listener: () => void): events.EventEmitter;
|
||||
export function on(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter;
|
||||
export function on(event: string, listener: Function): events.EventEmitter;
|
||||
|
||||
export function removeListener(event: "stateChange", listener: (state: string) => void): events.EventEmitter;
|
||||
export function removeListener(event: "scanStart", listener: () => void): events.EventEmitter;
|
||||
export function removeListener(event: "scanStop", listener: () => void): events.EventEmitter;
|
||||
export function removeListener(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter;
|
||||
export function removeListener(event: string, listener: Function): events.EventEmitter;
|
||||
|
||||
export var state:string;
|
||||
|
||||
export class Peripheral extends events.EventEmitter {
|
||||
id: string;
|
||||
uuid: string;
|
||||
address: string;
|
||||
addressType: string;
|
||||
connectable: boolean;
|
||||
advertisement: Advertisement;
|
||||
rssi: number;
|
||||
services: Service[];
|
||||
state: 'error' | 'connecting' | 'connected' | 'disconnecting' | 'disconnected';
|
||||
|
||||
connect(callback?: (error: string) => void): void;
|
||||
disconnect(callback?: () => void): void;
|
||||
updateRssi(callback?: (error: string, rssi: number) => void): void;
|
||||
discoverServices(serviceUUIDs: string[], callback?: (error: string, services: Service[]) => void): void;
|
||||
discoverAllServicesAndCharacteristics(callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
|
||||
discoverSomeServicesAndCharacteristics(serviceUUIDs: string[], characteristicUUIDs: string[], callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
|
||||
|
||||
readHandle(handle: Buffer, callback: (error: string, data: Buffer) => void): void;
|
||||
writeHandle(handle: Buffer, data: Buffer, withoutResponse: boolean, callback: (error: string) => void): void;
|
||||
toString(): string;
|
||||
|
||||
on(event: "connect", listener: (error: string) => void): this;
|
||||
on(event: "disconnect", listener: (error: string) => void): this;
|
||||
on(event: "rssiUpdate", listener: (rssi: number) => void): this;
|
||||
on(event: "servicesDiscover", listener: (services: Service[]) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
|
||||
export interface Advertisement {
|
||||
localName: string;
|
||||
serviceData: {
|
||||
uuid: string,
|
||||
data: Buffer
|
||||
};
|
||||
txPowerLevel: number;
|
||||
manufacturerData: Buffer;
|
||||
serviceUuids: string[];
|
||||
}
|
||||
|
||||
export class Service extends events.EventEmitter {
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
includedServiceUuids: string[];
|
||||
characteristics: Characteristic[];
|
||||
|
||||
discoverIncludedServices(serviceUUIDs: string[], callback?: (error: string, includedServiceUuids: string[]) => void): void;
|
||||
discoverCharacteristics(characteristicUUIDs: string[], callback?: (error: string, characteristics: Characteristic[]) => void): void;
|
||||
toString(): string;
|
||||
|
||||
on(event: "includedServicesDiscover", listener: (includedServiceUuids: string[]) => void): this;
|
||||
on(event: "characteristicsDiscover", listener: (characteristics: Characteristic[]) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
|
||||
export class Characteristic extends events.EventEmitter {
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
properties: string[];
|
||||
descriptors: Descriptor[];
|
||||
|
||||
read(callback?: (error: string, data: Buffer) => void): void;
|
||||
write(data: Buffer, notify: boolean, callback?: (error: string) => void): void;
|
||||
broadcast(broadcast: boolean, callback?: (error: string) => void): void;
|
||||
notify(notify: boolean, callback?: (error: string) => void): void;
|
||||
discoverDescriptors(callback?: (error: string, descriptors: Descriptor[]) => void): void;
|
||||
toString(): string;
|
||||
subscribe(callback?: (error: string) => void): void;
|
||||
unsubscribe(callback?: (error: string) => void): void;
|
||||
|
||||
on(event: "read", listener: (data: Buffer, isNotification: boolean) => void): this;
|
||||
on(event: "write", withoutResponse: boolean, listener: (error: string) => void): this;
|
||||
on(event: "broadcast", listener: (state: string) => void): this;
|
||||
on(event: "notify", listener: (state: string) => void): this;
|
||||
on(event: "descriptorsDiscover", listener: (descriptors: Descriptor[]) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
on(event: string, option: boolean, listener: Function): this;
|
||||
}
|
||||
|
||||
export class Descriptor extends events.EventEmitter {
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
|
||||
readValue(callback?: (error: string, data: Buffer) => void): void;
|
||||
writeValue(data: Buffer, callback?: (error: string) => void): void;
|
||||
toString(): string;
|
||||
|
||||
on(event: "valueRead", listener: (error: string, data: Buffer) => void): this;
|
||||
on(event: "valueWrite", listener: (error: string) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
}
|
2008
docs/AbsoluteMotor.html
Normal file
2008
docs/AbsoluteMotor.html
Normal file
File diff suppressed because one or more lines are too long
1391
docs/BaseHub.html
Normal file
1391
docs/BaseHub.html
Normal file
File diff suppressed because one or more lines are too long
1459
docs/BasicMotor.html
Normal file
1459
docs/BasicMotor.html
Normal file
File diff suppressed because one or more lines are too long
3025
docs/ColorDistanceSensor.html
Normal file
3025
docs/ColorDistanceSensor.html
Normal file
File diff suppressed because one or more lines are too long
1022
docs/CurrentSensor.html
Normal file
1022
docs/CurrentSensor.html
Normal file
File diff suppressed because one or more lines are too long
841
docs/Device.html
Normal file
841
docs/Device.html
Normal file
File diff suppressed because one or more lines are too long
2092
docs/DuploTrainBase.html
Normal file
2092
docs/DuploTrainBase.html
Normal file
File diff suppressed because one or more lines are too long
1509
docs/DuploTrainBaseColorSensor.html
Normal file
1509
docs/DuploTrainBaseColorSensor.html
Normal file
File diff suppressed because one or more lines are too long
1479
docs/DuploTrainBaseMotor.html
Normal file
1479
docs/DuploTrainBaseMotor.html
Normal file
File diff suppressed because one or more lines are too long
1193
docs/DuploTrainBaseSpeaker.html
Normal file
1193
docs/DuploTrainBaseSpeaker.html
Normal file
File diff suppressed because one or more lines are too long
871
docs/DuploTraniBaseSpeedometer.html
Normal file
871
docs/DuploTraniBaseSpeedometer.html
Normal file
File diff suppressed because one or more lines are too long
7451
docs/Hub.html
Normal file
7451
docs/Hub.html
Normal file
File diff suppressed because one or more lines are too long
1239
docs/HubLED.html
Normal file
1239
docs/HubLED.html
Normal file
File diff suppressed because one or more lines are too long
2066
docs/LPF2Hub.html
Normal file
2066
docs/LPF2Hub.html
Normal file
File diff suppressed because one or more lines are too long
1239
docs/Light.html
Normal file
1239
docs/Light.html
Normal file
File diff suppressed because one or more lines are too long
2092
docs/Mario.html
Normal file
2092
docs/Mario.html
Normal file
File diff suppressed because one or more lines are too long
1215
docs/MarioAccelerometer.html
Normal file
1215
docs/MarioAccelerometer.html
Normal file
File diff suppressed because one or more lines are too long
1215
docs/MarioBarcodeSensor.html
Normal file
1215
docs/MarioBarcodeSensor.html
Normal file
File diff suppressed because one or more lines are too long
1022
docs/MarioPantsSensor.html
Normal file
1022
docs/MarioPantsSensor.html
Normal file
File diff suppressed because one or more lines are too long
1357
docs/MediumLinearMotor.html
Normal file
1357
docs/MediumLinearMotor.html
Normal file
File diff suppressed because one or more lines are too long
1022
docs/MotionSensor.html
Normal file
1022
docs/MotionSensor.html
Normal file
File diff suppressed because one or more lines are too long
2092
docs/MoveHub.html
Normal file
2092
docs/MoveHub.html
Normal file
File diff suppressed because one or more lines are too long
1357
docs/MoveHubMediumLinearMotor.html
Normal file
1357
docs/MoveHubMediumLinearMotor.html
Normal file
File diff suppressed because one or more lines are too long
1045
docs/MoveHubTiltSensor.html
Normal file
1045
docs/MoveHubTiltSensor.html
Normal file
File diff suppressed because one or more lines are too long
1057
docs/PiezoBuzzer.html
Normal file
1057
docs/PiezoBuzzer.html
Normal file
File diff suppressed because one or more lines are too long
4371
docs/PoweredUP.html
Normal file
4371
docs/PoweredUP.html
Normal file
File diff suppressed because one or more lines are too long
2092
docs/RemoteControl.html
Normal file
2092
docs/RemoteControl.html
Normal file
File diff suppressed because one or more lines are too long
1022
docs/RemoteControlButton.html
Normal file
1022
docs/RemoteControlButton.html
Normal file
File diff suppressed because one or more lines are too long
871
docs/SimpleMediumLinearMotor.html
Normal file
871
docs/SimpleMediumLinearMotor.html
Normal file
File diff suppressed because one or more lines are too long
2620
docs/TachoMotor.html
Normal file
2620
docs/TachoMotor.html
Normal file
File diff suppressed because one or more lines are too long
1037
docs/Technic3x3ColorLightMatrix.html
Normal file
1037
docs/Technic3x3ColorLightMatrix.html
Normal file
File diff suppressed because one or more lines are too long
1525
docs/TechnicColorSensor.html
Normal file
1525
docs/TechnicColorSensor.html
Normal file
File diff suppressed because one or more lines are too long
1401
docs/TechnicDistanceSensor.html
Normal file
1401
docs/TechnicDistanceSensor.html
Normal file
File diff suppressed because one or more lines are too long
1316
docs/TechnicForceSensor.html
Normal file
1316
docs/TechnicForceSensor.html
Normal file
File diff suppressed because one or more lines are too long
2028
docs/TechnicLargeAngularMotor.html
Normal file
2028
docs/TechnicLargeAngularMotor.html
Normal file
File diff suppressed because one or more lines are too long
2028
docs/TechnicLargeLinearMotor.html
Normal file
2028
docs/TechnicLargeLinearMotor.html
Normal file
File diff suppressed because one or more lines are too long
2028
docs/TechnicMediumAngularMotor.html
Normal file
2028
docs/TechnicMediumAngularMotor.html
Normal file
File diff suppressed because one or more lines are too long
2092
docs/TechnicMediumHub.html
Normal file
2092
docs/TechnicMediumHub.html
Normal file
File diff suppressed because one or more lines are too long
1068
docs/TechnicMediumHubAccelerometerSensor.html
Normal file
1068
docs/TechnicMediumHubAccelerometerSensor.html
Normal file
File diff suppressed because one or more lines are too long
1068
docs/TechnicMediumHubGyroSensor.html
Normal file
1068
docs/TechnicMediumHubGyroSensor.html
Normal file
File diff suppressed because one or more lines are too long
1696
docs/TechnicMediumHubTiltSensor.html
Normal file
1696
docs/TechnicMediumHubTiltSensor.html
Normal file
File diff suppressed because one or more lines are too long
2028
docs/TechnicSmallAngularMotor.html
Normal file
2028
docs/TechnicSmallAngularMotor.html
Normal file
File diff suppressed because one or more lines are too long
2028
docs/TechnicXLargeLinearMotor.html
Normal file
2028
docs/TechnicXLargeLinearMotor.html
Normal file
File diff suppressed because one or more lines are too long
1045
docs/TiltSensor.html
Normal file
1045
docs/TiltSensor.html
Normal file
File diff suppressed because one or more lines are too long
1479
docs/TrainMotor.html
Normal file
1479
docs/TrainMotor.html
Normal file
File diff suppressed because one or more lines are too long
1022
docs/VoltageSensor.html
Normal file
1022
docs/VoltageSensor.html
Normal file
File diff suppressed because one or more lines are too long
1887
docs/WeDo2SmartHub.html
Normal file
1887
docs/WeDo2SmartHub.html
Normal file
File diff suppressed because one or more lines are too long
728
docs/consts.js.html
Normal file
728
docs/consts.js.html
Normal file
File diff suppressed because one or more lines are too long
195
docs/devices_absolutemotor.js.html
Normal file
195
docs/devices_absolutemotor.js.html
Normal file
File diff suppressed because one or more lines are too long
138
docs/devices_basicmotor.js.html
Normal file
138
docs/devices_basicmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
361
docs/devices_colordistancesensor.js.html
Normal file
361
docs/devices_colordistancesensor.js.html
Normal file
File diff suppressed because one or more lines are too long
132
docs/devices_currentsensor.js.html
Normal file
132
docs/devices_currentsensor.js.html
Normal file
File diff suppressed because one or more lines are too long
239
docs/devices_device.js.html
Normal file
239
docs/devices_device.js.html
Normal file
File diff suppressed because one or more lines are too long
154
docs/devices_duplotrainbasecolorsensor.js.html
Normal file
154
docs/devices_duplotrainbasecolorsensor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_duplotrainbasemotor.js.html
Normal file
89
docs/devices_duplotrainbasemotor.js.html
Normal file
File diff suppressed because one or more lines are too long
117
docs/devices_duplotrainbasespeaker.js.html
Normal file
117
docs/devices_duplotrainbasespeaker.js.html
Normal file
File diff suppressed because one or more lines are too long
111
docs/devices_duplotrainbasespeedometer.js.html
Normal file
111
docs/devices_duplotrainbasespeedometer.js.html
Normal file
File diff suppressed because one or more lines are too long
137
docs/devices_hubled.js.html
Normal file
137
docs/devices_hubled.js.html
Normal file
File diff suppressed because one or more lines are too long
123
docs/devices_light.js.html
Normal file
123
docs/devices_light.js.html
Normal file
File diff suppressed because one or more lines are too long
127
docs/devices_marioaccelerometer.js.html
Normal file
127
docs/devices_marioaccelerometer.js.html
Normal file
File diff suppressed because one or more lines are too long
135
docs/devices_mariobarcodesensor.js.html
Normal file
135
docs/devices_mariobarcodesensor.js.html
Normal file
File diff suppressed because one or more lines are too long
111
docs/devices_mariopantssensor.js.html
Normal file
111
docs/devices_mariopantssensor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_mediumlinearmotor.js.html
Normal file
89
docs/devices_mediumlinearmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
115
docs/devices_motionsensor.js.html
Normal file
115
docs/devices_motionsensor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_movehubmediumlinearmotor.js.html
Normal file
89
docs/devices_movehubmediumlinearmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
113
docs/devices_movehubtiltsensor.js.html
Normal file
113
docs/devices_movehubtiltsensor.js.html
Normal file
File diff suppressed because one or more lines are too long
105
docs/devices_piezobuzzer.js.html
Normal file
105
docs/devices_piezobuzzer.js.html
Normal file
File diff suppressed because one or more lines are too long
117
docs/devices_remotecontrolbutton.js.html
Normal file
117
docs/devices_remotecontrolbutton.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_simplemediumlinearmotor.js.html
Normal file
89
docs/devices_simplemediumlinearmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
244
docs/devices_tachomotor.js.html
Normal file
244
docs/devices_tachomotor.js.html
Normal file
File diff suppressed because one or more lines are too long
131
docs/devices_technic3x3colorlightmatrix.js.html
Normal file
131
docs/devices_technic3x3colorlightmatrix.js.html
Normal file
File diff suppressed because one or more lines are too long
149
docs/devices_techniccolorsensor.js.html
Normal file
149
docs/devices_techniccolorsensor.js.html
Normal file
File diff suppressed because one or more lines are too long
135
docs/devices_technicdistancesensor.js.html
Normal file
135
docs/devices_technicdistancesensor.js.html
Normal file
File diff suppressed because one or more lines are too long
135
docs/devices_technicforcesensor.js.html
Normal file
135
docs/devices_technicforcesensor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_techniclargeangularmotor.js.html
Normal file
89
docs/devices_techniclargeangularmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_techniclargelinearmotor.js.html
Normal file
89
docs/devices_techniclargelinearmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_technicmediumangularmotor.js.html
Normal file
89
docs/devices_technicmediumangularmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
115
docs/devices_technicmediumhubaccelerometersensor.js.html
Normal file
115
docs/devices_technicmediumhubaccelerometersensor.js.html
Normal file
File diff suppressed because one or more lines are too long
115
docs/devices_technicmediumhubgyrosensor.js.html
Normal file
115
docs/devices_technicmediumhubgyrosensor.js.html
Normal file
File diff suppressed because one or more lines are too long
183
docs/devices_technicmediumhubtiltsensor.js.html
Normal file
183
docs/devices_technicmediumhubtiltsensor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_technicsmallangularmotor.js.html
Normal file
89
docs/devices_technicsmallangularmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_technicxlargelinearmotor.js.html
Normal file
89
docs/devices_technicxlargelinearmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
113
docs/devices_tiltsensor.js.html
Normal file
113
docs/devices_tiltsensor.js.html
Normal file
File diff suppressed because one or more lines are too long
89
docs/devices_trainmotor.js.html
Normal file
89
docs/devices_trainmotor.js.html
Normal file
File diff suppressed because one or more lines are too long
136
docs/devices_voltagesensor.js.html
Normal file
136
docs/devices_voltagesensor.js.html
Normal file
File diff suppressed because one or more lines are too long
BIN
docs/fonts/OpenSans-Bold-webfont.eot
Normal file
BIN
docs/fonts/OpenSans-Bold-webfont.eot
Normal file
Binary file not shown.
1830
docs/fonts/OpenSans-Bold-webfont.svg
Normal file
1830
docs/fonts/OpenSans-Bold-webfont.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 116 KiB |
BIN
docs/fonts/OpenSans-Bold-webfont.woff
Normal file
BIN
docs/fonts/OpenSans-Bold-webfont.woff
Normal file
Binary file not shown.
BIN
docs/fonts/OpenSans-BoldItalic-webfont.eot
Normal file
BIN
docs/fonts/OpenSans-BoldItalic-webfont.eot
Normal file
Binary file not shown.
1830
docs/fonts/OpenSans-BoldItalic-webfont.svg
Normal file
1830
docs/fonts/OpenSans-BoldItalic-webfont.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 118 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user