"Go" Android 4.2 Bluetooth introduction

Source: Internet
Author: User

Original URL: http://blog.csdn.net/innost/article/details/9187199

Tieto company some Bluetooth Daniel wrote "programmer" articles

Android 4.2 Bluetooth Introduction

The word bluetooth originates from the Blatand in the name of Danish king Haraldblatand in Tenth century A.D. Blatand's English meaning is blue tooth. This is because the Danish king, who prides himself on eating blueberries, is so fond of blueberry that the gums are dyed blue. Because Blatand unified Denmark and Norway, so, as a wireless communication technology, Bluetooth technology is the name of Bluetooth is ambitious. However, before the advent of Android-represented smartphones, Bluetooth has been playing a "chicken" role in the early days of smartphones and even function machines. So, with the rapid development of wireless communication technology and the popularity of Android, Bluetooth can bring us what new changes?

This article will introduce Bluetooth technology to readers from the development history of Bluetooth Core specification, several Bluetooth profiles with the most application foreground and Bluetooth implementation in Android 4.2.

Introduction of a Bluetooth specification

As a general wireless communication technology, the specification is the core of Bluetooth technology. The Bluetooth specification can be divided into two levels, as shown in 1:

Figure 1 Hierarchy of Bluetooth specifications

As shown in Figure 1, the Bluetooth specification includes:

    • Core specification, which specifies the common functionality and protocol hierarchy that Bluetooth devices must implement. It consists of software and hardware modules, and the information and data between the two modules can be passed through the interpretation of the host Control Interface (HCI).
    • Profiles (Bluetooth Application Specification), which sets different specifications for the use of Bluetooth technology from the perspective of the application scenario. This is also the most contact with the public daily life part. Bluetooth supports many profiles, and the following are some of the most widely used Bluetooth application specifications.

1.1 Bluetooth Core Specification Introduction

The core specification is the basis of the Bluetooth protocol family, since the Bluetooth sig,special Interest Group issued the Bluetooth Core Specification 1.0 release in 1999, so far the Bluetooth SIG has released seven important versions. Each version promotes Bluetooth technology toward faster, safer, and more power-saving directions. Table 1 shows the development history of the Bluetooth core specification [①].

Table 1 Bluetooth Core Specification Development Introduction

Version

Specification Release date

Enhanced Features

0.7

October 19, 1998

Baseband, LMP

0.8

January 21, 1999

HCI, L2cap, RFCOMM

0.9

April 30, 1999

Interoperability of OBEX with IrDA

1.0 Draft

July 5, 1999

SDP, TCS

1.0 A

July 26, 1999

The first official version of

1.0 B

October 1, 2000

Security, connectivity compatibility between vendor devices

1.1

February 22, 2001

IEEE 802.15.1

1.2

November 5, 2003

Fast connectivity, adaptive frequency hopping, error detection and process control, and synchronization capabilities

2.0 + EDR

November 9, 2004

EDR transfer rate increased to 2-3mbps

2.1 + EDR

July 26, 2007

Extended query response, easy secure pairing, pause and resume encryption, sniff power saving

3.0 + HS

April 21, 2009

Alternate RF technology, 802.11 protocol adaptation layer, power management, cancellation of UMB applications

4.0 +ble

June 30, 2010

Low power physical layer and link layer, AES encryption, Attribute Protocol (ATT), Generic Attribute profile (GATT), Security Manager (SM)

In table 1,

    • EDR: All called enhanced Data rate. By improving multitasking and the ability to run multiple Bluetooth devices simultaneously, EDR enables Bluetooth devices to transfer speeds up to 3Mbps.
    • HS: All called high speed. HS enables Bluetooth to use WiFi as a transport for data transmission, which supports transmission speeds up to 24Mbps. Its core is based on 802.11, through the integration of the 802.11 protocol adaptation layer, so that the Bluetooth protocol stack according to the different tasks and equipment, choose the right RF.
    • BLE: All called Bluetooth low energy. Bluetooth Specification 4.0 One of the most important features is low power consumption. BLE allows Bluetooth devices to be powered by a button battery to maintain a continuous operation for several years. It is clear that BLE makes Bluetooth devices a very bright application in markets such as clocks, remote control, healthcare and motion sensors.

