--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_feat_mngr_example_8cpp_source.html Tue Mar 30 16:16:55 2010 +0100
@@ -0,0 +1,380 @@
+<!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/Base/FeatMngrExample/src/FeatMngrExample.cpp 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/Base/FeatMngrExample/src/FeatMngrExample.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (c) 2008-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">//</span>
+<a name="l00015"></a>00015
+<a name="l00016"></a>00016 <span class="preprocessor">#include "FeatMngrExample.h"</span>
+<a name="l00017"></a>00017 <span class="preprocessor">#include <e32base.h></span>
+<a name="l00018"></a>00018 <span class="preprocessor">#include <e32std.h></span>
+<a name="l00019"></a>00019 <span class="preprocessor">#include <e32def.h></span>
+<a name="l00020"></a>00020 <span class="preprocessor">#include <e32cmn.h></span>
+<a name="l00021"></a>00021
+<a name="l00022"></a>00022 <span class="comment">//String literals</span>
+<a name="l00023"></a>00023 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KNewline, <span class="stringliteral">"\n"</span>);
+<a name="l00024"></a>00024
+<a name="l00025"></a>00025 <a class="code" href="class_c_feat_mngr_example.html">CFeatMngrExample</a>* CFeatMngrExample::NewL(TInt aPriority)
+<a name="l00026"></a>00026 {
+<a name="l00027"></a>00027 <a class="code" href="class_c_feat_mngr_example.html">CFeatMngrExample</a>* <span class="keyword">self</span>=<span class="keyword">new</span>(ELeave)<a class="code" href="class_c_feat_mngr_example.html">CFeatMngrExample</a>(aPriority);
+<a name="l00028"></a>00028 CleanupStack::PushL(<span class="keyword">self</span>);
+<a name="l00029"></a>00029 <span class="keyword">self</span>->ConstructL();
+<a name="l00030"></a>00030 CleanupStack::Pop(<span class="keyword">self</span>);
+<a name="l00031"></a>00031 <span class="keywordflow">return</span> <span class="keyword">self</span>;
+<a name="l00032"></a>00032 }
+<a name="l00033"></a>00033
+<a name="l00034"></a>00034 <span class="keywordtype">void</span> CFeatMngrExample::ConstructL()
+<a name="l00035"></a>00035 {
+<a name="l00036"></a>00036 <span class="comment">//Create console</span>
+<a name="l00037"></a>00037 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTextConsoleTitle, <span class="stringliteral">"FeatureManager"</span>);
+<a name="l00038"></a>00038 iConsole = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen));
+<a name="l00039"></a>00039 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KWelcome, <span class="stringliteral">"Welcome to the Feature Management Example\n"</span>);
+<a name="l00040"></a>00040 iConsole->Printf(KWelcome);
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="comment">//Create another process to receive notification. </span>
+<a name="l00043"></a>00043 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KProcessName, <span class="stringliteral">"FeatureChecker.exe"</span>);
+<a name="l00044"></a>00044 User::LeaveIfError(iProcess.Create(KProcessName, KNullDesC));
+<a name="l00045"></a>00045 iProcess.Resume();
+<a name="l00046"></a>00046
+<a name="l00047"></a>00047 User::LeaveIfError(iFeatControl.Open());
+<a name="l00048"></a>00048 }
+<a name="l00049"></a>00049
+<a name="l00050"></a>00050 CFeatMngrExample::CFeatMngrExample(TInt aPriority):CActive( aPriority )
+<a name="l00051"></a>00051 {
+<a name="l00052"></a>00052 CActiveScheduler::Add(<span class="keyword">this</span>);
+<a name="l00053"></a>00053 }
+<a name="l00054"></a>00054
+<a name="l00058"></a><a class="code" href="class_c_feat_mngr_example.html#a3ae7073d06744fb9088d2fa0dbbad3f5">00058</a> <a class="code" href="class_c_feat_mngr_example.html#a3ae7073d06744fb9088d2fa0dbbad3f5">CFeatMngrExample::~CFeatMngrExample</a>()
+<a name="l00059"></a>00059 {
+<a name="l00060"></a>00060 Cancel();
+<a name="l00061"></a>00061 <span class="keyword">delete</span> iConsole;
+<a name="l00062"></a>00062 iFeatControl.Close();
+<a name="l00063"></a>00063 iProcess.Close();
+<a name="l00064"></a>00064 }
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="keywordtype">void</span> CFeatMngrExample::RunL()
+<a name="l00067"></a>00067 {
+<a name="l00068"></a>00068 TRAPD(err,<a class="code" href="class_c_feat_mngr_example.html#a85093d5fbf8f322d40d9847ad56f4dc1">ProcessKeyPressL</a>(TChar(iConsole->KeyCode())));
+<a name="l00069"></a>00069 <span class="keywordflow">if</span>(err != KErrNone)
+<a name="l00070"></a>00070 {
+<a name="l00071"></a>00071 iConsole->Printf(_L(<span class="stringliteral">"Failed. Error: %d\r\n"</span>),err);
+<a name="l00072"></a>00072 RequestCharacter();
+<a name="l00073"></a>00073 }
+<a name="l00074"></a>00074 }
+<a name="l00075"></a>00075
+<a name="l00080"></a><a class="code" href="class_c_feat_mngr_example.html#a85093d5fbf8f322d40d9847ad56f4dc1">00080</a> <span class="keywordtype">void</span> <a class="code" href="class_c_feat_mngr_example.html#a85093d5fbf8f322d40d9847ad56f4dc1">CFeatMngrExample::ProcessKeyPressL</a>(TChar aChar)
+<a name="l00081"></a>00081 {
+<a name="l00082"></a>00082 <span class="keywordflow">switch</span>(aChar)
+<a name="l00083"></a>00083 {
+<a name="l00084"></a>00084 <span class="keywordflow">case</span> <span class="charliteral">'1'</span>:
+<a name="l00085"></a>00085 {
+<a name="l00086"></a>00086 <a class="code" href="class_c_feat_mngr_example.html#a841f40d4b9488f6e02f5abfaaf692bd2">ListFeaturesL</a>();
+<a name="l00087"></a>00087 <span class="keywordflow">break</span>;
+<a name="l00088"></a>00088 }
+<a name="l00089"></a>00089 <span class="keywordflow">case</span> <span class="charliteral">'2'</span>:
+<a name="l00090"></a>00090 {
+<a name="l00091"></a>00091 <a class="code" href="class_c_feat_mngr_example.html#a31dd0f3394355f0e1a3ff9472c7e1c36">AddL</a>();
+<a name="l00092"></a>00092 <span class="keywordflow">break</span>;
+<a name="l00093"></a>00093 }
+<a name="l00094"></a>00094 <span class="keywordflow">case</span> <span class="charliteral">'3'</span>:
+<a name="l00095"></a>00095 {
+<a name="l00096"></a>00096 <a class="code" href="class_c_feat_mngr_example.html#a61e725ad3ad030deb9785fdd5e9624b3">UpdateL</a>();
+<a name="l00097"></a>00097 <span class="keywordflow">break</span>;
+<a name="l00098"></a>00098 }
+<a name="l00099"></a>00099 <span class="keywordflow">case</span> <span class="charliteral">'4'</span>:
+<a name="l00100"></a>00100 {
+<a name="l00101"></a>00101 <a class="code" href="class_c_feat_mngr_example.html#aac0b9cf0f234a0342df2b80f12fe13c6">EnableFeatureL</a>();
+<a name="l00102"></a>00102 <span class="keywordflow">break</span>;
+<a name="l00103"></a>00103 }
+<a name="l00104"></a>00104 <span class="keywordflow">case</span> <span class="charliteral">'5'</span>:
+<a name="l00105"></a>00105 {
+<a name="l00106"></a>00106 <a class="code" href="class_c_feat_mngr_example.html#a82b08ef640e63540424ce1c45d8dc88f">DeleteL</a>();
+<a name="l00107"></a>00107 <span class="keywordflow">break</span>;
+<a name="l00108"></a>00108 }
+<a name="l00109"></a>00109 <span class="keywordflow">case</span> <span class="charliteral">'6'</span>:
+<a name="l00110"></a>00110 {
+<a name="l00111"></a>00111 <a class="code" href="class_c_feat_mngr_example.html#ab294a09f4686c515062329e045563445">CheckFeatureSupportL</a>();
+<a name="l00112"></a>00112 <span class="keywordflow">break</span>;
+<a name="l00113"></a>00113 }
+<a name="l00114"></a>00114 <span class="keywordflow">default</span>:
+<a name="l00115"></a>00115 CActiveScheduler::Stop();
+<a name="l00116"></a>00116 <span class="keywordflow">break</span>;
+<a name="l00117"></a>00117 }
+<a name="l00118"></a>00118 }
+<a name="l00119"></a>00119
+<a name="l00124"></a><a class="code" href="class_c_feat_mngr_example.html#a31dd0f3394355f0e1a3ff9472c7e1c36">00124</a> <span class="keywordtype">void</span> <a class="code" href="class_c_feat_mngr_example.html#a31dd0f3394355f0e1a3ff9472c7e1c36">CFeatMngrExample::AddL</a>()
+<a name="l00125"></a>00125 {
+<a name="l00126"></a>00126 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeat, <span class="stringliteral">"Enter the UID of the feature to be added.\n"</span>);
+<a name="l00127"></a>00127 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KSelectUIDL1, <span class="stringliteral">"Select any UID, but in order to receive notification from featurechecker.exe,\n"</span>);
+<a name="l00128"></a>00128 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KSelectUIDL2,<span class="stringliteral">"choose a UID from the range 12000000 to 1200001A.\n"</span>);
+<a name="l00129"></a>00129 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KSelectUIDL3, <span class="stringliteral">"Notification takes the form of an info message displayed at the top right\n"</span>);
+<a name="l00130"></a>00130 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KSelectUIDL4, <span class="stringliteral">"corner of the screen.\n"</span>);
+<a name="l00131"></a>00131 iConsole->Printf(KFeat);
+<a name="l00132"></a>00132 iConsole->Printf(KSelectUIDL1);
+<a name="l00133"></a>00133 iConsole->Printf(KSelectUIDL2);
+<a name="l00134"></a>00134 iConsole->Printf(KSelectUIDL3);
+<a name="l00135"></a>00135 iConsole->Printf(KSelectUIDL4);
+<a name="l00136"></a>00136 TUid uidFeature;
+<a name="l00137"></a>00137 uidFeature.iUid = <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">GetUserInput</a>(EFalse);
+<a name="l00138"></a>00138
+<a name="l00139"></a>00139 TBitFlags32 flags(0);
+<a name="l00140"></a>00140 <span class="comment">//Set the feature to be upgradable and modifiable.</span>
+<a name="l00141"></a>00141 flags.Set( EFeatureSupported );
+<a name="l00142"></a>00142 flags.Set( EFeatureModifiable );
+<a name="l00143"></a>00143
+<a name="l00144"></a>00144 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KSetFeaturedata, <span class="stringliteral">"\nEnter an integer value to set the feature data\n"</span>);
+<a name="l00145"></a>00145 iConsole->Printf(KSetFeaturedata);
+<a name="l00146"></a>00146 TUint32 fdata = <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">GetUserInput</a>(ETrue);
+<a name="l00147"></a>00147 iConsole->Printf(KNewline);
+<a name="l00148"></a>00148 TFeatureEntry featureEntry(uidFeature ,flags, fdata);
+<a name="l00149"></a>00149 TInt featadded = User::LeaveIfError(iFeatControl.AddFeature(featureEntry));
+<a name="l00150"></a>00150 <span class="keywordflow">if</span>(featadded == KErrNone)
+<a name="l00151"></a>00151 {
+<a name="l00152"></a>00152 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatureAdded, <span class="stringliteral">"A new feature is added.\n"</span>);
+<a name="l00153"></a>00153 iConsole->Printf(KFeatureAdded);
+<a name="l00154"></a>00154 }
+<a name="l00155"></a>00155 RequestCharacter();
+<a name="l00156"></a>00156 }
+<a name="l00157"></a>00157
+<a name="l00162"></a><a class="code" href="class_c_feat_mngr_example.html#a82b08ef640e63540424ce1c45d8dc88f">00162</a> <span class="keywordtype">void</span> <a class="code" href="class_c_feat_mngr_example.html#a82b08ef640e63540424ce1c45d8dc88f">CFeatMngrExample::DeleteL</a>()
+<a name="l00163"></a>00163 {
+<a name="l00164"></a>00164 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KUIDtoDelete, <span class="stringliteral">"Enter the UID of the feature to delete\n"</span>);
+<a name="l00165"></a>00165 iConsole->Printf(KUIDtoDelete);
+<a name="l00166"></a>00166 TUid uidFeature;
+<a name="l00167"></a>00167 uidFeature.iUid = <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">GetUserInput</a>(EFalse);
+<a name="l00168"></a>00168 iConsole->Printf(KNewline);
+<a name="l00169"></a>00169 TInt featdeleted = User::LeaveIfError(iFeatControl.DeleteFeature(uidFeature));
+<a name="l00170"></a>00170 <span class="keywordflow">if</span>(featdeleted == KErrNone)
+<a name="l00171"></a>00171 {
+<a name="l00172"></a>00172 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatDeleted, <span class="stringliteral">"The feature is deleted.\n"</span>);
+<a name="l00173"></a>00173 iConsole->Printf(KFeatDeleted);
+<a name="l00174"></a>00174 }
+<a name="l00175"></a>00175 RequestCharacter();
+<a name="l00176"></a>00176 }
+<a name="l00177"></a>00177
+<a name="l00182"></a><a class="code" href="class_c_feat_mngr_example.html#aac0b9cf0f234a0342df2b80f12fe13c6">00182</a> <span class="keywordtype">void</span> <a class="code" href="class_c_feat_mngr_example.html#aac0b9cf0f234a0342df2b80f12fe13c6">CFeatMngrExample::EnableFeatureL</a>()
+<a name="l00183"></a>00183 {
+<a name="l00184"></a>00184 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KUIDtoEnable, <span class="stringliteral">"Enter the UID of the feature to enable/disable\n"</span>);
+<a name="l00185"></a>00185 iConsole->Printf(KUIDtoEnable);
+<a name="l00186"></a>00186 TUid uidFeature;
+<a name="l00187"></a>00187 uidFeature.iUid = <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">GetUserInput</a>(EFalse);
+<a name="l00188"></a>00188
+<a name="l00189"></a>00189 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KEnable, <span class="stringliteral">"\nPress e/d to enable/disable it\n"</span>);
+<a name="l00190"></a>00190 iConsole->Printf(KEnable);
+<a name="l00191"></a>00191 TChar ch = iConsole->Getch();
+<a name="l00192"></a>00192 <span class="keywordflow">if</span>(ch == <span class="charliteral">'e'</span>)
+<a name="l00193"></a>00193 {
+<a name="l00194"></a>00194 User::LeaveIfError(iFeatControl.EnableFeature(uidFeature));
+<a name="l00195"></a>00195 }
+<a name="l00196"></a>00196 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ch == <span class="charliteral">'d'</span>)
+<a name="l00197"></a>00197 {
+<a name="l00198"></a>00198 User::LeaveIfError(iFeatControl.DisableFeature(uidFeature));
+<a name="l00199"></a>00199 }
+<a name="l00200"></a>00200 RequestCharacter();
+<a name="l00201"></a>00201 }
+<a name="l00202"></a>00202
+<a name="l00207"></a><a class="code" href="class_c_feat_mngr_example.html#ab294a09f4686c515062329e045563445">00207</a> <span class="keywordtype">void</span> <a class="code" href="class_c_feat_mngr_example.html#ab294a09f4686c515062329e045563445">CFeatMngrExample::CheckFeatureSupportL</a>()
+<a name="l00208"></a>00208 {
+<a name="l00209"></a>00209 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KPrintUIDtoCheck, <span class="stringliteral">"Enter the UID to check if it is supported\n"</span>);
+<a name="l00210"></a>00210 iConsole->Printf(KPrintUIDtoCheck);
+<a name="l00211"></a>00211
+<a name="l00212"></a>00212 TUid uidFeature;
+<a name="l00213"></a>00213 uidFeature.iUid = <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">GetUserInput</a>(EFalse);
+<a name="l00214"></a>00214 iConsole->Printf(KNewline);
+<a name="l00215"></a>00215 User::LeaveIfError(iFeatControl.FeatureSupported(uidFeature));
+<a name="l00216"></a>00216
+<a name="l00217"></a>00217 TInt err = iFeatControl.FeatureSupported(uidFeature);
+<a name="l00218"></a>00218 <span class="keywordflow">if</span>(err == KFeatureSupported)
+<a name="l00219"></a>00219 {
+<a name="l00220"></a>00220 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatSupported, <span class="stringliteral">"\nThis feature is supported\n"</span>);
+<a name="l00221"></a>00221 iConsole->Printf(KFeatSupported);
+<a name="l00222"></a>00222 }
+<a name="l00223"></a>00223 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(err == KFeatureUnsupported)
+<a name="l00224"></a>00224 {
+<a name="l00225"></a>00225 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatNotsupported, <span class="stringliteral">"\nThis feature is not supported\n"</span>);
+<a name="l00226"></a>00226 iConsole->Printf(KFeatNotsupported);
+<a name="l00227"></a>00227 }
+<a name="l00228"></a>00228 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(err == KErrNotFound)
+<a name="l00229"></a>00229 {
+<a name="l00230"></a>00230 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatNotFound, <span class="stringliteral">"\nThis feature is not found\n"</span>);
+<a name="l00231"></a>00231 iConsole->Printf(KFeatNotFound);
+<a name="l00232"></a>00232 }
+<a name="l00233"></a>00233 <span class="keywordflow">else</span>
+<a name="l00234"></a>00234 {
+<a name="l00235"></a>00235 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KErr, <span class="stringliteral">"Failed : %d"</span>);
+<a name="l00236"></a>00236 iConsole->Printf(KErr, err);
+<a name="l00237"></a>00237 }
+<a name="l00238"></a>00238
+<a name="l00239"></a>00239 RequestCharacter();
+<a name="l00240"></a>00240 }
+<a name="l00241"></a>00241
+<a name="l00245"></a><a class="code" href="class_c_feat_mngr_example.html#a841f40d4b9488f6e02f5abfaaf692bd2">00245</a> <span class="keywordtype">void</span> <a class="code" href="class_c_feat_mngr_example.html#a841f40d4b9488f6e02f5abfaaf692bd2">CFeatMngrExample::ListFeaturesL</a>()
+<a name="l00246"></a>00246 {
+<a name="l00247"></a>00247 RFeatureUidArray supportedFeatures;
+<a name="l00248"></a>00248 CleanupClosePushL(supportedFeatures);
+<a name="l00249"></a>00249
+<a name="l00250"></a>00250 iFeatControl.ListSupportedFeatures(supportedFeatures);
+<a name="l00251"></a>00251 TInt featureCount = supportedFeatures.Count();
+<a name="l00252"></a>00252 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatureCount, <span class="stringliteral">"The number of features present is : %d \n"</span>);
+<a name="l00253"></a>00253 iConsole->Printf(KFeatureCount, featureCount);
+<a name="l00254"></a>00254 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j< featureCount; j++)
+<a name="l00255"></a>00255 {
+<a name="l00256"></a>00256 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatureUID, <span class="stringliteral">"Feature UID%d is %x \n"</span>);
+<a name="l00257"></a>00257 iConsole->Printf(KFeatureUID, (j+1), supportedFeatures[j]);
+<a name="l00258"></a>00258 <span class="comment">//list 12 entries at a time, to ensure visibility in the console.</span>
+<a name="l00259"></a>00259 <span class="keywordflow">if</span>((j+1)%12 == 0)
+<a name="l00260"></a>00260 {
+<a name="l00261"></a>00261 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KPress, <span class="stringliteral">"Press any key to continue\n"</span>);
+<a name="l00262"></a>00262 iConsole->Printf(KPress);
+<a name="l00263"></a>00263 iConsole->Getch();
+<a name="l00264"></a>00264 }
+<a name="l00265"></a>00265 }
+<a name="l00266"></a>00266 CleanupStack::PopAndDestroy(&supportedFeatures);
+<a name="l00267"></a>00267 RequestCharacter();
+<a name="l00268"></a>00268 }
+<a name="l00269"></a>00269
+<a name="l00277"></a><a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">00277</a> TInt64 <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">CFeatMngrExample::GetUserInput</a>(TBool aDecimal)
+<a name="l00278"></a>00278 {
+<a name="l00279"></a>00279 TBufC<50> buf;
+<a name="l00280"></a>00280 TPtr ptr(buf.Des());
+<a name="l00281"></a>00281 TKeyCode ch = iConsole->Getch();
+<a name="l00282"></a>00282 <span class="keywordflow">while</span>(ch != EKeyEnter)
+<a name="l00283"></a>00283 {
+<a name="l00284"></a>00284 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KChar, <span class="stringliteral">"%c"</span>);
+<a name="l00285"></a>00285 iConsole->Printf(KChar,ch);
+<a name="l00286"></a>00286 <span class="keywordflow">if</span>(ch!= EKeyBackspace)
+<a name="l00287"></a>00287 {
+<a name="l00288"></a>00288 ptr.Append(ch);
+<a name="l00289"></a>00289 }
+<a name="l00290"></a>00290 ch=iConsole->Getch();
+<a name="l00291"></a>00291 }
+<a name="l00292"></a>00292 TInt64 value;
+<a name="l00293"></a>00293 TInt err;
+<a name="l00294"></a>00294 <span class="keywordflow">if</span>(aDecimal)
+<a name="l00295"></a>00295 {
+<a name="l00296"></a>00296 err = TLex(ptr).Val(value);
+<a name="l00297"></a>00297 }
+<a name="l00298"></a>00298 <span class="keywordflow">else</span>
+<a name="l00299"></a>00299 {
+<a name="l00300"></a>00300 err = TLex(ptr).Val(value, EHex);
+<a name="l00301"></a>00301 }
+<a name="l00302"></a>00302 <span class="keywordflow">if</span> (err == KErrNone)
+<a name="l00303"></a>00303 {
+<a name="l00304"></a>00304 <span class="keywordflow">return</span> value;
+<a name="l00305"></a>00305 }
+<a name="l00306"></a>00306 <span class="keywordflow">else</span>
+<a name="l00307"></a>00307 {
+<a name="l00308"></a>00308 <span class="keywordflow">return</span> KErrArgument; <span class="comment">// Error condition - could not parse input.</span>
+<a name="l00309"></a>00309 }
+<a name="l00310"></a>00310 }
+<a name="l00311"></a>00311
+<a name="l00315"></a><a class="code" href="class_c_feat_mngr_example.html#a61e725ad3ad030deb9785fdd5e9624b3">00315</a> <span class="keywordtype">void</span> <a class="code" href="class_c_feat_mngr_example.html#a61e725ad3ad030deb9785fdd5e9624b3">CFeatMngrExample::UpdateL</a>()
+<a name="l00316"></a>00316 {
+<a name="l00317"></a>00317 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KFeatUpdate, <span class="stringliteral">"Enter the UID of the feature to be updated\n"</span>);
+<a name="l00318"></a>00318 iConsole->Printf(KFeatUpdate);
+<a name="l00319"></a>00319 TUid uidFeature;
+<a name="l00320"></a>00320 uidFeature.iUid = <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">GetUserInput</a>(EFalse);
+<a name="l00321"></a>00321
+<a name="l00322"></a>00322 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KSetFeaturedata, <span class="stringliteral">"\nEnter a number to set as the feature data\n"</span>);
+<a name="l00323"></a>00323 iConsole->Printf(KSetFeaturedata);
+<a name="l00324"></a>00324 TUint32 fdata = <a class="code" href="class_c_feat_mngr_example.html#a97ca8c2de0959fe9235c182a9af9a744">GetUserInput</a>(ETrue);
+<a name="l00325"></a>00325 iConsole->Printf(KNewline);
+<a name="l00326"></a>00326 <span class="comment">//Updates any existing feature </span>
+<a name="l00327"></a>00327 User::LeaveIfError(iFeatControl.SetFeature(uidFeature , fdata));
+<a name="l00328"></a>00328 RequestCharacter();
+<a name="l00329"></a>00329 }
+<a name="l00330"></a>00330
+<a name="l00331"></a>00331
+<a name="l00332"></a>00332 <span class="keywordtype">void</span> CFeatMngrExample::DoCancel()
+<a name="l00333"></a>00333 {
+<a name="l00334"></a>00334 iConsole->ReadCancel();
+<a name="l00335"></a>00335 }
+<a name="l00336"></a>00336
+<a name="l00337"></a>00337
+<a name="l00338"></a>00338 <span class="keywordtype">void</span> CFeatMngrExample::RequestCharacter()
+<a name="l00339"></a>00339 {
+<a name="l00340"></a>00340 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL1,<span class="stringliteral">"\nSelect one option from the following:\n"</span>);
+<a name="l00341"></a>00341 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL2,<span class="stringliteral">"1.List the features currently present\n"</span>);
+<a name="l00342"></a>00342 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL3,<span class="stringliteral">"2.Add a feature\n"</span>);
+<a name="l00343"></a>00343 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL4,<span class="stringliteral">"3.Update a feature\n"</span>);
+<a name="l00344"></a>00344 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL5,<span class="stringliteral">"4.Enable/Disable a feature\n"</span>);
+<a name="l00345"></a>00345 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL6,<span class="stringliteral">"5.Delete a feature\n"</span>);
+<a name="l00346"></a>00346 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL7,<span class="stringliteral">"6.Check feature support\n"</span>);
+<a name="l00347"></a>00347 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KMenuL8,<span class="stringliteral">"Press any other key to exit\n"</span>);
+<a name="l00348"></a>00348
+<a name="l00349"></a>00349 iConsole->Printf(KMenuL1);
+<a name="l00350"></a>00350 iConsole->Printf(KMenuL2);
+<a name="l00351"></a>00351 iConsole->Printf(KMenuL3);
+<a name="l00352"></a>00352 iConsole->Printf(KMenuL4);
+<a name="l00353"></a>00353 iConsole->Printf(KMenuL5);
+<a name="l00354"></a>00354 iConsole->Printf(KMenuL6);
+<a name="l00355"></a>00355 iConsole->Printf(KMenuL7);
+<a name="l00356"></a>00356 iConsole->Printf(KMenuL8);
+<a name="l00357"></a>00357 iConsole->Printf(KNewline);
+<a name="l00358"></a>00358 <span class="comment">// Read the key press. RunL() will be called when iStatus completes.</span>
+<a name="l00359"></a>00359 iConsole->Read(iStatus);
+<a name="l00360"></a>00360 <span class="keywordflow">if</span>(!IsActive())
+<a name="l00361"></a>00361 {
+<a name="l00362"></a>00362 SetActive();
+<a name="l00363"></a>00363 }
+<a name="l00364"></a>00364 }
+<a name="l00365"></a>00365
+<a name="l00366"></a>00366 <span class="keyword">static</span> <span class="keywordtype">void</span> MainL()
+<a name="l00367"></a>00367 {
+<a name="l00368"></a>00368 CActiveScheduler* scheduler = <span class="keyword">new</span> (ELeave) CActiveScheduler();
+<a name="l00369"></a>00369 CleanupStack::PushL(scheduler);
+<a name="l00370"></a>00370 CActiveScheduler::Install(scheduler);
+<a name="l00371"></a>00371
+<a name="l00372"></a>00372 <a class="code" href="class_c_feat_mngr_example.html">CFeatMngrExample</a>* featMngr = CFeatMngrExample::NewL();
+<a name="l00373"></a>00373 CleanupStack::PushL(featMngr);
+<a name="l00374"></a>00374 featMngr->RequestCharacter();
+<a name="l00375"></a>00375 CActiveScheduler::Start();
+<a name="l00376"></a>00376
+<a name="l00377"></a>00377 CleanupStack::PopAndDestroy(featMngr);
+<a name="l00378"></a>00378 CleanupStack::PopAndDestroy(scheduler);
+<a name="l00379"></a>00379 }
+<a name="l00380"></a>00380
+<a name="l00381"></a>00381 <span class="keyword">extern</span> TInt E32Main()
+<a name="l00382"></a>00382 {
+<a name="l00383"></a>00383 <span class="comment">// Create cleanup stack</span>
+<a name="l00384"></a>00384 __UHEAP_MARK;
+<a name="l00385"></a>00385 CTrapCleanup* cleanup = CTrapCleanup::New();
+<a name="l00386"></a>00386 <span class="keywordflow">if</span>(cleanup == NULL)
+<a name="l00387"></a>00387 {
+<a name="l00388"></a>00388 <span class="keywordflow">return</span> KErrNoMemory;
+<a name="l00389"></a>00389 }
+<a name="l00390"></a>00390 <span class="comment">// Run application code inside a TRAP harness.</span>
+<a name="l00391"></a>00391 TRAPD(mainError, MainL());
+<a name="l00392"></a>00392 <span class="keywordflow">if</span>(mainError != KErrNone)
+<a name="l00393"></a>00393 {
+<a name="l00394"></a>00394 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KUserPanic,<span class="stringliteral">"Failed to complete"</span>);
+<a name="l00395"></a>00395 User::Panic(KUserPanic, mainError);
+<a name="l00396"></a>00396 }
+<a name="l00397"></a>00397 <span class="keyword">delete</span> cleanup;
+<a name="l00398"></a>00398 __UHEAP_MARKEND;
+<a name="l00399"></a>00399 <span class="keywordflow">return</span> KErrNone;
+<a name="l00400"></a>00400 }
+</pre></div></div>
+<hr size="1"/><address style="text-align: right;"><small>Generated by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
+</body>
+</html>