Symbian3/PDK/Source/GUID-8CB4B949-CEDA-5F59-B46D-1415B016EF13.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 16:16:55 +0100
changeset 6 43e37759235e
parent 5 f345bda72bc4
child 14 578be2adaf3e
permissions -rw-r--r--
Week 12 contribution of example code"

<?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 task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-8CB4B949-CEDA-5F59-B46D-1415B016EF13" xml:lang="en"><title>Creating
System State Manager policy plug-in</title><shortdesc>The System State Manager will have policy associated with a transition
in system state or a system-wide property. The transition from one state to
another is implicit. The SSM policy is defined by a system state policy plug-in
and an associated command list resource file.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context><p>SSM policies implements <xref href="GUID-A86FEEA6-7602-34A9-A200-E2521CB66BD4.dita"><apiname>MSsmStatePolicy</apiname></xref> interface
to initialize, prepare and return a <codeph>commandlist</codeph> using <xref href="GUID-4181374F-8545-3AF0-8932-A73138296FD1.dita"><apiname>CSsmCommandListResourceReader</apiname></xref>.
It also implements <xref href="GUID-B29C0C6D-4BFC-3AAF-B9CB-8C200CF4B4C7.dita"><apiname>MSsmConditionalCallback</apiname></xref> function to
decide whether to include a command in a <codeph>commandlist</codeph> or not. </p> <p>The
system state manager policies derived are normal, start-up, fail and shutdown.
All these policies are created using the <codeph>MSsmStatePolicy</codeph> interface. </p><p>Follow
the steps given below to create a normal policy plug-in:</p></context>
<steps id="GUID-634FADFB-7A3F-5D77-B83F-1E73CAF1715E">
<step id="GUID-ABF4CEFD-EE5E-5B43-8FDA-4E1A4D1D8A26"><cmd/>
<info>Define a class that implements <codeph>MSsmStatePolicy</codeph> interface. </info>
</step>
<step id="GUID-0CDC72F2-BC0B-5853-8529-3840048607E0"><cmd/>
<info>Export the static method to create new normal state policy plug-in as
shown in the code snippet: </info>
<stepxmp><codeblock id="GUID-2B82A037-EF9D-5328-8F70-DD58FEA85E0D" xml:space="preserve">
EXPORT_C MSsmStatePolicy* CGsaStatePolicyNormal::NewL()
{
    CGsaStatePolicyNormal* self = new ( ELeave ) CGsaStatePolicyNormal; 
    CleanupStack::PushL(self);    
    self-&gt;ConstructL();    
    CleanupStack::Pop(self);   
    return self;
}</codeblock> </stepxmp>
<info>The code returns a new normal state policy plug-in. </info>
</step>
</steps>
<result><p>The normal state policy plug-in is created. </p> </result>
</taskbody><related-links>
<link href="GUID-95FA6DDA-E1C2-5148-9F18-4171BF06C9AC.dita"><linktext>Creating
System-wide Property Policy plug-in</linktext></link>
<link href="GUID-4D6FBF03-FA0A-5D79-A8B9-4C0B52303CF1.dita"><linktext>Creating
System Utility Policy plug-in</linktext></link>
</related-links></task>