The author's blog address: http://blog.sina.com.cn/samzhen1977
By Sam (zhufeng) sam_code@hotmail.com
Service Discovery
Protocol (SDP) provides a capability for applications to discover which service is available and the features of this service.
Service Discovery Protocol (SDP or Bluetooth
SDP) in the Bluetooth protocol stack, applications in the Bluetooth environment have special meanings and find out which service is available and determine the characteristics of these available services. SDP defines Bluetooth
Bluetooth is available on the client
Server services and their features. This Protocol defines how customers can find services based on specific attributes, so that they do not know any knowledge about available services. SDP provides the party that Discovers New Services
When the customer logs on to a region of the active Bluetooth server, it is available.
Service
The discovery mechanism allows client applications to detect services provided by server applications and obtain service features. Service quality includes service type or service
Class.
SDP also provides communication between the SDP server and the SDP client. SDP
Server maintainsService
Record)
List. EachService Entry
Describes a separate service attribute. SDP
The client can obtain this by sending an SDP request.Service Entry
.
If a client or application attached to the client decides to use a service.
It creates a separate connection to the service provider. SDP
Only the mechanism for detecting services is provided, but the mechanism for using these services is not provided. Sam thinks that SDP only provides a method to detect services.
Use SDP.
Each bluetooth device can have only one SDP server. If a Bluetooth
Device only serves as client, so it does not need SDP server. However, a bluetooth device can act as SDP at the same time.
Server and SDP client.
Service record (service entry)
:
A service is an entity that provides information for another entity to execute actions or control resources. A service can be provided by software, hardware, or software.
All service information is contained in a service record. One service
Record contains a service attribute list.
In an SDP server, each service record has a 32-bit unique data. Generally, this uniqueness is only true for each SDP.
Server. If SDP server S1 and SDP server S2 have the same service
Record. Then their unique values in different SDP sever are not necessarily the same.
SDP does not notify SDP client when the SDP Server adds or reduces service record.
Service attribute (Service
Attribute ):
Each service attribute describes the characteristics of servcie. A service attribute consists of two parts:
Attribute ID + attribute value.
Attribute ID: A 16-bit unsigned integer used to distinguish other attributes in a service record.
Attribute Value: attribute value.
Service class:
Each service is an instance of a service class. Service class defines the service
The service attribute contained in the record. Property ID. The property values are all defined.
Each service class also has a unique ID. This service
The Class Identifier is included in the serviceclassidlist attribute. And is depictedUUID
. Since service
The format and meaning of the attribute in record depend on the service class, And the serviceclassidlist attribute becomes very important.
Searching for service:
Service search transaction (transaction ?) Allow the client to obtain the Service Record
Handle. Once the SDP client obtains the Service Record
Handle, which can request the value of a specific attribute in the record.
If the uuid of a property value, you can find this property by looking for the UUID.
UUID: universally unique identifier. (unique identifier)
The SDP protocol stack uses the request/response mode. Each transmission process includes a request protocol data
Unit (PDU) and a response PDU. SDP use an L2CAP connection to transmit data. Before sending a request
The request PDU cannot be sent to the same server before the response PDU is received.
PDU: Protocol Data Unit
Pdu id: used to identify PDU.
Transactionid:
Used to identify request pud and response pud. It is used to compare whether a response pud corresponds to a request
Pud.