Learning Linux bluez with cainiao 1

Source: Internet
Author: User

 

Architecture of the Bluetooth protocol stack

 

Underlying hardware module

 

RF

1. Use 2400m ~ 2483.5m band

2. Data is transmitted in FM mode, with a total of 79/EDR and 40/ble hops per second.

3. gfsk (dqpsk and 8 DPSK) modulation

4. channel interval (1 MHz/EDR mode, 2 MHz/ble Mode)

 

Bb

The Bluetooth system provides point-to-point or point-to-point connections. In the connection, devices share physical channels, which are called piconet. One device acts as the master, and other devices act as the slave. The pico network supports a maximum of seven active slave instances. Others are inactive. These inactive slave still need to be synchronized with the master, and the access to the channel is controlled by the master.

For all modulation methods, the sign rate is 1 ms/s. In this way, the value of BR is 1 Mbps, the value of EDR dqpsk is 2 Mbps, and the value of EDR 8dpsk is 3 Mbps.

Package format

Bluetooth address



1. physical channel

2. the Bluetooth physical channel consists of a pseudo-random frequency hopping sequence, a specific slot, an access code, and a packet header code.

3. The two devices need to use a shared channel for communication, so that they must use the same frequency at the same time.

Rate.

4. The hopping sequence is determined by the UAP and lap in the bluetooth device address. The length of timeslot depends on the physical channel, and the maximum hop rate is 1600 hops/s in the connection status, inquiry and Page Status Are 3200 hops/s.

Four physical Channels

1. Basic pico network Channel 2. Adaptive pico network Channel 3. Page scan physical channel 4. inquiryscan physical channel

Physical connection

Includes power control, link monitoring, encryption and link management protocols, channel data rate changes, and multi-slot packet control.

 

Five types of logic Transmission

1. SCO Based on synchronous connection logic transmission 2. ESCO extended SCO 3. ACL asynchronous logic Transmission

4. asb activity slave broadcast 5. PSB parked slave Broadcast

 

LMP

1. Link Management Protocol

2. It is used for link establishment and control. signals are parsed and filtered at The Link Management Layer and are not transmitted to the top layer.

3. The Protocol consists of a series of messages that are transmitted through the ACL-C logic.

Transmission

Package format

 

Main functions

1) Connection Control: Connection establishment, disconnection, power supply control, Adaptive Frequency Hopping, channel classification, link monitoring, channel quality-Driven Data Rate Change, QoS, paging parameters, multi-slot packet control, EDR and lmp pdu encapsulation.

2) Security: authentication, pairing, changing the link key, changing the current link key type, encryption, request encryption keysize, simple and secure pairing.

3) Information Request

4) function Switching

5) Operation Mode

6) logical Transmission

7) Test Mode

HCI

Defines a unified command interface for the Controller

1) Traffic Control

2) HCI Data Format

3) HCI configuration parameters

4) HCI commands and events

HCI Flow Control

Host-to-controller Data Flow Control

Packet-based Data Flow Control

Block-based Data Flow Control

Controller-to-Host Data Flow Control

Command Flow Control

Disconnection

Command error handling

 

 

HCI commands and events

1) Link Control commands

2) link policy commands

3) Control and baseband commands

4) Message Parameters

5) status parameters

6) test command

7) Events

8) Le controller command

 

Intermediate protocol layer

 

L2CAP

Frame chart



Process of Stream Control and retransmission and the creation and processing of the AMP Channel

SDP

This specification defines the local service protocols provided by bluetooth devices.

Some examples of service attributes:

Example service browsing hierarchy

 

 

Services records and Service Attributes

 

Gap

This profile defines the general process of discovering a bluetooth device (idle mode process), and The Link Management (connection mode process) connecting to the bluetooth device ). It also defines processes at different security levels.

Defines the parameter indicating Bluetooth

1) bd_addr

2) bluetooth device name

3) Bluetooth pin

4) device type

Pairing

Security

1) Authentication

2) Security Mode

Idle mode process

Creation process

1) link Creation

2) establish a channel

3) establish a connection

Extended inquiry Response Data Format

Le-related special specifications

 

GATT

GATT is a service framework based on the attribute protocol.

Function: describes how to use the attribute protocol to discover, read, write, and obtain the flag of these attributes, and configure attribute broadcast.

Client: For Service Startup commands and requests, you can receive responses, instructions, and notifications from the service.

Service: receives commands and requests from the client, sends responses, instructions, and notifications to the client.

For example:

Client: computer terminal

Service: Thermometer

Start the program on the computer terminal to configure the thermometer or read the value of the thermometer.

A thermometer provides information about its characteristics, such as its temperature service and other writable features.

User Requirements

1. changeable configurations

2. Discover services and features on devices

3. Read a feature value

4. Write a feature value

5. Notification feature value

6. indicated feature value

SMP

It is used for pairing, authentication, and encryption management between devices.

 

High-end application layer

 

Bluetooth specification


Basic Bluetooth specifications


Example

1. HTP in GATT based

2. a2dp in BR/EDR profiles

3. avdtp in BR/EDR protocols

 

Health thermometer profile (HTP)

 

Advanced Audio distribution profile (a2dp)

 

Audio/Video distribution Transport Protocol (avdtp)

 

Linuxbluez Architecture

 

 

Bt_io of Bluetooth

 

Bluetoothd Startup Process

 

 

Bluetooth scanning device process

 

 

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.