sysstatemgmt/systemstateplugins/gsapolicy/inc/gsastatepolicynormal.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 __GSASTATEPOLICYNORMAL_H__
       
    17 #define __GSASTATEPOLICYNORMAL_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <ssm/ssmstatepolicy.h>
       
    21 #include <ssm/ssmconditionalcallback.h>
       
    22 #include <ssm/conditionevaluate.h>
       
    23 
       
    24 class CSsmCommandListResourceReader;
       
    25 
       
    26 /**
       
    27 Normal state policy plug-in for GSA. This is a polymorphic dll.
       
    28 Implements MSsmStatePolicy to initialize, prepare and return command list using CSsmCommandListResourceReader.
       
    29 Implements MSsmConditionalCallback to decide whether to include a command in a command list or not.
       
    30 
       
    31 @internalComponent
       
    32 @released
       
    33 @see MSsmStatePolicy
       
    34 @see MSsmConditionalCallback
       
    35 */
       
    36 NONSHARABLE_CLASS(CGsaStatePolicyNormal) : public CBase, public MSsmStatePolicy, public MSsmConditionalCallback
       
    37 	{
       
    38 public:
       
    39 	IMPORT_C static MSsmStatePolicy* NewL();
       
    40 
       
    41 	//from MSsmStatePolicy
       
    42 	TResponse TransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, TSsmStateTransition const* aQueued, 
       
    43 								const RMessagePtr2& aMessage);
       
    44 	void Initialize(TRequestStatus& aStatus);
       
    45 	void InitializeCancel();
       
    46 	void PrepareCommandList(TSsmState aState, TInt aReason, TRequestStatus& aStatus);
       
    47 	void PrepareCommandListCancel();
       
    48 	CSsmCommandList* CommandList();
       
    49 	TBool GetNextState(TSsmState aCurrentTransition, TInt aReason, TInt aError, TInt aSeverity, TSsmState& aNextState);
       
    50 	void Release();
       
    51 
       
    52 	// from MSsmConditionalCallback
       
    53 	TBool ConditionalCommandAllowedL(CResourceFile& aResourceFile, TInt aResourceId);
       
    54 	
       
    55 private:
       
    56 	~CGsaStatePolicyNormal();
       
    57 	CGsaStatePolicyNormal();
       
    58 
       
    59 	void ConstructL();
       
    60 	TBool TransitionSupported(const TSsmState& aRequestedState) const;
       
    61 
       
    62 private:
       
    63 	RArray<TSsmState> iCurrentlySupportedTransitions;	
       
    64 	CSsmCommandListResourceReader* iCommandListResourceReader;
       
    65 	RFs iFs;
       
    66 	//CConditionEvaluate is created and used only when patchable constant KSsmGracefulOffline is enabled
       
    67 	CConditionEvaluate *iEvaluator;
       
    68 
       
    69 	// Possible panic codes within Normal policy
       
    70 	enum TNormalPanicCodes
       
    71 		{
       
    72 		/**
       
    73 		 Panic when command list resource reader is NULL
       
    74 		*/
       
    75 		EInvalidResourceReader = 1,
       
    76 		/**
       
    77 		 Panic when Main state supplied is not 'ESsmNormal'
       
    78 		*/
       
    79 		EInvalidNormalState,
       
    80 		/**
       
    81 		 Panic when ConditionalCommandAllowedL is called for a command which hasn't implemented conditional_information
       
    82 		*/
       
    83 		EConditionalInfoNotImplemented
       
    84 		};
       
    85 	};
       
    86 
       
    87 #endif	// __GSASTATEPOLICYNORMAL_H__