从Android 4.2开始,Bluetooth stack发生了重大改变:从Bluez换成了由Google和Broadcom联合开发的Bluedroid(当然,核心的部分还是Broadcom的,Google主要是做了和上层Framework相关的部分)。通过http://source.android.com/devices/bluetooth.html可以大概了解新的Bluetooth stack的架构,总的来说相关文档很少,主要靠阅读代码进行深入了解。

Bluedroid和Bluez相比,有如下优点:

  1. 层次结构清晰。各个profile对上层接口统一,便于增加新的profile;增加了HAL层,便于移植。
  2. 去掉了DBus,Framework的Java代码直接调用到Bluedroid的Native代码。

但是Android 4.2中的Bluedroid与Android 4.1中的Bluez相比,功能要少,例如不支持AVRCP 1.3; Bug较多,例如某些蓝牙耳机不能重拨最后一个电话。最重要的是4.2的Bluedroid不支持BLE。不过在刚刚发布的Android 4.3中已经有了很多改进,AVRCP 1.3和BLE都得到了支持。

目前有一些Android 4.1或4.2的设备是支持BLE的,但是都是采用的Vendor自己的解决方案,比如Bluetooth stack采用Bluez 5.x,再提供Vendor BLE Android SDK. 现在Android 4.3已经发布,从未来发展趋势来看,如果有人要学习Bluetooth in Android,建议不要再研究Bluez,最好转向Bluedroid。

以下是Android 4.2中Bluetooth相关代码之分布:

android.bluetooth frameworks/base/core/java/android/bluetooth implements public API for the Bluetooth adapter and profiles
Bluetooth system service packages/apps/Bluetooth/src implements service and profiles at the Android fraework layer
Bluetooth JNI packages/apps/Bluetooth/jni defines Bluetooth adapter and profiles service JNI: calls into HAL and receives callback from HAL
Bluetooth HAL hardware/libhardware/include/hardware/bt_*.h files defines the standard interface that the android.bluetooth adapter and  profiles APIs
Bluetooth stack external/bluetooth/bluedroid implement bluetooth stack: core and profiles

以Pan profile为例,我们可以看看代码的具体分布和类及文件的命名方式:

android.bluetooth frameworks public class BluetoothPan implements BluetoothProfile
Bluetooth System Service packages/apps public class PanService extends ProfileService
Bluetooth JNI packages/apps com_android_bluetooth_pan.cpp
Bluetooth HAL hardware/libhardware include/hardware/bt_pan.h
Bluetooth stack external/bluetooth bluedroid/btif/src/btif_pan.c(implements bt_pan.h)
    bluedroid/bta/pan (Broadcom BTA)
    bluedroid/stack/pan (Broadcom BTE)

Bluetooth in Android 4.2 and 4.3(一):综述的更多相关文章

  1. Bluetooth in Android 4.2 and 4.3(三):Enable Bluetooth

    以下是基于Android 4.2代码,对Bluetooth BR/EDR Enable process的分析.BluetoothAdapter类代表的是local device Bluetooth a ...

  2. Android使用BLE(低功耗蓝牙,Bluetooth Low Energy)

    背景 在学习BLE的过程中,积累了一些心得的DEMO,放到Github,形成本文.感兴趣的同学可以下载到源代码. github: https://github.com/vir56k/bluetooth ...

  3. android -- 蓝牙 bluetooth (四)OPP文件传输

    在前面android -- 蓝牙 bluetooth (一) 入门文章结尾中提到了会按四个方面来写这系列的文章,前面已写了蓝牙打开和蓝牙搜索,这次一起来看下蓝牙文件分享的流程,也就是蓝牙应用opp目录 ...

  4. android 蓝牙连接与通讯(Bluetooth)

    最近做了一个小项目,关于蓝牙的一个智能硬件.其中涉及到了蓝牙模块的操作.特记下蓝牙模块的操作过程.只记录下关于蓝牙部分的操作,具体业务逻辑不涉及其中.重点是记录下蓝牙的扫描.链接.通讯. 在使用蓝牙模 ...

  5. 深入了解Android蓝牙Bluetooth——《进阶篇》

    在 [深入了解Android蓝牙Bluetooth--<基础篇>](http://blog.csdn.net/androidstarjack/article/details/6046846 ...

  6. 【Android 应用开发】Android之Bluetooth编程

    Android Bluetopth 编程大牛文章 http://my.oschina.net/u/994235/blog?catalog=313604 ViewGroup 相关资料 : http:// ...

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

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

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

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

  9. Android学习笔记——Bluetooth的使用

    蓝牙应该是现在每一部智能手机的标配了.想当年在山寨机横行的年代里,蓝牙都可以做为一个卖点~~~ 废话不多说了,进入正题: 使用蓝牙功能是需要权限的,关于蓝牙的权限也就两个: <uses-perm ...

随机推荐

  1. reverse(), extend(), sort() methods of list

    >>> l = list('sdf') >>> l ['s', 'd', 'f'] >>> id(l) 4520422000 >>&g ...

  2. Excel学习笔记杂荟

    Excel学习 一.工具->选项 可以对整个excel里面的东西进行编辑,里面有隐藏行号,下拉档等选项,有文档作者信息. 隐藏网格等 二.单元格内容比较大可以右击单元格->设置单元格格式- ...

  3. Be quiet

    Be quiet */--> UP | HOME Be quiet Table of Contents 1 Be quiet 1 Be quiet 最近心情有点不太好,各方面原因.主要是25岁是 ...

  4. UIColor,CGColor,CIColor三者的区别和联系

    UIColor,CGColor,CIColor三者的区别和联系((转)) 最近看了看CoreGraphics的东西,看到关于CGColor的东西,于是就想着顺便看看UIColor,CIColor,弄清 ...

  5. 隐藏 php apache 的版本号

    隐藏Apache版本信息 找到apache安装路径,譬如\Apache\conf\httpd.conf 修改httpd.conf ServerTokens ProductOnly ServerSign ...

  6. 【转】 [C/OC的那点事儿]NSMutableArray排序的三种实现(依赖学生成绩管理系统).

    原文网址:http://blog.csdn.net/ministarler/article/details/17018839 c语言实现的学生成绩管理系统是面向过程的,而OC实现的学生成绩管理系统则是 ...

  7. slidingMenu默认显示菜单

    关键词:slidingmenu 默认 显示 打开 菜单 showMenu toggle 问题:要在Activity一打开就显示slidingmenu. 解决: 搜索“slidingmenu 默认打开” ...

  8. c排序算法大全

    排序算法是一种基本并且常用的算法.由于实际工作中处理的数量巨大,所以排序算法 对算法本身的速度要求很高. 而一般我们所谓的算法的性能主要是指算法的复杂度,一般用O方法来表示.在后面将给出详细的说明.& ...

  9. 360网站卫士推出google字体加速方案

    最近,有网友反映称谷歌官网域名google.com.谷歌香港google.com.hk都打不开, ping了一下google.com和google.com.hk两个域名的服务器情况,最后ping出来的 ...

  10. [转]linux的du和df命令

    转自:http://blog.csdn.net/kmesg/article/details/6570800 今天也有同学问我Linux下查看目录大小的命令,现在也将前阵子学习到du/df两个命令总结一 ...