Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcefully turning off BLE device connected to Android app fires onConnectionStateChange with status 8

I have an Android app that uses the BLE API to connect to a BLE device. If I connect to the device and then turn off the power of the device after a few seconds I get this line in the logcat:

11-15 12:33:07.977 27829-27847/com.mycompany.platform.hellodev D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=6 device=55:1C:6C:86:8A:F8

which then invokes our BluetoothGattCallback callback onConnectionStateChange with status=8 and newStatus=0

I can't find any public documentation that says what status=8 means.

Is it right to assume that if newStatus=0 is passed it means the BLE device has disconnected?

like image 353
Ido Ran Avatar asked Feb 09 '23 13:02

Ido Ran


1 Answers

I can't find any public documentation that says what status=8 means.

It means that you lost the connection link(LINK_LOSS) due to no response from remote device or Timeout happened.

Is it right to assume that if newStatus=0 is passed it means the BLE device has disconnected?

Yes if newStatus is 0, means CONNECTION state is idle, and device is now disconnected.

like image 70
AAnkit Avatar answered Feb 11 '23 02:02

AAnkit