connectGatt on Samsung Galaxy S7 creates connection over Bluetooth Classic instead of BLE

不羁岁月 提交于 2021-01-29 02:30:40

问题


I have a dual-mode (BR/EDR + BLE) device running a GATT server. The address is public and same for BLE and BD/EDR.
When I call connectGatt on Galaxy S7 with Android 6.0.1 (API level 23) and set the transport parameter as "TRANSPORT_LE" the phone still tries to establish connection over BD/EDR. It looks like the problem is related to the public address of the BLE because if I set it to private the connection is done over BLE, as expected.

This problem was observed only on Galaxy S7, on other phones (i.e Nexus 6P) the connection is always correctly done over BLE.

Is this an Android bug or am I missing something?


回答1:


Bluetooth 4.0 specification states that if both devices support Classic and LEW then connection must be done over Classic. And Android stacks tend to follow this. Make you other device non-connectable and not in visible in inquiry and it should work fine




回答2:


GATT is not transport specific and it is a framework implemented on top of attribute protocol(ATT). Its possible to access GATT over BR/EDR if the peripheral device is a dual mode device and supports GATT over BR/EDR. Bluetooth 4.X core specifications doesn't mandate access of connection bearer over GATT. Some android phones try using GATT over BR/EDR and applications can not control it. I also observed GATT over BR/EDR in Lenovo TAB 2 A8-50F.




回答3:


An old question, but not answered...

You might have wrong FLAGS on the Advertising packet on the GATT device. Additionally the EIR (Extended Inquiry Response) packet transmitted by the Classic part of your implementation.

There is a flag "BR/EDR NOT SUPPORTED" that might help you in both of these cases.

This problem is common on the CSR chipsets, due to the default setup in the ADK code provided by CSR. Is there any chance you are using a CSR chip? your problem might not be on the android device?



来源:https://stackoverflow.com/questions/40127107/connectgatt-on-samsung-galaxy-s7-creates-connection-over-bluetooth-classic-inste

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!