BluetoothGattCallback - onConnectionStateChange returns status22

I am developing an Android application for interacting with the Bluetooth module in two modes.

Due to the fact that the module works in two modes, I encounter the same problems described here.

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

When disconnect () was called, my mobile phone gets more connections to the module, however, after reconnecting, the onConnectionStateChange callback sometimes returns status 22.

I did not find about status 22 in the BluetoothGatt documentation.

UPDATE The BLE callbacks are passed to status codes that are not in the public API. The topic concerns status 22 and others.

thank

+4
source share
1 answer

133 means: connection timeout or device not found.

22 means: your bluetooth is closed and the device is disconnected.

-1
source

Source: https://habr.com/ru/post/1598052/


All Articles