Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_service_discoverer_8h_source.html
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 6 43e37759235e
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TB9.2 Example Applications: examples/ForumNokia/BluetoothPMPExample/inc/ServiceDiscoverer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2 -->
<h1>examples/ForumNokia/BluetoothPMPExample/inc/ServiceDiscoverer.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright © 2009 Nokia Corporation.</span>
<a name="l00003"></a>00003 <span class="comment"> */</span>
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="preprocessor">#ifndef SERVICEDISCOVERER_H</span>
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define SERVICEDISCOVERER_H</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span>
<a name="l00008"></a>00008 <span class="comment">// INCLUDES</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;e32base.h&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;aknviewappui.h&gt;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;coecntrl.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;es_sock.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;btdevice.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;bt_sock.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;btsdp.h&gt;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;Common.h&quot;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a><a class="code" href="class_m_service_disco_observer.html">00020</a> <span class="keyword">class </span><a class="code" href="class_m_service_disco_observer.html">MServiceDiscoObserver</a>
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">public</span>:
<a name="l00029"></a>00029     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_m_service_disco_observer.html#a364f228dafe48577465fac49bc49e20c">HandleServiceDiscoveryCompleteL</a>()=0;
<a name="l00030"></a>00030     <span class="keyword">virtual</span> <span class="keywordtype">void</span> ReportServiceDiscoveryErrorL(TInt aError)=0;
<a name="l00031"></a>00031 };
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 
<a name="l00034"></a><a class="code" href="class_c_service_discoverer.html">00034</a> <span class="keyword">class </span><a class="code" href="class_c_service_discoverer.html">CServiceDiscoverer</a> : <span class="keyword">public</span> CBase,
<a name="l00035"></a>00035                            <span class="keyword">public</span> MSdpAgentNotifier,
<a name="l00036"></a>00036                            <span class="keyword">public</span> MSdpAttributeValueVisitor
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038 <span class="keyword">public</span>:
<a name="l00039"></a>00039 
<a name="l00046"></a>00046     <span class="keyword">static</span> <a class="code" href="class_c_service_discoverer.html">CServiceDiscoverer</a>* <a class="code" href="class_c_service_discoverer.html#a2dad79c50af3415d82b76b8b61a5045a">NewL</a>(<a class="code" href="class_m_service_disco_observer.html">MServiceDiscoObserver</a>&amp; aObserver);
<a name="l00047"></a>00047 
<a name="l00052"></a>00052     <span class="keyword">static</span> <a class="code" href="class_c_service_discoverer.html">CServiceDiscoverer</a>* <a class="code" href="class_c_service_discoverer.html#aa46a9c42ecbd7cb9976927b6858cb993">NewLC</a>(<a class="code" href="class_m_service_disco_observer.html">MServiceDiscoObserver</a>&amp; aObserver);
<a name="l00053"></a>00053 
<a name="l00059"></a>00059     <a class="code" href="class_c_service_discoverer.html#a5b2d0445970a22d19dfc40c88554646b">~CServiceDiscoverer</a>();
<a name="l00060"></a>00060 
<a name="l00071"></a>00071     <span class="keywordtype">void</span> <a class="code" href="class_c_service_discoverer.html#ae75c6998eec994853effa62131ed1d48">DiscoverServicesOnDeviceL</a>(<a class="code" href="struct_t_device_data.html">TDeviceData</a>* aDevData);
<a name="l00072"></a>00072 
<a name="l00080"></a>00080     <span class="keywordtype">void</span> <a class="code" href="class_c_service_discoverer.html#a1b2f22f43eb02687b945e5e67ac4eae8">DiscoverServicesL</a>(TDeviceDataList* aDevDataList);
<a name="l00081"></a>00081 
<a name="l00089"></a>00089     <span class="keywordtype">void</span> <a class="code" href="class_c_service_discoverer.html#accff779372cf2bc9bfaae0b5b5e35872">FinishDiscovery</a>();
<a name="l00090"></a>00090 
<a name="l00098"></a>00098     TBool <a class="code" href="class_c_service_discoverer.html#ac5987a2bdca5e9dfc441c827e1b26e07">HasServices</a>();
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 <span class="keyword">private</span>:
<a name="l00102"></a>00102 
<a name="l00108"></a>00108     <a class="code" href="class_c_service_discoverer.html">CServiceDiscoverer</a>(<a class="code" href="class_m_service_disco_observer.html">MServiceDiscoObserver</a>&amp; aObserver);
<a name="l00109"></a>00109 
<a name="l00114"></a>00114     <span class="keywordtype">void</span> ConstructL();
<a name="l00115"></a>00115 
<a name="l00122"></a>00122     <span class="keywordtype">void</span> HandleServiceDiscoveryCompleteL();
<a name="l00123"></a>00123 
<a name="l00124"></a>00124 <span class="comment">/*</span>
<a name="l00125"></a>00125 <span class="comment"> * NextRecordRequestComplete()</span>
<a name="l00126"></a>00126 <span class="comment"> *</span>
<a name="l00127"></a>00127 <span class="comment"> * discussion called when an service record</span>
<a name="l00128"></a>00128 <span class="comment"> *            (CSdpAgent::NextRecordRequestL()) operation completes.</span>
<a name="l00129"></a>00129 <span class="comment"> * param aError KErrNone, or an SDP error</span>
<a name="l00130"></a>00130 <span class="comment"> * param aHandle service record for which the query was made</span>
<a name="l00131"></a>00131 <span class="comment"> * param aTotalRecordsCount total number of matching records</span>
<a name="l00132"></a>00132 <span class="comment"> */</span>
<a name="l00133"></a>00133     <span class="keywordtype">void</span> NextRecordRequestComplete(
<a name="l00134"></a>00134         TInt aError,
<a name="l00135"></a>00135         TSdpServRecordHandle aHandle,
<a name="l00136"></a>00136         TInt aTotalRecordsCount);
<a name="l00137"></a>00137 
<a name="l00138"></a>00138 <span class="comment">/*</span>
<a name="l00139"></a>00139 <span class="comment"> * AttributeRequestResult()</span>
<a name="l00140"></a>00140 <span class="comment"> *</span>
<a name="l00141"></a>00141 <span class="comment"> * discussion Called by the attribute request</span>
<a name="l00142"></a>00142 <span class="comment"> *            (CSdpAgent::AttributeRequestL()) to pass the results of</span>
<a name="l00143"></a>00143 <span class="comment"> *            a successful attribute request.</span>
<a name="l00144"></a>00144 <span class="comment"> *</span>
<a name="l00145"></a>00145 <span class="comment"> * param aHandle service record for which the query was made</span>
<a name="l00146"></a>00146 <span class="comment"> * param aAttrID ID of the attribute obtained</span>
<a name="l00147"></a>00147 <span class="comment"> * param aAttrValue attribute value obtained</span>
<a name="l00148"></a>00148 <span class="comment"> */</span>
<a name="l00149"></a>00149     <span class="keywordtype">void</span> AttributeRequestResult(
<a name="l00150"></a>00150         TSdpServRecordHandle aHandle,
<a name="l00151"></a>00151         TSdpAttributeID aAttrID,
<a name="l00152"></a>00152         CSdpAttrValue* aAttrValue);
<a name="l00153"></a>00153 
<a name="l00163"></a>00163     <span class="keywordtype">void</span> AttributeRequestComplete(
<a name="l00164"></a>00164         TSdpServRecordHandle aHandle,
<a name="l00165"></a>00165         TInt aError);
<a name="l00166"></a>00166 
<a name="l00175"></a>00175     <span class="keywordtype">void</span> VisitAttributeValueL(CSdpAttrValue&amp; aValue, TSdpElementType aType);
<a name="l00176"></a>00176     <span class="comment">// not needed -&gt; not implemented</span>
<a name="l00177"></a>00177     <span class="keywordtype">void</span> StartListL(CSdpAttrValueList &amp;aList);
<a name="l00178"></a>00178     <span class="comment">// not needed -&gt; not implemented</span>
<a name="l00179"></a>00179     <span class="keywordtype">void</span> EndListL();
<a name="l00180"></a>00180 
<a name="l00181"></a>00181 <span class="keyword">public</span>:
<a name="l00182"></a>00182     <span class="comment">// Service Discovery is running</span>
<a name="l00183"></a>00183     TBool iRunning;
<a name="l00184"></a>00184 
<a name="l00185"></a>00185 <span class="keyword">private</span>:    <span class="comment">// data</span>
<a name="l00186"></a>00186 
<a name="l00187"></a>00187     <span class="comment">// observer reference</span>
<a name="l00188"></a>00188     <a class="code" href="class_m_service_disco_observer.html">MServiceDiscoObserver</a>&amp; iObserver;
<a name="l00189"></a>00189     <span class="comment">// service discovery agent</span>
<a name="l00190"></a>00190     CSdpAgent* iAgent;
<a name="l00191"></a>00191     <span class="comment">// service discovery search pattern</span>
<a name="l00192"></a>00192     CSdpSearchPattern* iSpat;
<a name="l00193"></a>00193     <span class="comment">// last discovered uuid in the service attributes</span>
<a name="l00194"></a>00194     TUUID iLastUUID;
<a name="l00195"></a>00195     <span class="comment">// port (comm channel) found in the service attributes</span>
<a name="l00196"></a>00196     TUint iPort;
<a name="l00197"></a>00197     <span class="comment">// device data record reference</span>
<a name="l00198"></a>00198     <a class="code" href="struct_t_device_data.html">TDeviceData</a>* iDevData;
<a name="l00199"></a>00199     <span class="comment">// device data list reference</span>
<a name="l00200"></a>00200     TDeviceDataList* iDevDataList;
<a name="l00201"></a>00201     <span class="comment">// this indicates that a port number was found in the service attributes</span>
<a name="l00202"></a>00202     <span class="comment">// and device data record for this device needs to be updated with the</span>
<a name="l00203"></a>00203     <span class="comment">// port number.</span>
<a name="l00204"></a>00204     TBool iDevDataChanged;
<a name="l00205"></a>00205     <span class="comment">// index of device in device data list used for service discovery</span>
<a name="l00206"></a>00206     TInt iDeviceIdx;
<a name="l00207"></a>00207 };
<a name="l00208"></a>00208 
<a name="l00209"></a>00209 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>