4822 views|1 replies

7422

Posts

2

Resources
The OP
 

Bluetooth protocol specifications (HCI, L2CAP, SDP, RFOCMM) [Copy link]

This post was last edited by freebsder on 2019-4-27 14:28
1. Host Control Interface Protocol HCI
Bluetooth Host-Host Control Model
Bluetooth Software Protocol Stack Data Transmission Process:
1. Bluetooth controller interface data grouping: command grouping, event grouping, data grouping
(1), command grouping
For example: Accpet Connection Request
Opcode is: 0x0409
Parameter length is: 07
The Bluetooth address in the parameter is: 00:0d:fd:5f:16:9f
Role: Slave device 0x01
Big endian data mode
Instruction: 09 04 07 9f 16 5f fd 0d 00 01
(2), Event Grouping
As shown above:
Opcode: 0x0409
Status: 0x00
Total length: 4 bytes
Command status: 0x0f
(3), Data grouping
ACL data grouping
Note: PB Packet_Boundary BC Broadcast Flag
SCO data packet
(4), RS232 packet indicator:411371[/attach]
2. HCI control commands
(1). Link control instructions
(2). Link strategy instructions
(3). Host controller and baseband instructions
(4). Information instruction parameters
(5) Status command parameters
(6) Test commands
(7) Error codes
II. Logical Link Control and Adaptation Protocol L2CAP
L2CAP is located above the baseband and converts the baseband data packets into a data packet format that is convenient for high-level applications, and provides functions such as protocol multiplexing and service quality exchange. L2CAP only supports ACL data transmission, not SCO data.
L2CAP itself does not provide a mechanism to enhance channel reliability and ensure data integrity. Its channel reliability depends on the baseband. 1. Protocol multiplexing: The underlying transport protocol does not provide a multiplexing mechanism for the higher-level protocol. Therefore, L2CAP supports higher-level protocol multiplexing. The L2CAP layer can distinguish between SDP, RFCOMM, TCS, etc. on it.
2. Segmentation and reassembly: The L2CAP layer helps to realize the mutual transmission of short PDU of baseband and long PDU of high layer. L2CAP itself does not complete the segmentation and reassembly of any PDU. The specific segmentation and reassembly is completed by the lower layer and the upper layer.
3. Exchange of Quality of Service Information: During the process of establishing a Bluetooth connection, L2CAP allows the exchange of the quality of service expected by Bluetooth. After the establishment is completed, the quality of service is guaranteed by monitoring the usage of resources.
4. Group abstraction: L2CAP ignores the concept of address group and only cares about data.
There are three types of L2CAP channels:
A. Connection-Oriented CO, used for data communication between two devices.
B. Connectionless CL, used to broadcast data to a group of devices. CID is a fixed value: 0x0002. C. Signaling channel: Signaling is used to create a CO channel. The characteristics of the CO channel can be changed through negotiation. L2CAP_PDU of the CL channel 411382 PSM is a protocol/service multiplexer, which is generally used for multiplexing of intermediary protocols such as SDP, RFCOMM, and TCS. A value less than 0x1000, 0x0001 corresponds to SDP, 0x0003 corresponds to RFCOMM, and 0x0005 corresponds to TCS. (1) Bluetooth Logical Link Control and Adaptation Protocol signaling: The CID of the L2CAP signaling channel is 0x0001. Signaling instruction packet: 411383 Signaling instruction format: As shown in the figure above, in an L2CAP signaling, 1 is the L2CAP packet header, 2 is the signaling instruction header, and 3 is the data part. L2CAP: Role: Master Address: 11 PDULength: 6 //The length of the command, the value is 06 00 ChannelID: 0x0001 (Signaling) //L2CAP signaling channel, the value is 01 00 Code: Information request //Information request, the value is 0a Identifier: 1 //Identifier, the value is 01 CommandLength: 2 //Command length, the value is 02 00 InfoType:Extended features supported//02 00
So the complete instruction is:
06 00 01 00 0a 01 02 00 02 00
Other signaling operations are as follows:
L2CAP signaling instruction code:
1) Connection request Connection_RequestCode=0x02 For example: SDP connection request https://img-blog.csdn.net/20140730194840110?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveHViaW4zNDE3MTk=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast As shown in the red box above: 2) Connection response Connection_ResponseCode=0x03 For example: SDP request response https://img-blog.csdn.net/20140730194933384?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveHViaW4zNDE3MTk=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast[/img]
如上面红The box shows:
0x03
3
8
0x0040
0x0040
0x0000
(2) MTU MAXIMUM TRANSMISSION UNIT Maximum transmission unit. L2CAP applications must support a minimum MTU of 48 bytes. The default value is 672. =left](3) QoS Quality of Service
3. Service Discovery Protocol SDP
SDP has two service discovery modes:
1) Service search: query services with specific service attributes; 2) Service browsing: simply browse all available services. (1) PDU format: (Protocol Data Unit) PDU ID (1 byte) Transaction ID (2 bytes) /align]
Parameter length (2 bytes)
Parameter 1
...
Parameter N [align] Different PDU IDs implement different functions of SDP, as summarized in the following table: Value Parameter Description 0x00
Reserved
0x01
SDP_ErrorResponse[ Error Response 0x02 SDP_ServiceSearchRequest 0x03 SDP_ServiceSearchResponse align]
Service Search Response
0x04
SDP_ServiceAttributeRequest
Service Attribute Request
]0x05
SDP_ServiceAttributeResponse
Service Attribute Response
0x06
SDP_ServiceSearchAttributeRequest
=left]Service Search Attribute Request
0x07
SDP_ServiceSearchAttributeResponse
Service Search Attribute Response 0x08-0xff Reserved (2) Service Record Table The SDP service record table describes each service. Each record contains a service handle and a set of service attributes: Record Attributes: Service Record Handle Service Handle; Attribute Service Attribute; IV. Serial Port Emulation Protocol RFCOMM /align]
Provides an environment interface for traditional applications built on serial ports, so that they can work on Bluetooth wireless communication links with relatively few protocol changes. Multi-channel serial port simulation is an important function of RFCOMM Through a multiplexer, an L2CAP link can support multiple serial applications simultaneously. Serial port simulation between two devices: RFCOMM can support up to 60 simulated serial ports between two Bluetooth devices. left]RFCOMM frame types are as follows:
SABM
Asynchronous Balanced Mode Setting Command
UA
Unnumbered confirmation response DM Disconnect mode response DISC Open Connection Command UIH Unnumbered Message Command and Response with Header CheckRFCOMM can support up to 60 simulated serial ports between two Bluetooth devices. RFCOMM frame types are as follows: SABM UA Unnumbered confirmation response DM Disconnection mode response DISC Disconnection command UIH Unnumbered information command and response with header checksumRFCOMM can support up to 60 simulated serial ports between two Bluetooth devices. RFCOMM frame types are as follows: SABM UA Unnumbered confirmation response DM Disconnection mode response DISC Disconnection command UIH Unnumbered information command and response with header checksum


3.png (34.7 KB, downloads: 0)

3.png

8.png (19.73 KB, downloads: 0)

8.png

9.png (19.88 KB, downloads: 0)

9.png

10.png (20.31 KB, downloads: 0)

10.png

11.png (59.96 KB, downloads: 0)

11.png

12.png (20.1 KB, downloads: 0)

12.png

13.png (24.02 KB, downloads: 0)

13.png

14.png (18.87 KB, downloads: 0)

14.png
This post is from RF/Wirelessly

Latest reply

Thanks for sharing!  Details Published on 2019-4-28 08:29
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 

173

Posts

0

Resources
2
 
Thanks for sharing!
This post is from RF/Wirelessly
Personal signature服务器大全
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

快速回复 返回顶部 Return list