Although the Bluetooth 4.0 specification was released 3 years ago, the most widely used Bluetooth core specification version is now 3.0. Only iphone 4s,iphone5, Samsung GallaxyS3, S4, Note2 and a few other devices support Bluetooth 4.0 in smartphones. However, Google has added support for 4.0 to Android 4.3. Obviously, with the continuous advancement of Android and the support of many manufacturers, I estimate that the Bluetooth Core Specification 4.0 will be popularized rapidly in a short period of time in the future. Table 2 is a few of the differences between classic Bluetooth and low power Bluetooth:

Table 2 The difference between classic Bluetooth and low power Bluetooth

Technical Specifications

Classic Bluetooth (2.1 &3.0)

Bluetooth Low power (4.0)

Radio frequency

2.4GHz

2.4GHz

Distance

10 m/100 m

30 m

Data rate

1-3mbps

1Mbps

Application throughput

0.7-2.1mbps

0.2Mbps

Total time to send data

100ms

<6ms

Power consumption

1

0.01 to 0.5

Maximum operating current

<30ma

<15MA (max operating time is MA)

Main purpose

Mobile phones, game consoles, headsets, stereo audio streams, cars and PCs, etc.

Mobile phones, gaming consoles, PCs, tables, sports and fitness, healthcare, Automotive, home Electronics, automation and industry, etc.

So what's so special about Bluetooth core spec 4.0? The Bluetooth core specification 4.0 is shown in Module 2:

Figure 2 Module for Bluetooth Core Specification 4.0

As shown in Figure 2, the Bluetooth Core Specification 4.0 module adds the following Bluetooth low power components.

    • GATT represents server properties and client properties that describe the service hierarchy, features, and attributes used in the property server. BLE devices use it as a service discovery for Bluetooth low-power application specifications.
    • ATT implements a point-to-point protocol between a property client and a server. The ATT client sends a command to the ATT server. The ATT server sends replies and notifications to the ATT client.
    • SMP is used to generate cryptographic keys and identity keys for peer protocols. SMP manages the storage of encryption keys and identity keys, which identify Bluetooth devices by generating and parsing the address of the device.
1.2 Bluetooth Application Specification [②]

Bluetooth sig has defined different Bluetooth application specifications according to different application scenarios, and as of now, 40 Bluetooth application specifications have been released. This section describes the five most commonly used Bluetooth application specifications.

1.2.1 Advanced Audio Distribution profile

Advanced Audio distribution profiles, referred to as A2DP (high quality audio distribution specification), defines how stereo-quality audio is streamed from a media source to a receiver. A2DP uses the asynchronous connectionless Link (ACL, Bluetooth asynchronous transmission) channel to transmit high-quality audio content, which relies on generic audio/video distribution profile (GAVDP, Generic audio/Video distribution specification). The A2DP must support low complexity and SUB-BANDCODEC (SBC, low bandwidth codec), optional support for mpeg1,2 audio, MPEG2, 4AAC. A2DP application Scenario 4[1]: A2DP scenario 3 shows:

Figure 3 A2DP Application Scenario

As shown in Figure 3, A2DP has two application scenarios, namely playback and recording.

    • The playback scene is a Bluetooth-enabled player that transmits high-quality audio to a Bluetooth headset or Bluetooth stereo speaker via A2DP.
    • The recording scene is a Bluetooth-enabled microphone that transmits high-quality audio to the Bluetooth recorder via the A2DP.

Specifications related to A2DP are video distribution profile (VDP, video distribution specification), Audio/video Remote Control profile (AVRCP, audio/video operation program specification).

1.2.2 Object Push Profile

The OPP (object Push specification) defines the specification for object exchange between the push server and client based on the generic object Exchange profile (Goep, Common Object Exchange specification). Application Scenario 4 for OPP is as follows:

Figure 4 Application Scenarios for OPP

As shown in Figure 4, OPP is mainly used in mobile phone and mobile phone or between the mobile phone and the computer via Bluetooth file operation. exchangeable file types include phone book, memo, Calendar and other text files, as well as videos, sounds, pictures, music and other multimedia files.

Wi-Fi Direct (WiFi directly connected) [③] and Bluetooth opp have the same function. WiFi direct connection is the WiFi device does not need a wireless router, direct object Exchange. Its advantages are long transmission distance, fast speed, the disadvantage is the high power consumption.

