question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disconnecting and closing BLE connection stops classic Blutetooth profile too

See original GitHub issue

I have a setup with two Android devices: an android phone and a custom hardware running Android 10. The latter acts as a BLE Server, which is discoverable always with the same static MAC address. Also when that custom HW is paired with the phone it has access to phone’s contacts and calls history. That HW can also play media (sound) streamed from the phone.

I use RxAndroidBle 1.11.0 library for BLE communication. As soon as I exchange some data via BLE Characteristic I unsubscribe from the RX observable so the library effectively calls: bluetoothGatt.disconnect() then blutetoohGatt.close() (all those inside the DisconnectOperation class).

My problem is the fact that based on my observations, calling blutetoohGatt.disconnect() disconnects the classic BT profile (PBAP) as well.

Is it an expected behaviour?

I have investigated the code of generic Android P framework and it looks that callingbluetoothGatt.disconnect()-> bluetoothGatt.close() completely disconnects the device described by the given MAC Address: BluteoothGatt#disconnect() BlutetoothGatt#close() BlutetoothGatt#unregisterApp()

I would risk a statement that I possibly have quite unusual BLE use-case scenario where the phone (Central/Client) and the peripheral (custom Android HW/Server) are connected simultaneously via Classic BT profile and via BLE. I suspect that disconnecting/closing device using its BT MAC address disconnect both profiles, hence the contacts sharing stops working. Is it possible to disconnect BLE connection only, but not affect the classic BT (SPP/PBAP) connections between the two devices?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dariuszseweryncommented, Sep 23, 2020

From what I read in the above mentioned links I see that the hardware is dual-mode i.e. it uses SPP (Classic Bluetooth) and GATT (BLE). Judging from the screens / text and more links they also used different MAC addresses for their BT and BLE functionalities. Anyway — I am glad you resolved the problem. Unfortunately as far as I know the library cannot do anything to help — this is an OS BLE stack problem.

0reactions
gary0707commented, Sep 23, 2020

Thanks for the response and posted links. In those cases, the “duality” seems to be related to fact, that the BT HW can act as a both: master and slave. That is not my case probably. I am still not sure that I have fully resolve my problems, but for sure the order of pairing (BLE first then Classic) is crucial in my case. All in all the topic I have raised in this ticket seems to be resolved hence I have closed it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disconnecting and closing BLE connection stops classic ...
Is it possible to disconnect BLE connection only, but not affect the classic BT (SPP/PBAP) connections between the two devices?
Read more >
Understanding BLE Disconnections | Argenox Blog
BLE Connection Drops. The other reason why a disconnection happens is that one or both devices realize the connection has cut out. This...
Read more >
CC2652R: BLE connection disconnection issue - Bluetooth forum ...
after connecting with android application I am pressing connect disconnect buttons on app but it seems after pressing 1-2 times the BLE is...
Read more >
How to Fix Bluetooth Pairing Problems - Techlicious
1. Make sure Bluetooth is turned on · 2. Determine which pairing process your device employs · 3. Turn on discoverable mode ·...
Read more >
Understanding the BC127 Bluetooth Module - SparkFun Learn
DISCOVERABLE mode makes the device discoverable by other Bluetooth Classic devices in range ( ON ). The device will automatically switch to OFF...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found