Reputation: 737
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
Upvotes: 0
Views: 1407
Reputation: 737
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
.
Upvotes: 0
Reputation: 813
The int error codes need to be converted to HEX and mapped to the values in the following file:
In the cases you mentioned:
8 = GATT_INSUF_AUTHORIZATION
19 = GATT_RSP_WRITE
133 = GATT_ERROR
Upvotes: 1