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. docx4j docx转html

    不好用,转完问题挺多,百度还找不到资料头疼.public static void docxToHtml(String fileUrl) throws Exception { String path = ...

  2. jmeter插件 --PerfMon Metrics Collector监控工具的使用

    PerfMon Metrics Collector 用来监控 被压测服务器的cpu.内存.磁盘.网络等 1.服务端监控程序ServerAgent下载 https://github.com/undera ...

  3. [linux][nginx] 通过nginx扩展nginx-rtmp-module简单做了一个流媒体直播

    做的过程出现很多问题,环境其实就需要nginx就可以,然后就是在播放的问题,m3u8的格式,mac直接访问就支持,苹果系统原生H5支持m3u8,还有就是手机直接访问也支持!但是其他其他系统PC端不支持 ...

  4. 取代 Python 多进程!伯克利开源分布式框架 Ray

    Ray 由伯克利开源,是一个用于并行计算和分布式 Python 开发的开源项目.本文将介绍如何使用 Ray 轻松构建可从笔记本电脑扩展到大型集群的应用程序. 并行和分布式计算是现代应用程序的主要内容. ...

  5. js上传文件前判断获取文件大小并且加以判断

    描述:要求浏览器单个上传文件大小不超过10M. 解决方案: var fileSize = $("#fileId")[0].files[0].size/(1024*1024);if( ...

  6. 将jar包发布到maven中央仓库

    将jar包发布到maven中央仓库 最近做了一个swagger-ui的开源项目,因为是采用vue进行解析swagger-json,需要前端支持,为了后端也能方便的使用此功能,所以将vue项目编译后的结 ...

  7. 用scrapy实现模拟登陆

    class Test1sSpider(scrapy.Spider): name = 'test1s' allowed_domains = ['yaozh.com'] start_urls = ['ht ...

  8. 8个超好用的Python内置函数,提升效率必备(小白必看)

    python中有许多内置函数,不像print那么广为人知,但它们却异常的强大,用好了可以大大提高代码效率. 这次来梳理下8个好用的python内置函数. 1.set() 当需要对一个列表进行去重操作的 ...

  9. 负载均衡服务之HAProxy基础配置(五)

    前文我们聊了下haproxy的修改报文首部的配置.压缩功能以及haproxy基于http协议自定义健康状态检测机制:回顾请参考https://www.cnblogs.com/qiuhom-1874/p ...

  10. 今天,VS Code 五岁了。

    时光飞逝,岁月如梭.今天,VS Code 迎来了 5 岁的生日. 回想起 VS Code 发布的那一天,仿佛还在昨天. 回顾 VS Code 这五年的发展,总是能给我们开发者带了无限的惊喜. 2015 ...