Symbian3/PDK/Source/GUID-B14B3D67-B0D5-54B6-AAE4-D4486D019498.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 16 Jul 2010 17:23:46 +0100
changeset 12 80ef3a206772
parent 9 59758314f811
permissions -rw-r--r--
Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE reference
  PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="GUID-B14B3D67-B0D5-54B6-AAE4-D4486D019498" xml:lang="en"><title>SystemStateManager: The System State Manager example</title><shortdesc>This example demonstrates the System State Manager (SSM)
API. It consists of System State Manager example executable (ssmanager.exe),
two system state policy plugins (ssm.state.policy.0004.dll and ssm.state.policy.0005.dll),
a system-wide property policy plugin (ssm.swp.policy.dummy.diskstatus.dll),
an example Normal State policy (ssm.state.policy.0001.dll) and a dummy
back-up application (dummybackup.exe). </shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody>
<section id="GUID-2F32F775-F525-5893-A581-3A5396A66333"><title>Purpose</title> <p>This example demonstrates following SSM features </p> <ul>
<li id="GUID-55D30A2E-9EEF-515C-9DA5-2261AD64FD2E"><p>How to write
a System Wide Property (SWP) policy. </p> </li>
<li id="GUID-477F87E7-D3B2-53FB-A96D-8304632AF48D"><p>How to write
a System State policy. </p> </li>
<li id="GUID-3AAA1DCD-F21A-53A2-8AB8-39F42396972D"><p>How to request
a change to an SWP, with and without notification </p> </li>
<li id="GUID-5022B224-8620-5AB8-B8C7-F95296DC7A14"><p>How to request
a change to a system state, with and without notification </p> </li>
</ul> </section>
<section id="GUID-878E4690-1F02-5C15-8B4E-F53E8EA8719D-GENID-1-12-1-11-1-1-7-1-5-1-6-1-3-2"><title>Download</title><p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-77c0248d-dda5-4b56-9d5a-eda76091bca2.zip" scope="external">ssmanager.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-77c0248d-dda5-4b56-9d5a-eda76091bca2.html" scope="peer">browse</xref> to view the example code. </p> </section>
<section id="GUID-BD0B6948-73B3-4814-A8F4-BEF86DBE589E"><title>Class
Summary</title><ul>
<li><p><xref href="GUID-60E6220E-5B9B-3D4E-A95F-B7AD6DB8AF68.dita"><apiname>TSsmSwp</apiname></xref></p></li>
<li><p><xref href="GUID-CEBD45FB-5E0E-3EBA-B134-545B7F82EBEC.dita"><apiname>TSsmStateTransition</apiname></xref></p></li>
<li><p><xref href="GUID-76D2A5E8-BC64-3528-BED6-499E52CF8B2B.dita"><apiname>CSsmSystemWideProperty</apiname></xref></p></li>
<li><p><xref href="GUID-89C25B0F-DB76-30D5-A4D6-0C12922194E4.dita"><apiname>RSsmStateAwareSession</apiname></xref></p></li>
<li><p><xref href="GUID-8CE82869-EA9E-327C-B817-ACF497CCDC9D.dita"><apiname>RSsmStateManager</apiname></xref></p></li>
<li><p><xref href="GUID-31FB0BC8-83FC-3581-A7A3-C1781CAE7187.dita"><apiname>MSsmSwpPolicy</apiname></xref></p></li>
<li><p><xref href="GUID-ABE0DF1C-78FB-3141-8AE6-5CC8C73A8034.dita"><apiname>CSsmCommandList</apiname></xref></p></li>
<li><p><xref href="GUID-62413EF5-F6F1-37C9-9213-5178EAE6C2F5.dita"><apiname>MSwpChangeNotificationSubscriber</apiname></xref></p></li>
<li><p><xref href="GUID-4181374F-8545-3AF0-8932-A73138296FD1.dita"><apiname>CSsmCommandListResourceReader</apiname></xref></p></li>
<li><p><xref href="GUID-B29C0C6D-4BFC-3AAF-B9CB-8C200CF4B4C7.dita"><apiname>MSsmConditionalCallback</apiname></xref></p></li>
</ul></section>
<section id="GUID-C68A69F1-0692-50E3-A049-D38D90E4B52B"><title>Design
and implementation</title> <p>The example consists of several components:
a System State Manager example executable (<filepath>ssmanager.exe</filepath>), two system state policy plugins (<filepath>ssm.state.policy.0004.dll</filepath> and <filepath>ssm.state.policy.0005.dll</filepath>), a system-wide
property policy plugin (<filepath>ssm.swp.policy.dummy.diskstatus.dll</filepath>), an example Normal State policy (<filepath>ssm.state.policy.0001.dll</filepath>) and a dummy back-up application (<filepath>dummybackup.exe</filepath>). </p> <p>This section describes the components in the example: </p> <ul>
<li id="GUID-61B148DD-A13E-51C2-9EEB-54E354DE2DB3"><p> <filepath>ssmanager.exe</filepath>: The main process which presents the menu to the user, receives
the input from the user . It has the following functions: </p> <ul>
<li id="GUID-EA2E0A4A-8EC3-5BF8-8994-A2F90E4D032D"><p> <codeph>RequestSwpChange()</codeph>. This demonstrates changing the value of a system wide property
without notifying any clients. When the disk status changes, the dummy
backup application is launched to simulate a disk backup. <codeph>RequestSwpChangeWithNotificationL()</codeph> is similar to RequestSwpChange(),
but it notifies its clients when a value of a system wide property
changes. </p> </li>
<li id="GUID-D87525A4-570E-5CA9-AAC7-721564BDB50A"><p> <codeph>RequestSsChange()</codeph>. This demonstrates changing the system state without notifying any
clients. When the system state changes from 'Normal' to 'Restore'
state, the dummy backup application is launched. <codeph>RequestSsChangeWithNotification()</codeph> is similar to RequestSwpChange(), but it notifies its clients when
a value of a system wide property changes. </p> </li>
</ul> </li>
<li id="GUID-A61E42C7-F62E-5012-86D6-9D71833BB488"><p> <filepath>ssm.state.policy.0004.dll</filepath>:The dummy backup system state policy with custom commands listed
in a resource file (<filepath>ssm_cmdlist_state_dummy_backup.rss</filepath>). The command list is prepared in the dummy backup policy using
the <xref href="GUID-4181374F-8545-3AF0-8932-A73138296FD1.dita"><apiname>CSsmCommandListResourceReader</apiname></xref> class. </p> </li>
<li id="GUID-A74E6A5F-7E2B-5DEF-A8D9-75BDE2BCF765"><p> <filepath>ssm.state.policy.0005.dll</filepath>: The dummy restore system state policy with custom commands defined
using the command factory classes <xref href="GUID-A9E6135E-3C15-3176-A41A-108CE99AE28F.dita"><apiname>MSsmCommand</apiname></xref> and <xref href="GUID-365DF661-A86F-3218-9C77-483526385EDC.dita"><apiname>SsmCommandFactory</apiname></xref>. </p> </li>
<li id="GUID-90199262-D9C1-52C3-8475-02957E8A4E74"><p> <filepath>ssm.swp.policy.dummy.diskstatus.dll</filepath>: The dummy disk status system-wide property with custom commands
listed in a resource file (<filepath>ssm_cmdlist_swp_dummy_diskstatus.rss</filepath>). The command list is prepared by using the <xref href="GUID-4181374F-8545-3AF0-8932-A73138296FD1.dita"><apiname>CSsmCommandListResourceReader</apiname></xref> class. </p> </li>
<li id="GUID-6374DEC2-4AAB-500C-8AFA-EE8BF003F741"><p> <filepath>ssm.state.policy.0001.dll</filepath>: the dummy back up and restore states need to be supported by the
Normal state inorder to allow transition from one state to another.
Hence, the existing Normal state policy file is updated with the changes
required to support these transitions. </p> </li>
<li id="GUID-4F412BA5-3A79-5688-BD95-A3C384981FC1"><p> <filepath>dummybackup.exe</filepath>: The dummy application which is launched when the system state changes
to 'backup'. It just prints a series of statements to the console. </p> </li>
</ul> </section>
<section id="GUID-DEFCF4B9-452A-5EAF-ABD3-BC4F6FBD528B-GENID-1-12-1-11-1-1-7-1-5-1-6-1-3-5"><title>Building
and configuring</title> <p>To build the example: </p> <ul>
<li id="GUID-BCB63B67-BA41-5BE6-B80A-3DE0A0211A96"><p>The example
builds the following binaries </p> <p> <filepath>ssmanager.exe</filepath>  </p> <p> <filepath>ssm.state.policy.0004.dll</filepath>  </p> <p> <filepath>ssm.state.policy.0005.dll</filepath>  </p> <p> <filepath>ssm.swp.policy.dummy.diskstatus.dll</filepath>  </p> <p> <filepath>ssm.state.policy.0001.dll</filepath>  </p> <p> <filepath>dummybackup.exe</filepath>  </p> </li>
<li id="GUID-1D7646C4-40E8-5615-BD7C-DAFF33483CD5"><p>You can build
the example from your IDE or the command line. </p> <p>If you use
an IDE, import the <filepath>bld.inf</filepath> file of the example
into your IDE, and use the build command of the IDE. </p> <p>If you
use the command line, open a command prompt, and set the current directory
to the source code directory of the example. You can then build the
example with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake bldfiles</userinput> </p> <p><userinput>abld
build</userinput> </p> </li>
<li id="GUID-53F53A62-94CE-5412-AD52-CC00D4A44053"><p>For the emulator,
the example builds <filepath>ssmanager.exe</filepath> in the <filepath>epoc32\release\winscw\&lt;udeb or urel&gt;\</filepath> folder. </p> </li>
</ul> </section>
</refbody><related-links>
<link href="GUID-26DBE128-6244-557E-989D-A4A608F43A0F.dita"><linktext>System
State Manager Overview</linktext></link>
<link href="GUID-06724AAF-3C6D-5964-B69D-D9D981543505.dita"><linktext>System
State Manager Tutorials</linktext></link>
</related-links></reference>