fix: 修复 getMaximumWriteLength 断开时未回调结果的问题 (#15)

This commit is contained in:
Mr剑侠客
2023-09-11 14:13:43 +08:00
committed by GitHub
parent 78bcb88563
commit 073c2b9a2e
7 changed files with 27 additions and 15 deletions

View File

@ -1,3 +1,7 @@
## 2.2.1
* Fix the issue that `CentralController#getMaximumWriteLength` may throw.
## 2.2.0
* Add `CentralController#getMaximumWriteLength` method.

View File

@ -450,6 +450,10 @@ class MyCentralController(private val context: Context, binaryMessenger: BinaryM
gatt.close()
cachedGATTs.remove(deviceKey)
val error = IllegalStateException("GATT is disconnected with status: $status")
val getMaximumWriteLengthCallback = getMaximumWriteLengthCallbacks.remove(deviceKey)
if (getMaximumWriteLengthCallback != null) {
getMaximumWriteLengthCallback(Result.failure(error))
}
val discoverGattCallback = discoverGattCallbacks.remove(deviceKey)
if (discoverGattCallback != null) {
discoverGattCallback(Result.failure(error))

View File

@ -1,6 +1,6 @@
name: bluetooth_low_energy_android
description: Android implementation of the bluetooth_low_energy plugin.
version: 2.2.0
version: 2.2.1
homepage: https://github.com/yanshouwang/bluetooth_low_energy
environment: