|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-65F8675F-FF08-5707-BA5B-BF3B4B779393" xml:lang="en"><title>Handling |
|
13 SDP results</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>Clients that make service and attribute queries through <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>CSdpAgent</apiname></xref> must |
|
15 implement the <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>MSdpAgentNotifier</apiname></xref> interface |
|
16 to handle the responses. </p> |
|
17 <section><title>How to create an object to handle inquiry results</title> <p>There |
|
18 are two kinds of results that require handling, they are: </p> <ul> |
|
19 <li id="GUID-5D797F13-A380-5286-905F-9DCB374224B7"><p>Service Search Results, |
|
20 and </p> </li> |
|
21 <li id="GUID-49BAAE50-2EB9-5A64-910A-5C95CED036DE"><p>Attribute Read Results </p> </li> |
|
22 </ul> <p>We will examine a simple handling example for both kinds below. </p><p>Note: |
|
23 Queries are asynchronous. </p> </section> |
|
24 <section><title>Handling service search results</title> <p>When a service |
|
25 search request completes, it calls the <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>NextRecordRequestComplete()</apiname></xref>: </p> <codeblock id="GUID-00FBBFCE-2C58-5D79-9C24-D0BC796BE1D3" xml:space="preserve">virtual void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount)</codeblock> <p> <codeph>aHandle</codeph> gives the service record handle of the matching |
|
26 service, and can be used in a subsequent attribute query. <codeph>aTotalRecordsCount</codeph> gives |
|
27 the total number of matching records. </p> </section> |
|
28 <section><title>Handling attribute read results</title> <p>When an attribute |
|
29 request completes, each single attribute is returned with its attribute ID |
|
30 using <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>AttributeRequestResult()</apiname></xref>. </p> <codeblock id="GUID-B13E900D-9D1A-5FA4-9063-FA830B86218E" xml:space="preserve">virtual void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue)</codeblock> <p>The ID of the attribute is given in <codeph>aAttrID</codeph>, and the |
|
31 attribute value itself in <codeph>aAttrValue</codeph>. You can find the type |
|
32 of the attribute through <codeph>aAttrValue->Type()</codeph>, cast <codeph>aAttrValue</codeph> on |
|
33 this base to the correct subclass of <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>CSdpAttrValue</apiname></xref>: |
|
34 for example, if the type is <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>ETypeBoolean</apiname></xref>, |
|
35 you can cast <codeph>aAttrValue</codeph> to a <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>CSdpAttrValueBoolean</apiname></xref>. </p> <p>When |
|
36 there are no more attributes to be returned, <xref href="GUID-AD76DB7F-CD45-3903-A07A-E94BE583CDB0.dita"><apiname>AttributeRequestComplete()</apiname></xref> is |
|
37 called. </p> </section> |
|
38 <section><title>Where Next?</title> <p>The complete set of Service Discovery |
|
39 Agent tutorials are shown below: </p> <ul> |
|
40 <li id="GUID-7461DF52-06B4-55BE-B176-7F1F88851B7C"><p> <xref href="GUID-275D7892-EEBD-5DBD-A9D7-F6A715B79659.dita">Querying |
|
41 the SDP database</xref> </p> </li> |
|
42 <li id="GUID-2C509727-D129-5DC6-8761-1975151FBA6C"><p> <xref href="GUID-1EA7B3A5-7A94-5E8F-A0A8-9CA417E14032.dita">Reading |
|
43 remote SDP service attributes</xref> </p> </li> |
|
44 <li id="GUID-93251739-F226-5398-9F7B-A3BC599AB40F"><p> <b>Handling SDP query |
|
45 results</b> - This document </p> </li> |
|
46 </ul> <p>Also refer to the <xref href="GUID-2F1C6B4C-2C23-5A35-A0D2-223EC6238F7D.dita">Bluetooth |
|
47 Service Discovery Agent Overview</xref> and the <xref href="GUID-8451102A-8E68-5C86-9E40-D53183E32261.dita">Bluetooth |
|
48 SDP Overview</xref> for additional background information. </p> </section> |
|
49 </conbody></concept> |