1.2.3 Hands-free Profile

The HFP (HFP, hands-free specification) defines how a Bluetooth audio gateway device can make and receive calls over a Bluetooth hands-free device. HFP Application Scenario 5 shows:

Figure 5 HFP Application Scenario

As shown in Figure 5, HFP consists of two roles:

    • Audio Gateway (AG, AV gateways) and Hands-free unit (HF, hands-free device). AG is the audio input and output device, the typical AG device is the mobile phone. HF is a remote audio input that performs an audio gateway.
    • HFP A common scenario is a car kit that dials and calls through a wireless Bluetooth headset when the car kit and headset are connected to the phone via Bluetooth.

The specifications associated with HFP are headset profile (HSP, headphone specification), Phonebook access profile (PBAP, phone Book Accessibility specification.

1.2.4 Heart Rate Profile

HRP (heart rate specification) locates with a medical/health-related scenario, which enables the Bluetooth device to interact with the heart rate sensor. The relevant scenario 6 shows:

Fig. 6 Role relationship and application scenario of HRP

The figure 6 shows that:

    • The diagram on the left is a role relationship defined by HRP. There are two roles in HRP: a heart rate sensor and a collector. The heart rate sensor is the GATT server, is a device that measures heart rate, it includes heart rate service and device information service, heart rate service to export heart rate measurement data, collector is the GATT client, is a device that receives heart rate measurement data and other data from the heart rate sensor.
    • The image on the right is an HRP application scenario. The heart rate specification allows the device to get heart rate measurements and other data from the heart rate sensor. For example, a nurse or doctor can use a heart rate sensor to measure a patient's heart rate and transmit the heart rate data to a laptop or handheld device.

With the aging of the population, medical equipment and health care personnel resources are insufficient, can use Bluetooth health norms to achieve telemedicine. The author of the Tieto company on the Android platform using the heart rate specification developed a heart rate measurement of the prototype program, detailed information please see the video http://www.youtube.com/watch?v=r_t-hstRgDs&feature= youtu.be.

The health specifications associated with HRP are glucose profile (GLP, blood glucose specification), Blood pressure profile (BLP, blood pressure regulation BLP), and Health thermometer profile (HTP, Healthy Thermometer specification).

1.2.5 Cycling speed and Cadence profile

CSCP (bicycle speed and pace specification) allows people to track speed and rhythm while cycling. CSCP is also based on the GATT specification. The role of the bike speed and cadence specification is shown in Scenario 7:

Figure 7 CSCP role Relationship and application scenario

The Figure 7 shows that:

    • The diagram on the left is a cscp role relationship. CSCP defines two roles: bike speed and cadence sensor and collector. The CSC sensor is a GATT server that reports wheel speed data or shaft speed data to the collector. The CSC sensor includes CSC service and device information service, and the collector is the GATT client, which receives the speed and cadence data of the bicycle from the CSC sensor.
    • The image on the right is the CSCP application scenario. Sensor measurements are widely used in sports and fitness, monitoring and controlling training stress through sensors, and measuring progress in multiple workouts. The bike speed sensor and the bike Cadence sensor are the devices that the user measures the wheel speed or pedal cadence. Any Device implementation CSC specification can be connected to the CSC sensor and receive data.

Specifications related to CSCP are running speed and Cadence profiles (RSCS, pace and pace specification).

Two Bluetooth in Android

Before Android 4.2, Google has been using the official Linux Bluetooth protocol stack, known as the established Open source project BlueZ. BlueZ was actually an open source project, released by Qualcomm in May 2001 under the GPL, which was incorporated into the Linux kernel by the Linux parent Linux Torvalds one months after its release, and became the official Bluetooth protocol stack for the Linux 2.4.6 kernel. With the popularity of Android devices, BlueZ has also been greatly improved and extended. For example, the version of BlueZ in Android 4.1 is upgraded to 4.93, it supports the Bluetooth core specification 4.0, and most of the profiles is implemented.

BlueZ is at its peak now, but not for the time being. Starting with Android 4.2, the Jelly Bean, Google launched the bluedroid that it developed with Broadcom in place of Android source to replace BlueZ. Despite the time and maturity, most handset makers continue to use BlueZ in Android 4.2. But according to the author, BlueZ's founders, Qualcomm will also be in the Android reference design based on its chip to remove BlueZ, and only support bluedroid.

BlueZ the future of how the author aside. However, Bluedroid has its own reasonableness in allowing Qualcomm to take a tack. The most commendable thing about Bluez,bluedroid is that its frame structure has become more concise and clearer. In addition, with the help of HAL (Hardware abstraction layers, Hardware abstraction layer), Bluedroid finally no longer has any involvement with Dbus. Figure 8 shows the framework diagram for Bluedroid in Android 4.2 [④]:

Figure 8 Android 4.2BlueDroid Frame structure diagram

As shown in Figure 8, the Bluedroid framework in Android4.2 consists of the following parts:

    • The application uses the API under the Android.bluetooth package to invoke the system's Bluetooth functionality.
    • Application tier space adds a Bluetooth-named app. It exists as the system's Bluetooth core process. The Bluetooth HAL layer is invoked internally via JNI to complete a variety of Bluetooth requests.
    • Bluetooth Hal also belongs to the Android 4.2 new module, which consists of the Bluetooth core specification hardware abstraction layer and the Bluetooth Application Specification hardware abstraction layer. Due to the isolation of the HAL layer, the upper code can be easily ported to different chip platforms.
    • As the core of the entire Bluetooth service, the Bluetooth stack module consists of the Bluetooth application Layer (abbreviated as BTA) and the Bluetooth Embedded System (abbreviated as BTE). BTA realizes the Bluetooth device management, state management and some application specifications. Bte, through HCI, interacts with the manufacturer's Bluetooth chip to realize the common function of the Bluetooth protocol stack and the related protocol. In addition, the BTE includes a unified kernel interface (GKI) that allows Bluetooth chip manufacturers to quickly and easily migrate Bluetooth protocol stacks to other operating systems or mobile platforms with Gki.
    • Vendor extentions (Vendor extension): Developers can add custom extensions to implement vendor-specific modules and components.

In addition to bluedroid, at this year's Google I/O conference, Google also announced that it will co-support Bluetooth Smart Ready (BSR, Bluetooth Smart) and bluetooth® Smart (BS, Inc.) with Apple, Microsoft and BlackBerry. Bluetooth smart) technology. This technology makes it easy for Bluetooth devices or applications to connect thousands of Bluetooth devices around the world, making life easier for Bluetooth users. BSR and BS are both established in the Bluetooth Core Specification 4.0 and the GATT Application specification. The upcoming Android 4.3 (MR2) supports BSR technology, making it easy for BS developers to connect and publish their devices and applications to Android BSR devices. Bluetooth users use BS's smart application accessories, such as health monitoring or medical devices, to collect data and transfer them to support BSR devices such as smartphones or tablets.

In addition, Bluetooth SIG is also developing the tool Bluetooth application Accelerator (Bluetooth application accelerator). According to reliable news, the tool will be released with Android 4.3 and will help developers quickly develop Bluetooth applications on Android 4.3 to speed up the development time of related products.

Three summary

The Bluetooth core specification, Bluetooth Application Specification and Bluetooth protocol stack bluedroid in Android 4.2 are briefly introduced in this paper.

From the author's understanding of the situation, although the bluedroid to BlueZ a big replacement of the trend, but now it is not perfect for Bluetooth Application specification support. For example, bluedroid only supports AVRCP 1.0, not the latest AVRCP 1.5. Therefore, some domestic chip or mobile phone manufacturers if the early completion of the BlueZ-related modules to bluedroid transplant work, I believe that can help them in the increasingly competitive day-to-day mobile world in the opportunity to pull.

In addition, as a pioneer of mature and low-power wireless communication technology, Bluetooth will play an increasingly important role in the field of wearable devices. At that time, Bluetooth may be really like "teeth" as an integral part of a variety of devices.

[①]http://zh.wikipedia.org/wiki/bluetooth

[②] For details refer to http://developer.bluetooth.org/TechnologyOverview/Pages/Profiles.aspx

[③] about WFD, readers can refer to http://blog.csdn.net/innost/article/details/8474683

[④]http://source.android.com/devices/bluetooth.html

"Go" Android 4.2 Bluetooth introduction

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.