网址:http://blog.csdn.net/yuanzhangmei1/article/details/25057587
从Android 4.2开始,Bluetooth stack发生了重大改变:从Bluez换成了由Google和Broadcom联合开发的Bluedroid(当然,核心的部分还是Broadcom的,Google主要是做了和上层Framework相关的部分)。通过
http://source.android.com/devices/bluetooth.html
可以大概了解新的Bluetooth stack的架构,总的来说相关文档很少,主要靠阅读代码进行深入了解。
Bluedroid和Bluez相比,有如下优点:
目前有一些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相关代码之分布:
以Pan profile为例,我们可以看看代码的具体分布和类及文件的命名方式:
- 层次结构清晰。各个profile对上层接口统一,便于增加新的profile;增加了HAL层,便于移植。
- 去掉了DBus,Framework的Java代码直接调用到Bluedroid的Native代码。
目前有一些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相关代码之分布:
以Pan profile为例,我们可以看看代码的具体分布和类及文件的命名方式: