We are trying to disconnect from the periphery, but with the help of the Bluetooth sniffer we do not see the LL_TERMINATE_IND packet. Instead, the phone seems to continue to send Empty PDU to the periphery for about 20 seconds.
We use the following Cordova BLE plugin: https://github.com/don/cordova-plugin-ble-central
The disconnect method is here: https://github.com/don/cordova-plugin-ble-central#/L74
We also tried to add explicit gatt.disconnect() to gatt.close() , as shown below, but it did not matter:
public void disconnect() { connectCallback = null; connected = false; if (gatt != null) { gatt.disconnect(); gatt.close(); gatt = null; } }
Here is the corresponding adb log. Is there a bug in the adb log "Context not found" that could be related? Although this happens immediately after onDisconnected ().
04-15 16:25:34.931 24199 24199 I chromium: [INFO:CONSOLE(79263)] "ble:store > Handle dispatch DOOR_DISCONNECT", source: file:///android_asset/www/js/bundle.js (79263) 04-15 16:25:34.931 24199 24199 I chromium: [INFO:CONSOLE(79263)] "ble:connecting > ยง 20", source: file:///android_asset/www/js/bundle.js (79263) 04-15 16:25:34.932 24199 24274 D BluetoothGatt: close() 04-15 16:25:34.932 24199 24274 D BluetoothGatt: unregisterApp() - mClientIf=5 04-15 16:25:34.933 1886 9721 D BtGatt.GattService: unregisterClient() - clientIf=5 04-15 16:25:34.934 1886 2019 W bt_btif : bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016 04-15 16:25:34.934 1886 2019 W bt_btif : bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0016 04-15 16:25:34.934 1886 2019 W bt_btif : bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0016 04-15 16:25:34.944 1886 1924 D BtGatt.GattService: onDisconnected() - clientIf=5, connId=5, address=00:A0:00:00:00:14 04-15 16:25:34.944 1886 1924 E BtGatt.ContextMap: Context not found for ID 5 04-15 16:25:34.948 24199 24199 I chromium: [INFO:CONSOLE(79270)] "ble:connecting > _disconnectFromDoor success", source: file:///android_asset/www/js/bundle.js (79270) 04-15 16:25:34.952 24199 24199 I chromium: [INFO:CONSOLE(79263)] "ble:store > Handle dispatch DOOR_DISCONNECT_SUCCESS", source: file:///android_asset/www/js/bundle.js (79263)
And here is what bluetooth sniffing looks like (with a lot of the same):

There is a possibility that the peripheral device fell asleep at this moment (this is done for battery life). It would be reasonable for me why the phone just sends Empty PDU s, but shouldn't we see a request to disconnect over the air?
source share