2

my android application runs as central is connected to a peripheral, enables notifications and the peripheral starts sending.

my problem is that the connection is terminated after about 13 seconds.

below i have the logcat information.

What is status 59 of Bluetooth LE in Android?

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
schoensn
  • 23
  • 4

1 Answers1

4

I've had the same issue. After some digging i found in our case statuscode 59 (or 0x3B hex) pointed to HCI_ERR_UNACCEPT_CONN_INTERVAL.

By examining the Bluetooth HCI snoop logs from my phone i discovered that the ble device is negotiating with the phone about connection parameters. The device requested a connection interval of 7.5ms and the phone rejected this. After three times (15ms) the device disconnected and resetted.

I've found this post saying the minimum connection interval in Android 6.0 has changed to 12.5ms. So if you adjust the connection interval that the device requests, you'll probably keep the connection.

Community
  • 1
  • 1
JPS
  • 604
  • 5
  • 14
  • ok. thats the problem i had a minimum connection interval of 7.5 ms. thanks. – schoensn Apr 11 '16 at 06:44
  • THANK YOU! This was my problem too. Except in my case I had the device's MIN_CONN_INTERVAL set to 20ms, so it kept trying to renegotiate when I set high priority in Android. – Chriszuma May 10 '17 at 14:48
  • @schoensn what does the status 15 mean ? Where can we get the list of statuses and its meaning returned by gatt ? – madhuri H R Dec 20 '17 at 07:49
  • google helped me to find this list: http://allmydroids.blogspot.co.at/2015/06/android-ble-error-status-codes-explained.html – schoensn Dec 21 '17 at 09:37