--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/ssmanager_8cpp_source.html Tue Mar 30 16:16:55 2010 +0100
@@ -0,0 +1,341 @@
+<!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/AppFramework/ssmanager/src/ssmanager.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/AppFramework/ssmanager/src/ssmanager.cpp</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 (c) 2009 Nokia Corporation and/or its subsidiary(-ies).</span>
+<a name="l00003"></a>00003 <span class="comment">// All rights reserved.</span>
+<a name="l00004"></a>00004 <span class="comment">// This component and the accompanying materials are made available</span>
+<a name="l00005"></a>00005 <span class="comment">// under the terms of "Eclipse Public License v1.0"</span>
+<a name="l00006"></a>00006 <span class="comment">// which accompanies this distribution, and is available</span>
+<a name="l00007"></a>00007 <span class="comment">// at the URL "http://www.eclipse.org/legal/epl-v10.html".</span>
+<a name="l00008"></a>00008 <span class="comment">//</span>
+<a name="l00009"></a>00009 <span class="comment">// Initial Contributors:</span>
+<a name="l00010"></a>00010 <span class="comment">// Nokia Corporation - initial contribution.</span>
+<a name="l00011"></a>00011 <span class="comment">//</span>
+<a name="l00012"></a>00012 <span class="comment">// Contributors:</span>
+<a name="l00013"></a>00013 <span class="comment">//</span>
+<a name="l00014"></a>00014 <span class="comment">// Description: This example is used to demonstrate the utilities of System state </span>
+<a name="l00015"></a>00015 <span class="comment">// Manager framework.</span>
+<a name="l00016"></a>00016 <span class="comment">// </span>
+<a name="l00017"></a>00017
+<a name="l00028"></a>00028 <span class="preprocessor">#include "ssmanager.h"</span>
+<a name="l00029"></a>00029 <span class="preprocessor">#include "dummy_diskstatus_swppolicy.hrh"</span>
+<a name="l00030"></a>00030 <span class="preprocessor">#include <ssm/ssmsubstates.hrh></span>
+<a name="l00031"></a>00031 <span class="preprocessor">#include <ssm/ssmstate.h></span>
+<a name="l00032"></a>00032 <span class="preprocessor">#include <ssm/ssmstateawaresession.h></span>
+<a name="l00033"></a>00033 <span class="preprocessor">#include <ssm/ssmdomaindefs.h></span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtExampleCode,<span class="stringliteral">"System State Manager Example"</span>);
+<a name="l00036"></a>00036 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtError,<span class="stringliteral">"error is %d\n"</span>);
+<a name="l00037"></a>00037 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtFormat,<span class="stringliteral">"*****************************\n"</span>);
+<a name="l00038"></a>00038 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtFormat1,<span class="stringliteral">".............\n"</span>);
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtSwpInfo,<span class="stringliteral">"\nKey of the SwP is %d \n \nValue of the SwP is %d \n\n"</span>);
+<a name="l00041"></a>00041 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtSasResult,<span class="stringliteral">"\nState aware session connected with [%d]"</span>);
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtState,<span class="stringliteral">"\nValue of new state :"</span>);
+<a name="l00044"></a>00044 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtReqNotificationChgofState,<span class="stringliteral">"\nRequest Notification for any change of state\n"</span>);
+<a name="l00045"></a>00045 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtStateValues,<span class="stringliteral">"\n Main state: %04x \n SubState: %04x \n"</span>);
+<a name="l00046"></a>00046
+<a name="l00047"></a>00047 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtStateChangeResult,<span class="stringliteral">"\nState transition completed with : %d\n"</span>);
+<a name="l00048"></a>00048 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtSwpChangeResult,<span class="stringliteral">"\nSwP transition completed with : %d\n"</span>);
+<a name="l00049"></a>00049
+<a name="l00050"></a>00050 <span class="keyword">const</span> TUint KFiveSecDelay = 500000;
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="keyword">static</span> TInt StopScheduler(TAny* <span class="comment">/*aAny*/</span>)
+<a name="l00053"></a>00053 {
+<a name="l00054"></a>00054 CActiveScheduler::Stop();
+<a name="l00055"></a>00055 <span class="keywordflow">return</span> KErrNone;
+<a name="l00056"></a>00056 }
+<a name="l00057"></a>00057
+<a name="l00058"></a>00058 <a class="code" href="class_c_sys_state_manager_example.html">CSysStateManagerExample</a>* CSysStateManagerExample::NewLC()
+<a name="l00059"></a>00059 {
+<a name="l00060"></a>00060 <a class="code" href="class_c_sys_state_manager_example.html">CSysStateManagerExample</a>* <span class="keyword">self</span>=<span class="keyword">new</span>(ELeave)<a class="code" href="class_c_sys_state_manager_example.html">CSysStateManagerExample</a>();
+<a name="l00061"></a>00061 CleanupStack::PushL(<span class="keyword">self</span>);
+<a name="l00062"></a>00062 <span class="keywordflow">return</span> <span class="keyword">self</span>;
+<a name="l00063"></a>00063 }
+<a name="l00064"></a>00064
+<a name="l00065"></a>00065 CSysStateManagerExample::CSysStateManagerExample()
+<a name="l00066"></a>00066 {
+<a name="l00067"></a>00067
+<a name="l00068"></a>00068 }
+<a name="l00069"></a>00069
+<a name="l00073"></a><a class="code" href="class_c_sys_state_manager_example.html#a944fe05cd6a679bca6011802bc3dba33">00073</a> <a class="code" href="class_c_sys_state_manager_example.html#a944fe05cd6a679bca6011802bc3dba33">CSysStateManagerExample::~CSysStateManagerExample</a>()
+<a name="l00074"></a>00074 {
+<a name="l00075"></a>00075 iSsmStateManager.Close();
+<a name="l00076"></a>00076 <span class="keyword">delete</span> iConsole; <span class="comment">// delete iConsole.</span>
+<a name="l00077"></a>00077 }
+<a name="l00078"></a>00078
+<a name="l00082"></a><a class="code" href="class_c_sys_state_manager_example.html#a0c096e8f81f4c40a24bd43d9962f274e">00082</a> <span class="keywordtype">void</span> <a class="code" href="class_c_sys_state_manager_example.html#a0c096e8f81f4c40a24bd43d9962f274e">CSysStateManagerExample::SwpChanged</a>(TSsmSwp <span class="comment">/*aSwp*/</span>)
+<a name="l00083"></a>00083 {
+<a name="l00084"></a>00084 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtUserNotifiedSwPChange,<span class="stringliteral">"Notification received of a change in the SwP value.\n"</span>);
+<a name="l00085"></a>00085 iConsole->Printf(KTxtUserNotifiedSwPChange);
+<a name="l00086"></a>00086 }
+<a name="l00087"></a>00087
+<a name="l00091"></a><a class="code" href="class_c_sys_state_manager_example.html#a1c585579a816b7e0f8393267a7a7a97a">00091</a> <span class="keywordtype">void</span> <a class="code" href="class_c_sys_state_manager_example.html#a1c585579a816b7e0f8393267a7a7a97a">CSysStateManagerExample::RequestSwpChange</a>()
+<a name="l00092"></a>00092 {
+<a name="l00097"></a>00097 TSsmSwp swp(EExampleSwPKey, ESwpValueJustPublishSwP);
+<a name="l00098"></a>00098 <span class="comment">// Request a Swp change</span>
+<a name="l00099"></a>00099 TRequestStatus status;
+<a name="l00100"></a>00100 iSsmStateManager.RequestSwpChange(swp, status);
+<a name="l00101"></a>00101 User::WaitForRequest(status);
+<a name="l00102"></a>00102 iConsole->Printf(KTxtSwpChangeResult,status.Int());
+<a name="l00103"></a>00103 iConsole->Printf(KTxtSwpInfo,swp.Key(),swp.Value());
+<a name="l00104"></a>00104 }
+<a name="l00105"></a>00105
+<a name="l00109"></a><a class="code" href="class_c_sys_state_manager_example.html#a6b5511414b63e07e00fbff5af8808cad">00109</a> <span class="keywordtype">void</span> <a class="code" href="class_c_sys_state_manager_example.html#a6b5511414b63e07e00fbff5af8808cad">CSysStateManagerExample::RequestSsChange</a>()
+<a name="l00110"></a>00110 {
+<a name="l00111"></a>00111 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtNormalToRestore,<span class="stringliteral">"\nRequesting a System state change from Normal to Restore\n"</span>);
+<a name="l00112"></a>00112 TInt reason =0; <span class="comment">//Various reasons for state transition can be stated, the value is taken as '0'</span>
+<a name="l00113"></a>00113 TSsmStateTransition state(ESsmRestore, ESsmRestoreSubState, reason);
+<a name="l00114"></a>00114 iConsole->Printf(KTxtNormalToRestore);
+<a name="l00115"></a>00115 TRequestStatus status;
+<a name="l00116"></a>00116 iSsmStateManager.RequestStateTransition(state,status);
+<a name="l00117"></a>00117 User::WaitForRequest(status);
+<a name="l00118"></a>00118 User::After(KFiveSecDelay); <span class="comment">//Wait for 0.5sec to allow transitions to fully complete</span>
+<a name="l00119"></a>00119 iConsole->Printf(KTxtStateChangeResult,status.Int());
+<a name="l00120"></a>00120 <span class="comment">//This session helps you to get the details of the current state of the device</span>
+<a name="l00121"></a>00121 RSsmStateAwareSession stateAwareSession;
+<a name="l00122"></a>00122 <span class="comment">/*</span>
+<a name="l00123"></a>00123 <span class="comment"> 'KSM2UiServicesDomain3' is the domain id for the third domain in the UI </span>
+<a name="l00124"></a>00124 <span class="comment"> Service level of the Startup Domain Hierarchy.</span>
+<a name="l00125"></a>00125 <span class="comment"> */</span>
+<a name="l00126"></a>00126 TInt ret = stateAwareSession.Connect(KSM2UiServicesDomain3);
+<a name="l00127"></a>00127 <span class="keywordflow">if</span>(ret!=KErrNone)
+<a name="l00128"></a>00128 {
+<a name="l00129"></a>00129 iConsole->Printf(KTxtSasResult,ret);
+<a name="l00130"></a>00130 }
+<a name="l00131"></a>00131 <span class="keywordflow">else</span>
+<a name="l00132"></a>00132 {
+<a name="l00133"></a>00133 TSsmState current = stateAwareSession.State();
+<a name="l00134"></a>00134 TSsmStateName name = current.Name();
+<a name="l00135"></a>00135 iConsole->Printf(KTxtState);
+<a name="l00136"></a>00136 iConsole->Printf(name);
+<a name="l00137"></a>00137 iConsole->Printf(KTxtStateValues,current.MainState(),current.SubState());
+<a name="l00138"></a>00138 stateAwareSession.Close();
+<a name="l00139"></a>00139 }
+<a name="l00140"></a>00140 }
+<a name="l00141"></a>00141
+<a name="l00146"></a><a class="code" href="class_c_sys_state_manager_example.html#a7c3ee7dd5826eb98097e2c2ef43ed980">00146</a> <span class="keywordtype">void</span> <a class="code" href="class_c_sys_state_manager_example.html#a7c3ee7dd5826eb98097e2c2ef43ed980">CSysStateManagerExample::RequestSwpChangeWithNotificationL</a>()
+<a name="l00147"></a>00147 {
+<a name="l00148"></a>00148 CActiveScheduler* sched = <span class="keyword">new</span>(ELeave) CActiveScheduler;
+<a name="l00149"></a>00149 CleanupStack::PushL(sched);
+<a name="l00150"></a>00150 CActiveScheduler::Install(sched);
+<a name="l00155"></a>00155 CSsmSystemWideProperty* cProp = CSsmSystemWideProperty::NewLC(EExampleSwPKey);
+<a name="l00156"></a>00156
+<a name="l00157"></a>00157 <span class="comment">// Subscribe to changes in dummy disk status Swp</span>
+<a name="l00158"></a>00158 cProp->AddSubscriberL(*<span class="keyword">this</span>);
+<a name="l00159"></a>00159
+<a name="l00160"></a>00160 <span class="comment">// Request Swp changes</span>
+<a name="l00161"></a>00161 TSsmSwp swp(EExampleSwPKey,ESwpValueJustPublishSwP);
+<a name="l00162"></a>00162 TRequestStatus status;
+<a name="l00163"></a>00163 iSsmStateManager.RequestSwpChange(swp, status);
+<a name="l00164"></a>00164 User::WaitForRequest(status);
+<a name="l00165"></a>00165 iConsole->Printf(KTxtSwpChangeResult,status.Int());
+<a name="l00166"></a>00166 iConsole->Printf(KTxtSwpInfo,swp.Key(),swp.Value());
+<a name="l00167"></a>00167
+<a name="l00168"></a>00168 <span class="comment">// Request Swp changes</span>
+<a name="l00169"></a>00169 swp.Set(EExampleSwPKey,ESwpValueForBackup);
+<a name="l00170"></a>00170 iSsmStateManager.RequestSwpChange(swp, status);
+<a name="l00171"></a>00171 User::WaitForRequest(status);
+<a name="l00172"></a>00172 iConsole->Printf(KTxtSwpChangeResult,status.Int());
+<a name="l00173"></a>00173 iConsole->Printf(KTxtSwpInfo,swp.Key(),swp.Value());
+<a name="l00174"></a>00174 CAsyncCallBack* stopper = <span class="keyword">new</span>(ELeave) CAsyncCallBack(CActive::EPriorityIdle);
+<a name="l00175"></a>00175 CleanupStack::PushL(stopper);
+<a name="l00176"></a>00176 TCallBack stopSchedulerCallback(StopScheduler, <span class="keyword">this</span>);
+<a name="l00177"></a>00177 stopper->Set(stopSchedulerCallback);
+<a name="l00178"></a>00178
+<a name="l00179"></a>00179 <span class="comment">// This callback will not run until the Swp change is finished, because it has idle priority. </span>
+<a name="l00180"></a>00180 stopper->CallBack();
+<a name="l00181"></a>00181 <span class="comment">// Causes CSsmSystemWideProperty::RunL to run, as cProp is subscribing on 'Dummy Disk Status' changes</span>
+<a name="l00182"></a>00182 sched->Start();
+<a name="l00183"></a>00183 CleanupStack::PopAndDestroy(3, sched); <span class="comment">// Pop and Destroy sched, cprop and stopper.</span>
+<a name="l00184"></a>00184 }
+<a name="l00185"></a>00185
+<a name="l00190"></a><a class="code" href="class_c_sys_state_manager_example.html#a3e70c77631e8cd6092de93f51cab49ad">00190</a> <span class="keywordtype">void</span> <a class="code" href="class_c_sys_state_manager_example.html#a3e70c77631e8cd6092de93f51cab49ad">CSysStateManagerExample::RequestSsChangeWithNotification</a>()
+<a name="l00191"></a>00191 {
+<a name="l00192"></a>00192 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtStateChangeNotificationSuccess,<span class="stringliteral">"\nNotification of the state transition received\n"</span>);
+<a name="l00193"></a>00193 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtStateChangeNotificationFailure,<span class="stringliteral">"\nNotification of the state transition failed\n"</span>);
+<a name="l00194"></a>00194 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtNormalToBackup,<span class="stringliteral">"\nRequest a System State change from Normal to Back up\n"</span>);
+<a name="l00195"></a>00195 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtAlreadyInThisState,<span class="stringliteral">"\nSystem state is already in Backup\n"</span>);
+<a name="l00196"></a>00196
+<a name="l00197"></a>00197 <span class="comment">// This session helps you to get the details of the current state of the device</span>
+<a name="l00198"></a>00198 RSsmStateAwareSession stateAwareSession;
+<a name="l00199"></a>00199
+<a name="l00200"></a>00200 <span class="comment">/*</span>
+<a name="l00201"></a>00201 <span class="comment"> 'KSM2UiServicesDomain3' is the domain id for the third domain in the UI </span>
+<a name="l00202"></a>00202 <span class="comment"> Service level of the Startup Domain Hierarchy.</span>
+<a name="l00203"></a>00203 <span class="comment"> */</span>
+<a name="l00204"></a>00204 TInt err = stateAwareSession.Connect(KSM2UiServicesDomain3);
+<a name="l00205"></a>00205 iConsole->Printf(KTxtSasResult,err);
+<a name="l00206"></a>00206 TSsmState current = stateAwareSession.State();
+<a name="l00207"></a>00207 TSsmStateName name = current.Name();
+<a name="l00208"></a>00208
+<a name="l00209"></a>00209 <span class="keywordflow">if</span>(current.MainState()!= ESsmBackup)
+<a name="l00210"></a>00210 {
+<a name="l00211"></a>00211 TSsmStateTransition state1(ESsmBackup,ESsmBackupSubState, 0);
+<a name="l00212"></a>00212 iConsole->Printf(KTxtNormalToBackup);
+<a name="l00213"></a>00213 TRequestStatus status1,status2;
+<a name="l00214"></a>00214 iConsole->Printf(KTxtReqNotificationChgofState);
+<a name="l00215"></a>00215 stateAwareSession.RequestStateNotification(status1);
+<a name="l00216"></a>00216 iSsmStateManager.RequestStateTransition(state1,status2);
+<a name="l00217"></a>00217 User::WaitForRequest(status2);
+<a name="l00218"></a>00218 User::After(KFiveSecDelay); <span class="comment">// Wait for 0.5 sec to allow transitions to fully complete</span>
+<a name="l00219"></a>00219 <span class="keywordflow">if</span>(status2.Int() == KErrNone)
+<a name="l00220"></a>00220 {
+<a name="l00221"></a>00221 iConsole->Printf(KTxtStateChangeResult,status2.Int());
+<a name="l00222"></a>00222 current = stateAwareSession.State();
+<a name="l00223"></a>00223 name = current.Name();
+<a name="l00224"></a>00224 }
+<a name="l00225"></a>00225 <span class="keywordflow">else</span>
+<a name="l00226"></a>00226 {
+<a name="l00227"></a>00227 iConsole->Printf(KTxtStateChangeResult,status2.Int());
+<a name="l00228"></a>00228 }
+<a name="l00229"></a>00229 iConsole->Printf(KTxtState);
+<a name="l00230"></a>00230 iConsole->Printf(name);
+<a name="l00231"></a>00231 iConsole->Printf(KTxtStateValues,current.MainState(),current.SubState());
+<a name="l00232"></a>00232 User::WaitForRequest(status1); <span class="comment">//status1 of the Notification request waits for status2 to complete</span>
+<a name="l00233"></a>00233 <span class="keywordflow">if</span>(status1.Int() == KErrNone)
+<a name="l00234"></a>00234 {
+<a name="l00235"></a>00235 iConsole->Printf(KTxtStateChangeNotificationSuccess);
+<a name="l00236"></a>00236 }
+<a name="l00237"></a>00237 <span class="keywordflow">else</span>
+<a name="l00238"></a>00238 {
+<a name="l00239"></a>00239 iConsole->Printf(KTxtStateChangeNotificationFailure);
+<a name="l00240"></a>00240 }
+<a name="l00241"></a>00241 }
+<a name="l00242"></a>00242 <span class="keywordflow">else</span>
+<a name="l00243"></a>00243 {
+<a name="l00244"></a>00244 iConsole->Printf(KTxtAlreadyInThisState);
+<a name="l00245"></a>00245 }
+<a name="l00246"></a>00246 stateAwareSession.Close();
+<a name="l00247"></a>00247 }
+<a name="l00248"></a>00248
+<a name="l00249"></a>00249 <span class="keywordtype">void</span> CSysStateManagerExample::SSManagerL()
+<a name="l00250"></a>00250 {
+<a name="l00251"></a>00251 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTextPressAnyKey,<span class="stringliteral">" [press any key]"</span>);
+<a name="l00252"></a>00252 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTextPressAnyKeyToExit,<span class="stringliteral">" [press any key to exit]"</span>);
+<a name="l00253"></a>00253
+<a name="l00254"></a>00254 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtSwp,<span class="stringliteral">"Swp means SystemWide Property.\nDisk status, Battery information are few examples of System wide properties.\n"</span>);
+<a name="l00255"></a>00255 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtSs,<span class="stringliteral">"\n SS means System State.\n Ex:Backup,Restore, Start-up, Shutdown are few examples of System states.\n"</span>);
+<a name="l00256"></a>00256 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtExampleDemo,<span class="stringliteral">"\n The example helps the user in understanding, how to define new System states and System wide properties.It also helps him in exercising the various features of SSM framework.\n"</span>);
+<a name="l00257"></a>00257 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtSSM, <span class="stringliteral">"Exercise the features of System State Manager\n"</span>);
+<a name="l00258"></a>00258 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtConnect,<span class="stringliteral">"Connecting to System State Manager.........\n"</span>);
+<a name="l00259"></a>00259 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtSuccess,<span class="stringliteral">"Connection is successful.........\n"</span>);
+<a name="l00260"></a>00260
+<a name="l00261"></a>00261 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtReqChangeInSwp,<span class="stringliteral">"1) request a change to a Swp, without notification\n"</span>);
+<a name="l00262"></a>00262 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtReqChangeInSs,<span class="stringliteral">"2) request a change to a system state, without notification\n"</span>);
+<a name="l00263"></a>00263 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtNotifyChangeInSwp,<span class="stringliteral">"3) request a change to a Swp, with notification\n"</span>);
+<a name="l00264"></a>00264 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtNotifyChangeInSs,<span class="stringliteral">"4) request a change to a system state, with notification\n"</span>);
+<a name="l00265"></a>00265 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtOptionNotSupported,<span class="stringliteral">"this option is not supported\n"</span>);
+<a name="l00266"></a>00266
+<a name="l00267"></a>00267 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtPressESC,<span class="stringliteral">"Press ESC to stop using the System State Information utility\n"</span>);
+<a name="l00268"></a>00268 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KTxtContinue,<span class="stringliteral">"Choose any option 1 - 4 to continue\n"</span>);
+<a name="l00269"></a>00269
+<a name="l00270"></a>00270 iConsole= Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
+<a name="l00271"></a>00271 iConsole->Printf(KTxtFormat);
+<a name="l00272"></a>00272 iConsole->Printf(KTxtSwp);
+<a name="l00273"></a>00273 iConsole->Printf(KTxtSs);
+<a name="l00274"></a>00274 iConsole->Printf(KTxtExampleDemo);
+<a name="l00275"></a>00275 iConsole->Printf(KTxtFormat);
+<a name="l00276"></a>00276 iConsole->Printf(KTxtSSM);
+<a name="l00277"></a>00277 iConsole->Printf(KTxtConnect);
+<a name="l00278"></a>00278 iConsole->Printf(KTxtFormat1);
+<a name="l00279"></a>00279 TInt connect = iSsmStateManager.Connect();
+<a name="l00280"></a>00280 <span class="keywordflow">if</span>(connect==KErrNone)
+<a name="l00281"></a>00281 {
+<a name="l00282"></a>00282 iConsole->Printf(KTxtSuccess);
+<a name="l00283"></a>00283 iConsole->Printf(KTxtFormat);
+<a name="l00284"></a>00284 iConsole->Printf(KTextPressAnyKey);
+<a name="l00285"></a>00285 iConsole->Getch(); <span class="comment">// Get and ignore character.</span>
+<a name="l00286"></a>00286 iConsole->ClearScreen();
+<a name="l00287"></a>00287 iConsole->Printf(KTxtReqChangeInSwp);
+<a name="l00288"></a>00288 iConsole->Printf(KTxtReqChangeInSs);
+<a name="l00289"></a>00289 iConsole->Printf(KTxtNotifyChangeInSwp);
+<a name="l00290"></a>00290 iConsole->Printf(KTxtNotifyChangeInSs);
+<a name="l00291"></a>00291 iConsole->Printf(KTxtContinue);
+<a name="l00292"></a>00292 TChar tchar = iConsole->Getch();
+<a name="l00293"></a>00293 <span class="comment">//make a choice</span>
+<a name="l00294"></a>00294 <span class="keywordflow">while</span> (tchar != EKeyEscape)
+<a name="l00295"></a>00295 {
+<a name="l00296"></a>00296 <span class="keywordflow">switch</span>(tchar)
+<a name="l00297"></a>00297 {
+<a name="l00298"></a>00298 <span class="keywordflow">case</span> <span class="charliteral">'1'</span>:
+<a name="l00299"></a>00299 {
+<a name="l00300"></a>00300 <a class="code" href="class_c_sys_state_manager_example.html#a1c585579a816b7e0f8393267a7a7a97a">RequestSwpChange</a>();
+<a name="l00301"></a>00301 <span class="keywordflow">break</span>;
+<a name="l00302"></a>00302 }
+<a name="l00303"></a>00303 <span class="keywordflow">case</span> <span class="charliteral">'2'</span>:
+<a name="l00304"></a>00304 {
+<a name="l00305"></a>00305 <a class="code" href="class_c_sys_state_manager_example.html#a6b5511414b63e07e00fbff5af8808cad">RequestSsChange</a>();
+<a name="l00306"></a>00306 <span class="keywordflow">break</span>;
+<a name="l00307"></a>00307 }
+<a name="l00308"></a>00308 <span class="keywordflow">case</span> <span class="charliteral">'3'</span>:
+<a name="l00309"></a>00309 {
+<a name="l00310"></a>00310 <a class="code" href="class_c_sys_state_manager_example.html#a7c3ee7dd5826eb98097e2c2ef43ed980">RequestSwpChangeWithNotificationL</a>();
+<a name="l00311"></a>00311 <span class="keywordflow">break</span>;
+<a name="l00312"></a>00312 }
+<a name="l00313"></a>00313 <span class="keywordflow">case</span> <span class="charliteral">'4'</span>:
+<a name="l00314"></a>00314 {
+<a name="l00315"></a>00315 <a class="code" href="class_c_sys_state_manager_example.html#a3e70c77631e8cd6092de93f51cab49ad">RequestSsChangeWithNotification</a>();
+<a name="l00316"></a>00316 <span class="keywordflow">break</span>;
+<a name="l00317"></a>00317 }
+<a name="l00318"></a>00318 <span class="keywordflow">default</span>:
+<a name="l00319"></a>00319 {
+<a name="l00320"></a>00320 iConsole->Printf(KTxtOptionNotSupported);
+<a name="l00321"></a>00321 <span class="keywordflow">break</span>;
+<a name="l00322"></a>00322 }
+<a name="l00323"></a>00323 }
+<a name="l00324"></a>00324 iConsole->Printf(KTextPressAnyKey);
+<a name="l00325"></a>00325 iConsole->Getch(); <span class="comment">// Get and ignore character.</span>
+<a name="l00326"></a>00326 iConsole->ClearScreen();
+<a name="l00327"></a>00327 iConsole->Printf(KTxtPressESC);
+<a name="l00328"></a>00328 iConsole->Printf(KTxtContinue);
+<a name="l00329"></a>00329 iConsole->Printf(KTxtReqChangeInSwp);
+<a name="l00330"></a>00330 iConsole->Printf(KTxtReqChangeInSs);
+<a name="l00331"></a>00331 iConsole->Printf(KTxtNotifyChangeInSwp);
+<a name="l00332"></a>00332 iConsole->Printf(KTxtNotifyChangeInSs);
+<a name="l00333"></a>00333 tchar = iConsole->Getch();
+<a name="l00334"></a>00334 }
+<a name="l00335"></a>00335 }
+<a name="l00336"></a>00336 <span class="keywordflow">else</span>
+<a name="l00337"></a>00337 {
+<a name="l00338"></a>00338 iConsole->Printf(KTxtError,connect);
+<a name="l00339"></a>00339 }
+<a name="l00340"></a>00340 iConsole->Printf(KTextPressAnyKeyToExit);
+<a name="l00341"></a>00341 iConsole->Getch(); <span class="comment">// Get and ignore character.</span>
+<a name="l00342"></a>00342 }
+<a name="l00343"></a>00343
+<a name="l00344"></a>00344 <span class="keyword">static</span> <span class="keywordtype">void</span> doExampleL()
+<a name="l00345"></a>00345 {
+<a name="l00346"></a>00346 <a class="code" href="class_c_sys_state_manager_example.html">CSysStateManagerExample</a>* ssManager = CSysStateManagerExample::NewLC();
+<a name="l00347"></a>00347 ssManager->SSManagerL();
+<a name="l00348"></a>00348 CleanupStack::PopAndDestroy(ssManager);
+<a name="l00349"></a>00349 }
+<a name="l00350"></a>00350
+<a name="l00351"></a>00351 <span class="keyword">extern</span> TInt E32Main()
+<a name="l00352"></a>00352 {
+<a name="l00353"></a>00353 __UHEAP_MARK;
+<a name="l00354"></a>00354 CTrapCleanup* cleanup=CTrapCleanup::New(); <span class="comment">// Get clean-up stack.</span>
+<a name="l00355"></a>00355 <span class="keywordflow">if</span>(cleanup!=NULL)
+<a name="l00356"></a>00356 {
+<a name="l00357"></a>00357 TRAPD (error,doExampleL());
+<a name="l00358"></a>00358 __ASSERT_ALWAYS(!error,User::Panic(KTxtExampleCode,error));
+<a name="l00359"></a>00359 }
+<a name="l00360"></a>00360 <span class="keyword">delete</span> cleanup; <span class="comment">// Delete clean-up stack.</span>
+<a name="l00361"></a>00361 __UHEAP_MARKEND;
+<a name="l00362"></a>00362 <span class="keywordflow">return</span> KErrNone; <span class="comment">// And return.</span>
+<a name="l00363"></a>00363 }
+</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>