Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Bluetooth SDP overview

[Top]


Purpose

The Symbian OS Bluetooth Service Discovery Protocol (SDP) component provides APIs that allow you to register services to the SDP database or query the database for available services. This functionality is provided by the two SDP APIs:


Required background

Developers using the API need to be familiar with the following:

[Top]


Architectural relationship

A service wishing to advertise on the SDP server must create a session with the SDP server using RSdp. A subsession must be created through RSdpDatabase to access the database. A subsession allows service records and their attributes to be added, deleted and updated in the database. The application uses CSdpAgent to query the services and has to implement MSdpAgentNotifier or MSdpElementBuilder interfaces to handle and organize responses from the server.

SDP Database

The SDP database maintains a list of service records that describe the characteristics of services on the local device that may be used by a remote device via Bluetooth. Each service record contains information about a single service.

SDP Agent

The SDP agent retrieves information from a service record in the SDP database by issuing an SDP request. If an application chooses to use a service, it opens a separate connection with the service provider. For example;

if you need to print a document on your Symbian OS phone you could:

  1. do an SDP search for devices offering a print service.

  2. Should a device be found offering the print service you would further query it for connection details.

  3. With that information your application would then create a Bluetooth connection to the device in question using the connection configuration required and print the document.

[Top]


Description

In this section you will be introduced to the APIs used with service discovery.


Key Concepts

The following terms are used frequently throughout the SDP Overviews and Tutorials.

Service Discovery Database

This is the database that stores information about available services. If you are writing an application to advertise a specific service you will use the SDP Database APIs to register your service and if you are writing an application that needs to search for available services on other devices you will use the SDP Agent APIs.

Service Record

A data record for an individual service in the service discovery database.

Service Record Attribute

An attribute of the service that is stored in the service record. We will discuss service record attributes in greater detail in "SDP Service records and attributes".

UUID

Universally Unique Identifier - See the Service Discovery Protocol Assigned Numbers listing from the Bluetooth SIG for a current list of default UUIDs.

DEA

Data element alternative - A sequence of data elements of which one must be selected.

DES

Data element sequence - A sequence of data elements.


SDP Database

The SDP database provides information about services currently active on a device, together with their characteristics or 'attributes'. It is the service's responsibility to register to or remove itself from the SDP server when necessary.

How SDP Server works

The database contains information such as the characteristics or attributes of the services available on the local device. The SDP database class RSdpDatabase is used to register the service, including its attributes, in a record of the database when it starts and delete the record when it stops or is no longer available.

SDP Server APIs

RSdp

The SDP Server itself is a standalone Symbian OS server to which the sdpdatabase DLL acts as a client (in the standard Symbian OS client\server relationship). RSdp is used to connect to that server.

RSdpDatabase

This is the subsession class which provides access to the SDP Server. It provides methods for creating and deleting service records, and for adding, updating and deleting attributes within those service records.

Further to this the sdpdatabase DLL provides a set of classes representing both a service record and the various types of attributes relating to that service.


SDP Agent

The SDP Agent provides a way to query an SDP database on a remote device, and then to do an attribute request on one of the services found using the CSdpAgent API.

How SDP Agent works

An application uses the SDP Agent to send query requests and receive responses from the remote device's SDP Database using CSdpAgent. The SDP Agent searches a remote device's SDP database for available services and requests information about the attributes of the returned service records.

Note:

SDP Agent APIs

CSdpAgent

This provides an API to the SDP Agent. The SDP Agent does not have a standalone Symbian OS server, but instead uses ESock and the c32 server.

CSdpAgent's API splits into two parts, one which allows service searches to be performed and the other which allows attribute requests to be made on any service found.

Service searches are performed by asking a remote device's SDP database to return all service records that contain all of a supplied set of universally unique identifiers (UUIDs) within their attributes. Service searches return a list of service record handles.

The search results are shown one at a time and a prompt is required to receive the next handle. A service record handle is a number which identifies a service record on a given remote device's SDP database.

Attribute requests are made on a returned service record handle and are used to discover what attributes exist in the associated service record and what information those attributes contain. The attributes returned are limited by providing the attribute request with a set of attribute identifiers. Only attributes with those identifiers will be returned.

The SDP spec provides a set of universally defined attribute identifiers. In order for the attribute information to be returned the SdpAgent DLL includes the SdpDatabase library, which has the secondary purpose of providing the attribute classes.

MSdpAgentNotifier

An applicaton must derive from the MSdpAgentNotifier class to receive information returned from the CSdpAgent.

MSdpElementBuilder

An application can supply its own derived version of MSdpElementBuilder. This allows it to determine how to use, store or ignore attribute information that is retrieved.

[Top]


Typical uses

Following are typical uses for the SDP Database and SDP Agent APIs:


SDP Database

The SDP Database API provides access to the database for creating and maintaining records of services and setting the service attributes.

For more information see:

The typical uses for the SDP Database are:


SDP Agent

The SDP Agent API is used when an application needs to query a remote device for available services and service attributes. It allows creating an object to handle the inquiry results and proceed to the next service record in the list.

For more information see:

The typical uses for the SDP Agent are: