android蓝牙
架构
组件 | 说明 |
---|---|
LibHardware | 指定硬件抽象层(HAL);定义了蓝牙堆栈必须实现的所有HAL接口。 |
蓝牙接口层 | ■实现JNI调用调用的HAL接口 ■维护JNI注册的回调 ■根据蓝牙应用层(BTA)堆栈的回调调用JNI回调 ■提供应用程序的接口 |
BTA(与Android应用程序不同) | ■实现蓝牙配置文件 ■维护配置文件状态机 ■处理堆栈中的事件并将事件发送回接口层 |
BlueDroid堆栈 | 实现核心堆栈和协议 |
HCI层 | ■构建为共享库(libbt-hci) ■充当传输层和堆栈之间的接口■支持HCI H4;例如,将上层的串行驱动程序调用粘合在一起 |
蓝牙应用 | 包括以下内容 ■Bluetooth.apk,包含蓝牙配置文件服务和其他蓝牙功能;进程由设置UI启动 ■BluetoothExt.apk,包含Qualcomm添加的蓝牙配置文件服务;进程由设置UI启动 ■蓝牙中间件组件 |
源码
Contents of folder | Folder path |
---|---|
BlueDroid stack user space component | external/bluetooth/bluedroid/ |
Android Bluetooth profile interface files | frameworks/base/core/java/android/bluetooth |
Android native Java files OBEX profile implementation | frameworks/base/obex/ |
OBEX profile implementation | packages/apps/Bluetooth |
Bluetooth setting application in Java | vendor/qcom/opensource-bluetooth, packages/apps/Settings/src/com/android/settings/bluetooth |
Android Bluetooth profile service files | packages/apps/Bluetooth/src/com/android/bluetooth |
APIs to control the Bluetooth profiles | frameworks/base/core/java/android/bluetooth |
Android Bluetooth JNI files | packages/apps/Bluetooth/jni |
BluetoothExt.apk directory | vendor/qcom/opensource/bluetooth |
SAP application layer files | vendor/qcom/opensource/bluetooth/src/com/android/sap |
Android default messaging application in Java | packages/apps/Mms |
Android default email application in Java | packages/apps/Email |
PBAP files | packages/apps/Bluetooth/src/com/android/bluetooth/pbap |
OPP files | packages/apps/Bluetooth/src/com/android/bluetooth/opp |
FTP files | vendor/qcom/opensource/bluetooth/ftp |
A2DP files | packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/ |
MAP files | /packages/apps/Bluetooth/src/com/android/bluetooth/map/ |
AVRCP CoverArt files | vendor/qcomm/opensource/bluetooth_ext/packages_apps_bluetooth_ext/avrcp |
AVRCP files | packages/apps/Bluetooth/src/com/android/bluetooth/avrcp/ |
源码分析
//system\bt\btif\src\bluetooth.c
EXPORT_SYMBOL struct hw_module_t HAL_MODULE_INFO_SYM = {
.tag = HARDWARE_MODULE_TAG,
.version_major = 1,
.version_minor = 0,
.id = BT_HARDWARE_MODULE_ID,
.name = "Bluetooth Stack",
.author = "The Android Open Source Project",
.methods = &bt_stack_module_methods
};
精彩博客汇总
Android下bluedroid、bluetooth apk介绍 https://blog.csdn.net/zjli321/article/details/52402968
Ubuntu系统(bluez)蓝牙调试 https://blog.csdn.net/zjli321/article/details/52122447
蓝牙协议栈(Bluetooth stack)简介 https://blog.csdn.net/zjli321/article/details/53468429