






















Android provides a default Bluetooth stack, BlueDroid, that is divided into two layers: The Bluetooth Embedded System (BTE), which implements the core Bluetooth functionality and the Bluetooth Application Layer (BTA), which communicates with Android framework applications. A Bluetooth system service communicates with the Bluetooth stack through JNI and with applications through Binder IPC. The system service provides developers access to various Bluetooth profiles. The following diagram shows the general structure of the Bluetooth stack:

packages/apps/Bluetooth, is packaged as an Android app and implements the Bluetooth service and profiles at the Android framework layer. This app calls into the HAL layer via JNI.packages/apps/Bluetooth/jni. The JNI code calls into the HAL layer and receives callbacks from the HAL when certain Bluetooth operations occur, such as when devices are discovered.hardware/libhardware/include/hardware/bluetooth.h and hardware/libhardware/include/hardware/bt_*.h files.external/bluetooth/bluedroid. The stack implements the generic Bluetooth HAL as well as customizes it with extensions and configuration changes.The Bluetooth HAL is located in the hardware/libhardware/include/hardware/ directory and consists of the following header files:
bluetooth.h: Contains the HAL for the Bluetooth hardware on the devicebt_av.h: Contains the HAL for the advanced audio profile.bt_hf.h: Contains the HAL for the handsfree profile.bt_hh.h: Contains the HAL for the HID host profilebt_hl.h: Contains the HAL for the health profilebt_pan.h: Contains the HAL for the pan profilebt_sock.h: Contains the HAL for the socket profile.Keep in mind that your Bluetooth implementation is not constrained to the features and profiles exposed in the HAL. You can find the default implementation located in the BlueDroid Bluetooth stack in the external/bluetooth/bluedroid directory, which implements the default HAL and also extra features and customizations.
If you are using the default BlueDroid stack, but want to make a few customizations, you can do the following things:
packages/apps/Bluetooth), and add them to the BlueDroid stack (external/bluetooth/bluedroid).libbt-vendor module. See the vendor/broadcom/libbt-vendor directory for an example.libbt-hci module, which is mainly used for debug tracing. See the external/bluetooth/hci directory for an example.此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。