自从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. cocos2d CCArray

    CCArray* arr=CCArray::create(); arr->retain();//如果不加这个东西,CCArray会被清空 arr->addObject(CCSprite:: ...

  2. startInstrumentation asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL

    由于手头上一直没有android level 17及以上版本的手机,有一个shell命令启动脚本的BUG,发生在SDK level 17及以上 API>=17中加入了INTERACT_ACROS ...

  3. Codeforces Round #213 (Div. 2) A. Good Number

    #include <iostream> #include <vector> using namespace std; int main(){ ; cin >> n ...

  4. ios ASIHttpLib 同步请求和异步请求

    1.同步请求可以从因特网请求数据,一旦发送同步请求,程序将停止用户交互,直至服务器返回数据完成,才可以进行下一步操作, 2.异步请求不会阻塞主线程,而会建立一个新的线程来操作,用户发出异步请求后,依然 ...

  5. POJ 2948 Martian Mining(DP)这是POJ第200道,居然没发现

    题目链接 两种矿石,Y和B,Y只能从从右到左,B是从下到上,每个空格只能是上下或者左右,具体看图.求左端+上端最大值. 很容易发现如果想最优,分界线一定是不下降的,分界线上面全是往上,分界线下面都是往 ...

  6. Why NHibernate updates DB on commit of read-only transaction

    http://www.zvolkov.com/clog/2009/07/09/why-nhibernate-updates-db-on-commit-of-read-only-transaction/ ...

  7. npm 国内淘宝镜像cnpm

    某些插件很奇怪,需要用国内的镜像下载才可以 #安装淘宝镜像npm install cnpm -g --registry=https://registry.npm.taobao.org #使用淘宝镜像下 ...

  8. ajax利用json进行服务器与客户端的通信

    1.JQuery中$.ajax()方法参数详解 http://blog.sina.com.cn/s/blog_4f925fc30100la36.html 2.服务器端获取String que=requ ...

  9. WBS练习

    我们把这次团队程序设计分成了6个模块,让每一个同学都能参与其中,然后让每一个人选一个自己喜欢的模块,最后数据库设计这个部分就大家一起来做. Everybody's task allocation is ...

  10. IOS第四天(3:数组的排序和乱序)

    数组的升序和降序 - (void)sortWith:(NSArray *)array { // 排序 array = [array sortedArrayUsingComparator:^NSComp ...