Symbian3/PDK/Source/GUID-BBA7D3E2-1766-53CA-8D58-4F0B3BAA4873.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/PDK/Source/GUID-BBA7D3E2-1766-53CA-8D58-4F0B3BAA4873.dita	Fri Jan 22 18:26:19 2010 +0000
@@ -0,0 +1,86 @@
+<?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-BBA7D3E2-1766-53CA-8D58-4F0B3BAA4873" xml:lang="en"><title>Registering
+for Shutdown Notification</title><shortdesc>This document explains how to register for shutdown notification
+for a component. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
+<prereq><p>Before you start, you must know: </p> <ul>
+<li id="GUID-5B8F2E24-2E7C-569E-9603-2775788DD9F3"><p>the APIs for components
+that want to be system state aware. </p> </li>
+<li id="GUID-E7336F6D-EDB1-5EB2-A2FD-9D28468EEC1C"><p>that each state aware
+component must connect to the appropriate domain ID. </p> </li>
+</ul> </prereq>
+<context><p>Register a component or an application for shutdown notification
+through <xref href="GUID-89C25B0F-DB76-30D5-A4D6-0C12922194E4.dita"><apiname>RSsmStateAwareSession</apiname></xref> if they need to do save critical
+or non-critical data and perform clean-up tasks at the time of shutdown. </p> <p>For
+example, a component or an application can free all resources or can close
+any connection with the servers to make the shutdown graceful. The shutdown
+sequence will commence once all the components acknowledge the notification
+they have received. </p><p>Follow the steps given below to register for shutdown
+notification:</p></context>
+<steps id="GUID-70BB5BD2-EFB2-5E9E-BFE4-B57B9E6FB49B">
+<step id="GUID-EA0AA697-4409-5587-BBC7-8E18EF7E0B6D"><cmd/>
+<info>Create a class which is derived from <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref>  </info>
+<info>The following code snippet illustrates how to create a class from <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref>: </info>
+<stepxmp><codeblock id="GUID-C84D1F72-0FFE-5E2E-B34B-1325E905030C" xml:space="preserve">
+class CExample : public CActive
+{
+    public:
+          static CExample* NewL();
+          ~CExample();
+
+          private:
+              //from CActive
+              void RunL();
+              void DoCancel();
+          private:
+              void ConstructL();
+          private:
+              RSsmStateAwareSession iStateAwareSession;
+              //A state aware component, which can be used to provide APIs for components that want to be system state aware.
+};
+</codeblock> </stepxmp>
+</step>
+<step id="GUID-5D5E947F-A834-598C-9D13-D0D8C50F9B91"><cmd/>
+<info>Connect the session and register for notification. </info>
+<info>The following code snippet illustrates how to connect the session and
+register for notification: </info>
+<stepxmp><codeblock id="GUID-99CB04C9-838D-57A5-9154-39F739178FFC" xml:space="preserve">
+CExample* CExample::NewL()
+{
+    CExample* self = new( ELeave ) CExample();
+          CleanupStack::PushL( self );
+          self-&gt;ConstructL();
+          CleanupStack::Pop( self );
+          return self;
+}
+CExample:: CExample()
+CActive( CActive::EPriorityStandard )
+{
+    CActiveScheduler::Add( this );
+}
+void CExample::ConstructL()
+{
+    // Each state aware component must connect to the appropriate domain ID.
+    //Example, this component is high up in the domain hierarchy ( in the UI Frameworks domain ).
+    User::LeaveIfError( iStateAwareSession.Connect ( KUIFramework3 ));
+          iStateAwareSession.RequestStateNotification( iStatus );
+          SetActive();
+}</codeblock> </stepxmp>
+</step>
+</steps>
+<result><p>The component is registered for shutdown notification. </p> </result>
+<postreq><p>After registering for shutdown notification, the user needs to
+know how the component handles and acknowledge the shutdown notification. </p> </postreq>
+</taskbody><related-links>
+<link href="GUID-833BF27D-B288-506A-B545-E748C9FE7AEA.dita"><linktext>Making a
+Component Shutdown Aware</linktext></link>
+</related-links></task>
\ No newline at end of file