Android-4.2 getting started with BlueTooth (1), androidbluetooth

Source: Internet
Author: User

Android-4.2 getting started with BlueTooth (1), androidbluetooth

Bluetooth, Wi-Fi, and 3g are the most common dongles on mobile platforms. Currently, Bluetooth is widely used, especially for smart terminals, multi-point mutual control, Wi-Fi, 3g, and other high resource consumption, infrared has limitations on distance and obstacle, so Bluetooth communication will become more and more widely used in smart TV. here is only a preliminary understanding of the learning, and will be a layer from the kernel to the application


Not easy to write, reproduced need to indicate the source: http://blog.csdn.net/jscese/article/details/41283879


Structural hierarchy:

First look at a level chart:



We can see that it is roughly divided into three parts,

Java:

The top layer is the application framework, which provides the APIs used by the application,

Source code path of the java-layer api class: framework/base/core/java/android/bluetooth

And the Bluetooth services under packages/apps/bluetooth/src/com/android/bluetooth (compiled into the system in the form of javasth.apk)


Native space:

The second layer starts from the local JNI called by the service under packages/apps/Bluetooth and calls the definition in hardware (hardware/libhardware/include/hardware/bluetooth.hhardware/libhardware/include/hardware/bt_*.h),

Bluetooth. default. so is implemented in external/bluetooth/bluedroid

This is the core protocol stack of bluetooth.

It can be seen that the functions are divided into several parts.

There is also an abstract interface protocol layer hci, which is used to connect to the Vendor of different manufacturers. In the Vendor HCI, it is necessary to implement the interface


Kernel:

At the bottom of the kernel layer, it is a general driver of linux. Here, it is the driver module involved in linux's operations on Bluetooth.




I am not familiar with the previous android version, but the online saying that android4.2 is relatively different from the previous ones, the Bluetooth changes a lot, replacing the original BlueZ with Bluedroid (that is, in external ), change the original bluetooth service jni in the framework to the app in the package,

As far as debugging is concerned, the previous/system/bluetooth is useless.




Module diagram:

This is a picture from google's official http://source.android.com/devices/bluetooth.html:






This is from application to vendor, whereBluetooth StackThe module is composedBluetooth Application Layer(BTA) andBluetooth Embedded System(Abbreviated as BTE) is composed of two parts.

BTAImplements bluetooth device management, status management, and some application specifications, and interacts with the Android framework.

BTEHCI interacts with the manufacturer's Bluetooth chip to implement the universal functions of the Bluetooth protocol stack and related protocols. In addition, BTE also includes a unified kernel interface (GKI). Bluetooth chip manufacturers can use GKI to quickly and easily transplant Bluetooth protocol stacks.


Next, we will analyze the module operations at each level and the interaction between upstream and downstream ~











Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.