|
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 __GSASTATEPOLICYSHUTDOWN_H__ |
|
17 #define __GSASTATEPOLICYSHUTDOWN_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <ssm/ssmstatepolicy.h> |
|
21 #include <ssm/ssmconditionalcallback.h> |
|
22 #include <ssm/ssmstate.h> |
|
23 |
|
24 class CSsmCommandListResourceReader; |
|
25 |
|
26 /** |
|
27 Shutdown 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(CGsaStatePolicyShutdown) : 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, |
|
43 TSsmStateTransition const* aQueued, 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 ~CGsaStatePolicyShutdown(); |
|
57 CGsaStatePolicyShutdown(); |
|
58 |
|
59 void ConstructL(); |
|
60 |
|
61 private: |
|
62 TInt iHardwareReason; |
|
63 TInt iSoftwareReason; |
|
64 TInt iSubStatesCount; |
|
65 TSsmState iPublishState; |
|
66 TUint16 iRequestedSubState; |
|
67 RArray<TInt> iSubStates; |
|
68 |
|
69 CSsmCommandListResourceReader* iCommandListResourceReader; |
|
70 RFs iFs; |
|
71 |
|
72 // Possible panic codes within Shutdown policy |
|
73 enum TShutdownPanicCodes |
|
74 { |
|
75 /** |
|
76 Panic when command list resource reader is NULL |
|
77 */ |
|
78 EInvalidResourceReader = 1, |
|
79 /** |
|
80 Panic when Main state supplied is not 'ESsmShutdown' |
|
81 */ |
|
82 EInvalidShutdownState, |
|
83 /** |
|
84 Panic when ConditionalCommandAllowedL is called for a command which hasn't implemented conditional_information |
|
85 */ |
|
86 EConditionalInfoNotImplemented |
|
87 }; |
|
88 }; |
|
89 |
|
90 #endif //__GSASTATEPOLICYSHUTDOWN_H__ |