2

I sometimes get connectionStatus=8 when writing to a characteristic

Writing characteristic 03... (WRITE COMMAND)
gatt.writeCharacteristic(03...)

//6 seconds gap

BluetoothGatt: onClientConnectionState() - status=8 clientIf=7 device=C0:4B:3C:5D:93:49
[Callback] Connection state changed with status: 8 and new state: 0 (DISCONNECTED)
Error: (0x8): GATT CONN TIMEOUT
Connection lost
onDeviceDisconnected()
fail for command 0x39 with status 8 //WriteRequest callback

I don't know the root cause, might be a bug in our end. It's only happening in some Android 9 devices (Pixel 2, for example)

The thing is, once this happens, I stop receiving onCharacteristicWriteSafe callback for future writes. Even when the write succeeds (I know thanks to internal logs), I don't get the callback.

Any hint as to why this might be happening in Android 9?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Maragues
  • 37,861
  • 14
  • 95
  • 96
  • The disconnect would explain why nothing else works. As for understanding what is happening, turn on the HCI snoop log in the developer menu of the device. Can you get any debug info out of the BLE device you are talking to? Or mock it with a BLE eval board? Unfortunately BLE stack bugs are often not repairable app-side. – Chris Stratton Mar 26 '19 at 15:59
  • do you discover services and wait for a success callback before writing to the characteristic? – zafrani Mar 27 '19 at 00:10
  • Thanks for looking into it. The lib takes care of the reconnection, I didn't mention that. I'll have to look into it with our FW team, might be a bug on our end. – Maragues Mar 27 '19 at 08:33

0 Answers0