The Service Discovery Agent is used to perform queries about the Bluetooth services that are available on a specified remote device. It is typically used after the suitable devices that are in range have been identified through the Bluetooth Sockets API.
A service search returns the record handles of services that are of a specified class or classes (identified by UUID numbers). If the search is for more than one UUID, then all the UUIDs must exist in a service record for it to be considered a match. See " Service Discovery Protocol Assigned Numbers " for the common UUIDs.
Service search results are returned through asynchronous callbacks to an MSdpAgentNotifier interface, which the querier must implement, as discussed later.
The steps to perform a service search are as follows:
Set the search pattern on the agent object using CSdpAgent::SetRecordFilterL() .
Call CSdpAgent::NextRecordRequestL() to get search results until results are exhausted, or sufficient results have been obtained.
Querying for a service
The following code fragements may be used, in an appropriate context, to query a remote device's SDP database for Obex file transfer support (for example). The steps are given here:
Create agent. (Assume rcvr implements MSdpAgentNotifier and devAddr is the address of the remote device.)
Create a search pattern and add a service classes to it.
The UUID 0x1106 represents the OBEXFileTransfer service class.
Set the search pattern on the agent.
Get first search result: results in call back to rcvr .
A positive match indicates a device has been found that supports OBEX file transfer. The above code may serve as a template to search for any service class for which you have the UUID value.
The complete set of Service Discovery Agent tutorials are shown below:
Querying the SDP database - This document
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.