Ido Ran
Ido Ran

Reputation: 11374

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?

Upvotes: 4

Views: 3639

Answers (1)

AAnkit
AAnkit

Reputation: 27549

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.

Upvotes: 8

Related Questions