Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BluetoothGattCallback - onConnectionStateChange returns status22

I am developing an Android application to interface with Bluetooth module dual mode.

Due to the module is dual mode, I am confronting the same problems described here.

However I trying to do a workaround, because after first connection the callback onConnectionStateChange() returns status 133. Always in the onStop() method from Main Activity, I close BluetoothGatt object to free resources. Further was added bluetoothGatt.disconnect() before bluetooth.close().

When was called disconnect(), my cellphone get more connections with the module, however after reconnecting sometimes, the callback onConnectionStateChange returns status 22.

I didn't find about status 22 in the BluetoothGatt documentation.

UPDATE In BLE callbacks are passed status codes that are not in the public API. topic is about status 22 and others.

Thanks

like image 511
Arubu Avatar asked Jul 15 '15 14:07

Arubu


1 Answers

133 error code: Connect timeout or device not found.

22 error code: The bluetooth is closed then device is disconnected.

22 error code: The Connection Terminated By Local Host error code indicates that the local device terminated the connection.

like image 181
sowhat Avatar answered Nov 08 '22 12:11

sowhat