Inquiring about Services on a Remote Device

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.

How to inquire about services on a remote device

There are two ways to inquire about the services on offer on a remote device, they are:

  1. Use MajorClassOfDevice() to examine the class of device attribute when making an address inquiry.

  2. Use the Bluetooth Service Discovery Protocol (SDP) Agent APIs.

Examining the Class of Device

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:

  1. Perform a device inquiry.

  2. Check the class of device.

  3. 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.

Using the Bluetooth SDP Agent

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.

Where Next?

This tutorial set takes you through all the steps involved in setting up and communicating over a Bluetooth connection.