UDKOX UDKOX - 1 month ago 11
Android Question

Should I get BluetoothGatt.GATT_SUCCESS also when disconnecting from a device?

I am working with custom devices and I am struggling to manage the Bluetooth LE correctly.

My only concern is not getting 0 (

BluetoothGatt.GATT_SUCCESS
) when I read the
status
value along with value 2 on
newState
variable (what means
BluetoothProfile.STATE_DISCONNECTED
) at method
onConnectionStateChange
. Instead, I get an 8, what can't be tracked in the
BluetoothGatt
nor
BluetoothProfile
classes.

All connection works fine, I read and write values perfectly.

(1) Is this supposed to be like that? Why do I read an eight?

I have seen many
status
values at my
onConnectionStateChange
method: 8, 19, 133 etc.

(2) Where can I check this values?

Thanks in advance




EDIT: There are many values in the api.h file, we were looking in the wrong place.

8: 0x08 = GATT CONN TIMEOUT
19: 0x13 = GATT CONN TERMINATE PEER USER
133: 0x85 = GATT_ERROR

Answer

Answer is no.

I wasn't getting BluetoothGatt.GATT_SUCCESS because the connection was closed by the other end. If gatt.disconnect() is executed I read status = BluetoothGatt.GATT_SUCCESS.