|
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 __SSMSTATETRANSITIONENGINE_H__ |
|
17 #define __SSMSTATETRANSITIONENGINE_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <ssm/ssmstatetransition.h> |
|
21 #include <ssm/ssmstatepolicy.h> |
|
22 #include <ssm/ssmcmd.hrh> |
|
23 |
|
24 class CSsmStatePolicyFrame; |
|
25 class CSsmCommandList; |
|
26 class MCleSessionProxy; |
|
27 class MSsmStatePolicyResolverProxy; |
|
28 class CSsmStateTransitionRequest; |
|
29 |
|
30 /** |
|
31 The CSsmStateTransitionEngine class is responsible for drivingin |
|
32 System State Changes by requesting answers and actions from System State |
|
33 Policy implememtations and the Command List Execution Server. |
|
34 |
|
35 @internalComponent |
|
36 @released |
|
37 */ |
|
38 class CSsmStateTransitionEngine : public CActive |
|
39 { |
|
40 public: |
|
41 static CSsmStateTransitionEngine* NewL(MSsmStatePolicyResolverProxy* aResolver, MCleSessionProxy* aCleSession); |
|
42 static CSsmStateTransitionEngine* NewLC(MSsmStatePolicyResolverProxy* aResolver, MCleSessionProxy* aCleSession); |
|
43 ~CSsmStateTransitionEngine(); |
|
44 |
|
45 TSsmStateTransition const* CurrentTransition() const; |
|
46 TSsmStateTransition const* QueuedTransition() const; |
|
47 |
|
48 MSsmStatePolicy::TResponse TransitionAllowed(const TSsmStateTransition& aRequest, const RMessagePtr2& aMessage); |
|
49 void SubmitL(const TSsmStateTransition& aRequest); |
|
50 void SubmitL(const TSsmStateTransition& aRequest, const RMessage2& aMessage); |
|
51 void Cancel(CSession2*); |
|
52 void PerformCommandListValidation(TBool aSetting); |
|
53 #ifdef _DEBUG |
|
54 void CleanupTransitionEngine(); |
|
55 #endif |
|
56 |
|
57 protected: |
|
58 //from CActive |
|
59 void DoCancel(); |
|
60 void RunL(); |
|
61 TInt RunError(TInt aError); |
|
62 |
|
63 private: |
|
64 CSsmStateTransitionEngine(MSsmStatePolicyResolverProxy* aResolver, MCleSessionProxy* aCleSession); |
|
65 void DoSubmit(CSsmStateTransitionRequest* aRequest); |
|
66 void Start(); |
|
67 void ShiftQueueIfNeeded(); |
|
68 CSsmStatePolicyFrame* Policy(); |
|
69 void DoConnectCleSessionL(); |
|
70 void DoStartTransitionL(); |
|
71 void DoInitialize(); |
|
72 void DoPrepareCommandList(); |
|
73 void DoExecuteCommandList(); |
|
74 void DoValidation(); |
|
75 TBool FurtherTransition(); |
|
76 TBool InTransition() const; |
|
77 |
|
78 private: |
|
79 enum TInternalActions |
|
80 { |
|
81 EUnConnected, |
|
82 EIdle, |
|
83 EStartTransition, |
|
84 EInitialize, |
|
85 EPrepareCommandList, |
|
86 EExecuteCommandList, |
|
87 EReadNextTransition |
|
88 }; |
|
89 |
|
90 MSsmStatePolicyResolverProxy& iResolver; |
|
91 MCleSessionProxy& iCleSession; |
|
92 TBool iPerformCommandListValidation; |
|
93 |
|
94 CSsmStateTransitionRequest* iQueuedTransition; |
|
95 CSsmStateTransitionRequest* iCurrentTransition; |
|
96 |
|
97 TSsmState iTargetSystemState; |
|
98 TInternalActions iNextAction; |
|
99 /** The severity of the current command*/ |
|
100 TCmdErrorSeverity iSeverity; |
|
101 CSsmCommandList* iCommandList; |
|
102 }; |
|
103 |
|
104 #endif |