# examples/AppFramework/ssmanager/policies/sysstates/dummy_backup_statepolicy.h

    00001 //
    00002 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
    00003 // All rights reserved.
    00004 // This component and the accompanying materials are made available
    00005 // under the terms of "Eclipse Public License v1.0"
    00006 // which accompanies this distribution, and is available
    00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    00008 //
    00009 // Initial Contributors:
    00010 // Nokia Corporation - initial contribution.
    00011 //
    00012 // Contributors:
    00013 //
    00014 // Description: A dummy backup state policy is provided to demonstrate the system state
    00015 // manager framework.
    00016 //
    00017
    00018 #ifndef _DUMMY_BACKUP_STATEPOLICY_H__
    00019 #define _DUMMY_BACKUP_STATEPOLICY_H__
    00020
    00021 #include <e32base.h>
    00022 #include <f32file.h>
    00023
    00024 #include <ssm/ssmstatepolicy.h>
    00025 #include <ssm/ssmstate.h>
    00026 #include <ssm/ssmconditionalcallback.h>
    00027 #include <ssm/ssmstatetransition.h>
    00028
    00029 // Forward declaration
    00030 class CSsmCommandListResourceReader;
    00031
    00038 NONSHARABLE_CLASS(CSsmDummyBackUpStatePolicy) : public CBase, public MSsmStatePolicy, public MSsmConditionalCallback
    00039         {
    00040 public:
    00041         IMPORT_C static MSsmStatePolicy* NewL();
    00042
    00043         //from MSsmStatePolicy
    00044         void Initialize(TRequestStatus& aStatus);
    00045         void InitializeCancel();
    00046         void Release();
    00047         TResponse TransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, TSsmStateTransition const* aQueued, const RMessagePtr2& aMessage);
    00048         void PrepareCommandList(TSsmState aState, TInt aReason, TRequestStatus& aStatus);
    00049         void PrepareCommandListCancel();
    00050         CSsmCommandList* CommandList();
    00051         TBool GetNextState(TSsmState aCurrentTransition, TInt aReason, TInt aError, TInt aSeverity, TSsmState& aNextState);
    00052
    00053         //from MSsmConditionalCallback
    00054         TBool ConditionalCommandAllowedL(CResourceFile& aResourceFile, TInt aResourceId);
    00055
    00056 private:
    00057         void ConstructL();
    00058         //from CBase
    00059         CSsmDummyBackUpStatePolicy();
    00060         ~CSsmDummyBackUpStatePolicy();
    00061         TBool TransitionSupported(const TSsmState& aRequestedState) const;
    00062 private:
    00063         RFs iFs;
    00064         CSsmCommandListResourceReader* iCommandListResourceReader;
    00065         RArray<TSsmState> iCurrentlySupportedTransitions;
    00066         enum TBackupPanicCodes
    00067                 {
    00068                 EInvalidResourceReader // Panic code used when the command list resource reader is NULL
    00069                 };
    00070         };
    00071
    00072 #endif  //_DUMMY_BACKUP_STATEPOLICY_H__