Bluetooth in Android 4.2 and 4.3 (I): overview

Source: Internet
Author: User

From Android 4.2, the Bluetooth Stack has undergone a major change: From bluez to bluedroid jointly developed by Google and Broadcom (of course, the core part is still Broadcom, google is mainly engaged in the upper-layer framework ). You can use http://source.android.com/devices/javasth.htmlto obtain a new Bluetooth
Stack architecture. In general, there are few relevant documents, mainly by reading the code for in-depth understanding.

Compared with bluez, bluedroid has the following advantages:

  1. The hierarchy is clear. Each profile is unified to the upper-layer interface to facilitate the addition of a new profile; the Hal layer is added to facilitate migration.
  2. With the release removed, the Java code of the framework directly calls the native code of bluedroid.

However, bluedroid in Android 4.2 has fewer functions than bluez in Android 4.1. For example, it does not support avrcp 1.3 and has many bugs. For example, some Bluetooth headsets cannot redial the last phone. Most importantly, bluedroid 4.2 does not support ble. However, there have been many improvements in the just-released Android 4.3, and avrcp 1.3 and ble are supported.

Currently, some Android 4.1 or 4.2 devices support Ble, but they all adopt their own vendor solutions. For example, Bluetooth Stack uses bluez 5.x, and then provides vendor ble Android SDK. now Android 4.3 has been released. From the future development trend, if someone wants to learn Bluetooth in Android, It is recommended not to study bluez any more. It is best to switch to bluedroid.

The distribution of Bluetooth-related codes in Android 4.2 is as follows:

Android. Bluetooth Frameworks/base/CORE/Java/Android/Bluetooth Implements public API for the Bluetooth adapter and profiles
Bluetooth System Service Packages/apps/Bluetooth/src Implements service and profiles at the android fraework Layer
Bluetooth JNI Packages/apps/Bluetooth/JNI Defines Bluetooth adapter and profiles service JNI: callinto Hal and calls es callback from Hal
Bluetooth hal Hardware/libhardware/include/hardware/BT _ *. H files Defines the standard interface that the Android. Bluetooth adapter and profiles APIs
Bluetooth Stack External/Bluetooth/bluedroid Implement Bluetooth Stack: core and profiles

Taking Pan profile as an example, we can look at the distribution of code and the naming of classes and files:

Android. Bluetooth Frameworks Public class implements thpan implements thprofile
Bluetooth System Service Packages/apps Public class panservice extends profileservice
Bluetooth JNI Packages/apps Com_android_bluetooth_pan.cpp
Bluetooth hal Hardware/libhardware Include/hardware/bt_pan.h
Bluetooth Stack External/Bluetooth Bluedroid/btif/src/btif_pan.c (implements bt_pan.h)
    Bluedroid/BTA/PAN (Broadcom BTA)
    Bluedroid/stack/PAN (Broadcom BTE)

Related Article

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.