Improve error handling and disconnection events (#60)

* Improve Android error handling

* Improve cleanup after disconnection on Apple

* Update changelog
This commit is contained in:
Foti Dim
2024-07-05 11:02:33 +02:00
committed by GitHub
parent 0070f5c002
commit 9cd2faee66
5 changed files with 85 additions and 30 deletions
+18
View File
@@ -121,6 +121,24 @@ private class BleCentralDarwin: NSObject, UniversalBlePlatformChannel, CBCentral
}
return false
}
characteristicWriteFutures.removeAll { future in
if future.deviceId == deviceId {
future.result(
Result.failure(FlutterError(code: "DeviceDisconnected", message: "Device Disconnected", details: nil))
)
return true
}
return false
}
characteristicNotifyFutures.removeAll { future in
if future.deviceId == deviceId {
future.result(
Result.failure(FlutterError(code: "DeviceDisconnected", message: "Device Disconnected", details: nil))
)
return true
}
return false
}
discoverServicesFutures.removeAll { future in
if future.deviceId == deviceId {
future.result(