自从Android 4.2开始,Android开始使用自己的蓝牙协议栈BlueDroid,而不是bluez

BlueDroid可分为两层: 
- BTE: Bluetooth Embedded System 
- BTA: Bluetooth Application Layer

BTE实现了核心的蓝牙功能,BTA则与框架的应用程序进行通信

1. 基本结构

下图显示了协议栈的基本结构

Application framework 
framework/base/core/java/android/bluetooth 
这里是app代码,使用android.bluetooth APIs和蓝牙设备交互 
其实现原理是通过Binder IPC机制使用蓝牙服务

Bluetooth system service 
位于packages/app/Bluetooth,打包为一个Android应用程序(通过JNI与蓝牙协议栈交互) 
它在Android框架层实现了蓝牙的服务和Profiles

JNI 
有关代码位于packages/apps/Bluetooth/jni下 
当进行蓝牙操作时,JNI的代码会调用到HAL层以获取回调

HAL 
HAL层定义了android.bluetooth和Bluetooth process calls into的标准接口 
其头文件位于hardware/libhardware/include/hardware

bluetooth.h: Contains the HAL for the Bluetooth hardware on the device
bt_av.h:     Contains the HAL for the advanced audio profile.
bt_hf.h:     Contains the HAL for the handsfree profile.
bt_hh.h:     Contains the HAL for the HID host profile
bt_hl.h:     Contains the HAL for the health profile
bt_pan.h:    Contains the HAL for the pan profile
bt_sock.h:   Contains the HAL for the socket profile

Bluetooth stack 
蓝牙协议栈,位于external/bluetooth/bluedroid 
实现了通用的蓝牙HAL及可配置组件

Vendor extensions 
厂商可通过创建libbt-vendor模块来自定义扩展接口和HCI层来方便调试

2. 代码区

如下网址可在线查看相关代码 
AndroidXref
external/bluetooth/bluedroid
packages/apps/Bluetooth
hardware/libhardware/include/hardware

github上可进行代码的下载 
external_bluetooth_bluedroid
packages_apps_Bluetooth
 
android_hardware_libhardware

也可以到Android官网去下载 
android Git repositories

参考: 
<Android BlueDroid
<
BlueDroid的结构和代码分布>

BlueDroid介绍的更多相关文章

  1. BlueDroid介绍 【转】

    转自:http://blog.csdn.net/fen_liu/article/details/41213167 [-] 基本结构 代码区 http://www.cnblogs.com/hzl6255 ...

  2. 【转】BlueDroid介绍

    原文网址:http://www.cnblogs.com/hzl6255/p/3887547.html 自从Android 4.2开始,Android开始使用自己的蓝牙协议栈BlueDroid,而不是b ...

  3. Bluetooth Low Energy介绍

    目录 1. 介绍 2. 协议栈 3. 实现方案 3.1 硬件实现方案 3.2 软件实现方案 1. 介绍 Bluetooth low energy,也称BLE(低功耗蓝牙),在4.0规范中提出 BLE分 ...

  4. Android 4.2蓝牙介绍

    蓝牙一词源于公元十世纪丹麦国王HaraldBlatand名字中的Blatand.Blatand的英文之意就是Blue tooth.这是因为这位让丹麦人引以为傲的国王酷爱吃蓝莓以至于牙龈都被染成蓝色.由 ...

  5. 【转】Android 4.2蓝牙介绍

    原文网址:http://blog.csdn.net/innost/article/details/9187199 Tieto公司某蓝牙大牛写得<程序员>投稿文章 Android 4.2蓝牙 ...

  6. AndroidO bluedroid alarm 机制分析

    bluedroid的alarm 机制实现在osi/osi/src/alarm.cc 中: 这里面实现了很多的接口: alarm_t* alarm_new(const char* name): alar ...

  7. Bluedroid: 蓝牙协议栈源码剖析

    一. 基础知识介绍 1.缩略语 BTIF: Bluetooth Interface BTU : Bluetooth Upper Layer BTM: Bluetooth Manager BTE: Bl ...

  8. ZT Android 4.2蓝牙介绍

    Android 4.2蓝牙介绍 分类: Android开发系列 2013-06-27 14:16 7110人阅读 评论(22) 收藏 举报 目录(?)[-] Android 42蓝牙介绍 一  蓝牙规 ...

  9. Android蓝牙介绍

    1. 介绍 自从Android 4.2开始,Android开始使用自己的蓝牙协议栈BlueDroid,而不是bluez BlueDroid可分为两层: - BTE: Bluetooth Embedde ...

随机推荐

  1. 算法教程(2)zz

    In the previous section we saw how to use vectors to solve geometry problems. Now we are going to le ...

  2. BZOJ4296 : [PA2015]Mistrzostwa

    先不断将度数小于D的点都删去,再找到剩下的图里最大的连通块即可. #include<cstdio> #include<algorithm> #define N 200010 i ...

  3. BZOJ3413 : 匹配

    FDUSC前刷刷题吧.. 本题每个询问就是说将询问串与主串每个后缀匹配,若匹配成功则结束,否则加上lcp的长度 对主串建立后缀树,并用主席树维护DFS序 对于每个询问串,找到最后走到的点fin_nod ...

  4. [Unity2D]精灵

    精灵是Unity2D里面对通过图片纹理实现的游戏对象,通常会是游戏里面的玩家,敌人之类的,在Unity里面创建一个精灵的操作非常简单,直接把图片资源拖放到Hierarachy视图就可以完成了精灵的创建 ...

  5. 斯坦福大学 iOS 开发公开课总结

     斯坦福大学 iOS 开发公开课总结   前言 iPhone 开发相关的教程中最有名的,当数斯坦福大学发布的 "iPhone 开发公开课 " 了.此公开课在以前叫做<iPho ...

  6. 让input不可编辑的方法

    两种方法: disabled="true " 文字会变成灰色,不可编辑. readOnly="true" 文字不会变色,也是不可编辑的 <input na ...

  7. 对thinkphp静态模板表单提交的理解

    看表单的提交<form action="{$Think.const.__SELF__}"  method="post">...</form&g ...

  8. MUI - 预加载

    预加载都是在mui.init({)}中执行的 方式一:preload一次仅能预加载一个页面(除非循环) var subWebview = mui.preload({ url: 'examples/ac ...

  9. Java类型相互转换byte[]类型,blob类型

    在我们的程序开发当中,经常会用到java.sql.Blob.byte[].InputStream之间的相互转换,但在JDK的API当中,又没有直接给我们提供可用的API,下面的程序片段主要就是实现它们 ...

  10. 移动WEB 性能优化方案

    最近一项 研究表明,80%的网民对移动端的浏览体验感到失望,同时,当体验提升时,他们会在智能手机上花费更多的时间. 这不奇怪,因为64%的智能手机用户希望网站可以在4秒内加载完毕,但一半的网站花费了二 ...