Services must be registered in the SDP database before they can be found by an SDP Agent query.
After connecting to the SDP database , a service record can be created. You do this by supplying the UUID for the service class of the record. As the service class may be a single UUID or a list of UUIDs in the form of a DES, there are two overloaded functions.
The steps to register a service are as follows:
Create a blank service record object, TSdpServRecordHandle .
If the service class attribute should be a single UUID, create and set a TUUID object. If the attribute should be a list of UUIDs, create a attribute list object, CSdpAttrValueDES or CSdpAttrValueDEA , and call MSdpElementBuilder::BuildUUIDL() repeatedly to add UUIDs to the list.
Call RSdpDatabase::CreateServiceRecordL() on an open subsession. On return, the record handle object holds a handle to the service record.
The following example creates a service record with a single service class.
The following example creates a service record with a list of service classes.
Create a blank record handle
Create a list of service class UUIDs
CSdpAttrValueDES* UUIDlist = CSdpAttrValueDES::NewDESL(NULL); CleanupStack::PushL(UUIDlist); UUIDlist ->StartListL() ->BuildUUIDL(TUUID(TUint32(0x20002000))) ->BuildUUIDL(TUUID(TUint32(0x11112222), TUint32(0x33334444), TUint32(0x55556666), TUint32(0x77778888))) ->BuildUUIDL(TUUID(TUint32(0x40000))) ->EndListL();
Enter record into the database
The examples shows UUIDs of varying length. Both 16- and 32-bit integers may be used, which are assumed to be offsets from the Bluetooth base UUID.
The complete set of Service Discovery Database tutorials are shown below:
Registering Services - 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.