Building SDP Records

Profile drivers that advertise their services can build Service Discovery Protocol (SDP) tree hierarchies from scratch and then convert them to an SDP record stream. A profile driver must first call the SdpCreateNodeTree function. The SdpCreateNodeTree function returns an allocated and empty SDP_TREE_ROOT_NODE structure that the profile driver can populate by using the following functions:

SdpAddAttributeToTree

SdpAppendNodeToContainerNode

SdpCreateNodeAlternative

SdpCreateNodeBoolean

SdpCreateNodeInt128

SdpCreateNodeInt16

SdpCreateNodeInt32

SdpCreateNodeInt64

SdpCreateNodeInt8

SdpCreateNodeNil

SdpCreateNodeSequence

SdpCreateNodeString

SdpCreateNodeUInt128

SdpCreateNodeUInt16

SdpCreateNodeUInt32

SdpCreateNodeUInt64

SdpCreateNodeUInt8

SdpCreateNodeUrl

SdpCreateNodeUUID128

SdpCreateNodeUUID16

SdpCreateNodeUUID32

After the profile driver finishes building the tree-based SDP record, it calls the SdpConvertTreeToStream function to produce a raw byte stream version of the SDP record. In this form, the SDP record is ready for the profile driver to publish it to the local SDP server. This process can be more convenient for profile drivers to use than constructing an SDP record as a stream.

The SdpConvertTreeToStream function allocates the necessary memory to store the stream version of the SDP record. When the profile driver no longer requires an SDP record, it must free the memory using ExFreePool.

Additionally, when a profile driver no longer requires the tree-based version of an SDP record, it must call SdpFreeTree to free the memory allocated with the associated SDP_TREE_ROOT_NODE structure.

Profile drivers can obtain a pointer to all of the functions discussed in this topic by querying for the BTHDDI_SDP_PARSE_INTERFACE and BTHDDI_SDP_NODE_INTERFACE interfaces. For more information about how to query for these interfaces, see Querying for Bluetooth Interfaces.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft