我的android应用程序在中央连接到外围设备时运行,启用通知,外围设备开始发送。
我的问题是连接在大约13秒后终止。
下面我有日志信息。
在Android系统中蓝牙LE的状态是什么?
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
发布于 2016-04-06 11:08:57
我也有过同样的问题。经过深入研究,我发现在我们的示例中,statuscode 59 (或0x3B十六进制)指向了HCI_ERR_UNACCEPT_CONN_INTERVAL
。
通过检查我手机上的蓝牙HCI监听日志,我发现该设备正在与手机就连接参数进行协商。设备要求连接间隔为7.5ms,但手机拒绝了这一请求。经过三次(15毫秒)后,设备断开和重新检查。
我发现this post说Android6.0中的最小连接间隔已经更改为12.5ms。因此,如果您调整设备请求的连接间隔,可能会保持连接。
https://stackoverflow.com/questions/35892288
复制相似问题