Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/driver1_8h-source.html
Week 12 contribution of SDK documentation_content. See release notes for details. Fixes Bug 1892, Bug 1522, Bug 1520, Bug 394, Bug 1319, Bug 344, Bug 1897
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>TB10.1 Example Applications: examples/Base/IPC/AdvancedClientServerExample/driver/driver1.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<h1>examples/Base/IPC/AdvancedClientServerExample/driver/driver1.h</h1><a href="driver1_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).</span>
<a name="l00002"></a>00002 <span class="comment">// All rights reserved.</span>
<a name="l00003"></a>00003 <span class="comment">// This component and the accompanying materials are made available</span>
<a name="l00004"></a>00004 <span class="comment">// under the terms of "Eclipse Public License v1.0"</span>
<a name="l00005"></a>00005 <span class="comment">// which accompanies this distribution, and is available</span>
<a name="l00006"></a>00006 <span class="comment">// at the URL "http://www.eclipse.org/legal/epl-v10.html".</span>
<a name="l00007"></a>00007 <span class="comment">//</span>
<a name="l00008"></a>00008 <span class="comment">// Initial Contributors:</span>
<a name="l00009"></a>00009 <span class="comment">// Nokia Corporation - initial contribution.</span>
<a name="l00010"></a>00010 <span class="comment">//</span>
<a name="l00011"></a>00011 <span class="comment">// Contributors:</span>
<a name="l00012"></a>00012 <span class="comment">//</span>
<a name="l00013"></a>00013 <span class="comment">// Description:</span>
<a name="l00014"></a>00014 <span class="comment">// Interface to example Logical Device Driver</span>
<a name="l00015"></a>00015 <span class="comment">//</span>
<a name="l00016"></a>00016
<a name="l00017"></a>00017
<a name="l00018"></a>00018
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef __DRIVER1_H__</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define __DRIVER1_H__</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#include <e32cmn.h></span>
<a name="l00027"></a>00027 <span class="preprocessor">#include <e32ver.h></span>
<a name="l00028"></a>00028 <span class="preprocessor">#ifndef __KERNEL_MODE__</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <e32std.h></span>
<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
<a name="l00035"></a><a class="code" href="class_r_driver1.html">00035</a> <span class="keyword">class </span><a class="code" href="class_r_driver1.html">RDriver1</a> : <span class="keyword">public</span> RBusLogicalChannel
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037 <span class="keyword">public</span>:
<a name="l00042"></a><a class="code" href="class_r_driver1_1_1_t_caps.html">00042</a> <span class="keyword">class </span><a class="code" href="class_r_driver1_1_1_t_caps.html">TCaps</a>
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keyword">public</span>:
<a name="l00045"></a><a class="code" href="class_r_driver1_1_1_t_caps.html#8acb73cae71002cb92ff7944036da689">00045</a> TVersion <a class="code" href="class_r_driver1_1_1_t_caps.html#8acb73cae71002cb92ff7944036da689">iVersion</a>;
<a name="l00046"></a>00046 };
<a name="l00047"></a>00047
<a name="l00051"></a><a class="code" href="class_r_driver1_1_1_t_config.html">00051</a> <span class="keyword">class </span><a class="code" href="class_r_driver1_1_1_t_config.html">TConfig</a>
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053 <span class="keyword">public</span>:
<a name="l00054"></a><a class="code" href="class_r_driver1_1_1_t_config.html#1bbc5535ddf8863917bf9ca18a688d91">00054</a> TInt <a class="code" href="class_r_driver1_1_1_t_config.html#1bbc5535ddf8863917bf9ca18a688d91">iSpeed</a>;
<a name="l00055"></a><a class="code" href="class_r_driver1_1_1_t_config.html#8355e96a67e66e79903fe0a74f17b6d2">00055</a> TInt <a class="code" href="class_r_driver1_1_1_t_config.html#8355e96a67e66e79903fe0a74f17b6d2">iPddBufferSize</a>;
<a name="l00056"></a><a class="code" href="class_r_driver1_1_1_t_config.html#5d055bb015e0902481ced408c2c7892b">00056</a> TInt <a class="code" href="class_r_driver1_1_1_t_config.html#5d055bb015e0902481ced408c2c7892b">iMaxSendDataSize</a>;
<a name="l00057"></a><a class="code" href="class_r_driver1_1_1_t_config.html#3b6388ffc3c59b31e9f003ca2bf12812">00057</a> TInt <a class="code" href="class_r_driver1_1_1_t_config.html#3b6388ffc3c59b31e9f003ca2bf12812">iMaxReceiveDataSize</a>;
<a name="l00058"></a>00058 };
<a name="l00059"></a><a class="code" href="class_r_driver1.html#1aa1c078824a79d07da05b1a7fdae816">00059</a> <span class="keyword">typedef</span> TPckgBuf<TConfig> <a class="code" href="class_r_driver1.html#1aa1c078824a79d07da05b1a7fdae816">TConfigBuf</a>;
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <span class="keyword">public</span>:
<a name="l00062"></a>00062 <span class="keyword">inline</span> TInt <a class="code" href="class_r_driver1.html#f30696b673cd91e87f9c7497a72798eb">Open</a>();
<a name="l00063"></a>00063 <span class="keyword">inline</span> TInt <a class="code" href="class_r_driver1.html#c728a3fa6f4d51b284bcee48d8cc3f4a">GetConfig</a>(<a class="code" href="class_r_driver1.html#1aa1c078824a79d07da05b1a7fdae816">TConfigBuf</a>& aConfig);
<a name="l00064"></a>00064 <span class="keyword">inline</span> TInt <a class="code" href="class_r_driver1.html#22e5408e8d1216fe3581ec154c2632a1">SetConfig</a>(<span class="keyword">const</span> <a class="code" href="class_r_driver1.html#1aa1c078824a79d07da05b1a7fdae816">TConfigBuf</a>& aConfig);
<a name="l00065"></a>00065 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#2b99c6487e8916a54720d8eb3071cd85">SendData</a>(TRequestStatus &aStatus,<span class="keyword">const</span> TDesC8& aData);
<a name="l00066"></a>00066 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#3a9b32b811f9bec9b3317d2b187b8417">SendDataCancel</a>();
<a name="l00067"></a>00067 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#7e192c22f84adc61b6418cd6ffb65526">ReceiveData</a>(TRequestStatus &aStatus,TDes8& aBuffer);
<a name="l00068"></a>00068 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#c6bee07d661dfd83a14516aa964672bb">ReceiveDataCancel</a>();
<a name="l00069"></a>00069 <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keyword">const</span> TDesC& <a class="code" href="class_r_driver1.html#7e98e9f7ec04a53a404d646481f589ca">Name</a>();
<a name="l00070"></a>00070 <span class="keyword">inline</span> <span class="keyword">static</span> TVersion <a class="code" href="class_r_driver1.html#7d1f08b59801b5890fb77666e14d5e8f">VersionRequired</a>();
<a name="l00071"></a>00071 <span class="keyword">private</span>:
<a name="l00075"></a>00075 <span class="keyword">enum</span> TControl
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077 EGetConfig,
<a name="l00078"></a>00078 ESetConfig
<a name="l00079"></a>00079 };
<a name="l00080"></a>00080
<a name="l00084"></a>00084 <span class="keyword">enum</span> TRequest
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086 ESendData,
<a name="l00087"></a>00087 EReceiveData,
<a name="l00088"></a>00088 ENumRequests,
<a name="l00089"></a>00089 EAllRequests = (1<<ENumRequests)-1
<a name="l00090"></a>00090 };
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="comment">// Kernel side LDD channel is a friend</span>
<a name="l00093"></a><a class="code" href="class_r_driver1.html#3dc837125ab7311c8533472f93e390b0">00093</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_d_driver1_channel.html">DDriver1Channel</a>;
<a name="l00094"></a>00094 };
<a name="l00095"></a>00095
<a name="l00100"></a><a class="code" href="class_r_driver1.html#7e98e9f7ec04a53a404d646481f589ca">00100</a> <span class="keyword">inline</span> <span class="keyword">const</span> TDesC& <a class="code" href="class_r_driver1.html#7e98e9f7ec04a53a404d646481f589ca">RDriver1::Name</a>()
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102 _LIT(KDriver1Name,<span class="stringliteral">"DRIVER1"</span>);
<a name="l00103"></a>00103 <span class="keywordflow">return</span> KDriver1Name;
<a name="l00104"></a>00104 }
<a name="l00105"></a>00105
<a name="l00110"></a><a class="code" href="class_r_driver1.html#7d1f08b59801b5890fb77666e14d5e8f">00110</a> <span class="keyword">inline</span> TVersion <a class="code" href="class_r_driver1.html#7d1f08b59801b5890fb77666e14d5e8f">RDriver1::VersionRequired</a>()
<a name="l00111"></a>00111 {
<a name="l00112"></a>00112 <span class="keyword">const</span> TInt KMajorVersionNumber=1;
<a name="l00113"></a>00113 <span class="keyword">const</span> TInt KMinorVersionNumber=0;
<a name="l00114"></a>00114 <span class="keyword">const</span> TInt KBuildVersionNumber=KE32BuildVersionNumber;
<a name="l00115"></a>00115 <span class="keywordflow">return</span> TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
<a name="l00116"></a>00116 }
<a name="l00117"></a>00117
<a name="l00118"></a>00118 <span class="comment">/*</span>
<a name="l00119"></a>00119 <span class="comment"> NOTE: The following methods would normally be exported from a seperate client DLL</span>
<a name="l00120"></a>00120 <span class="comment"> but are included in this header file for convenience.</span>
<a name="l00121"></a>00121 <span class="comment">*/</span>
<a name="l00122"></a>00122
<a name="l00123"></a>00123 <span class="preprocessor">#ifndef __KERNEL_MODE__</span>
<a name="l00124"></a>00124 <span class="preprocessor"></span>
<a name="l00129"></a><a class="code" href="class_r_driver1.html#f30696b673cd91e87f9c7497a72798eb">00129</a> <span class="keyword">inline</span> TInt <a class="code" href="class_r_driver1.html#f30696b673cd91e87f9c7497a72798eb">RDriver1::Open</a>()
<a name="l00130"></a>00130 {
<a name="l00131"></a>00131 <span class="keywordflow">return</span> <a class="code" href="class_d_driver1_channel.html#c08720a956dbae4e7127da92944c35ad">DoCreate</a>(<a class="code" href="class_r_driver1.html#7e98e9f7ec04a53a404d646481f589ca">Name</a>(),<a class="code" href="class_r_driver1.html#7d1f08b59801b5890fb77666e14d5e8f">VersionRequired</a>(),KNullUnit,NULL,NULL,EOwnerThread);
<a name="l00132"></a>00132 }
<a name="l00133"></a>00133
<a name="l00139"></a><a class="code" href="class_r_driver1.html#c728a3fa6f4d51b284bcee48d8cc3f4a">00139</a> <span class="keyword">inline</span> TInt <a class="code" href="class_r_driver1.html#c728a3fa6f4d51b284bcee48d8cc3f4a">RDriver1::GetConfig</a>(<a class="code" href="class_r_driver1.html#1aa1c078824a79d07da05b1a7fdae816">TConfigBuf</a>& aConfig)
<a name="l00140"></a>00140 {
<a name="l00141"></a>00141 <span class="keywordflow">return</span> DoControl(EGetConfig,(TAny*)&aConfig);
<a name="l00142"></a>00142 }
<a name="l00143"></a>00143
<a name="l00151"></a><a class="code" href="class_r_driver1.html#22e5408e8d1216fe3581ec154c2632a1">00151</a> <span class="keyword">inline</span> TInt <a class="code" href="class_r_driver1.html#22e5408e8d1216fe3581ec154c2632a1">RDriver1::SetConfig</a>(<span class="keyword">const</span> <a class="code" href="class_r_driver1.html#1aa1c078824a79d07da05b1a7fdae816">TConfigBuf</a>& aConfig)
<a name="l00152"></a>00152 {
<a name="l00153"></a>00153 <span class="keywordflow">return</span> DoControl(ESetConfig,(TAny*)&aConfig);
<a name="l00154"></a>00154 }
<a name="l00155"></a>00155
<a name="l00164"></a><a class="code" href="class_r_driver1.html#2b99c6487e8916a54720d8eb3071cd85">00164</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#2b99c6487e8916a54720d8eb3071cd85">RDriver1::SendData</a>(TRequestStatus &aStatus,<span class="keyword">const</span> TDesC8& aData)
<a name="l00165"></a>00165 {
<a name="l00166"></a>00166 DoRequest(ESendData,aStatus,(TAny*)&aData);
<a name="l00167"></a>00167 }
<a name="l00168"></a>00168
<a name="l00172"></a><a class="code" href="class_r_driver1.html#3a9b32b811f9bec9b3317d2b187b8417">00172</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#3a9b32b811f9bec9b3317d2b187b8417">RDriver1::SendDataCancel</a>()
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174 DoCancel(1<<ESendData);
<a name="l00175"></a>00175 }
<a name="l00176"></a>00176
<a name="l00185"></a><a class="code" href="class_r_driver1.html#7e192c22f84adc61b6418cd6ffb65526">00185</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#7e192c22f84adc61b6418cd6ffb65526">RDriver1::ReceiveData</a>(TRequestStatus &aStatus,TDes8& aBuffer)
<a name="l00186"></a>00186 {
<a name="l00187"></a>00187 DoRequest(EReceiveData,aStatus,(TAny*)&aBuffer);
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189
<a name="l00193"></a><a class="code" href="class_r_driver1.html#c6bee07d661dfd83a14516aa964672bb">00193</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_r_driver1.html#c6bee07d661dfd83a14516aa964672bb">RDriver1::ReceiveDataCancel</a>()
<a name="l00194"></a>00194 {
<a name="l00195"></a>00195 DoCancel(1<<EReceiveData);
<a name="l00196"></a>00196 }
<a name="l00197"></a>00197
<a name="l00198"></a>00198 <span class="preprocessor">#endif // !__KERNEL_MODE__</span>
<a name="l00199"></a>00199 <span class="preprocessor"></span>
<a name="l00200"></a>00200 <span class="preprocessor">#endif // __DRIVER1_H__</span>
<a name="l00201"></a>00201 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 21 10:32:56 2010 for TB10.1 Example Applications by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>