Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



How to create an object to handle inquiry results

Clients that make service and attribute queries through CSdpAgent must implement the MSdpAgentNotifier interface to handle the responses.

Note that queries are asynchronous, although this is hidden in the API. The implication is that the interface functions that receive responses are only called when the thread's active scheduler can schedule handling of the completion of the query.

Handling service search results

When a service search request completes, it calls the NextRecordRequestComplete():

virtual void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount)

aHandle gives the service record handle of the matching service, and can be used in a subsequent attribute query. aTotalRecordsCount gives the total number of matching records.

Handling attribute read results

When an attribute request completes, each single attribute is returned with its attribute ID using AttributeRequestResult().

virtual void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue)

The ID of the attribute is given in aAttrID, and the attribute value itself in aAttrValue. You can find the type of the attribute through aAttrValue->Type(), cast aAttrValue on this base to the correct subclass of CSdpAttrValue: for example, if the type is ETypeBoolean, you can cast aAttrValue to a CSdpAttrValueBoolean.

When there are no more attributes to be returned, AttributeRequestComplete() is called.