ember-mug 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/bluetooth.js +6 -0
- package/package.json +1 -1
package/dist/lib/bluetooth.js
CHANGED
|
@@ -46,6 +46,12 @@ export class BluetoothManager extends EventEmitter {
|
|
|
46
46
|
this.emit('mugFound', name);
|
|
47
47
|
await this.stopScanning();
|
|
48
48
|
this.peripheral = peripheral;
|
|
49
|
+
// Wait for BLE adapter to settle after stopping scan
|
|
50
|
+
// This delay is necessary because some BLE adapters (especially on Linux with BlueZ)
|
|
51
|
+
// need time to switch from scanning mode to connection mode
|
|
52
|
+
const POST_SCAN_DELAY = 500;
|
|
53
|
+
debug(`Waiting ${POST_SCAN_DELAY}ms for BLE adapter to settle after scan...`);
|
|
54
|
+
await new Promise(resolve => setTimeout(resolve, POST_SCAN_DELAY));
|
|
49
55
|
debug('Starting connection process...');
|
|
50
56
|
await this.connectWithRetry();
|
|
51
57
|
}
|