Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to create and manipulate 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:

Both of these implement the MSdpElementBuilder interface, which supplies functions of the form BuildtypeL() to add elements of the specified type to the list.

Example

The following example builds a protocol list attribute (attribute ID 4), which is a list containing two nested lists. Note:

// Create list; NULL indicates that the list is not itself in another list
CSdpAttrValueDES* attrValProt = CSdpAttrValueDES::NewDESL(NULL);
CleanupStack::PushL(attrValProt);
attrValProt
    ->StartListL()
        ->BuildDESL()
        ->StartListL()
            ->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP
        ->EndListL()
        ->BuildDESL()
        ->StartListL()
            ->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM
            ->BuildUintL(TServAttrInt<TUint8>>(1)) // DLCI = 1
        ->EndListL()
    ->EndListL();