2016-03-09 191 views
2

我的android應用程序在中央連接到外設時運行,啓用通知並且外設開始發送。android藍牙低能耗狀態= 59

我的問題是,連接約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 
+0

您的Android應用程序是否運行在Android 6.0或更高版本上? – JPS

+0

是的,它運行在與安卓6 – schoensn

回答

2

我有同樣的問題。經過一番挖掘,我發現我們的情況代碼59(或0x3B十六進制)指向HCI_ERR_UNACCEPT_CONN_INTERVAL

通過檢查手機中的Bluetooth HCI snoop日誌,我發現該設備正在與手機進行有關連接參數的協商。該設備要求7.5ms的連接間隔,並且電話拒絕了這一點。三次(15ms)後,設備斷開並重新設置。

我發現this post表示Android 6.0中的最小連接間隔已更改爲12.5ms。所以如果你調整設備請求的連接間隔,你可能會保持連接。

+0

好的聯繫9上。那是我有一個最小連接間隔7.5毫秒的問題。謝謝。 – schoensn

+0

謝謝!這也是我的問題。除了我的情況,我將設備的MIN_CONN_INTERVAL設置爲20ms,所以當我在Android中設置高優先級時,它一直試圖重新協商。 – Chriszuma

+0

@schoensn狀態15是什麼意思?我們在哪裏可以獲得gatt返回的狀態列表和它的含義? –