Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



How to read remote service attributes

The data for a service record is contained in attributes. Each attribute has a well-known ID, a type, and a value.

Attribute requests take service record handles found as a result of service searches and return attributes. You can limit the attributes returned to a specific attribute, or to a range of IDs.

Like a service search, results are returned through asynchronous callbacks to an MSdpAgentNotifier interface, which the querier must implement.

The steps to read attributes are as follows:

  1. Create a CSdpAttrIdMatchList object in which to specify the attributes that you want retrieved (termed the match list).

  2. Add the attribute IDs to the match list using CSdpAttrIdMatchList::AddL(). IDs are wrapped in a TAttrRange type, which can specify a single attribute or a range of IDs.

  3. Start the query using using CSdpAgent::AttributeRequestL(). As well as the match list, you specify the record handle of the service that you're interested in.

Example

// Assumes agent is an CSdpAgent, and serviceHandle a service record handle

// 1. Create a match list
CSdpAttrIdMatchList* matchList = CSdpAttrIdMatchList::NewL();
CleanupStack::PushL(matchList);

// 2. Add an attribute ID to get
matchList->AddL(TAttrRange(0x102));

// 3. Set the match list on the agent
agent->AttributeRequestL(serviceHandle, *matchList);

CleanupStack::PopAndDestroy(); //matchList

Note

CSdpAgent::AttributeRequestL() is an overloaded function. Some of the overloads allow you to supply an MSdpElementBuilder object: if it is supplied, then the object will be called with each type found in the response.