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. Python爬取养眼图片

    1.准备 各位绅士们,你可能会觉得疫情在家无聊,那么现在我们的Python语言可以满足你们的需求.项目需要的工具(1)Python3(2)requests库requests库可以通过代码pip ins ...

  2. 15分钟从零开始搭建支持10w+用户的生产环境(二)

    上一篇文章,把这个架构的起因,和操作系统的选择进行了详细说明. 原文地址:15分钟从零开始搭建支持10w+用户的生产环境(一)   二.数据库的选择 对于一个10W+用户的系统,数据库选择很重要. 一 ...

  3. sublime查看项目代码多少行

    ---------------------sublime   0.右击要查找的文件; 1.勾选正则( .* ); 3.输入正则表达式 ^[ \t]*[^ \t\n\r]+.*$ 0:搜索 \n 是不是 ...

  4. SpringMVC转发及重定向

    基础环境搭建请参考SringMVC入门程序 1:springmvc-servlet.xml <?xml version="1.0" encoding="UTF-8& ...

  5. python 携程asyncio实现高并发示例1

    import asyncio #携程(携程不是函数) async def print_hello(): while True: print("hello world") await ...

  6. jdbc-手写Java方法连接数据库

    一.关键四元素   ①    com.mysql.jdbc.Driver      mysql数据库连接jar包.   获取途径: 链接:https://pan.baidu.com/s/1SFcjuu ...

  7. ES6让字符串String增加了哪些好玩的特性呢?

    确实因为现在天气变热了,所以一天天的这么写我也很累.所以如果阅读的时候有什么错误还请大家指出来,不好意思.学习永无止境. OK,今天继续讲解ES6系列知识 学过上一节的解构赋值就知道,ES6确实给我们 ...

  8. Apk优化极致

    1. webp WebP格式,谷歌(google)开发的一种旨在加快图片加载速度的图片格式.图片压缩体积大约只有JPEG的2/3,并能节省大量的服务器宽带资源和数据空间.Facebook Ebay等知 ...

  9. ajax轮询思路

    以我个人理解 ,ajax短轮询就是用定时器,定时请求数据库,然后把有用的数据做处理 ajax长轮询恩 就是在 ajax回调函数,继续调用ajax请求

  10. CG-CTF(1)

    CG-CTF CG-CTF题目网址:https://cgctf.nuptsast.com/challenges#Web 第一题:签到题 查看页面源代码,得到flag(干杯~): 第二题:md5 col ...