diff --git a/DOCS.md b/DOCS.md index 4c8d4c5..105441a 100644 --- a/DOCS.md +++ b/DOCS.md @@ -3,7 +3,7 @@
EventEmitter
Hub
Hub
LPF2Hub
WeDo2SmartHub
\| LPF2Hub
|
+| hub | [WeDo2SmartHub
](#WeDo2SmartHub) \| LPF2Hub
|
-
+
-## WeDo2Hub ⇐ Hub
+## WeDo2SmartHub ⇐ Hub
**Kind**: global class
**Extends**: Hub
-* [WeDo2Hub](#WeDo2Hub) ⇐ Hub
- * [new WeDo2Hub()](#new_WeDo2Hub_new)
+* [WeDo2SmartHub](#WeDo2SmartHub) ⇐ Hub
+ * [new WeDo2SmartHub()](#new_WeDo2SmartHub_new)
* [.name](#Hub+name)
* [.uuid](#Hub+uuid)
* [.rssi](#Hub+rssi)
* [.batteryLevel](#Hub+batteryLevel)
- * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) ⇒ Promise
- * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) ⇒ Promise
- * [.setMotorSpeed(port, speed, [time])](#WeDo2Hub+setMotorSpeed) ⇒ Promise
- * [.playSound(frequency, time)](#WeDo2Hub+playSound) ⇒ Promise
+ * [.setLEDColor(color)](#WeDo2SmartHub+setLEDColor) ⇒ Promise
+ * [.setLEDRGB(red, green, blue)](#WeDo2SmartHub+setLEDRGB) ⇒ Promise
+ * [.setMotorSpeed(port, speed, [time])](#WeDo2SmartHub+setMotorSpeed) ⇒ Promise
+ * [.playSound(frequency, time)](#WeDo2SmartHub+playSound) ⇒ Promise
* [.connect()](#Hub+connect) ⇒ Promise
* [.disconnect()](#Hub+disconnect) ⇒ Promise
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ Promise
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ Promise
* [.sleep(delay)](#Hub+sleep) ⇒ Promise
* [.wait(commands)](#Hub+wait) ⇒ Promise
- * ["button" (button, state)](#WeDo2Hub+event_button)
- * ["distance" (port, distance)](#WeDo2Hub+event_distance)
- * ["color" (port, color)](#WeDo2Hub+event_color)
- * ["tilt" (port, x, y)](#WeDo2Hub+event_tilt)
- * ["rotate" (port, rotation)](#WeDo2Hub+event_rotate)
+ * ["button" (button, state)](#WeDo2SmartHub+event_button)
+ * ["distance" (port, distance)](#WeDo2SmartHub+event_distance)
+ * ["color" (port, color)](#WeDo2SmartHub+event_color)
+ * ["tilt" (port, x, y)](#WeDo2SmartHub+event_tilt)
+ * ["rotate" (port, rotation)](#WeDo2SmartHub+event_rotate)
* ["attach" (port, type)](#Hub+event_attach)
* ["detach" (port)](#Hub+event_detach)
-
+
-### new WeDo2Hub()
-The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
+### new WeDo2SmartHub()
+The WeDo2SmartHub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.name
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.name
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -114,8 +114,8 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.uuid
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.uuid
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -125,8 +125,8 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.rssi
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.rssi
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -136,8 +136,8 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.batteryLevel
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.batteryLevel
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -145,24 +145,24 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
| --- | --- | --- |
| batteryLevel | number
| Battery level of the hub (Percentage between 0-100) |
-
+
-### weDo2Hub.setLEDColor(color) ⇒ Promise
+### weDo2SmartHub.setLEDColor(color) ⇒ Promise
Set the color of the LED on the Hub via a color value.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type | Description |
| --- | --- | --- |
| color | number
| A number representing one of the LED color consts. |
-
+
-### weDo2Hub.setLEDRGB(red, green, blue) ⇒ Promise
+### weDo2SmartHub.setLEDRGB(red, green, blue) ⇒ Promise
Set the color of the LED on the Hub via RGB values.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type |
@@ -171,12 +171,12 @@ Set the color of the LED on the Hub via RGB values.
| green | number
|
| blue | number
|
-
+
-### weDo2Hub.setMotorSpeed(port, speed, [time]) ⇒ Promise
+### weDo2SmartHub.setMotorSpeed(port, speed, [time]) ⇒ Promise
Set the motor speed on a given port.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful completion of command. If time is specified, this is once the motor is finished.
| Param | Type | Description |
@@ -185,12 +185,12 @@ Set the motor speed on a given port.
| speed | number
| For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
| [time] | number
| How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. |
-
+
-### weDo2Hub.playSound(frequency, time) ⇒ Promise
+### weDo2SmartHub.playSound(frequency, time) ⇒ Promise
Play a sound on the Hub's in-built buzzer
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful completion of command (ie. once the sound has finished playing).
| Param | Type | Description |
@@ -200,25 +200,25 @@ Play a sound on the Hub's in-built buzzer
-### weDo2Hub.connect() ⇒ Promise
+### weDo2SmartHub.connect() ⇒ Promise
Connect to the Hub.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Overrides**: [connect
](#Hub+connect)
**Returns**: Promise
- Resolved upon successful connect.
-### weDo2Hub.disconnect() ⇒ Promise
+### weDo2SmartHub.disconnect() ⇒ Promise
Disconnect the Hub.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful disconnect.
-### weDo2Hub.subscribe(port, [mode]) ⇒ Promise
+### weDo2SmartHub.subscribe(port, [mode]) ⇒ Promise
Subscribe to sensor notifications on a given port.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type | Description |
@@ -228,10 +228,10 @@ Subscribe to sensor notifications on a given port.
-### weDo2Hub.unsubscribe(port) ⇒ Promise
+### weDo2SmartHub.unsubscribe(port) ⇒ Promise
Unsubscribe to sensor notifications on a given port.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type |
@@ -240,12 +240,12 @@ Unsubscribe to sensor notifications on a given port.
-### weDo2Hub.sleep(delay) ⇒ Promise
+### weDo2SmartHub.sleep(delay) ⇒ Promise
Sleep a given amount of time.
This is a helper method to make it easier to add delays into a chain of commands.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved after the delay is finished.
| Param | Type | Description |
@@ -254,60 +254,60 @@ This is a helper method to make it easier to add delays into a chain of commands
-### weDo2Hub.wait(commands) ⇒ Promise
+### weDo2SmartHub.wait(commands) ⇒ Promise
Wait until a given list of concurrently running commands are complete.
This is a helper method to make it easier to wait for concurrent commands to complete.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved after the commands are finished.
| Param | Type | Description |
| --- | --- | --- |
| commands | Array.<Promise.<any>>
| Array of executing commands. |
-
+
### "button" (button, state)
Emits when a button is pressed.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
| button | string
| |
| state | number
| A number representing one of the button state consts. |
-
+
### "distance" (port, distance)
Emits when a distance sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
| port | string
| |
| distance | number
| Distance, in millimeters. |
-
+
### "color" (port, color)
Emits when a color sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
| port | string
| |
| color | number
| A number representing one of the LED color consts. |
-
+
### "tilt" (port, x, y)
Emits when a tilt sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type |
| --- | --- |
@@ -315,12 +315,12 @@ Emits when a tilt sensor is activated.
| x | number
|
| y | number
|
-
+
### "rotate" (port, rotation)
Emits when a rotation sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type |
| --- | --- |
@@ -332,7 +332,7 @@ Emits when a rotation sensor is activated.
### "attach" (port, type)
Emits when a motor or sensor is attached to the Hub.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
@@ -344,7 +344,7 @@ Emits when a motor or sensor is attached to the Hub.
### "detach" (port)
Emits when an attached motor or sensor is detached from the Hub.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type |
| --- | --- |
diff --git a/README.md b/README.md
index c038e3d..f9825fd 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ Thanks go to Jorge Pereira ([@JorgePe](https://github.com/JorgePe)), Sebastian R
EventEmitter
Hub
Hub
LPF2Hub
WeDo2SmartHub
\| LPF2Hub
|
+| hub | [WeDo2SmartHub
](#WeDo2SmartHub) \| LPF2Hub
|
-
+
-## WeDo2Hub ⇐ Hub
+## WeDo2SmartHub ⇐ Hub
**Kind**: global class
**Extends**: Hub
-* [WeDo2Hub](#WeDo2Hub) ⇐ Hub
- * [new WeDo2Hub()](#new_WeDo2Hub_new)
+* [WeDo2SmartHub](#WeDo2SmartHub) ⇐ Hub
+ * [new WeDo2SmartHub()](#new_WeDo2SmartHub_new)
* [.name](#Hub+name)
* [.uuid](#Hub+uuid)
* [.rssi](#Hub+rssi)
* [.batteryLevel](#Hub+batteryLevel)
- * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) ⇒ Promise
- * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) ⇒ Promise
- * [.setMotorSpeed(port, speed, [time])](#WeDo2Hub+setMotorSpeed) ⇒ Promise
- * [.playSound(frequency, time)](#WeDo2Hub+playSound) ⇒ Promise
+ * [.setLEDColor(color)](#WeDo2SmartHub+setLEDColor) ⇒ Promise
+ * [.setLEDRGB(red, green, blue)](#WeDo2SmartHub+setLEDRGB) ⇒ Promise
+ * [.setMotorSpeed(port, speed, [time])](#WeDo2SmartHub+setMotorSpeed) ⇒ Promise
+ * [.playSound(frequency, time)](#WeDo2SmartHub+playSound) ⇒ Promise
* [.connect()](#Hub+connect) ⇒ Promise
* [.disconnect()](#Hub+disconnect) ⇒ Promise
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ Promise
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ Promise
* [.sleep(delay)](#Hub+sleep) ⇒ Promise
* [.wait(commands)](#Hub+wait) ⇒ Promise
- * ["button" (button, state)](#WeDo2Hub+event_button)
- * ["distance" (port, distance)](#WeDo2Hub+event_distance)
- * ["color" (port, color)](#WeDo2Hub+event_color)
- * ["tilt" (port, x, y)](#WeDo2Hub+event_tilt)
- * ["rotate" (port, rotation)](#WeDo2Hub+event_rotate)
+ * ["button" (button, state)](#WeDo2SmartHub+event_button)
+ * ["distance" (port, distance)](#WeDo2SmartHub+event_distance)
+ * ["color" (port, color)](#WeDo2SmartHub+event_color)
+ * ["tilt" (port, x, y)](#WeDo2SmartHub+event_tilt)
+ * ["rotate" (port, rotation)](#WeDo2SmartHub+event_rotate)
* ["attach" (port, type)](#Hub+event_attach)
* ["detach" (port)](#Hub+event_detach)
-
+
-### new WeDo2Hub()
-The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
+### new WeDo2SmartHub()
+The WeDo2SmartHub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.name
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.name
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -164,8 +164,8 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.uuid
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.uuid
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -175,8 +175,8 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.rssi
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.rssi
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -186,8 +186,8 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
-### weDo2Hub.batteryLevel
-**Kind**: instance property of [WeDo2Hub
](#WeDo2Hub)
+### weDo2SmartHub.batteryLevel
+**Kind**: instance property of [WeDo2SmartHub
](#WeDo2SmartHub)
**Read only**: true
**Properties**
@@ -195,24 +195,24 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
| --- | --- | --- |
| batteryLevel | number
| Battery level of the hub (Percentage between 0-100) |
-
+
-### weDo2Hub.setLEDColor(color) ⇒ Promise
+### weDo2SmartHub.setLEDColor(color) ⇒ Promise
Set the color of the LED on the Hub via a color value.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type | Description |
| --- | --- | --- |
| color | number
| A number representing one of the LED color consts. |
-
+
-### weDo2Hub.setLEDRGB(red, green, blue) ⇒ Promise
+### weDo2SmartHub.setLEDRGB(red, green, blue) ⇒ Promise
Set the color of the LED on the Hub via RGB values.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type |
@@ -221,12 +221,12 @@ Set the color of the LED on the Hub via RGB values.
| green | number
|
| blue | number
|
-
+
-### weDo2Hub.setMotorSpeed(port, speed, [time]) ⇒ Promise
+### weDo2SmartHub.setMotorSpeed(port, speed, [time]) ⇒ Promise
Set the motor speed on a given port.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful completion of command. If time is specified, this is once the motor is finished.
| Param | Type | Description |
@@ -235,12 +235,12 @@ Set the motor speed on a given port.
| speed | number
| For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
| [time] | number
| How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. |
-
+
-### weDo2Hub.playSound(frequency, time) ⇒ Promise
+### weDo2SmartHub.playSound(frequency, time) ⇒ Promise
Play a sound on the Hub's in-built buzzer
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful completion of command (ie. once the sound has finished playing).
| Param | Type | Description |
@@ -250,25 +250,25 @@ Play a sound on the Hub's in-built buzzer
-### weDo2Hub.connect() ⇒ Promise
+### weDo2SmartHub.connect() ⇒ Promise
Connect to the Hub.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Overrides**: [connect
](#Hub+connect)
**Returns**: Promise
- Resolved upon successful connect.
-### weDo2Hub.disconnect() ⇒ Promise
+### weDo2SmartHub.disconnect() ⇒ Promise
Disconnect the Hub.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful disconnect.
-### weDo2Hub.subscribe(port, [mode]) ⇒ Promise
+### weDo2SmartHub.subscribe(port, [mode]) ⇒ Promise
Subscribe to sensor notifications on a given port.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type | Description |
@@ -278,10 +278,10 @@ Subscribe to sensor notifications on a given port.
-### weDo2Hub.unsubscribe(port) ⇒ Promise
+### weDo2SmartHub.unsubscribe(port) ⇒ Promise
Unsubscribe to sensor notifications on a given port.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved upon successful issuance of command.
| Param | Type |
@@ -290,12 +290,12 @@ Unsubscribe to sensor notifications on a given port.
-### weDo2Hub.sleep(delay) ⇒ Promise
+### weDo2SmartHub.sleep(delay) ⇒ Promise
Sleep a given amount of time.
This is a helper method to make it easier to add delays into a chain of commands.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved after the delay is finished.
| Param | Type | Description |
@@ -304,60 +304,60 @@ This is a helper method to make it easier to add delays into a chain of commands
-### weDo2Hub.wait(commands) ⇒ Promise
+### weDo2SmartHub.wait(commands) ⇒ Promise
Wait until a given list of concurrently running commands are complete.
This is a helper method to make it easier to wait for concurrent commands to complete.
-**Kind**: instance method of [WeDo2Hub
](#WeDo2Hub)
+**Kind**: instance method of [WeDo2SmartHub
](#WeDo2SmartHub)
**Returns**: Promise
- Resolved after the commands are finished.
| Param | Type | Description |
| --- | --- | --- |
| commands | Array.<Promise.<any>>
| Array of executing commands. |
-
+
### "button" (button, state)
Emits when a button is pressed.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
| button | string
| |
| state | number
| A number representing one of the button state consts. |
-
+
### "distance" (port, distance)
Emits when a distance sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
| port | string
| |
| distance | number
| Distance, in millimeters. |
-
+
### "color" (port, color)
Emits when a color sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
| port | string
| |
| color | number
| A number representing one of the LED color consts. |
-
+
### "tilt" (port, x, y)
Emits when a tilt sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type |
| --- | --- |
@@ -365,12 +365,12 @@ Emits when a tilt sensor is activated.
| x | number
|
| y | number
|
-
+
### "rotate" (port, rotation)
Emits when a rotation sensor is activated.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type |
| --- | --- |
@@ -382,7 +382,7 @@ Emits when a rotation sensor is activated.
### "attach" (port, type)
Emits when a motor or sensor is attached to the Hub.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type | Description |
| --- | --- | --- |
@@ -394,7 +394,7 @@ Emits when a motor or sensor is attached to the Hub.
### "detach" (port)
Emits when an attached motor or sensor is detached from the Hub.
-**Kind**: event emitted by [WeDo2Hub
](#WeDo2Hub)
+**Kind**: event emitted by [WeDo2SmartHub
](#WeDo2SmartHub)
| Param | Type |
| --- | --- |
diff --git a/package.json b/package.json
index df3e446..e1c72f0 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"types": "dist/lpf2.d.ts",
"scripts": {
"build": "tslint -c tslint.json \"*.ts\" && tsc",
- "docs": "jsdoc2md dist/lpf2.js dist/lpf2hub.js dist/wedo2hub.js dist/boostmovehub.js dist/puphub.js dist/pupremote.js dist/hub.js dist/consts.js > DOCS.md",
+ "docs": "jsdoc2md dist/lpf2.js dist/lpf2hub.js dist/wedo2smarthub.js dist/boostmovehub.js dist/puphub.js dist/pupremote.js dist/hub.js dist/consts.js > DOCS.md",
"readme": "cat ABOUT.md DOCS.md > README.md",
"all": "npm run build && npm run docs && npm run readme",
"prepublishOnly": "tsc"
diff --git a/wedo2smarthub.ts b/wedo2smarthub.ts
index 36963b9..c777b08 100644
--- a/wedo2smarthub.ts
+++ b/wedo2smarthub.ts
@@ -7,12 +7,12 @@ import * as Consts from "./consts";
import Debug = require("debug");
import { resolve } from "path";
-const debug = Debug("wedo2hub");
+const debug = Debug("wedo2smarthub");
/**
- * The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
- * @class WeDo2Hub
+ * The WeDo2SmartHub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
+ * @class WeDo2SmartHub
* @extends Hub
*/
export class WeDo2SmartHub extends Hub {
@@ -55,7 +55,7 @@ export class WeDo2SmartHub extends Hub {
/**
* Set the color of the LED on the Hub via a color value.
- * @method WeDo2Hub#setLEDColor
+ * @method WeDo2SmartHub#setLEDColor
* @param {number} color A number representing one of the LED color consts.
* @returns {Promise} Resolved upon successful issuance of command.
*/
@@ -75,7 +75,7 @@ export class WeDo2SmartHub extends Hub {
/**
* Set the color of the LED on the Hub via RGB values.
- * @method WeDo2Hub#setLEDRGB
+ * @method WeDo2SmartHub#setLEDRGB
* @param {number} red
* @param {number} green
* @param {number} blue
@@ -94,7 +94,7 @@ export class WeDo2SmartHub extends Hub {
/**
* Set the motor speed on a given port.
- * @method WeDo2Hub#setMotorSpeed
+ * @method WeDo2SmartHub#setMotorSpeed
* @param {string} port
* @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
* @param {number} [time] How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely.
@@ -117,7 +117,7 @@ export class WeDo2SmartHub extends Hub {
/**
* Play a sound on the Hub's in-built buzzer
- * @method WeDo2Hub#playSound
+ * @method WeDo2SmartHub#playSound
* @param {number} frequency
* @param {number} time How long the sound should play for (in milliseconds).
* @returns {Promise} Resolved upon successful completion of command (ie. once the sound has finished playing).
@@ -181,7 +181,7 @@ export class WeDo2SmartHub extends Hub {
if (data[0] === 0x01) {
/**
* Emits when a button is pressed.
- * @event WeDo2Hub#button
+ * @event WeDo2SmartHub#button
* @param {string} button
* @param {number} state A number representing one of the button state consts.
*/
@@ -208,7 +208,7 @@ export class WeDo2SmartHub extends Hub {
}
/**
* Emits when a distance sensor is activated.
- * @event WeDo2Hub#distance
+ * @event WeDo2SmartHub#distance
* @param {string} port
* @param {number} distance Distance, in millimeters.
*/
@@ -220,7 +220,7 @@ export class WeDo2SmartHub extends Hub {
const distance = data[2];
/**
* Emits when a color sensor is activated.
- * @event WeDo2Hub#color
+ * @event WeDo2SmartHub#color
* @param {string} port
* @param {number} color A number representing one of the LED color consts.
*/
@@ -239,7 +239,7 @@ export class WeDo2SmartHub extends Hub {
}
/**
* Emits when a tilt sensor is activated.
- * @event WeDo2Hub#tilt
+ * @event WeDo2SmartHub#tilt
* @param {string} port
* @param {number} x
* @param {number} y
@@ -252,7 +252,7 @@ export class WeDo2SmartHub extends Hub {
const rotation = data.readInt32LE(2);
/**
* Emits when a rotation sensor is activated.
- * @event WeDo2Hub#rotate
+ * @event WeDo2SmartHub#rotate
* @param {string} port
* @param {number} rotation
*/