flutter_reactive_ble icon indicating copy to clipboard operation
flutter_reactive_ble copied to clipboard

[Android] BleGattCharacteristicException while readCharacteristic

Open mkiisoft opened this issue 1 year ago • 1 comments

Describe the bug I have a BLE device with several (11) characteristics and almost of those working. One in particular is not, but I was able to read it using HTML5 Bluetooth library on Android itself (same phone) and on iOS using this library connecting to the same device (the result on iOS has several trailing zeros).

The following exception is being thrown:

com.polidea.rxandroidble2.exceptions.BleGattCharacteristicException: GATT exception from MAC='XX:XX:XX:XX:XX:XX', status 133 (GATT_ERROR), type BleGattOperation{description='CHARACTERISTIC_READ'}. (Look up status 0x85 here https://cs.android.com/android/platform/superproject/+/master:packages/modules/Bluetooth/system/stack/include/gatt_api.h)

Every single other Characteristic works, no problem, still connected (so, it's not a connection issue) right before and right after that one, except for every time I'm reading that Characteristic.

To Reproduce Steps to reproduce the behavior:

  1. Connect to one devices using connectTo() and connectToAdvertisingDevice
  2. Read from non-protected characteristic
  3. Observe a failure with exception:
com.polidea.rxandroidble2.exceptions.BleGattCharacteristicException: GATT exception from MAC='XX:XX:XX:XX:XX:XX', status 133 (GATT_ERROR), type BleGattOperation{description='CHARACTERISTIC_READ'}. (Look up status 0x85 here https://cs.android.com/android/platform/superproject/+/master:packages/modules/Bluetooth/system/stack/include/gatt_api.h)

Expected behavior iOS (using this library) and HTML5/Js native implementation, all of them return a List of int as expected being the following one:

[118, 49, 46, 56, 46, 50, 32, 104, 119, 49, 32, 110, 54, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Smartphone / tablet

  • Device: OnePlus 6T
  • OS: Android 11
  • Package version: 5.0.3

Peripheral device

  • Vendor, model: CUSTOM [BlueRetro N64 BLE dongle]
  • Does it run a custom firmware / software: yes

Additional context I discarded being my device as I'm getting the data if I use a HTML5/Js library and the data gets as expected

mkiisoft avatar May 14 '23 01:05 mkiisoft

Same while trying to connect to a device. I searched the web for that error and it said that the device is not close enough to establish a connection. However, I get this error when standing 5cm away from the device so that can't be the true error here.

skast96 avatar Jun 15 '23 11:06 skast96