Renamed Wedo2Hub to WeDo2SmartHub
This commit is contained in:
parent
7b8d7bd8d2
commit
d83b913a69
2
DOCS.md
2
DOCS.md
@ -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>
|
||||||
|
|
||||||
|
@ -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
10
lpf2.ts
@ -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 };
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user