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)等等

  c)  bt_did.conf,/etc/Bluetooth/

i. Device ID (DID) configuration file,未被使用

  d) auto_pair_devlist.conf,/etc/Bluetooth/

i. 保存blacklist和whitelist

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/bluetooth.h

         ii. <Android Root>/hardware/libhardware/include/hardware/bt_*.h

  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的精华所在

i.  由如下库文件组成,static lib (参考:bluedroid/main/Android.mk)

      1. libbt-brcm_bta \ -> bluedroid/bta/Android.mk
      2. libbt-brcm_gki \ -> bluedroid/gki/Android.mk
      3. libbt-brcm_stack \ -> bluedroid/stack/Android.mk
      4. libbt-hci \ -> bluedroid/hci/Android.mk
      5. libbt-utils \ -> bluedroid/hci/Android.mk
      6. libbt-qcom_sbc_decoder \ -> bluedroid\embdrv\sbc\decoder\Android.mk
      7. libosi \ -> bluedroid/osi/Android.mk
      8. libtinyxml2 \

  b) audio.a2dp.default.so

i. 这个是a2dp和audio的hal接口,-> bluedroid\audio_a2dp_hw\Android.mk

  c) libbt-vendor.so

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

7、  Android BT基本架构

Android Bluetooth How To--Based on Android L Bluedroid的更多相关文章

  1. 【转】Android bluetooth介绍(三): 蓝牙扫描(scan)设备分析

    原文网址:http://blog.csdn.net/xubin341719/article/details/38584469 关键词:蓝牙blueZ  A2DP.SINK.sink_connect.s ...

  2. vue app混合开发蓝牙串口连接(报错java.io.IOException: read failed, socket might closed or timeout, read ret: -1;at android.bluetooth.BluetoothSocket.connect at js/BluetoothTool.js:329)

    我使用的uni-app <template> <view class="bluetooth"> <!-- 发送数据 --> <view c ...

  3. Android bluetooth介绍(三): 蓝牙扫描(scan)设备分析

    关键词:蓝牙blueZ  A2DP.SINK.sink_connect.sink_disconnect.sink_suspend.sink_resume.sink_is_connected.sink_ ...

  4. 【转】Android bluetooth介绍(二): android blueZ蓝牙代码架构及其uart 到rfcomm流程

    原文网址:http://blog.sina.com.cn/s/blog_602c72c50102uzoj.html 关键词:蓝牙blueZ  UART  HCI_UART H4  HCI  L2CAP ...

  5. android Bluetooth(官方翻译)

    Bluetooth Using the Bluetooth APIs, an Android application can perform the following: 使用蓝牙APIs,一个And ...

  6. Android Bluetooth开发

    原文地址:http://developer.android.com/guide/topics/wireless/bluetooth.html 翻译:jykenan 更新:2012.06.19 Andr ...

  7. Android bluetooth介绍(四): a2dp connect流程分析

    关键词:蓝牙blueZ  A2DP.SINK.sink_connect.sink_disconnect.sink_suspend.sink_resume.sink_is_connected.sink_ ...

  8. Android BLE与终端通信(二)——Android Bluetooth基础科普以及搜索蓝牙设备显示列表

    Android BLE与终端通信(二)--Android Bluetooth基础搜索蓝牙设备显示列表 摘要 第一篇算是个热身,这一片开始来写些硬菜了,这篇就是实际和蓝牙打交道了,所以要用到真机调试哟, ...

  9. Android BLE与终端通信(一)——Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址

    Android BLE与终端通信(一)--Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址 Hello,工作需要,也必须开始向BLE方向学习了,公司的核心技术就是BLE终端 ...

随机推荐

  1. Alpha-release 总结

    因组员一周来事情较多,因此博客更新停滞了一个星期.这周我们已经开始了第二个release的相关工作,首先先对上一个release的工作进行简短总结. 团队在上个星期进行了alpha-release版本 ...

  2. E - Dividing Chocolate ATcoder

    题目大意:切割图形,给你一个非0即1的矩阵,将它切割成多个长方形,使每个小长方形中1的个数不得多于k个,切割的规则,要么切一整行,要么是一整列. 题解: 二进制枚举. 注意行数最大才是10.用二进制枚 ...

  3. N - Remove Adjacent CodeForces - 1321C

    题目大意:删除字符,当一个字符左边或者右边存在一个比它小“1”的字符那么就可以将这个字符删除,问最多能删除多少个字符 思路,:刚开始想的是,对于单调连续的字符,可以直接删除,比如,单点增的字符只保留前 ...

  4. ppt和pptx转图片完整代码,解决2003版和2007版中文乱码问题

    引入所需依赖,注意poi版本,新版本不支持,最好使用和我一样的版本. <!-- https://mvnrepository.com/artifact/org.apache.poi/poi --& ...

  5. Charles抓包——弱网测试(客户端)

    基础知识 网络延迟:网络延时指一个数据包从用户的计算机发送到网站服务器,然后再立即从网站服务器返回用户计算机的来回时间.通常使用网络管理工具PING(Packet Internet Grope)来测量 ...

  6. 【原创】Linux RCU原理剖析(二)-渐入佳境

    背景 Read the fucking source code! --By 鲁迅 A picture is worth a thousand words. --By 高尔基 说明: Kernel版本: ...

  7. 深入理解kestrel的应用

    1 前言 之所以写本文章,是因为在我停止维护多年前写的NetworkSocket组件两年多来,还是有一些开发者在关注这个项目,我希望有类似需求的开发者明白为什么要停止更新,可以使用什么更好的方式来替换 ...

  8. Java中集合的初等案例

    我有五个学生,请把这个学生的信息储存到数组中,并遍历数组,获取得到每一个学生信息. 学生:Strdent 成员变量:name,age 构造方法:无参,带参 成员方法:getXxx()/setXxx() ...

  9. Java创建对象时的简单内存分析

    简单创建对象的内存分析 主程序: 1 public class Application { 2 public static void main(String[] args) { 3 Animal do ...

  10. Windows 计划任务 如果选择未登录就运行 则看不到GUI

    You can specify that a task should run even if the account under which the task is scheduled to run ...