SDP Database service records are made up of a number of attributes. The attributes identify information about the service such as the class of service, that is the general category to which the service belongs, the date on which the service record was first created, the service's UUID and more. See the SDP specification, link provided elsewhere, for more information. The only required attribute is the UUID for the service.
Symbian have identified a special pattern for creating and manipulating SDP attributes.
Attributes in service records can be one of fixed number of types. The API encapsulates each attribute type in a class, each of which is derived from CSdpAttrValue . The type is easily deducible from the name: e.g. CSdpAttrValueUint encapsulates an unsigned integer type attribute.
Complex attribute values are stored as lists of other elements; nested lists are allowed.
The list classes are:
CSdpAttrValueDEA : a Data element alternative, a data element whose data field is a sequence of data elements from which one data element is to be selected.
CSdpAttrValueDES : a Data element sequence, a data element whose data field is a sequence of data elements.
Both of these implement the MSdpElementBuilder interface, which supplies functions of the form Build type L() to add elements of the specified type to the list.
Creating a Protocol List Attribute
The following example builds a ProtocolDescriptorList attribute (attribute ID 0x0004), which is a list containing two nested lists.
Create the list. (NULL indicates that the list is not itself in another list)
Build the first nested list. Notice the pattern used to push the new attribute value onto the service record.
Build the second nested list.
->BuildDESL() ->StartListL() ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM ->BuildUintL(TServAttrInt<TUint8>>(1)) // DLCI = 1 ->EndListL() ->EndListL();
Notice that all the code from the start of 2 above to the end of 3 is essentially a single long line of code. This is an example of the SDP pattern discussed earlier.
The complete set of Service Discovery Database tutorials are shown below:
Handling SDP attributes - 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.