sysstatemgmt/systemstatemgr/ssm/inc/ssmswptransitionengine.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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 __SSMSWPTRANSITIONENGINE_H__
       
    17 #define __SSMSWPTRANSITIONENGINE_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <ssm/ssmswp.h>
       
    21 #include <ssm/ssmcmd.hrh>
       
    22 #include "ssmswppolicyproxy.h"
       
    23 
       
    24 class CSsmSwpPolicyFrame;
       
    25 class CSsmCommandList;
       
    26 class MCleSessionProxy;
       
    27 class CSsmSwpPolicyFrame;
       
    28 
       
    29 /** 
       
    30 The CSsmSwpTransitionEngine class is responsible for:-
       
    31 - retrieving the command list from the policy
       
    32 - executing the command list
       
    33 - informing the client of the result when the commands have finished executing
       
    34 
       
    35 @internalComponent
       
    36 @released
       
    37 
       
    38 */
       
    39 class CSsmSwpTransitionEngine : public CActive
       
    40 	{
       
    41 public:
       
    42 	// construction
       
    43 	static CSsmSwpTransitionEngine* NewL(const TSsmSwp& SwpValue);
       
    44 	~CSsmSwpTransitionEngine();
       
    45 
       
    46 	// wiring
       
    47 	void SetClientMessage(const RMessage2* aMessage);
       
    48 	void SetCleSessionProxy(MCleSessionProxy* aCleSession);
       
    49 	void SetSsmSwpPolicySession(CSsmSwpPolicyCliSession* aSsmSwpPolicySession);
       
    50 	void SetSwpPolicyFrame(CSsmSwpPolicyFrame* aPolicyFrame);
       
    51 
       
    52 	// functions
       
    53 #ifdef TEST_SSM_SERVER
       
    54 	void Submit();
       
    55 #endif
       
    56 	void Submit(TRequestStatus& aClientStatus);
       
    57 	void CompleteClientMessage(TInt aError);
       
    58 	CSession2* OriginatingSesssion() const;
       
    59 	void PerformCommandListValidation(TBool aSetting);
       
    60 	TBool InTransition() const;
       
    61 	const TSsmSwp& TransitionValue() const;
       
    62 	MCleSessionProxy* CleSessionProxy();
       
    63 
       
    64 protected:
       
    65 	//from CActive
       
    66 	void DoCancel();
       
    67 	void RunL();
       
    68 	TInt RunError(TInt aError);
       
    69 
       
    70 private:
       
    71 	CSsmSwpTransitionEngine(const TSsmSwp& SwpValue);
       
    72 	void ConstructL();
       
    73 	void DoSubmit();
       
    74 	void Start();
       
    75 	void CancelCommandExecution();
       
    76 	void DoConnectCleSessionL();
       
    77 	void DoInitialize();
       
    78 	TBool DoTransitionAllowed();
       
    79 	void DoPrepareCommandList();
       
    80 	void DoExecuteCommandList();
       
    81 	void DoValidation();
       
    82 	void DoHandleCleReturnValue();
       
    83 	void DoRunError(TInt aError);
       
    84 
       
    85 private:
       
    86 	enum TInternalActions
       
    87 		{
       
    88 		EIdle,
       
    89 		EUnConnected,
       
    90 		ESetSwpPolicyDllHandleAndInitialize,
       
    91 		ETransitionAllowed,
       
    92 		EPrepareCommandList,
       
    93 		EExecuteCommandList,
       
    94 		EWaitForCommandListExecute,
       
    95 		EWaitForHandleCleReturnValue,
       
    96 		ETransitionComplete
       
    97 		};
       
    98 		
       
    99 	/** the policy frame used to access the policy DLL functions */
       
   100 	CSsmSwpPolicyFrame* iPolicyFrame; // owned by me
       
   101 	/** the interface used to communicate with the command executor */
       
   102 	MCleSessionProxy* iCleSession; // not owned by me
       
   103 	/** The client (caller) status */
       
   104 	TRequestStatus* iClientStatus; // not owned by me
       
   105 	/** The current change in progress */
       
   106 	TSsmSwp iCurrentSwpValue; // copied to me
       
   107 	/** to keep track of the internal state for extra checking */
       
   108 	TInternalActions iNextAction; // internal to me
       
   109 	/** to inform the client of the result of the engines run */
       
   110 	RMessage2 iClientMessage;
       
   111 	TBool iPerformCommandListValidation;
       
   112 	/** The severity of the current command*/
       
   113 	TCmdErrorSeverity iSeverity;
       
   114 	CSsmSwpPolicyCliSession* iSsmSwpPolicySession; // not owned by me
       
   115 	CSsmCommandList* iCommandList;
       
   116 	};
       
   117 
       
   118 #endif