sysstatemgmt/systemstatemgr/ssm/inc/ssmstatepolicyframe.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __SSMSTATEPOLICYFRAME_H__
       
    17 #define __SSMSTATEPOLICYFRAME_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <ssm/ssmstatepolicy.h>
       
    21 
       
    22 class CSsmCommandList;
       
    23 class TSsmState;
       
    24 class TSsmStateTransition;
       
    25 
       
    26 /**
       
    27 This class owns the MSsmStatePolicy instance created from the System State Policy DLL.
       
    28 Its main purpose is to construct and delete the MSsmStatePolicy object, and to guarantee 
       
    29 correctness from the CSsmStateTransitionEngine.
       
    30 @internalComponent
       
    31 @released
       
    32 */
       
    33 class CSsmStatePolicyFrame : public CBase
       
    34   	{
       
    35 public:
       
    36 	static CSsmStatePolicyFrame* NewL(TLibraryFunction aNewLFunc);
       
    37 	CSsmStatePolicyFrame(MSsmStatePolicy* aStatePolicy);
       
    38 	~CSsmStatePolicyFrame();
       
    39 
       
    40 	TUint16 StatePolicyId() const;
       
    41 	void SetStatePolicyId(TUint16 aMainState);
       
    42 	inline TBool Initialized() const { return iInitializeCalled; }
       
    43 	
       
    44 	void CallInitialize(TRequestStatus& aStatus);
       
    45 	void CallInitializeCancel();
       
    46 	MSsmStatePolicy::TResponse CallTransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, TSsmStateTransition const* aQueued, const RMessagePtr2& aMessage);
       
    47 	void CallPrepareCommandList(TSsmState aTargetState, TInt aReason, TRequestStatus& aStatus);
       
    48 	void CallPrepareCommandListCancel();
       
    49 	CSsmCommandList* CallCommandList();
       
    50 	TBool CallGetNextState(TSsmState aCurrentTransition, TInt aReason, TInt aError, TInt aSeverity, TSsmState& aNextState);
       
    51 
       
    52 private:
       
    53 	CSsmStatePolicyFrame();
       
    54 	void ConstructL(TLibraryFunction aNewLFunc);
       
    55 	
       
    56 private:				
       
    57 	enum TInternalActions
       
    58 		{
       
    59 		EInitialize,
       
    60 		EPrepare,
       
    61 		EGet,
       
    62 		ENext
       
    63 		};
       
    64 	/** the policy that has been loaded */
       
    65 	MSsmStatePolicy* iStatePolicy;
       
    66 	/** used to track the internal state of the object for extra integrity */
       
    67 	TInternalActions iNextAction;
       
    68 	TUint16 iStatePolicyId;
       
    69 	TBool iInitializeCalled;	
       
    70 	};
       
    71 	
       
    72 #endif