diff --git a/DOCS.md b/DOCS.md index eb64484..be2ff45 100644 --- a/DOCS.md +++ b/DOCS.md @@ -920,12 +920,6 @@ Emits when an attached motor or sensor is detached from the Hub. * [.sleep(delay)](#Hub+sleep) ⇒ Promise * [.wait(commands)](#Hub+wait) ⇒ Promise * ["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) @@ -1079,75 +1073,3 @@ Emits when a button is pressed. | 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 [PUPRemote](#PUPRemote) - -| Param | Type | Description | -| --- | --- | --- | -| port | string | | -| distance | number | Distance, in millimeters. | - - - -### "color" (port, color) -Emits when a color sensor is activated. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| 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 [PUPRemote](#PUPRemote) - -| Param | Type | Description | -| --- | --- | --- | -| port | string | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. | -| x | number | | -| y | number | | - - - -### "rotate" (port, rotation) -Emits when a rotation sensor is activated. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| Param | Type | -| --- | --- | -| port | string | -| rotation | number | - - - -### "attach" (port, type) -Emits when a motor or sensor is attached to the Hub. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| Param | Type | Description | -| --- | --- | --- | -| port | string | | -| type | number | A number representing one of the peripheral consts. | - - - -### "detach" (port) -Emits when an attached motor or sensor is detached from the Hub. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| Param | Type | -| --- | --- | -| port | string | - diff --git a/README.md b/README.md index 6002b27..dcb9d28 100644 --- a/README.md +++ b/README.md @@ -970,12 +970,6 @@ Emits when an attached motor or sensor is detached from the Hub. * [.sleep(delay)](#Hub+sleep) ⇒ Promise * [.wait(commands)](#Hub+wait) ⇒ Promise * ["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) @@ -1129,75 +1123,3 @@ Emits when a button is pressed. | 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 [PUPRemote](#PUPRemote) - -| Param | Type | Description | -| --- | --- | --- | -| port | string | | -| distance | number | Distance, in millimeters. | - - - -### "color" (port, color) -Emits when a color sensor is activated. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| 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 [PUPRemote](#PUPRemote) - -| Param | Type | Description | -| --- | --- | --- | -| port | string | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. | -| x | number | | -| y | number | | - - - -### "rotate" (port, rotation) -Emits when a rotation sensor is activated. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| Param | Type | -| --- | --- | -| port | string | -| rotation | number | - - - -### "attach" (port, type) -Emits when a motor or sensor is attached to the Hub. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| Param | Type | Description | -| --- | --- | --- | -| port | string | | -| type | number | A number representing one of the peripheral consts. | - - - -### "detach" (port) -Emits when an attached motor or sensor is detached from the Hub. - -**Kind**: event emitted by [PUPRemote](#PUPRemote) - -| Param | Type | -| --- | --- | -| port | string | - diff --git a/puphub.ts b/puphub.ts index 300708b..8115dda 100644 --- a/puphub.ts +++ b/puphub.ts @@ -18,6 +18,14 @@ const debug = Debug("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) { return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.BOOST_MOVE_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_HUB_ID); } diff --git a/pupremote.ts b/pupremote.ts index d8722f7..29376b2 100644 --- a/pupremote.ts +++ b/pupremote.ts @@ -18,6 +18,39 @@ const debug = Debug("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) { return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.BOOST_MOVE_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID); }