Skip to content

Commit 7721e60

Browse files
committed
Disabling bluetooth device should trigger device disconnection.
1 parent a50958e commit 7721e60

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

ios/BleClientManager/BleModule.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,13 @@ public class BleClientManager : NSObject {
150150

151151
_ = manager.monitorDisconnection(for: peripheral)
152152
.take(1)
153-
.subscribe(onNext: { [weak self] peripheral in
154-
self?.onPeripheralDisconnected(peripheral)
155-
})
153+
.subscribe(
154+
onNext: { [weak self] peripheral in
155+
self?.onPeripheralDisconnected(peripheral)
156+
},
157+
onError: { [weak self] error in
158+
self?.onPeripheralDisconnected(peripheral)
159+
})
156160

157161
peripheral.services?.forEach { service in
158162
discoveredServices[service.jsIdentifier] = service
@@ -278,6 +282,8 @@ public class BleClientManager : NSObject {
278282
.subscribe(onNext: { peripheral in
279283
// We are monitoring peripheral disconnections to clean up state.
280284
self?.onPeripheralDisconnected(peripheral)
285+
}, onError: { error in
286+
self?.onPeripheralDisconnected(device)
281287
})
282288
promise.resolve(device.asJSObject())
283289
} else {

0 commit comments

Comments
 (0)