Tagged with: android bluetooth JNI communication bluetooth
Because it is a novice, did not study the Bluetooth function, but also do not know Bluetooth in other Android version of the situation, but probably understand that after the Android4.2 Bluetooth module and the previous version of Android there is a lot of access, Specific performance where I do not study, so I am directly to take Android4.2 Bluetooth to study, of course, this also refers to many of the online predecessors of the article: Android Bluetooth (a) to get started. Thank you here!!!
a . Bluetooth module-related code in android 4. the distribution on 2 is as follows:
Settings Below are Bluetoothui part of the code. Mainly responsible for Bluetooth on / off and Bluetooth device search and so on.
packages/apps/bluetooth/
Span style= "font-size:18px" > bluetooth bluetooth . The apk < Span lang= "en-US" >binder framework/base/core/java/android/bluetooth Bluetooth service communication
Kai: by JNI and the external/bluetooth/blueroid Bluetooth protocol communication.
Framework/base/core/java/android/bluetooth
bluetooth for various protocolsAPIprovided to the upper deck for use. we usually use theBluetoothadapter,Bluetoothdevice,Bluetoothsocketwait
External\bluetooth\bluedroid
the official Bluetooth protocol stack, equivalent to BluetoothHAL operation. for the actual operation of all Bluetooth, switch Bluetooth, HCI,ACL,SCO,L2cap,RFComm, Bluetooth for all Profileand so on.
two . The overall structure of Bluetooth is as follows:
1.Applications is the Bluetooth-related upper-level App UI section, here we mainly analyze the Settings app under the wide Bluetooth section.
The 2.Java Framework is primarily the AP I interface of the Bluetooth service, which is provided to the settings APP under the Bluetooth settings call.
The 3.Bluetooth APP is the packages/apps/bluetooth/ code below that provides the core Bluetooth service, primarily through JNI calls to the Bluedroid Bluetooth protocol stack .
4.Bluedroid Bluetooth protocol stack, is external\bluetooth\bluedroid The following code, the implementation of specific Bluetooth open, close, find and other functions.
Iii. open enable with Bluetooth for an example simply explain the whole process of working with Bluetooth:
Settings UI Enable ()----->> framwork Bluetoothmanagerservice enable ()------>>> Bluetooth APP Adapterservice enable ()------>>>blueDroid enablenative ().
Next, detailed analysis of the entire Bluetooth open process, deep into the whole code system , the premise of a complete Android4.2 code.
Android 4.2 Bluetooth Analysis Summary (i)