Keywords: Bluetooth protocol HCI Anatomy HCI Overview HCI Note LMP l2cap SDP RFCOMM
Zhongjun
In the spirit of mutual learning purposes, to share this series of articles, welcome reprint, please specify the author, respect for copyright, thank you
Please correct me if the article is not in the wrong place, learn together
This series is currently intended to:
LMP anatomy + Analog Source code:
Analysis of Bluetooth LMP (i.)
Analysis of Bluetooth LMP (II.)
HCI anatomy + Analog Source code:
Analysis of Bluetooth HCI (II.)
Analysis of Bluetooth HCI (III.)
L2cap anatomy + Analog Source (not completed)
SDP profiling + Analog Source (unfinished)
Rfcomm Anatomy + Analog Source (not completed)
--------------------------------------------------------------------------------------------------------------- ---------------------
Gorgeous split line, go to the chase
--------------------------------------------------------------------------------------------------------------- ---------------------
I. HCI INTRODUCTIONHCI provides a unified interface for accessing Bluetooth control, which, in layman's terms, defines a specific format to control the Bluetooth chip to do the corresponding action (e.g. Inquiry,connect,disconnect)
Another question is why the HCI data chip we send is able to recognize and perform the corresponding action?
-"Very simple, Bluetooth chip also has the HCI protocol code, burning to Bluetooth chip, so we send the data can be the correct parse, perform the corresponding action after the accurate return to US response
Two. Transfer process
Three. FormatAltogether there are four kinds of packets Format,command (Host->control), EVENT (Host<-control), ACL (Host<-->control), SCO (host<-- >control)
1.COMMAND (Host->control)Popular is the Bluetooth protocol stack sent to the chip command, let the chip to perform the corresponding action
Foramt
Parameters:
OCF & OGF is introduced in article two
Parameter Total Length: length of subsequent parameters
For example:
Figure 4
2.EVENT (Host<-control)In layman's terms, the chip receives or executes the status or result returned to the Bluetooth protocol stack after the protocol stack is sent to the chip command.
Format
Parameters:
Event Code: In article Two there is a detailed list
Parameter Total Length: length of subsequent parameters
For example:
3.ACL (Host<-->control)In layman's terms, the data of the upper layer protocol (L2CAP,SDP,RFCOMM,AVDTP,AVCTP,HFP At,a2dp,avrcp,pbap,map,bnep,hid, etc.) is transmitted through this packets.
Format
Parameters:
Handle: There is a Handle handle when a Bluetooth ACL connection is established
PB flag: A picture will understand.
BC flag: A picture will understand.
Parameter Total Length: length of subsequent parameters
Example:
4.SCO (Host<-->control)
In layman's terms, this data format is transmitted more in HFP,HSP calls.
Format
Parameters::
CONNECTION_HANDLE:LMP's handle when establishing SCO link
Packet_status_flag (in packets Sentby the Controller):
Data_total_length: Length of subsequent parameters
Analysis of Bluetooth HCI (i.)