天天看點

BlueDroid介紹 【轉】

<a href="http://blog.csdn.net/fen_liu/article/details/41213167#">[-]</a>

<a href="http://blog.csdn.net/fen_liu/article/details/41213167#t0">基本結構</a>

<a href="http://blog.csdn.net/fen_liu/article/details/41213167#t1">代碼區</a>

http://www.cnblogs.com/hzl6255/p/3887547.html

BlueDroid可分為兩層:

- BTE: Bluetooth Embedded System

- BTA: Bluetooth Application Layer

BTE實作了核心的藍牙功能,BTA則與架構的應用程式進行通信

下圖顯示了協定棧的基本結構

BlueDroid介紹 【轉】

Application framework

其實作原理是通過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的标準接口

其頭檔案位于<code>hardware/libhardware/include/hardware</code>

Bluetooth stack

藍牙協定棧,位于external/bluetooth/bluedroid

實作了通用的藍牙HAL及可配置元件

Vendor extensions

廠商可通過建立libbt-vendor子產品來自定義擴充接口和HCI層來友善調試

如下網址可線上檢視相關代碼

<a href="http://androidxref.com/4.4.4_r1/xref/" target="_blank">AndroidXref</a>

<a href="http://androidxref.com/4.4.4_r1/xref/external/bluetooth/bluedroid/" target="_blank">external/bluetooth/bluedroid</a>

<a href="http://androidxref.com/4.4.4_r1/xref/packages/apps/Bluetooth/" target="_blank">packages/apps/Bluetooth</a>

<a href="http://androidxref.com/4.4.4_r1/xref/hardware/libhardware/include/hardware/" target="_blank">hardware/libhardware/include/hardware</a>

github上可進行代碼的下載下傳

<a href="https://github.com/CyanogenMod/android_external_bluetooth_bluedroid" target="_blank">external_bluetooth_bluedroid</a>

<a href="https://github.com/CyanogenMod/android_packages_apps_Bluetooth" target="_blank">packages_apps_Bluetooth</a>

<a href="https://github.com/CyanogenMod/android_hardware_libhardware" target="_blank">android_hardware_libhardware</a>

也可以到Android官網去下載下傳

<a href="https://android.googlesource.com/" target="_blank">android Git repositories</a>

參考:

【新浪微網誌】 張昺華--sky

【twitter】 @sky2030_

【facebook】 張昺華 zhangbinghua

本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接配接,否則保留追究法律責任的權利.

繼續閱讀