|
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 __GSASTATEPOLICYSTARTUP_H__ |
|
17 #define __GSASTATEPOLICYSTARTUP_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <ssm/ssmstatepolicy.h> |
|
21 #include <ssm/ssmconditionalcallback.h> |
|
22 |
|
23 class CSsmCommandListResourceReader; |
|
24 |
|
25 /** |
|
26 Startup state policy plug-in for GSA. This is a polymorphic dll. |
|
27 Implements MSsmStatePolicy to initialize, prepare and return command list using CSsmCommandListResourceReader. |
|
28 Implements MSsmConditionalCallback to decide whether to include a command in a command list or not. |
|
29 |
|
30 For internal use, implements a fallback mechanism to launch 'sysstart.exe' when static command list for 'start-up' state is not found. |
|
31 This is required during migration from 'sysstart' to 'ssma start-up' and is not required for writing a new 'start-up' state policy. |
|
32 |
|
33 @internalComponent |
|
34 @released |
|
35 |
|
36 @see MSsmStatePolicy |
|
37 @see MSsmConditionalCallback |
|
38 */ |
|
39 NONSHARABLE_CLASS(CGsaStatePolicyStartup) : public CBase, public MSsmStatePolicy, public MSsmConditionalCallback |
|
40 { |
|
41 public: |
|
42 IMPORT_C static MSsmStatePolicy* NewL(); |
|
43 |
|
44 //from MSsmStatePolicy |
|
45 TResponse TransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, |
|
46 TSsmStateTransition const* aQueued, const RMessagePtr2& aMessage); |
|
47 void Initialize(TRequestStatus& aStatus); |
|
48 void InitializeCancel(); |
|
49 void PrepareCommandList(TSsmState aState, TInt aReason, TRequestStatus& aStatus); |
|
50 void PrepareCommandListCancel(); |
|
51 CSsmCommandList* CommandList(); |
|
52 TBool GetNextState(TSsmState aCurrentTransition, TInt aReason, TInt aError, TInt aSeverity, TSsmState& aNextState); |
|
53 void Release(); |
|
54 |
|
55 // from MSsmConditionalCallback |
|
56 TBool ConditionalCommandAllowedL(CResourceFile& aResourceFile, TInt aResourceId); |
|
57 |
|
58 private: |
|
59 ~CGsaStatePolicyStartup(); |
|
60 CGsaStatePolicyStartup(); |
|
61 |
|
62 void ConstructL(); |
|
63 TBool TransitionSupported(const TSsmState& aRequestedState) const; |
|
64 void GetCommandListPath(TUint aBootMode, TDes& aCmdListPath); |
|
65 TInt GetBootupCountL(); |
|
66 |
|
67 private: |
|
68 TInt iHardwareReason; |
|
69 TInt iSoftwareReason; |
|
70 TInt iSubStatesCount; |
|
71 TUint16 iRequestedSubState; |
|
72 TBool iLaunchSysStart; |
|
73 TBool iLaunchSysAgt2SrvAndWServ; |
|
74 |
|
75 RArray<TInt> iSubStates; |
|
76 RArray<TSsmState> iCurrentlySupportedTransitions; |
|
77 CSsmCommandListResourceReader* iCommandListResourceReader; |
|
78 RFs iFs; |
|
79 |
|
80 // Possible panic codes within Startup policy |
|
81 enum TStartupPanicCodes |
|
82 { |
|
83 /** |
|
84 Panic when command list resource reader is NULL |
|
85 */ |
|
86 EInvalidResourceReader = 1, |
|
87 /** |
|
88 Panic when Main state supplied is not 'ESsmStartup' |
|
89 */ |
|
90 EInvalidStartupState, |
|
91 /** |
|
92 Panic when ConditionalCommandAllowedL is called for a command which hasn't implemented conditional_information |
|
93 */ |
|
94 EConditionalInfoNotImplemented, |
|
95 /** |
|
96 Panic on Emulator (__WINS__) instead of moving to Fail state when CLE returns an error during the execution of a command with a severity other than ECmdIgnoreFailure. |
|
97 Fail policy would issue a re-start(TPowerState::EPwRestart) which is not supported on emulator. On H4hrp a re-start is issued by Fail policy. |
|
98 */ |
|
99 EEmulatorPowerOff, |
|
100 /** |
|
101 Substate for transition is not found in the command list id. |
|
102 */ |
|
103 ESubStateIndexNotFound, |
|
104 /** |
|
105 File for persisting reboot counts not found |
|
106 */ |
|
107 EBootupCountFileNotFound |
|
108 }; |
|
109 }; |
|
110 |
|
111 #endif //__GSASTATEPOLICYSTARTUP_H__ |