|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declaration for CMMCScBkupState |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __CMMCSCBKUPSTATE_H__ |
|
20 #define __CMMCSCBKUPSTATE_H__ |
|
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
|
24 |
|
25 // User includes |
|
26 #include "MMMCScBkupDriver.h" |
|
27 #include "MMCScBkupStateIds.h" |
|
28 #include "RMMCScBkupPointerArray.h" |
|
29 #include "MMMCScBkupArchiveDataInterface.h" |
|
30 |
|
31 // Namespaces |
|
32 using namespace conn; |
|
33 |
|
34 // Classes referenced |
|
35 class CMMCScBkupState; |
|
36 |
|
37 /** |
|
38 * |
|
39 * |
|
40 * @since 3.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS(CMMCScBkupState) : public CActive |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Enumeration specifying how state is supposed to be handled |
|
48 */ |
|
49 enum TStateExecution |
|
50 { |
|
51 EStateOnce = 0, |
|
52 EStatePerCategory, |
|
53 EStatePerCategoryCommon |
|
54 }; |
|
55 |
|
56 /** |
|
57 * Destructor |
|
58 */ |
|
59 ~CMMCScBkupState(); |
|
60 |
|
61 protected: |
|
62 |
|
63 /** |
|
64 * C++ default constructor |
|
65 */ |
|
66 CMMCScBkupState( MMMCScBkupDriver& aDriver, TInt aPriority = CActive::EPriorityIdle ); |
|
67 |
|
68 public: |
|
69 |
|
70 /** |
|
71 * Return the unique RTTI id of this state |
|
72 */ |
|
73 virtual TMMCScBkupStateId StateId() const = 0; |
|
74 |
|
75 /** |
|
76 * Return the next state that should be executed |
|
77 * after this state has finished. This allows |
|
78 * for dynamic changes in the state machine |
|
79 */ |
|
80 virtual TMMCScBkupStateId NextStateId() const = 0; |
|
81 |
|
82 /** |
|
83 * Return false if no need for category specific actions, otherwise true |
|
84 */ |
|
85 virtual TStateExecution CategorySpecific() const { return EStateOnce; } |
|
86 |
|
87 /** |
|
88 * Perform the action associated with this |
|
89 * state |
|
90 */ |
|
91 void ExecuteL(TRequestStatus& aObserver); |
|
92 |
|
93 protected: // Virtual framework |
|
94 |
|
95 /** |
|
96 * Perform the initial action associated with this |
|
97 * state |
|
98 */ |
|
99 virtual void PerformStateInitL() = 0; |
|
100 |
|
101 /** |
|
102 * Perform some asynchronous operation |
|
103 */ |
|
104 virtual void PerformAsynchronousStateStepL(); |
|
105 |
|
106 /** |
|
107 * Perform some asynchronous cancellation |
|
108 */ |
|
109 virtual void PerformAsynchronousCancellation(); |
|
110 |
|
111 /** |
|
112 * Called just before observer's request is completed |
|
113 * in the case of an error-free operation. Not called |
|
114 * when errors occur during state processing. |
|
115 */ |
|
116 virtual void PerformLastRightsL(); |
|
117 |
|
118 /** |
|
119 * Called from RunError |
|
120 */ |
|
121 virtual TBool PerformAsynchronousErrorCleanup(TInt aError); |
|
122 |
|
123 private: // Virtual framework |
|
124 |
|
125 /** |
|
126 * Default behaviour is to panic if called |
|
127 */ |
|
128 void RunL(); |
|
129 |
|
130 /** |
|
131 * |
|
132 */ |
|
133 void DoCancel(); |
|
134 |
|
135 /** |
|
136 * Default behaviour is to return KErrNone |
|
137 */ |
|
138 TInt RunError(TInt aError); |
|
139 |
|
140 protected: // Internal API |
|
141 |
|
142 /** |
|
143 * |
|
144 */ |
|
145 inline MMMCScBkupDriver& Driver() const { return iDriver; } |
|
146 |
|
147 /** |
|
148 * |
|
149 */ |
|
150 inline MMMCScBkupArchiveDataInterface& ADI() const { return iDriver.DrvADI(); } |
|
151 |
|
152 /** |
|
153 * |
|
154 */ |
|
155 void CompleteSelf(TInt aCompletionCode = KErrNone); |
|
156 |
|
157 /** |
|
158 * |
|
159 */ |
|
160 void SetObserver(TRequestStatus& aStatus); |
|
161 |
|
162 private: // Internal API |
|
163 |
|
164 /** |
|
165 * |
|
166 */ |
|
167 void CompleteObserver(TInt aCompletionCode); |
|
168 |
|
169 private: // Member data |
|
170 |
|
171 // Driver |
|
172 MMMCScBkupDriver& iDriver; |
|
173 // Observer |
|
174 TRequestStatus* iObserver; |
|
175 }; |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 #endif // __CMMCSCBKUPSTATE_H__ |
|
182 |
|
183 //End of File |