Re: [問題] Android 的 bluetooth profile 問題消失

看板AndroidDev作者時間7年前 (2016/10/26 22:06), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《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. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.160.56.181 ※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1477490819.A.7DF.html
文章代碼(AID): #1O4BY3VV (AndroidDev)
文章代碼(AID): #1O4BY3VV (AndroidDev)