From 7857cd37762ee749ab275738c2ce08f15742b427 Mon Sep 17 00:00:00 2001 From: Marco Crespi Date: Wed, 28 Apr 2021 14:16:31 +0200 Subject: [PATCH] fix: Fix dbus scanning issues BREAKING CHANGE: Make isScanning and isAdvertising sync instead of async --- lib/bindings/dbus/Adapter.d.ts | 5 ++- lib/bindings/dbus/Adapter.d.ts.map | 2 +- lib/bindings/dbus/Adapter.js | 61 ++++++++++++++++++++++++++--- lib/bindings/dbus/Adapter.js.map | 2 +- lib/bindings/hci/Adapter.d.ts | 4 +- lib/bindings/hci/Adapter.d.ts.map | 2 +- lib/bindings/hci/Adapter.js | 8 +--- lib/bindings/hci/Adapter.js.map | 2 +- lib/bindings/mac/Adapter.d.ts | 4 +- lib/bindings/mac/Adapter.d.ts.map | 2 +- lib/bindings/mac/Adapter.js | 4 +- lib/bindings/mac/Adapter.js.map | 2 +- lib/bindings/web/Adapter.d.ts | 4 +- lib/bindings/web/Adapter.d.ts.map | 2 +- lib/bindings/web/Adapter.js | 8 +--- lib/bindings/web/Adapter.js.map | 2 +- lib/bindings/win/Adapter.d.ts | 4 +- lib/bindings/win/Adapter.d.ts.map | 2 +- lib/bindings/win/Adapter.js | 4 +- lib/bindings/win/Adapter.js.map | 2 +- lib/models/Adapter.d.ts | 4 +- lib/models/Adapter.d.ts.map | 2 +- src/bindings/dbus/Adapter.ts | 62 +++++++++++++++++++++++++++++- src/bindings/hci/Adapter.ts | 4 +- src/bindings/mac/Adapter.ts | 4 +- src/bindings/web/Adapter.ts | 4 +- src/bindings/win/Adapter.ts | 4 +- src/models/Adapter.ts | 4 +- 28 files changed, 155 insertions(+), 59 deletions(-) diff --git a/lib/bindings/dbus/Adapter.d.ts b/lib/bindings/dbus/Adapter.d.ts index 96e1f72a..f44741d0 100644 --- a/lib/bindings/dbus/Adapter.d.ts +++ b/lib/bindings/dbus/Adapter.d.ts @@ -10,19 +10,20 @@ export declare class DbusAdapter extends Adapter { private scanning; private requestScanStop; private updateTimer; + private scanChangeListeners; private peripherals; constructor(modblue: DbusMODblue, path: string, name: string, address: string); private init; private prop; getScannedPeripherals(): Promise; - isScanning(): Promise; + isScanning(): boolean; startScanning(): Promise; private onScanStart; stopScanning(): Promise; private onScanStop; private onDeviceFound; private updatePeripherals; - isAdvertising(): Promise; + isAdvertising(): boolean; startAdvertising(): Promise; stopAdvertising(): Promise; setupGatt(): Promise; diff --git a/lib/bindings/dbus/Adapter.d.ts.map b/lib/bindings/dbus/Adapter.d.ts.map index 95acd047..16bac83c 100644 --- a/lib/bindings/dbus/Adapter.d.ts.map +++ b/lib/bindings/dbus/Adapter.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.d.ts","sourceRoot":"","sources":["../../../src/bindings/dbus/Adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAe,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAKxC,qBAAa,WAAY,SAAQ,OAAO;IAChC,OAAO,EAAE,WAAW,CAAC;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,UAAU,CAAkB;IAEpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,WAAW,CAAe;IAElC,OAAO,CAAC,WAAW,CAAsC;gBAEtC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;YAMtE,IAAI;YA4CJ,IAAI;IAKL,qBAAqB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAI9C,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAI9B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B3C,OAAO,CAAC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AC;IAqC1C,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,aAAa,CAwBnB;IAEF,OAAO,CAAC,iBAAiB,CAgBvB;IAEK,aAAa,IAAI,OAAO;IAIlB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGjC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;CAG5C"} \ No newline at end of file diff --git a/lib/bindings/dbus/Adapter.js b/lib/bindings/dbus/Adapter.js index 7e4df5e8..8d98c6e5 100644 --- a/lib/bindings/dbus/Adapter.js +++ b/lib/bindings/dbus/Adapter.js @@ -20,6 +20,7 @@ class DbusAdapter extends models_1.Adapter { this.initialized = false; this.scanning = false; this.requestScanStop = false; + this.scanChangeListeners = []; this.peripherals = new Map(); this.onDeviceFound = (path, data) => { var _a, _b, _c, _d, _e; @@ -112,9 +113,7 @@ class DbusAdapter extends models_1.Adapter { }); } isScanning() { - return __awaiter(this, void 0, void 0, function* () { - return this.scanning; - }); + return this.scanning; } startScanning() { return __awaiter(this, void 0, void 0, function* () { @@ -130,6 +129,29 @@ class DbusAdapter extends models_1.Adapter { DuplicateData: misc_1.buildTypedValue('boolean', false) }); yield this.adapterIface.StartDiscovery(); + if (!this.isScanning()) { + yield new Promise((res, rej) => { + const cleanup = () => { + this.scanChangeListeners = this.scanChangeListeners.filter((l) => l !== listener); + clearTimeout(timer); + }; + const resolve = () => { + cleanup(); + res(); + }; + const reject = (err) => { + cleanup(); + rej(err); + }; + const listener = (state) => { + if (state) { + resolve(); + } + }; + const timer = setTimeout(() => reject(new Error('Scan state never changed'))); + this.scanChangeListeners.push(listener); + }); + } } const objs = yield this.objManagerIface.GetManagedObjects(); const keys = Object.keys(objs); @@ -141,6 +163,9 @@ class DbusAdapter extends models_1.Adapter { } onScanStart() { this.scanning = true; + for (const listener of this.scanChangeListeners) { + listener(true); + } } stopScanning() { return __awaiter(this, void 0, void 0, function* () { @@ -151,11 +176,37 @@ class DbusAdapter extends models_1.Adapter { this.updateTimer = null; this.requestScanStop = true; yield this.adapterIface.StopDiscovery(); + if (this.isScanning()) { + yield new Promise((res, rej) => { + const cleanup = () => { + this.scanChangeListeners = this.scanChangeListeners.filter((l) => l !== listener); + clearTimeout(timer); + }; + const resolve = () => { + cleanup(); + res(); + }; + const reject = (err) => { + cleanup(); + rej(err); + }; + const listener = (state) => { + if (!state) { + resolve(); + } + }; + const timer = setTimeout(() => reject(new Error('Scan state never changed'))); + this.scanChangeListeners.push(listener); + }); + } }); } onScanStop() { this.scanning = false; if (this.requestScanStop) { + for (const listener of this.scanChangeListeners) { + listener(false); + } this.requestScanStop = false; return; } @@ -165,9 +216,7 @@ class DbusAdapter extends models_1.Adapter { }); } isAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - return false; - }); + return false; } startAdvertising() { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/bindings/dbus/Adapter.js.map b/lib/bindings/dbus/Adapter.js.map index 7b34823e..a8e3596a 100644 --- a/lib/bindings/dbus/Adapter.js.map +++ b/lib/bindings/dbus/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/dbus/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAA2E;AAE3E,iCAAsH;AAEtH,6CAA8C;AAE9C,MAAM,eAAe,GAAG,CAAC,CAAC,CAAC,aAAa;AAExC,MAAa,WAAY,SAAQ,gBAAO;IAevC,YAAmB,OAAoB,EAAE,IAAY,EAAE,IAAY,EAAE,OAAe;QACnF,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QARxD,gBAAW,GAAG,KAAK,CAAC;QACpB,aAAQ,GAAG,KAAK,CAAC;QACjB,oBAAe,GAAG,KAAK,CAAC;QAGxB,gBAAW,GAA4B,IAAI,GAAG,EAAE,CAAC;QA0H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e,EAAE;YACzB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,mBAAmB,EAAE;gBAChD,QAAQ,CAAC,KAAK,CAAC,CAAC;aAChB;YAED,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;YAC7B,OAAO;SACP;QAED,8FAA8F;QAC9F,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YAC/B,QAAQ;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IA8CM,aAAa;QACnB,OAAO,KAAK,CAAC;IACd,CAAC;IAEY,gBAAgB;;YAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC5C,CAAC;KAAA;IACY,eAAe;;YAC3B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC5C,CAAC;KAAA;IAEY,SAAS;;YACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC5C,CAAC;KAAA;CACD;AA3PD,kCA2PC"} \ No newline at end of file diff --git a/lib/bindings/hci/Adapter.d.ts b/lib/bindings/hci/Adapter.d.ts index 4aa95a60..e8c92ab8 100644 --- a/lib/bindings/hci/Adapter.d.ts +++ b/lib/bindings/hci/Adapter.d.ts @@ -21,14 +21,14 @@ export declare class HciAdapter extends Adapter { private onHciStateChange; private onHciError; dispose(): void; - isScanning(): Promise; + isScanning(): boolean; startScanning(): Promise; stopScanning(): Promise; getScannedPeripherals(): Promise; private onDiscover; connect(peripheral: HciPeripheral, minInterval?: number, maxInterval?: number, latency?: number, supervisionTimeout?: number): Promise; disconnect(peripheral: HciPeripheral): Promise; - isAdvertising(): Promise; + isAdvertising(): boolean; startAdvertising(deviceName: string, serviceUUIDs?: string[]): Promise; stopAdvertising(): Promise; setupGatt(maxMtu?: number): Promise; diff --git a/lib/bindings/hci/Adapter.d.ts.map b/lib/bindings/hci/Adapter.d.ts.map index 59e7f87b..11da5e60 100644 --- a/lib/bindings/hci/Adapter.d.ts.map +++ b/lib/bind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jE,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,YAAY,CAAkC;YAExC,IAAI;IAkClB,OAAO,CAAC,gBAAgB,CAKtB;IAEF,OAAO,CAAC,UAAU,CAKhB;IAEK,OAAO,IAAI,IAAI;IAsBf,UAAU,IAAI,OAAO;IAIf,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAa9B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAe7B,qBAAqB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAI3D,OAAO,CAAC,UAAU,CAoBhB;IAEW,OAAO,CACnB,UAAU,EAAE,aAAa,EACzB,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,IAAI,CAAC;IAmDH,UAAU,CAAC,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1D,aAAa,IAAI,OAAO;IAIlB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBhF,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBhC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAU9D,OAAO,CAAC,cAAc,CAgBpB;IAEF,OAAO,CAAC,mBAAmB,CAgBzB;IAEF,OAAO,CAAC,gBAAgB,CAwBtB;IAEF,OAAO,CAAC,oBAAoB,CAoB1B;CACF"} \ No newline at end of file diff --git a/lib/bindings/hci/Adapter.js b/lib/bindings/hci/Adapter.js index b60d27dd..ca5b19ab 100644 --- a/lib/bindings/hci/Adapter.js +++ b/lib/bindings/hci/Adapter.js @@ -171,9 +171,7 @@ class HciAdapter extends models_1.Adapter { this.initialized = false; } isScanning() { - return __awaiter(this, void 0, void 0, function* () { - return this.scanning; - }); + return this.scanning; } startScanning() { return __awaiter(this, void 0, void 0, function* () { @@ -260,9 +258,7 @@ class HciAdapter extends models_1.Adapter { }); } isAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - return this.advertising; - }); + return this.advertising; } startAdvertising(deviceName, serviceUUIDs = []) { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/bindings/hci/Adapter.js.map b/lib/bindings/hci/Adapter.js.map index 5b77a987..e69891a7 100644 --- a/lib/bindings/hci/Adapter.js.map +++ b/lib/bindings/hci/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/hci/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAgE;AAEhE,iCAAsC;AACtC,iCAAkC;AAClC,6CAA6C;AAE7C,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAWxC,MAAa,UAAW,SAAQ,gBAAO;IAAvC;;QACS,gBAAW,GAAG,KAAK,CAAC;QAEpB,aAAQ,GAAG,KAAK,CAAC;QAGjB,gBAAW,GAAG,KAAK,CAAC;QAEpB,mBAAc,GAAG,KAAK,CAAC;QAKvB,eAAU,GAAW,IAAI,CAAC,EAAE,CAAC;QAC7B,2BAAsB,GAAa,EAAE,CAAC;QACtC,gBAAW,GAA+B,IAAI,GAAG,EAAE,CAAC;QACpD,qBAAgB,GAA+B,IAAI,GAAG,EAAE,CAAC;QACzD,iBAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;QAC9C,iBAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;QAoC9C,qBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE;YAC/C,oDAAoD;YACpD,IAAI,QAAQ,KAAK,YAAY,EAAE;gBAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;aACf;QACF,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,KAAY,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,CAAC,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,IAAI,EAAE;gBACf,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAY,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;aACrD;YAED,OAAO,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC;KAAA;CAqFD;AAjWD,gCAiWC"} \ No newline at end of file diff --git a/lib/bindings/mac/Adapter.d.ts b/lib/bindings/mac/Adapter.d.ts index 24fbd751..e022fb09 100644 --- a/lib/bindings/mac/Adapter.d.ts +++ b/lib/bindings/mac/Adapter.d.ts @@ -4,7 +4,7 @@ export declare class MacAdapter extends Adapter { private initDone; private scanning; private peripherals; - isScanning(): Promise; + isScanning(): boolean; constructor(modblue: MODblue, id: string, name: string); private init; dispose(): void; @@ -13,7 +13,7 @@ export declare class MacAdapter extends Adapter { private onNotification; stopScanning(): Promise; getScannedPeripherals(): Promise; - isAdvertising(): Promise; + isAdvertising(): boolean; startAdvertising(): Promise; stopAdvertising(): Promise; setupGatt(): Promise; diff --git a/lib/bindings/mac/Adapter.d.ts.map b/lib/bindings/mac/Adapter.d.ts.map index bb46f9a1..12657570 100644 --- a/lib/bindings/mac/Adapter.d.ts.map +++ b/lib/bindings/mac/Adapter.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.d.ts","sourceRoot":"","sources":["../../../src/bindings/mac/Adapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAe,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGpF,qBAAa,UAAW,SAAQ,OAAO;IAEtC,SAAgB,KAAK,EAAE,GAAG,CAAQ;IAElC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,WAAW,CAAsC;IAE5C,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;gBAIxB,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;YAU/C,I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IAIpD,aAAa,IAAI,OAAO;IAIxB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;CAGtC"} \ No newline at end of file diff --git a/lib/bindings/mac/Adapter.js b/lib/bindings/mac/Adapter.js index 7ec2ba41..c65d7d79 100644 --- a/lib/bindings/mac/Adapter.js +++ b/lib/bindings/mac/Adapter.js @@ -57,9 +57,7 @@ class MacAdapter extends models_1.Adapter { this.noble = new NobleMac(); } isScanning() { - return __awaiter(this, void 0, void 0, function* () { - return this.scanning; - }); + return this.scanning; } init() { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/bindings/mac/Adapter.js.map b/lib/bindings/mac/Adapter.js.map index 297dee6b..6ea2a2cd 100644 --- a/lib/bindings/mac/Adapter.js.map +++ b/lib/bindings/mac/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/mac/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAA4B;AAC5B,gDAAwB;AAExB,yCAAoF;AACpF,6CAA6C;AAE7C,MAAa,UAAW,SAAQ,gBAAO;IAatC,YAAmB,OAAgB,EAAE,EAAU,EAAE,IAAY;QAC5D,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QAb1B,8DAA8D;QAC9C,UAAK,GAAQ,IAAI,CAAC;QAE1B,aAAQ,GAAG,KAAK,CAAC;QACjB,aAAQ,GAAG,KAAK,CAAC;QAEjB,gBAAW,GAA4B,IAAI,GAAG,EAAE,CAAC;QAkDjD,eAAU,GAAG,CACpB,IAAY,EACZ,OAAe,EACf,WAAwB,EACxB,WAAoB,EACpB,aAAgE,EAChE,IAAY,EACX,EAAE;YACH,IAAI,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI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;YACjC,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC;KAAA;IAEM,aAAa;QACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,gBAAgB;QACtB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,eAAe;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD;AAjID,gCAiIC"} \ No newline at end of file diff --git a/lib/bindings/web/Adapter.d.ts b/lib/bindings/web/Adapter.d.ts index c386f3f7..ab786ac5 100644 --- a/lib/bindings/web/Adapter.d.ts +++ b/lib/bindings/web/Adapter.d.ts @@ -2,12 +2,12 @@ import { Adapter, GattLocal, Peripheral } from '../../models'; export declare class WebAdapter extends Adapter { private peripherals; dispose(): void; - isScanning(): Promise; + isScanning(): boolean; startScanning(): Promise; scanFor(filter: string | ((peripheral: Peripheral) => boolean), timeoutInSeconds?: number, serviceUUIDs?: string[]): Promise; stopScanning(): Promise; getScannedPeripherals(): Promise; - isAdvertising(): Promise; + isAdvertising(): boolean; startAdvertising(): Promise; stopAdvertising(): Promise; setupGatt(): Promise; diff --git a/lib/bindings/web/Adapter.d.ts.map b/lib/bindings/web/Adapter.d.ts.map index 4f881f1e..ddf013ca 100644 --- a/lib/bindings/web/Adapter.d.ts.map +++ b/lib/bindings/web/Adapter.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.d.ts","sourceRoot":"","sources":["../../../src/bindings/web/Adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI9D,qBAAa,UAAW,SAAQ,OAAO;IACtC,OAAO,CAAC,WAAW,CAAyC;IAErD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C,IAAI,CAAC;IAIjC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;IAI5C,OAAO,CAAC,SAAS;CASjB"} \ No newline at end of file diff --git a/lib/bindings/web/Adapter.js b/lib/bindings/web/Adapter.js index 0e4075b6..e9bf0308 100644 --- a/lib/bindings/web/Adapter.js +++ b/lib/bindings/web/Adapter.js @@ -21,9 +21,7 @@ class WebAdapter extends models_1.Adapter { // NO-OP } isScanning() { - return __awaiter(this, void 0, void 0, function* () { - return false; - }); + return false; } startScanning() { return __awaiter(this, void 0, void 0, function* () { @@ -78,9 +76,7 @@ class WebAdapter extends models_1.Adapter { }); } isAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); - }); + throw new Error('Method not implemented.'); } startAdvertising() { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/bindings/web/Adapter.js.map b/lib/bindings/web/Adapter.js.map index d05e29f9..ce6dd023 100644 --- a/lib/bindings/web/Adapter.js.map +++ b/lib/bindings/web/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/web/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA8D;AAE9D,6CAA6C;AAE7C,MAAa,UAAW,SAAQ,gBAAO;IAAvC;;QACS,gBAAW,GAA+B,IAAI,GAAG,EAAE,CAAC;IAyF7D,CAAC;IAvFO,OAAO;QACb,QAAQ;IACT,CAAC;IAEY,UAAU;;YACtB,OAAO,KAAK,CAAC;QACd,CAAC;KAAA;IAEY,aAAa;;YACzB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC5C,CAAC;KAAA;IAEY,OAAO,CACnB,MAAsD,EACtD,gBAAgB,GAAG,EAAE,EACrB,YAAuB;;YAEvB,8EAA8E;YAC9E,MAAM,kBAAkB,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,GAAG,CA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AC;KAAA;IAEO,SAAS,CAAC,IAAY;QAC7B,OAAO,CACN,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;YAC1B,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG;YAC3B,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG;YAC5B,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG;YAC5B,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CACvB,CAAC,WAAW,EAAE,CAAC;IACjB,CAAC;CACD;AA1FD,gCA0FC"} \ No newline at end of file diff --git a/lib/bindings/win/Adapter.d.ts b/lib/bindings/win/Adapter.d.ts index 93c5a174..0b2313ac 100644 --- a/lib/bindings/win/Adapter.d.ts +++ b/lib/bindings/win/Adapter.d.ts @@ -5,7 +5,7 @@ export declare class WinAdapter extends Adapter { private initDone; private scanning; private peripherals; - isScanning(): Promise; + isScanning(): boolean; constructor(modblue: MODblue, radio: Radio); private init; dispose(): void; @@ -14,7 +14,7 @@ export declare class WinAdapter extends Adapter { private onNotification; stopScanning(): Promise; getScannedPeripherals(): Promise; - isAdvertising(): Promise; + isAdvertising(): boolean; startAdvertising(): Promise; stopAdvertising(): Promise; setupGatt(): Promise; diff --git a/lib/bindings/win/Adapter.d.ts.map b/lib/bindings/win/Adapter.d.ts.map index 61b1dd43..2d033d6e 100644 --- a/lib/bindings/win/Adapter.d.ts.map +++ b/lib/bindings/win/Adapter.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.d.ts","sourceRoot":"","sources":["../../../src/bindings/win/Adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIlD,q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AAI;IAqBX,OAAO,IAAI,IAAI;IAKT,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7F,OAAO,CAAC,UAAU,CAyBhB;IAEF,OAAO,CAAC,cAAc,CAmBpB;IAEW,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAK7B,qBAAqB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAIpD,aAAa,IAAI,OAAO;IAIxB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;CAGtC"} \ No newline at end of file diff --git a/lib/bindings/win/Adapter.js b/lib/bindings/win/Adapter.js index a1cc6ef8..a3630aa3 100644 --- a/lib/bindings/win/Adapter.js +++ b/lib/bindings/win/Adapter.js @@ -50,9 +50,7 @@ class WinAdapter extends models_1.Adapter { this.noble = new bindings_1.NobleBindings(radio); } isScanning() { - return __awaiter(this, void 0, void 0, function* () { - return this.scanning; - }); + return this.scanning; } init() { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/bindings/win/Adapter.js.map b/lib/bindings/win/Adapter.js.map index 22e5b2f9..c7a9d576 100644 --- a/lib/bindings/win/Adapter.js.map +++ b/lib/bindings/win/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/win/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoF;AACpF,yCAAkD;AAElD,6CAA6C;AAE7C,MAAa,UAAW,SAAQ,gBAAO;IAatC,YAAmB,OAAgB,EAAE,KAAY;QAChD,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAbxC,8DAA8D;QAC9C,UAAK,GAAkB,IAAI,CAAC;QAEpC,aAAQ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C,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC;KAAA;IAEM,aAAa;QACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,gBAAgB;QACtB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,eAAe;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD;AA7HD,gCA6HC"} \ No newline at end of file diff --git a/lib/models/Adapter.d.ts b/lib/models/Adapter.d.ts index e72c2828..69bb68bb 100644 --- a/lib/models/Adapter.d.ts +++ b/lib/models/Adapter.d.ts @@ -45,7 +45,7 @@ export declare abstract class Adapter extends TypedEmitter { /** * Returns `true` if this adapter is currently scanning, `false` otherwise. */ - abstract isScanning(): Promise; + abstract isScanning(): boolean; /** * Start scanning for nearby {@link Peripheral}s. * @param serviceUUIDs The UUIDs of the {@link GattService} that an advertising @@ -64,7 +64,7 @@ export declare abstract class Adapter extends TypedEmitter { /** * Returns `true` if this adapter is currently advertising, `false` otherwise. */ - abstract isAdvertising(): Promise; + abstract isAdvertising(): boolean; /** * Start advertising on this adapter. * @param deviceName The device name that is included in the advertisement. diff --git a/lib/models/Adapter.d.ts.map b/lib/models/Adapter.d.ts.map index d76e0135..e03e9661 100644 --- a/lib/models/Adapter.d.ts.map +++ b/lib/models/Adapter.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.d.ts","sourceRoot":"","sources":["../../src/models/Adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAA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EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAEvD,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAqBxC"} \ No newline at end of file diff --git a/src/bindings/dbus/Adapter.ts b/src/bindings/dbus/Adapter.ts index 2d83bfb3..5c8627eb 100644 --- a/src/bindings/dbus/Adapter.ts +++ b/src/bindings/dbus/Adapter.ts @@ -20,6 +20,7 @@ export class DbusAdapter extends Adapter { private scanning = false; private requestScanStop = false; private updateTimer: NodeJS.Timer; + private scanChangeListeners: ((scanning: boolean) => void)[] = []; private peripherals: Map = new Map(); @@ -82,7 +83,7 @@ export class DbusAdapter extends Adapter { return [...this.peripherals.values()]; } - public async isScanning(): Promise { + public isScanning(): boolean { return this.scanning; } @@ -102,6 +103,31 @@ export class DbusAdapter extends Adapter { DuplicateData: buildTypedValue('boolean', false) }); await this.adapterIface.StartDiscovery(); + + if (!this.isScanning()) { + await new Promise((res, rej) => { + const cleanup = () => { + this.scanChangeListeners = this.scanChangeListeners.filter((l) => l !== listener); + clearTimeout(timer); + }; + const resolve = () => { + cleanup(); + res(); + }; + const reject = (err: Error) => { + cleanup(); + rej(err); + }; + + const listener = (state: boolean) => { + if (state) { + resolve(); + } + }; + const timer = setTimeout(() => reject(new Error('Scan state never changed'))); + this.scanChangeListeners.push(listener); + }); + } } const objs = await this.objManagerIface.GetManagedObjects(); @@ -115,6 +141,9 @@ export class DbusAdapter extends Adapter { private onScanStart() { this.scanning = true; + for (const listener of this.scanChangeListeners) { + listener(true); + } } public async stopScanning(): Promise { @@ -127,12 +156,41 @@ export class DbusAdapter extends Adapter { this.requestScanStop = true; await this.adapterIface.StopDiscovery(); + + if (this.isScanning()) { + await new Promise((res, rej) => { + const cleanup = () => { + this.scanChangeListeners = this.scanChangeListeners.filter((l) => l !== listener); + clearTimeout(timer); + }; + const resolve = () => { + cleanup(); + res(); + }; + const reject = (err: Error) => { + cleanup(); + rej(err); + }; + + const listener = (state: boolean) => { + if (!state) { + resolve(); + } + }; + const timer = setTimeout(() => reject(new Error('Scan state never changed'))); + this.scanChangeListeners.push(listener); + }); + } } private onScanStop() { this.scanning = false; if (this.requestScanStop) { + for (const listener of this.scanChangeListeners) { + listener(false); + } + this.requestScanStop = false; return; } @@ -187,7 +245,7 @@ export class DbusAdapter extends Adapter { } }; - public async isAdvertising(): Promise { + public isAdvertising(): boolean { return false; } diff --git a/src/bindings/hci/Adapter.ts b/src/bindings/hci/Adapter.ts index 0489ac4e..4d88e4d7 100644 --- a/src/bindings/hci/Adapter.ts +++ b/src/bindings/hci/Adapter.ts @@ -106,7 +106,7 @@ export class HciAdapter extends Adapter { this.initialized = false; } - public async isScanning(): Promise { + public isScanning(): boolean { return this.scanning; } @@ -233,7 +233,7 @@ export class HciAdapter extends Adapter { } } - public async isAdvertising(): Promise { + public isAdvertising(): boolean { return this.advertising; } diff --git a/src/bindings/mac/Adapter.ts b/src/bindings/mac/Adapter.ts index 1d0c5147..87b76969 100644 --- a/src/bindings/mac/Adapter.ts +++ b/src/bindings/mac/Adapter.ts @@ -13,7 +13,7 @@ export class MacAdapter extends Adapter { private peripherals: Map = new Map(); - public async isScanning(): Promise { + public isScanning(): boolean { return this.scanning; } @@ -118,7 +118,7 @@ export class MacAdapter extends Adapter { return [...this.peripherals.values()]; } - public isAdvertising(): Promise { + public isAdvertising(): boolean { throw new Error('Method not implemented.'); } diff --git a/src/bindings/web/Adapter.ts b/src/bindings/web/Adapter.ts index a3f1290c..223b3591 100644 --- a/src/bindings/web/Adapter.ts +++ b/src/bindings/web/Adapter.ts @@ -9,7 +9,7 @@ export class WebAdapter extends Adapter { // NO-OP } - public async isScanning(): Promise { + public isScanning(): boolean { return false; } @@ -67,7 +67,7 @@ export class WebAdapter extends Adapter { throw new Error('Method not implemented.'); } - public async isAdvertising(): Promise { + public isAdvertising(): boolean { throw new Error('Method not implemented.'); } diff --git a/src/bindings/win/Adapter.ts b/src/bindings/win/Adapter.ts index 0c8df989..b5500099 100644 --- a/src/bindings/win/Adapter.ts +++ b/src/bindings/win/Adapter.ts @@ -12,7 +12,7 @@ export class WinAdapter extends Adapter { private peripherals: Map = new Map(); - public async isScanning(): Promise { + public isScanning(): boolean { return this.scanning; } @@ -113,7 +113,7 @@ export class WinAdapter extends Adapter { return [...this.peripherals.values()]; } - public isAdvertising(): Promise { + public isAdvertising(): boolean { throw new Error('Method not implemented.'); } diff --git a/src/models/Adapter.ts b/src/models/Adapter.ts index bd584472..cc2d06d3 100644 --- a/src/models/Adapter.ts +++ b/src/models/Adapter.ts @@ -120,7 +120,7 @@ export abstract class Adapter extends TypedEmitter { /** * Returns `true` if this adapter is currently scanning, `false` otherwise. */ - public abstract isScanning(): Promise; + public abstract isScanning(): boolean; /** * Start scanning for nearby {@link Peripheral}s. @@ -142,7 +142,7 @@ export abstract class Adapter extends TypedEmitter { /** * Returns `true` if this adapter is currently advertising, `false` otherwise. */ - public abstract isAdvertising(): Promise; + public abstract isAdvertising(): boolean; /** * Start advertising on this adapter.