JSDoc ignore events
This commit is contained in:
parent
4db9a6528c
commit
0fee67c438
78
DOCS.md
78
DOCS.md
@ -920,12 +920,6 @@ Emits when an attached motor or sensor is detached from the Hub.
|
|||||||
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
* ["button" (button, state)](#LPF2Hub+event_button)
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
|
||||||
* ["color" (port, color)](#LPF2Hub+event_color)
|
|
||||||
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
|
||||||
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
|
||||||
* ["attach" (port, type)](#Hub+event_attach)
|
|
||||||
* ["detach" (port)](#Hub+event_detach)
|
|
||||||
|
|
||||||
<a name="new_PUPRemote_new"></a>
|
<a name="new_PUPRemote_new"></a>
|
||||||
|
|
||||||
@ -1079,75 +1073,3 @@ Emits when a button is pressed.
|
|||||||
| button | <code>string</code> | |
|
| button | <code>string</code> | |
|
||||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
<a name="LPF2Hub+event_distance"></a>
|
|
||||||
|
|
||||||
### "distance" (port, distance)
|
|
||||||
Emits when a distance sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | |
|
|
||||||
| distance | <code>number</code> | Distance, in millimeters. |
|
|
||||||
|
|
||||||
<a name="LPF2Hub+event_color"></a>
|
|
||||||
|
|
||||||
### "color" (port, color)
|
|
||||||
Emits when a color sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | |
|
|
||||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
|
||||||
|
|
||||||
<a name="LPF2Hub+event_tilt"></a>
|
|
||||||
|
|
||||||
### "tilt" (port, x, y)
|
|
||||||
Emits when a tilt sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
|
||||||
| x | <code>number</code> | |
|
|
||||||
| y | <code>number</code> | |
|
|
||||||
|
|
||||||
<a name="LPF2Hub+event_rotate"></a>
|
|
||||||
|
|
||||||
### "rotate" (port, rotation)
|
|
||||||
Emits when a rotation sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type |
|
|
||||||
| --- | --- |
|
|
||||||
| port | <code>string</code> |
|
|
||||||
| rotation | <code>number</code> |
|
|
||||||
|
|
||||||
<a name="Hub+event_attach"></a>
|
|
||||||
|
|
||||||
### "attach" (port, type)
|
|
||||||
Emits when a motor or sensor is attached to the Hub.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | |
|
|
||||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
|
||||||
|
|
||||||
<a name="Hub+event_detach"></a>
|
|
||||||
|
|
||||||
### "detach" (port)
|
|
||||||
Emits when an attached motor or sensor is detached from the Hub.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type |
|
|
||||||
| --- | --- |
|
|
||||||
| port | <code>string</code> |
|
|
||||||
|
|
||||||
|
78
README.md
78
README.md
@ -970,12 +970,6 @@ Emits when an attached motor or sensor is detached from the Hub.
|
|||||||
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
* ["button" (button, state)](#LPF2Hub+event_button)
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
|
||||||
* ["color" (port, color)](#LPF2Hub+event_color)
|
|
||||||
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
|
||||||
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
|
||||||
* ["attach" (port, type)](#Hub+event_attach)
|
|
||||||
* ["detach" (port)](#Hub+event_detach)
|
|
||||||
|
|
||||||
<a name="new_PUPRemote_new"></a>
|
<a name="new_PUPRemote_new"></a>
|
||||||
|
|
||||||
@ -1129,75 +1123,3 @@ Emits when a button is pressed.
|
|||||||
| button | <code>string</code> | |
|
| button | <code>string</code> | |
|
||||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
<a name="LPF2Hub+event_distance"></a>
|
|
||||||
|
|
||||||
### "distance" (port, distance)
|
|
||||||
Emits when a distance sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | |
|
|
||||||
| distance | <code>number</code> | Distance, in millimeters. |
|
|
||||||
|
|
||||||
<a name="LPF2Hub+event_color"></a>
|
|
||||||
|
|
||||||
### "color" (port, color)
|
|
||||||
Emits when a color sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | |
|
|
||||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
|
||||||
|
|
||||||
<a name="LPF2Hub+event_tilt"></a>
|
|
||||||
|
|
||||||
### "tilt" (port, x, y)
|
|
||||||
Emits when a tilt sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
|
||||||
| x | <code>number</code> | |
|
|
||||||
| y | <code>number</code> | |
|
|
||||||
|
|
||||||
<a name="LPF2Hub+event_rotate"></a>
|
|
||||||
|
|
||||||
### "rotate" (port, rotation)
|
|
||||||
Emits when a rotation sensor is activated.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type |
|
|
||||||
| --- | --- |
|
|
||||||
| port | <code>string</code> |
|
|
||||||
| rotation | <code>number</code> |
|
|
||||||
|
|
||||||
<a name="Hub+event_attach"></a>
|
|
||||||
|
|
||||||
### "attach" (port, type)
|
|
||||||
Emits when a motor or sensor is attached to the Hub.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| port | <code>string</code> | |
|
|
||||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
|
||||||
|
|
||||||
<a name="Hub+event_detach"></a>
|
|
||||||
|
|
||||||
### "detach" (port)
|
|
||||||
Emits when an attached motor or sensor is detached from the Hub.
|
|
||||||
|
|
||||||
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
|
||||||
|
|
||||||
| Param | Type |
|
|
||||||
| --- | --- |
|
|
||||||
| port | <code>string</code> |
|
|
||||||
|
|
||||||
|
@ -18,6 +18,14 @@ const debug = Debug("lpf2hub");
|
|||||||
export class PUPHub extends LPF2Hub {
|
export class PUPHub extends LPF2Hub {
|
||||||
|
|
||||||
|
|
||||||
|
// We set JSDoc to ignore these events as a Powered Up Remote will never emit them.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event PUPRemote#rotate
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
public static IsPUPHub (peripheral: Peripheral) {
|
public static IsPUPHub (peripheral: Peripheral) {
|
||||||
return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.BOOST_MOVE_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_HUB_ID);
|
return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.BOOST_MOVE_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_HUB_ID);
|
||||||
}
|
}
|
||||||
|
33
pupremote.ts
33
pupremote.ts
@ -18,6 +18,39 @@ const debug = Debug("lpf2hub");
|
|||||||
export class PUPRemote extends LPF2Hub {
|
export class PUPRemote extends LPF2Hub {
|
||||||
|
|
||||||
|
|
||||||
|
// We set JSDoc to ignore these events as a Powered Up Remote will never emit them.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event PUPRemote#distance
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event PUPRemote#color
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event PUPRemote#tilt
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event PUPRemote#rotate
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event PUPRemote#attach
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event PUPRemote#detach
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
public static IsPUPRemote (peripheral: Peripheral) {
|
public static IsPUPRemote (peripheral: Peripheral) {
|
||||||
return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.BOOST_MOVE_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID);
|
return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.BOOST_MOVE_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user