Android蓝牙低功耗断开请求未发送?

pos*_*ssy 5 android bluetooth cordova

我们试图断开与外围设备的连接,但是使用蓝牙嗅探器,我们没有看到LL_TERMINATE_IND数据包.相反,手机似乎继续向Empty PDU外围设备发送大约20秒钟.

我们使用以下Cordova BLE插件:https://github.com/don/cordova-plugin-ble-central

断开连接方法在这里:https://github.com/don/cordova-plugin-ble-central#/L74

我们还试过gatt.disconnect()gatt.close()下面添加一个明确的,但它似乎没有任何区别:

public void disconnect() {
    connectCallback = null;
    connected = false;
    if (gatt != null) {
        gatt.disconnect();
        gatt.close();
        gatt = null;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是相关的adb日志.adb日志"找不到上下文"中有错误可能与此有关?虽然看起来就 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)
Run Code Online (Sandbox Code Playgroud)

这就是蓝牙嗅探的样子(还有更多相同的东西):

Wireshark中的蓝牙嗅探器输出

外围设备有可能在此时进入睡眠状态(这是为了电池寿命目的).这对我来说是有道理的,为什么手机只是一直发送Empty PDUs,但是我们不应该通过无线电波看到断开请求吗?