Open pursual opened 4 years ago
Seems to be a matter of timing?
modifying bindings.js
to add a delay in NobleBindings.prototype.startScanning
eliminates the issue?
setTimeout(() => {
this._advertisementWatcher.start();
rt.keepAlive(true);
}, 200);
Turns out you can also add the delay in your noble code, as opposed to modifying the bindings.js:
noble.on('stateChange', (state) => {
console.log('BLE stateChange:', state);
if (state === 'poweredOn') {
setTimeout(() => {
//start scanning here.
}, 300);
}
if (state === 'poweredOff') {
// stop scanning, etc
}
});
Winrt bindings had same issue: https://github.com/Timeular/noble-winrt/issues/21