Renamed Wedo2Hub to WeDo2SmartHub

This commit is contained in:
Nathan Kunicki 2018-08-01 14:58:15 +01:00
parent 7b8d7bd8d2
commit d83b913a69
4 changed files with 9 additions and 9 deletions

View File

@ -64,7 +64,7 @@ Emits when a LPF2 Hub device is found.
| Param | Type | | Param | Type |
| --- | --- | | --- | --- |
| hub | [<code>WeDo2Hub</code>](#WeDo2Hub) \| <code>LPF2Hub</code> | | hub | <code>WeDo2SmartHub</code> \| <code>LPF2Hub</code> |
<a name="WeDo2Hub"></a> <a name="WeDo2Hub"></a>

View File

@ -114,7 +114,7 @@ Emits when a LPF2 Hub device is found.
| Param | Type | | Param | Type |
| --- | --- | | --- | --- |
| hub | [<code>WeDo2Hub</code>](#WeDo2Hub) \| <code>LPF2Hub</code> | | hub | <code>WeDo2SmartHub</code> \| <code>LPF2Hub</code> |
<a name="WeDo2Hub"></a> <a name="WeDo2Hub"></a>

10
lpf2.ts
View File

@ -4,7 +4,7 @@ import { BoostMoveHub } from "./boostmovehub";
import { Hub } from "./hub"; import { Hub } from "./hub";
import { PUPHub } from "./puphub"; import { PUPHub } from "./puphub";
import { PUPRemote } from "./pupremote"; import { PUPRemote } from "./pupremote";
import { WeDo2Hub } from "./wedo2hub"; import { WeDo2SmartHub } from "./wedo2smarthub";
import * as Consts from "./consts"; import * as Consts from "./consts";
@ -58,8 +58,8 @@ export class LPF2 extends EventEmitter {
let hub: Hub; let hub: Hub;
if (WeDo2Hub.IsWeDo2Hub(peripheral)) { if (WeDo2SmartHub.IsWeDo2SmartHub(peripheral)) {
hub = new WeDo2Hub(peripheral, this.autoSubscribe); hub = new WeDo2SmartHub(peripheral, this.autoSubscribe);
} else if (BoostMoveHub.IsBoostMoveHub(peripheral)) { } else if (BoostMoveHub.IsBoostMoveHub(peripheral)) {
hub = new BoostMoveHub(peripheral, this.autoSubscribe); hub = new BoostMoveHub(peripheral, this.autoSubscribe);
} else if (PUPHub.IsPUPHub(peripheral)) { } else if (PUPHub.IsPUPHub(peripheral)) {
@ -92,7 +92,7 @@ export class LPF2 extends EventEmitter {
/** /**
* Emits when a LPF2 Hub device is found. * Emits when a LPF2 Hub device is found.
* @event LPF2#discover * @event LPF2#discover
* @param {WeDo2Hub | LPF2Hub} hub * @param {WeDo2SmartHub | LPF2Hub} hub
*/ */
this.emit("discover", hub); this.emit("discover", hub);
@ -141,4 +141,4 @@ export class LPF2 extends EventEmitter {
} }
export default LPF2; export default LPF2;
export { Hub, WeDo2Hub, BoostMoveHub, PUPHub, PUPRemote, Consts }; export { Hub, WeDo2SmartHub, BoostMoveHub, PUPHub, PUPRemote, Consts };

View File

@ -15,10 +15,10 @@ const debug = Debug("wedo2hub");
* @class WeDo2Hub * @class WeDo2Hub
* @extends Hub * @extends Hub
*/ */
export class WeDo2Hub extends Hub { export class WeDo2SmartHub extends Hub {
public static IsWeDo2Hub (peripheral: Peripheral) { public static IsWeDo2SmartHub (peripheral: Peripheral) {
return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.WEDO2_SMART_HUB) >= 0); return (peripheral.advertisement.serviceUuids.indexOf(Consts.BLEServices.WEDO2_SMART_HUB) >= 0);
} }