Bluetooth SDP protocol Summary

Source: Internet
Author: User

1. Concept

The SDP protocol allows client applications to discover services provided by existing server applications and the attributes of these services. SDP only provides a mechanism for discovering services and does not provide methods for using these services. Each bluetooth device requires an SDP Service, except for a client-only bluetooth device.
2. servicerecordEach service is represented by servicerecord (with a unique 32bit handle). Each servicerecord is composed of multiple serviceattributes, represented:

The structure of each serviceattribute is as follows: attribute ID is defined by assigned value. For example, the ID of record handle attribute is 0x0000. Because SDP record is composed of many attributes, You can regard record as atributelist, which is often used in the subsequent SDP resposne. The device uses the SDP request to access the related information of these records. Here is a good SDP instance. The service class ID List describes the service type. For example, 0x00000000 indicates that SDP serviceprotocol descriptior list lists the protocols that may use this service. 3. Data ElementData element is a data structure defined in SDP to represent the value field of serviceattribute. Each data element consists of Type + size. Type is defined as follows:
The size is defined as follows:

Several data element examples:

4. Service ClassEach service is an instance of serviceclass, and a service record is an instance of a service class. The service class can represent all the attributes in a record. Each service class has an ID that is included in the value of the attribute serviceclassidlist, which is called UUID. 5. UUIDA globally unique identifier, 128bit. To save storage and transmission costs, some UUID BITs have been fixed, and there are two UUID types: 16 bit and 32 bit. The UUID of these different bits can be converted to each other, as shown in the following formula:

6. SDP data unit format (SDU)Transmission is in the form of big-Endian. The data format is as follows:
Pud IDs are defined as follows:
Transaction ID and length are defined as follows: 7. PDUS in SDP(1) Error PDU

(2) sdp_servicesearchrequest PDU
Servicesearchpattern is composed of UUID, and each UUID is composed of data lement. Maximumservicerecordcount is used to specify the maximum number of returned service records handles. Because this parameter is 2 bytes, the value range is 0x0001 ~ 0 xFFFF. It is necessary to specify this parameter because multiple service records handles matching servicesearchpattern may exist. (3) sdp_servicesearchresponse PDU

Totalservicerecordcount indicates the number of matched service records. The maximum value is 65535 (and cannot be greater than maximumservicerecordcount). If no service record is configured, the value is 0.

Currentservicerecordcount indicates the number of service record handle returned by the current PDU.

Servicerecordhandlelist contains the handles of all service record returned by the current PDU. Each handle is represented by a 32bit data, so the length of this parameter is 4 × currentservicerecordcount bytes.

(4) sdp_serviceattributerequest PDU

Servicerecordhandle is the service record handle of the specific service obtained through sdp_servicesearchresponse.

The maximumattributebycount parameter is used to specify the maximum length of attribute value returned, in bytes.

The third parameter attributeidlist is used to specify a group of attributeidlist. It can be several attributeids. It can be an ID range. If it is the former, the length is 16 bits. If it is the latter, the length is 32 characters.

 

(5) sdp_serviceattributeresponse PDU


Attributelistbytecount is used to indicate the total length of the data contained in the package. The value should be smaller than the maxmumattributebytecount value in sdp_servicesearchrequest.

 

The second parameter attributelists is the list item of the Service Record attribute. Each item contains the attribute ID and attribute value.

(6) sdp_servicesearchattributerequest PDU

Servicesearchpattern is exactly the same as that in sdp_servicesearchrequest.

The second parameter, maxmumattributebytecount, is used to specify the maximum total length of the returned attribute value, in bytes.

The third parameter attributeidlist is used to specify a group of attributeidlist. It can be several attributeids. It can be an ID range. If it is the former, the length is 16 bits. If it is the latter, the length is 32 characters.

 

(7) sdp_servicesearchattributeresponse PDU


Attributelistbytecount is used to indicate the total length of the data contained in the package. The value should be smaller than the maxmumattributebytecount value in sdp_servicesearchrequest.

 

The second parameter attributelists is the list item of the Service Record attribute. Each item contains the attribute ID and attribute value.

 

8. Some attributes

Each service record has two types of attributes: 1. servicerecordhandle (attribute ID 0x00002). serviceclassidlist (attribute ID 0x00001)

(1) servicerecordhandle attribute



(2) serviceclassidlist attribute



(3) servicerecordstate attribute



(4) serviceid attribute


For more attributes, see spec.

Bluetooth SDP protocol Summary

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.