diff --git a/packages/quick_blue/android/src/main/kotlin/com/example/quick_blue/QuickBluePlugin.kt b/packages/quick_blue/android/src/main/kotlin/com/example/quick_blue/QuickBluePlugin.kt index db2f868..36b5d8d 100644 --- a/packages/quick_blue/android/src/main/kotlin/com/example/quick_blue/QuickBluePlugin.kt +++ b/packages/quick_blue/android/src/main/kotlin/com/example/quick_blue/QuickBluePlugin.kt @@ -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" )) } } @@ -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) {