Accessing SDP Service Information
After a profile driver submits a Service Discovery Protocol (SDP) record to advertise its services with SDP, other devices can discover these services by either searching specifically for the record or by browsing to find it.
To search for SDP records, a client profile driver must first use IOCTL_BTH_SDP_CONNECT to connect to the SDP service of the remote device.
A profile driver can then use one of the following IOCTLs to perform the actual SDP record search:
IOCTL_BTH_SDP_ATTRIBUTE_SEARCH obtains all components of a remote SDP record that fall into a specified SDP attribute range.
IOCTL_BTH_SDP_SERVICE_SEARCH issues an SDP request to the remote device, requesting handles to SDP records of a particular service class or classes.
IOCTL_BTH_SDP_SERVICE_ATTRIBUTE_SEARCH combines IOCTL_BTH_SDP_ATTRIBUTE_SEARCH and IOCTL_BTH_SDP_SERVICE_ATTRIBUTE_SEARCH and returns a usable SDP record stream in a single operation.
Profile drivers can use IOCTL_BTH_SDP_SERVICE_SEARCH and IOCTL_BTH_SDP_ATTRIBUTE_SEARCH to reduce the amount of SDP traffic transmitted across a Bluetooth link and can extract necessary information by using a small number of maximum transfer units (MTUs). If neither of these issues is of great concern, it can be more convenient for profile drivers to call IOCTL_BTH_SDP_SERVICE_ATTRIBUTE_SEARCH.
After the profile driver has obtained the dynamic protocol/service multiplexer (PSM) for the desired service, it can connect to the remote service by using the BRB_L2CA_OPEN_CHANNEL BRB.
Note If the service has a fixed PSM, which many do, L2CAP client profile drivers do not need to use SDP to obtain the PSM. However, L2CAP client profile drivers can still use SDP to get the SDP server attributes.
When the profile driver finishes searching, it should use IOCTL_BTH_SDP_DISCONNECT to disconnect from the remote SDP server.