Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bluetooth LE connection issue on a Nexus 9

Currently I am testing an app that uses Bluetooth LE. I have gotten the app to work just fine the problem is that on a Nexus 9 the GATT connection will periodically disconnect for seemingly no reason & I have to restart the connection completely. This doesn't happen on the other device I'm working with (LG G4).

When looking at the system logs it tells me what is happening but I have no idea how to fix it.

693-913/? W/BluetoothEventManager: CachedBluetoothDevice for device 00:20:62:00:12:03 not found, calling readPairedDevices().
693-913/? E/BluetoothEventManager: Got bonding state changed for 00:20:62:00:12:03, but we have no record of that device.
16562-16648/? W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0022
16562-16648/? W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0022
16562-16648/? W/bt_btif: bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0022
16562-16648/? I/bt_btm_sec: btm_sec_disconnected clearing pending flag handle:64 reason:34
16562-16648/? E/bt_btif: bta_gattc_mark_bg_conn unable to find the bg connection mask for: 00:20:62:00:12:03  //<-- the device address
16562-16626/? D/BtGatt.GattService: onDisconnected() - clientIf=5, connId=5, address=00:20:62:00:12:03
3434-3445/com.blabla D/BluetoothGatt: onClientConnectionState() - status=34 clientIf=5 device=00:20:62:00:12:03
16562-16626/? E/BluetoothRemoteDevices: state12newState1
3434-3445/com.blabla E/Bluetooth: onConnectionStateChange:
                                                                 Device  -> LE_Dual_SPK
                                                                 Address -> 00:20:62:00:12:03
                                                                 State   -> Disconnected

Is this a problem with my code or is it a problem with the broadcom chip?

like image 213
Austi01101110 Avatar asked Jan 28 '16 19:01

Austi01101110


1 Answers

Oh Android, how you plague me so.

It was because the Nexus was allowing me to connect to & communicate with the device without actually bonding to it. Thus, when the system checked its connection state it couldn't find the mask, flagged it as a bad connection and dumped it.

like image 74
Austi01101110 Avatar answered Nov 15 '22 11:11

Austi01101110