当前位置: 代码迷 >> Android >> Android Bluetooth How To-Based on Android L Bluedroid
  详细解决方案

Android Bluetooth How To-Based on Android L Bluedroid

热度:784   发布时间:2016-04-28 01:24:58.0
Android Bluetooth How To--Based on Android L Bluedroid

Android Bluetooth How To(Based on Android L Bluedroid)

 

持续更新中…

1、How to enable btsnoop log?

  a) UI Settings-->

  b)  Developer Options-->

  c)  reboot Tablet, then snoop log will locate in /sdcard/btsnoop_hci.log(this path can be configured in /etc/bluetooth/bt_stack.conf)

2、If developer options default not enabled, you can use following steps to enable it

  a) Settings-->

  b) About Tablet-->

  c) Click 4 or 5 times or more in Build Number-->

  d)then, Develop options will comeout-->

Pls also be noted that how to enable Developer Options might depend on system and Android Versions

 

3、bluedroid useful config files

  a) bt_stack.conf

    i.  此文件保存在/etc/bluetooth/目录下,用于配置抓取bluedroid协议栈log的方式和log的级别

  b) bt_config.xml

          i.此文件在/data/misc/bluedroid/目录下,保存了当前BT设备、扫描到的BT设备以及配对过的BT设备的信息,包括device name、BD_ADDR、link key、Report Descriptor(HID)等等

 

4、How to enable & adjust bluedroid debug log level?

  a) this should customized in /etc/bluetooth/bt_stack.conf

  b) enable btsnoop log -->

                         i.set BtSnoopLogOutput to true

          BtSnoopLogOutput=true

                       ii.  set BtSnoopFileName to path you want to save btsnoop log

          BtSnoopFileName=/sdcard/btsnoop_hci.log

  c) adjust trace & debug level

                         i.  set TraceConf to true

        TraceConf=true

                       ii. 根据需要设置debug level,默认是2,通常debug的时候,都是将level默认设置为5来抓log,这样可以打出更多的信息(logcat)

        TRC_BTM=5

        TRC_HCI=5

        TRC_L2CAP=5

        TRC_RFCOMM=5

        TRC_OBEX=5

        TRC_AVCT=5

        TRC_AVDT=5

        TRC_AVRC=5

        TRC_AVDT_SCB=5

        TRC_AVDT_CCB=5

        TRC_A2D=5

        TRC_SDP=5

        TRC_GATT=5

        TRC_SMP=5

        TRC_BTAPP=5

        TRC_BTIF=5

5、Android Bluetooth相关code路径

  a) bluedroid协议栈

                         i.   <Android Root>/external/bluetooth/bluedroid/

  b) Bluetooth.apk

                         i.  <Android Root>/packages/apps/Bluetooth/

  c) Settings.apk

                         i. <Android Root>/packages/apps/Settings/src/com/android/settings/bluetooth 

  d) hal头文件

                         i. <Android Root>/hardware/libhardware/include/hardware/

  e) framework相关

                         i.  <Android Root>/frameworks/base/core/java/android/bluetooth

                       ii.   <Android Root>/frameworks/base/services/core/java/com/android/server/ BluetoothManagerService.java

 

6、bluedroid build出来的binary

  a) bluetooth.default.so

                         i. 这个协议栈的profile、stack所编译出来的,是bluedroid的精华所在

  b) audio.a2dp.default.so

                         i. 这个是a2dp和audio的hal接口

  c) libbt-vendor.so

                         i.  vendor自己实现的,用于将bluedroid协议栈铜特定的芯片driver接起来

7、  Android BT基本架构

  相关解决方案