Setting service record attributes

Service records are made up of attributes that collectively describe the service.

How to set an attribute in a service record

Attributes in a service record are set or altered by calling RSdpDatabase::UpdateAttributeL().

Example

The following example adds an attribute with ID 0x0102, the attribute that specifies the service provider name (0x0002 for the ProviderName attribute plus the language base offset, which for the primary language is 0x0100), in the service record identified by recordHandle:

// Assumes sdpSubSession is an open subsession to the database,
// and recordHandle is the service record

_LIT8(KProvName,"Symbian Ltd.");
CSdpAttrValueString* attrVal = CSdpAttrValueString::NewStringL(KProvName);
CleanupStack::PushL(attrVal);
sdpSubSession.UpdateAttributeL(recordHandle, 0x0102, *attrVal);
CleanupStack::PopAndDestroy();

Note

UpdateAttributeL() places no constraints on the contents of service records, and allows attributes of any value or content. You should ensure that the correct attribute IDs are used.

Where next?

The complete set of Service Discovery Database tutorials are shown below:

  1. Connecting to the service discovery database

  2. Handling SDP attributes

  3. Registering Services

  4. Setting service record attributes - This document

  5. SDP Service records and attributes

Also refer to the Bluetooth Service Discovery Database overview and the Bluetooth SDP Overview for additional background information.