Android 蓝牙断开连接D/BluetoothGatt:cancelOpen()

Android 蓝牙断开连接D/BluetoothGatt:cancelOpen(),android,bluetooth-lowenergy,android-bluetooth,android-ble,Android,Bluetooth Lowenergy,Android Bluetooth,Android Ble,当我调用特定命令时,ble设备似乎已断开连接 我发出两个命令,设备似乎工作正常。它处理请求并返回响应。但当我调用第三个命令时,设备会自动断开连接 我尝试在几乎所有的案例中增加延迟,但仍然收到错误。我真的不知道该怎么办?事实上,我看了一下,但我的连接情况不一样 **D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=12 D/BluetoothGatt: cancelOpen() - device:** 以上就是我

当我调用特定命令时,ble设备似乎已断开连接

我发出两个命令,设备似乎工作正常。它处理请求并返回响应。但当我调用第三个命令时,设备会自动断开连接

我尝试在几乎所有的案例中增加延迟,但仍然收到错误。我真的不知道该怎么办?事实上,我看了一下,但我的连接情况不一样

 **D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=12 
 D/BluetoothGatt: cancelOpen() - device:** 
以上就是我看到的问题。有人知道为什么会这样吗。谢谢

1599629181.075 ? W/bt_stack: [WARNING:bta_gattc_act.cc(1060)] bta_gattc_conn_cback: cif=3 connected=0 conn_id=0x0103 reason=0x0008
1599629181.075 ? W/bt_stack: [WARNING:bta_gattc_act.cc(1060)] bta_gattc_conn_cback: cif=4 connected=0 conn_id=0x0104 reason=0x0008
1599629181.075 ? W/bt_stack: [WARNING:bta_gattc_act.cc(1060)] bta_gattc_conn_cback: cif=6 connected=0 conn_id=0x0106 reason=0x0008
1599629181.075 ? W/bt_stack: [WARNING:bta_gattc_act.cc(1060)] bta_gattc_conn_cback: cif=7 connected=0 conn_id=0x0107 reason=0x0008
1599629181.076 ? W/bt_stack: [WARNING:bta_gattc_act.cc(1060)] bta_gattc_conn_cback: cif=8 connected=0 conn_id=0x0108 reason=0x0008
1599629181.076 ? W/bt_stack: [WARNING:bta_gattc_act.cc(1060)] bta_gattc_conn_cback: cif=9 connected=0 conn_id=0x0109 reason=0x0008
1599629181.076 ? W/bt_stack: [WARNING:bta_gattc_act.cc(1060)] bta_gattc_conn_cback: cif=10 connected=0 conn_id=0x010a reason=0x0008



    1599626204.256 ? E/BluetoothRemoteDevices: aclStateChangeCallback: device is NULL, address=FC:F5:C4:0C:99:2E, newState=1
    1599626204.257 com.buttonwillow.app.staging E/onDescriptorWrite: characteristic uuid is 923c8002-d0c5-4e1a-b9a4-a2d6befe2370 FC:F5:C4:0C:99:2E
    1599626204.257 com.buttonwillow.app.staging D/onDescriptorWrite: OnWriteCharacteristicCalled  android.bluetooth.BluetoothGatt@a178ad4
    1599626204.259 ? D/BluetoothMetrics: btclass0
    1599626204.259 ? E/BtGatt.GattService: writeCharacteristic() - No connection for FC:F5:C4:0C:99:2E...
    1599626204.260 com.buttonwillow.app.staging D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=12 device=FC:F5:C4:0C:99:2E
    1599626204.260 com.buttonwillow.app.staging D/BluetoothGatt: cancelOpen() - device: FC:F5:C4:0C:99:2E
    1599626204.261 ? E/BluetoothMetrics: CheckinEvent exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
    1599626204.262 ? E/bt_btif: No such connection need to be cancelled
    1599626204.262 ? E/bt_stack: [ERROR:bta_gattc_utils.cc(464)] bta_gattc_mark_bg_conn unable to find the bg connection mask for: fc:f5:c4:0c:99:2e
    1599626204.263 com.buttonwillow.app.staging D/BluetoothGatt: cancelOpen() - device: FC:F5:C4:0C:99:2E
    1599626204.265 ? E/bt_btif: No such connection need to be cancelled
    1599626204.265 ? E/bt_stack: [ERROR:bta_gattc_utils.cc(464)] bta_gattc_mark_bg_conn unable to find the bg connection mask for: fc:f5:c4:0c:99:2e

也许你应该发布你的代码?是否在onClientConnectionState()中调用close()?状态8表示链接层上的连接意外超时。不,我没有在代码中的任何位置调用close或disconnect。