diff --git a/DOCS.md b/DOCS.md
index be2ff45..2e57451 100644
--- a/DOCS.md
+++ b/DOCS.md
@@ -657,7 +657,6 @@ Emits when an attached motor or sensor is detached from the Hub.
* ["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)
@@ -864,18 +863,6 @@ 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 [PUPHub
](#PUPHub)
-
-| Param | Type |
-| --- | --- |
-| port | string
|
-| rotation | number
|
-
### "attach" (port, type)
diff --git a/README.md b/README.md
index dcb9d28..8eb573d 100644
--- a/README.md
+++ b/README.md
@@ -707,7 +707,6 @@ Emits when an attached motor or sensor is detached from the Hub.
* ["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)
@@ -914,18 +913,6 @@ 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 [PUPHub
](#PUPHub)
-
-| Param | Type |
-| --- | --- |
-| port | string
|
-| rotation | number
|
-
### "attach" (port, type)
diff --git a/boostmovehub.ts b/boostmovehub.ts
index b1cffab..ad35591 100644
--- a/boostmovehub.ts
+++ b/boostmovehub.ts
@@ -19,7 +19,7 @@ export class BoostMoveHub extends LPF2Hub {
public static IsBoostMoveHub (peripheral: Peripheral) {
- return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.BOOST_MOVE_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.BOOST_MOVE_HUB_ID);
+ return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.LPF2_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.BOOST_MOVE_HUB_ID);
}
@@ -60,7 +60,7 @@ export class BoostMoveHub extends LPF2Hub {
color = 0;
}
const data = Buffer.from([0x08, 0x00, 0x81, 0x32, 0x11, 0x51, 0x00, color]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();
});
}
@@ -82,22 +82,22 @@ export class BoostMoveHub extends LPF2Hub {
portObj.busy = true;
const data = Buffer.from([0x0c, 0x00, 0x81, portObj.value, 0x11, 0x09, 0x00, 0x00, this._mapSpeed(speed), 0x64, 0x7f, 0x03]);
data.writeUInt16LE(time > 65535 ? 65535 : time, 6);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
portObj.finished = () => {
return resolve();
};
} else {
const data = Buffer.from([0x08, 0x00, 0x81, portObj.value, 0x11, 0x51, 0x00, this._mapSpeed(speed)]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
setTimeout(() => {
const data = Buffer.from([0x08, 0x00, 0x81, portObj.value, 0x11, 0x51, 0x00, 0x00]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();
}, time);
}
} else {
const data = Buffer.from([0x08, 0x00, 0x81, portObj.value, 0x11, 0x51, 0x00, this._mapSpeed(speed)]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();
}
});
@@ -119,7 +119,7 @@ export class BoostMoveHub extends LPF2Hub {
const data = Buffer.from([0x0e, 0x00, 0x81, portObj.value, 0x11, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x7f, 0x03]);
data.writeUInt32LE(angle, 6);
data.writeUInt8(this._mapSpeed(speed), 10);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
portObj.finished = () => {
return resolve();
};
diff --git a/consts.ts b/consts.ts
index 601ed75..1dd8327 100644
--- a/consts.ts
+++ b/consts.ts
@@ -17,7 +17,7 @@ export enum Devices {
BOOST_INTERACTIVE_MOTOR = 38,
BOOST_MOVE_HUB_MOTOR = 39,
BOOST_TILT = 40,
- REMOTE_BUTTON = 55
+ POWERED_UP_REMOTE_BUTTON = 55
}
@@ -51,7 +51,7 @@ export enum BLEManufacturerData {
export enum BLEServices {
WEDO2_SMART_HUB = "000015231212efde1523785feabcd123",
- BOOST_MOVE_HUB = "000016231212efde1623785feabcd123"
+ LPF2_HUB = "000016231212efde1623785feabcd123"
}
@@ -67,5 +67,5 @@ export enum BLECharacteristics {
WEDO2_PORT_TYPE_WRITE = "000015631212efde1523785feabcd123", // "1563"
WEDO2_MOTOR_VALUE_WRITE = "000015651212efde1523785feabcd123", // "1565"
WEDO2_NAME_ID = "000015241212efde1523785feabcd123", // "1524"
- BOOST_ALL = "000016241212efde1623785feabcd123"
+ LPF2_ALL = "000016241212efde1623785feabcd123"
}
diff --git a/hub.ts b/hub.ts
index 01778e1..01ae342 100644
--- a/hub.ts
+++ b/hub.ts
@@ -324,7 +324,7 @@ export class Hub extends EventEmitter {
return (this.type === Consts.Hubs.WEDO2_SMART_HUB ? 0x00 : 0x08);
case Consts.Devices.BOOST_TILT:
return 0x04;
- case Consts.Devices.REMOTE_BUTTON:
+ case Consts.Devices.POWERED_UP_REMOTE_BUTTON:
return 0x00;
default:
return 0x00;
diff --git a/lpf2hub.ts b/lpf2hub.ts
index 516786b..0d86b90 100644
--- a/lpf2hub.ts
+++ b/lpf2hub.ts
@@ -37,23 +37,23 @@ export class LPF2Hub extends Hub {
public connect () {
return new Promise(async (resolve, reject) => {
await super.connect();
- const characteristic = this._characteristics[Consts.BLECharacteristics.BOOST_ALL];
+ const characteristic = this._characteristics[Consts.BLECharacteristics.LPF2_ALL];
this._subscribeToCharacteristic(characteristic, this._parseMessage.bind(this));
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, Buffer.from([0x05, 0x00, 0x01, 0x02, 0x02])); // Activate button reports
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, Buffer.from([0x0a, 0x00, 0x41, 0x3b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate current reports
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, Buffer.from([0x0a, 0x00, 0x41, 0x3c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate voltage reports
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, Buffer.from([0x05, 0x00, 0x01, 0x02, 0x02])); // Activate button reports
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, Buffer.from([0x0a, 0x00, 0x41, 0x3b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate current reports
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, Buffer.from([0x0a, 0x00, 0x41, 0x3c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01])); // Activate voltage reports
return resolve();
});
}
protected _activatePortDevice (port: number, type: number, mode: number, format: number, callback?: () => void) {
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, Buffer.from([0x0a, 0x00, 0x41, port, mode, 0x01, 0x00, 0x00, 0x00, 0x01]), callback);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, Buffer.from([0x0a, 0x00, 0x41, port, mode, 0x01, 0x00, 0x00, 0x00, 0x01]), callback);
}
protected _deactivatePortDevice (port: number, type: number, mode: number, format: number, callback?: () => void) {
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, Buffer.from([0x0a, 0x00, 0x41, port, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), callback);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, Buffer.from([0x0a, 0x00, 0x41, port, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), callback);
}
@@ -281,7 +281,7 @@ export class LPF2Hub extends Hub {
this.emit("tilt", port.id, tiltX, tiltY);
break;
}
- case Consts.Devices.REMOTE_BUTTON:
+ case Consts.Devices.POWERED_UP_REMOTE_BUTTON:
{
switch (data[4]) {
case 0x01:
diff --git a/puphub.ts b/puphub.ts
index 8115dda..87ded75 100644
--- a/puphub.ts
+++ b/puphub.ts
@@ -21,13 +21,13 @@ export class PUPHub extends LPF2Hub {
// We set JSDoc to ignore these events as a Powered Up Remote will never emit them.
/**
- * @event PUPRemote#rotate
+ * @event PUPHub#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);
+ return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.LPF2_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_HUB_ID);
}
@@ -65,7 +65,7 @@ export class PUPHub extends LPF2Hub {
color = 0;
}
const data = Buffer.from([0x08, 0x00, 0x81, 0x32, 0x11, 0x51, 0x00, color]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();
});
}
@@ -84,15 +84,15 @@ export class PUPHub extends LPF2Hub {
const portObj = this._ports[port];
if (time) {
const data = Buffer.from([0x0a, 0x00, 0x81, portObj.value, 0x11, 0x60, 0x00, this._mapSpeed(speed), 0x00, 0x00]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
setTimeout(() => {
const data = Buffer.from([0x0a, 0x00, 0x81, portObj.value, 0x11, 0x60, 0x00, 0x00, 0x00, 0x00]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();
}, time);
} else {
const data = Buffer.from([0x0a, 0x00, 0x81, portObj.value, 0x11, 0x60, 0x00, this._mapSpeed(speed), 0x00, 0x00]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();
}
});
diff --git a/pupremote.ts b/pupremote.ts
index 29376b2..3c7d69b 100644
--- a/pupremote.ts
+++ b/pupremote.ts
@@ -52,7 +52,7 @@ export class PUPRemote extends LPF2Hub {
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.LPF2_HUB) >= 0 && peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID);
}
@@ -89,7 +89,7 @@ export class PUPRemote extends LPF2Hub {
color = 0;
}
const data = Buffer.from([0x08, 0x00, 0x81, 0x34, 0x11, 0x51, 0x00, color]);
- this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
+ this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();
});
}