Re: [问题] Android 的 bluetooth profile 问题

楼主: hahafox (Andy)   2016-10-26 22:06:56
※ 引述《blueblueChen (蓝蓝欠)》之铭言:
: 不知道有没有版友有在研究 Android 6.0.1 的 bluetooth framework?
: device A 和 device B 之间用 bluetooth 连线,A 是 server, B 是 client
: 目前 study 结果是
: packages/apps/Bluetooth/src/com/android/bluetooth/ 有许多 profile service
: frameworks/base/core/java/android/bluetooth 有许多apk要用到的 class 例如
: BluetoothAdapter, BluetoothDevice之类
: 我在 BluetoothManagerService.java 和 AdapteService.java 埋了些log
: 看到 Gatt 和 hid, a2dp, hfp, map ...这些 service 有被打开...
: 但似乎就只是启动而已(不确定)
: 有没有什么关键的地方可以判定说 device A 和 device B 之间的连线是用
: 哪个 profile ? 之所以会有这篇是,A 和 B 上面的 apk 没有 source code
Method:
1. DeviceA(phone) Settings -> Developer Option -> enable BT snoop
2. Create connection (A and B)
3. adb pull sdcard/btsnoop_hci.log
4. Use Frontline SW tool to check the snoop
: 所以只能在 framework 中加一些 log
: 我另一个想法是: 我在B端写一个APK去扫A所提供的 UUID,在网络上有看到范例
: 但假如 A上面 gatt hid a2dp hfp 这些有起来的话
: 我写个APK去扫UUID是不是就会扫到这些 A提供的service?
: 然后我还是无法确定A和B之间连线后,是用哪个 profile?
: 谢谢指教
Above is the most accurate method than adding logs, because you may
miss adding logs in some profile by different software architecture.
Regarding to what profile you are using, it depends on what device you are
connecting and what kind of app you are using. e.g., if it is a speaker,
Settings.apk default profile connection is A2DP/HFP/AVRCP.
However, peer should support above profiles as well. So, before profile
connection, the initiator triggers a service discovery link to ask peer.

Links booklink

Contact Us: admin [ a t ] ucptt.com