Reputation: 445
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
Upvotes: 9
Views: 4519
Reputation: 161
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.
Upvotes: 1