![Symbian Developer Library](../../../../../../../../a_stock/images/mainheading.gif)
![]() |
![]() |
|
You will normally connect to a device to perform a specific task over Bluetooth. Connecting to any random device is not sensible. A better way is to check that the device you are about to establish a connection with is able to provide the required functionality. This document discusses the service discovery options.
There are two ways to inquire about the services on offer on a remote device, they are:
Use MajorClassOfDevice()
to examine the class
of device attribute when making an address inquiry.
Use the Bluetooth Service Discovery Protocol (SDP) Agent APIs.
A broad indicator of the services provided can be read from the class
of device. This could be used, for example, to decide the appropriate icon with
which to represent a device to the user. The class of device is got through
TInquirySockAddr::MajorClassOfDevice()
after an address
inquiry.
How it works:
Perform a device inquiry.
Check the class of device.
Make the connect or pass decision.
When the service discovery provided by the class of device is not adequate to determine which device to select, use the SDP Agent, discussed below.
The Bluetooth SDP database contains information about the services available on a device. Service discovery queries can be used on each device found to establish if it is a suitable choice. SDP queries are performed through the Bluetooth Service Discovery Agent Overview.
You can use the SDP Agent to discover the services available on a device and to look up specific attributes of a service. Several tutorials exist to show how the SDP Agent is used. See Bluetooth Service Discovery Agent Overview for more information.
This tutorial set takes you through all the steps involved in setting up and communicating over a Bluetooth connection.
Inquiring About Services on a Remote Device - This document