Android 蓝牙低功耗状态 = 59

标签 android bluetooth bluetooth-lowenergy

我的 Android 应用程序在中央设备连接到外围设备时运行,启用通知并且外围设备开始发送。

我的问题是连接在大约 13 秒后终止。

下面我有logcat信息。

Android 中蓝牙 LE 的状态 59 是什么?

BluetoothGatt: connect() - device: C5:7F:B0:8E:AA:91, auto: false
BluetoothGatt: registerApp()
BluetoothGatt: registerApp() - UUID=3a9c080d-ae20-47ea-b34c-7ea7798204cc
BluetoothGatt: onClientRegistered() - status=0 clientIf=5
BluetoothGatt: onClientConnectionState() - status=0 clientIf=5 device=C5:7F:B0:8E:AA:91
BluetoothGatt: discoverServices() - device: C5:7F:B0:8E:AA:91
BluetoothGatt: onSearchComplete() = Device=C5:7F:B0:8E:AA:91 Status=0
BluetoothGatt: setCharacteristicNotification() - uuid: 00002a05-0000-1000-8000-00805f9b34fb enable: true
BluetoothGatt: setCharacteristicNotification() - uuid: 00001625-1212-efde-1523-785feabcd123 enable: true
BluetoothGatt: cancelOpen() - device: C5:7F:B0:8E:AA:91
BluetoothGatt: onClientConnectionState() - status=59 clientIf=5 device=C5:7F:B0:8E:AA:91
BluetoothGatt: close()
BluetoothGatt: unregisterApp() - mClientIf=5

最佳答案

我也遇到过同样的问题。经过一番挖掘,我发现我们的案例状态代码 59(或十六进制 0x3B)指向 HCI_ERR_UNACCEPT_CONN_INTERVAL

通过检查手机中的蓝牙 HCI 监听日志,我发现 ble 设备正在与手机协商连接参数。设备请求 7.5 毫秒的连接间隔,但手机拒绝了此请求。三次(15ms)后设备断开连接并重置。

我找到了this post据说Android 6.0中的最小连接间隔已更改为12.5ms。因此,如果您调整设备请求的连接间隔,您可能会保持连接。

关于Android 蓝牙低功耗状态 = 59,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35892288/

相关文章:

android - 在 Android 中的 ListView 项目下方动态添加按钮

python - Twisted串口dataReceived()提供碎片数据

Android 4.0 蓝牙配对 : Need to enter password everytime

更改 UUID 后,Android 蓝牙未发现该特性

java - 如何从 CustomView 开始一个新的 Activity?

android - 如何在 Firebase 实时数据库 Android 中实现等价于 .contains(SomeText) ?

java - Android Volley解析Json响应为null

android - Android 上可靠的蓝牙

java - BLE Android - 未调用 onConnectionStateChange

testing - Bluetooth low energy : Discovery modes and connection mode, 独立还是依赖?