Skip to content

Commit f5fbd73

Browse files
author
Daisuke Baba
committed
Fix an issue where noble looses a reference to a peripheral after it is disconnected
1 parent 8b1615c commit f5fbd73

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/generic-ble.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ function disconnectPeripheral(peripheral, done, RED) {
396396
if (bleDevice) {
397397
bleDevice.emit('disconnected');
398398
}
399+
noble.stopScanning();
400+
noble.startScanning([], true);
399401
}
400402
timeout = null;
401403
if (done) {
@@ -411,6 +413,8 @@ function disconnectPeripheral(peripheral, done, RED) {
411413
if (bleDevice) {
412414
bleDevice.emit('timeout');
413415
}
416+
noble.stopScanning();
417+
noble.startScanning([], true);
414418
if (done) {
415419
done();
416420
}

0 commit comments

Comments
 (0)