Bluetooth in Android 4.2 and 4.3(一):综述
从Android 4.2开始,Bluetooth stack发生了重大改变:从Bluez换成了由Google和Broadcom联合开发的Bluedroid(当然,核心的部分还是Broadcom的,Google主要是做了和上层Framework相关的部分)。通过http://source.android.com/devices/bluetooth.html可以大概了解新的Bluetooth stack的架构,总的来说相关文档很少,主要靠阅读代码进行深入了解。
Bluedroid和Bluez相比,有如下优点:
- 层次结构清晰。各个profile对上层接口统一,便于增加新的profile;增加了HAL层,便于移植。
- 去掉了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(一):综述的更多相关文章
- Bluetooth in Android 4.2 and 4.3(三):Enable Bluetooth
以下是基于Android 4.2代码,对Bluetooth BR/EDR Enable process的分析.BluetoothAdapter类代表的是local device Bluetooth a ...
- Android使用BLE(低功耗蓝牙,Bluetooth Low Energy)
背景 在学习BLE的过程中,积累了一些心得的DEMO,放到Github,形成本文.感兴趣的同学可以下载到源代码. github: https://github.com/vir56k/bluetooth ...
- android -- 蓝牙 bluetooth (四)OPP文件传输
在前面android -- 蓝牙 bluetooth (一) 入门文章结尾中提到了会按四个方面来写这系列的文章,前面已写了蓝牙打开和蓝牙搜索,这次一起来看下蓝牙文件分享的流程,也就是蓝牙应用opp目录 ...
- android 蓝牙连接与通讯(Bluetooth)
最近做了一个小项目,关于蓝牙的一个智能硬件.其中涉及到了蓝牙模块的操作.特记下蓝牙模块的操作过程.只记录下关于蓝牙部分的操作,具体业务逻辑不涉及其中.重点是记录下蓝牙的扫描.链接.通讯. 在使用蓝牙模 ...
- 深入了解Android蓝牙Bluetooth——《进阶篇》
在 [深入了解Android蓝牙Bluetooth--<基础篇>](http://blog.csdn.net/androidstarjack/article/details/6046846 ...
- 【Android 应用开发】Android之Bluetooth编程
Android Bluetopth 编程大牛文章 http://my.oschina.net/u/994235/blog?catalog=313604 ViewGroup 相关资料 : http:// ...
- Android BLE与终端通信(二)——Android Bluetooth基础科普以及搜索蓝牙设备显示列表
Android BLE与终端通信(二)--Android Bluetooth基础搜索蓝牙设备显示列表 摘要 第一篇算是个热身,这一片开始来写些硬菜了,这篇就是实际和蓝牙打交道了,所以要用到真机调试哟, ...
- Android BLE与终端通信(一)——Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址
Android BLE与终端通信(一)--Android Bluetooth基础API以及简单使用获取本地蓝牙名称地址 Hello,工作需要,也必须开始向BLE方向学习了,公司的核心技术就是BLE终端 ...
- Android学习笔记——Bluetooth的使用
蓝牙应该是现在每一部智能手机的标配了.想当年在山寨机横行的年代里,蓝牙都可以做为一个卖点~~~ 废话不多说了,进入正题: 使用蓝牙功能是需要权限的,关于蓝牙的权限也就两个: <uses-perm ...
随机推荐
- mac 安装使用 webp 来压缩图片
学习性网站: https://developers.google.com/speed/webp/docs/cwebp http://www.w3ctech.com//topic/1672 https: ...
- 新浪微博顶部新评论提示层效果——position:fixed
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 部署在IIS服务器的asp.net 网站,禁止访问指定类型文件
网站上的一些文件不希望用户访问,可以通过下面的方式简单实现.不需写代码(在IIS6下试验过). 第一步,在IIS中实现映射. 哪些文件需要特殊处理. 通俗的将就是将哪种类型的文件交给特定的工厂来处理. ...
- Android Volley源码分析
今天来顺手分析一下谷歌的volley http通信框架.首先从github上 下载volley的源码, 然后新建你自己的工程以后 选择import module 然后选择volley. 最后还需要更改 ...
- 深入学习Struts2
本部分主要介绍struts.xml的常用配置. 1.1. 包配置: Struts2框架中核心组件就是Action.拦截器等,Struts2框架使用包来管理Action和拦截器等.每个包就是多个A ...
- IOS 单例 创建方式
@implementation Me static Car *sharedInstance= nil;//声明一个静态对象引用并赋为nil +(Me *) sharedInstance//声明类方法( ...
- Android应用开发学习—Toast使用方法大全
Toast 是一个 View 视图,快速的为用户显示少量的信息. Toast 在应用程序上浮动显示信息给用户,它永远不会获得焦点,不影响用户的输入等操作,主要用于 一些帮助 / 提示. Toast 最 ...
- [Everyday Mathematics]20150215
设 $n,k$ 是正整数, 使得 $x^{2k}-x^k+1$ 整除 $x^{2n}+x^n+1$. 试证: $x^{2k}+x^k+1$ 整除 $x^{2n}+x^n+1$.
- ylb:SQL 常用函数
ylbtech-SQL Server: SQL Server-SQL 常用函数 1,数学函数 2,日期和时间函数 3,字符串函数 4,转换函数 1,ylb:SQL 常用函数返回顶部 1,数学函数 2, ...
- delphi 中 $是什么意思 串口中使用
delphi 中 $是什么意思? 比如:$41----$5A 意识是26个字母, 可以用$来表示? $在delphi 中还可以怎么用?1.表示16进制,$41就是65,第一个字母的ASCII值 pro ...