Skip to content

Commit

Permalink
Add Android WriteError
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit Sangwan authored and Rohit Sangwan committed Jun 19, 2022
1 parent 163e99b commit 28f386b
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,12 @@ class QuickBluePlugin: FlutterPlugin, MethodCallHandler, EventChannel.StreamHand
"ConnectionState" to "connected"
))
} else {
// TODO Parse status code and send correct error messages
cleanConnection(gatt)
sendMessage(messageConnector, mapOf(
"deviceId" to gatt.device.address,
"ConnectionState" to "disconnected"
"ConnectionState" to "disconnected",
"error" to "Disconnection Reason : Status $status"
))
}
}
Expand Down Expand Up @@ -260,6 +262,13 @@ class QuickBluePlugin: FlutterPlugin, MethodCallHandler, EventChannel.StreamHand

override fun onCharacteristicWrite(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic, status: Int) {
Log.v(TAG, "onCharacteristicWrite ${characteristic.uuid}, ${characteristic.value.contentToString()} $status")
val deviceID = gatt?.device?.address ?: ""
// TODO Parse status code and send correct error messages
sendMessage(messageConnector, mapOf(
"deviceId" to deviceID,
"characteristic" to characteristic.uuid.toString(),
"error" to "Write Command Status : $status"
))
}

override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
Expand Down

0 comments on commit 28f386b

Please sign in to comment.