21
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2008 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:
|
|
15 |
* Scans for names of the files according to array.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef __CMMCSCBKUPENGINEIMPL_H__
|
|
20 |
#define __CMMCSCBKUPENGINEIMPL_H__
|
|
21 |
|
|
22 |
// System includes
|
|
23 |
#include <connect/sbeclient.h>
|
|
24 |
|
|
25 |
// User includes
|
|
26 |
#include "MMCScBkupConfig.h"
|
|
27 |
#include "MMMCScBkupDriver.h"
|
|
28 |
#include "MMCScBkupStateIds.h"
|
|
29 |
#include "MMCScBkupOperations.h"
|
|
30 |
#include "MMMCScBkupEngineObserver.h"
|
|
31 |
#include "MMMCScBkupProgressObserver.h"
|
|
32 |
|
|
33 |
// Namespaces
|
|
34 |
using namespace conn;
|
|
35 |
|
|
36 |
// Classes referenced
|
|
37 |
class RFs;
|
|
38 |
class CMMCScBkupState;
|
|
39 |
class CMMCScBkupArchive;
|
|
40 |
class CMMCScBkupStateFactory;
|
|
41 |
class CMMCScBkupOpParamsBase;
|
|
42 |
class MMMCScBkupEngineObserver;
|
|
43 |
class CMMCScBkupFileListCollection;
|
|
44 |
class CMMCScBkupDataOwnerCollection;
|
|
45 |
class MMMCScBkupArchiveDataInterface;
|
|
46 |
class CMMCScBkupArchiveInfo;
|
|
47 |
|
|
48 |
|
|
49 |
/**
|
|
50 |
*
|
|
51 |
*
|
|
52 |
* @since 3.0
|
|
53 |
*/
|
|
54 |
NONSHARABLE_CLASS(CMMCScBkupEngineImpl) : public CActive, public MMMCScBkupDriver, public MMMCScBkupProgressObserver
|
|
55 |
{
|
|
56 |
public:
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Two-phased constructor.
|
|
60 |
*/
|
|
61 |
static CMMCScBkupEngineImpl* NewL( RFs& aFsSession );
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Destructor
|
|
65 |
*/
|
|
66 |
~CMMCScBkupEngineImpl();
|
|
67 |
|
|
68 |
private:
|
|
69 |
|
|
70 |
/**
|
|
71 |
* C++ default constructor
|
|
72 |
*/
|
|
73 |
CMMCScBkupEngineImpl( RFs& aFsSession );
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Second phase constructor
|
|
77 |
*/
|
|
78 |
void ConstructL( );
|
|
79 |
|
|
80 |
|
|
81 |
public: // API
|
|
82 |
|
|
83 |
/**
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
void StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams );
|
|
87 |
|
|
88 |
/**
|
|
89 |
*
|
|
90 |
*/
|
|
91 |
void CleanupL( TInt aError = KErrNone );
|
|
92 |
|
|
93 |
/**
|
|
94 |
*
|
|
95 |
*/
|
|
96 |
TBool ValidArchiveForRestoreL( const TDesC& aFileName );
|
|
97 |
|
|
98 |
/**
|
|
99 |
*
|
|
100 |
*/
|
|
101 |
TInt64 TotalOperationSizeL() const;
|
|
102 |
|
|
103 |
/**
|
|
104 |
*
|
|
105 |
*/
|
|
106 |
TBool RebootRequired() const;
|
|
107 |
|
|
108 |
/**
|
|
109 |
*
|
|
110 |
*/
|
|
111 |
void ListArchivesL(
|
|
112 |
RPointerArray< CMMCScBkupArchiveInfo >& aArchives,
|
|
113 |
CMMCScBkupOpParamsBase* aParams,
|
|
114 |
const TUint32 aDriveAttMatch,
|
|
115 |
const TInt aDriveMatch );
|
|
116 |
|
|
117 |
private: // From MMMCScBkupDriver
|
|
118 |
void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState );
|
|
119 |
void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState, TMMCScBkupStateId aNextState );
|
|
120 |
void DrvHandleStateExecutionErrorL( const CMMCScBkupState& aState, TInt aError );
|
|
121 |
|
|
122 |
private: // From MMMCScBkupDriver
|
|
123 |
MMMCScBkupArchiveDataInterface& DrvADI() const;
|
|
124 |
CMMCScBkupArchive& DrvArchive() const;
|
|
125 |
CSBEClient& DrvSecureBackupClient() const;
|
|
126 |
TMMCScBkupOperationType DrvOperation() const;
|
|
127 |
CMMCScBkupOpParamsBase& DrvParamsBase() const;
|
|
128 |
CMMCScBkupDataOwnerCollection& DrvDataOwners() const;
|
|
129 |
RPointerArray<CMMCScBkupDataOwnerCollection>& DrvDataOwnersAll();
|
|
130 |
CMMCScBkupFileListCollection& DrvFileList() const;
|
|
131 |
TBool DrvLastCategory() const;
|
|
132 |
void DrvStoreTotalProgress(TInt64 aProgress);
|
|
133 |
TInt64 DrvTotalProgress() const;
|
|
134 |
MMMCScBkupProgressObserver& DrvProgressHandler() const;
|
|
135 |
|
|
136 |
private: // From MMMCScBkupProgressObserver
|
|
137 |
void MMCScBkupHandleProgress( TInt aAmountCompleted );
|
|
138 |
void MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount );
|
|
139 |
TInt MMCScBkupHandleFreeSpace( TInt aPercentualFree );
|
|
140 |
void MMCScBkupStartBackuping( TBool aProceed );
|
|
141 |
|
|
142 |
private: // From CActive
|
|
143 |
void RunL();
|
|
144 |
void DoCancel();
|
|
145 |
TInt RunError(TInt aError);
|
|
146 |
|
|
147 |
private: // Internal
|
|
148 |
|
|
149 |
/**
|
|
150 |
*
|
|
151 |
*/
|
|
152 |
void CompleteOwnRequest(TInt aCompletionCode = KErrNone, TBool aSetActive = ETrue);
|
|
153 |
|
|
154 |
/**
|
|
155 |
*
|
|
156 |
*/
|
|
157 |
void NotifyObserver(MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData = KErrNone);
|
|
158 |
|
|
159 |
/**
|
|
160 |
*
|
|
161 |
*/
|
|
162 |
void PrepareForBackupL(TBool aPartial);
|
|
163 |
|
|
164 |
/**
|
|
165 |
*
|
|
166 |
*/
|
|
167 |
void PrepareForRestoreL(TBool aPartial);
|
|
168 |
|
|
169 |
/**
|
|
170 |
*
|
|
171 |
*/
|
|
172 |
void SetParameters(CMMCScBkupOpParamsBase* aParameters);
|
|
173 |
|
|
174 |
/**
|
|
175 |
*
|
|
176 |
*/
|
|
177 |
void CreateFactoryL(TMMCScBkupOperationType aOperation);
|
|
178 |
|
|
179 |
/**
|
|
180 |
*
|
|
181 |
*/
|
|
182 |
TBool CurrentStateAvailable() const;
|
|
183 |
|
|
184 |
/**
|
|
185 |
*
|
|
186 |
*/
|
|
187 |
TMMCScBkupStateId CurrentStateId() const;
|
|
188 |
|
|
189 |
/**
|
|
190 |
*
|
|
191 |
*/
|
|
192 |
CMMCScBkupState& CurrentState();
|
|
193 |
|
|
194 |
/**
|
|
195 |
*
|
|
196 |
*/
|
|
197 |
const CMMCScBkupState& CurrentState() const;
|
|
198 |
|
|
199 |
/**
|
|
200 |
*
|
|
201 |
*/
|
|
202 |
void PrepareNextStateL( TMMCScBkupStateId aCurrentStateId );
|
|
203 |
|
|
204 |
/**
|
|
205 |
*
|
|
206 |
*/
|
|
207 |
void DestroyCurrentState();
|
|
208 |
|
|
209 |
/**
|
|
210 |
*
|
|
211 |
*/
|
|
212 |
void ExecuteStateL();
|
|
213 |
|
|
214 |
/**
|
|
215 |
*
|
|
216 |
*/
|
|
217 |
void PrepareObjectsL();
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Reset and Destroy the RPointArray of Archives
|
|
221 |
*
|
|
222 |
*/
|
|
223 |
static void ResetAndDestroyArchives( TAny* aPtr );
|
|
224 |
|
|
225 |
#ifdef DEBUGGING_DATA_TRANSFER
|
|
226 |
|
|
227 |
/**
|
|
228 |
*
|
|
229 |
*/
|
|
230 |
void CleanBackupFilesL();
|
|
231 |
|
|
232 |
/**
|
|
233 |
*
|
|
234 |
*/
|
|
235 |
void ClearRestoreFilesL();
|
|
236 |
#endif
|
|
237 |
|
|
238 |
private: // Member data
|
|
239 |
|
|
240 |
// Referenced objects
|
|
241 |
// file server session
|
|
242 |
RFs& iFsSession;
|
|
243 |
// backup engine observer
|
|
244 |
MMMCScBkupEngineObserver* iObserver;
|
|
245 |
|
|
246 |
// Owned objects
|
|
247 |
//
|
|
248 |
TInt64 iCumulativeProgress;
|
|
249 |
// Secure backup engine client
|
|
250 |
CSBEClient* iSBEClient;
|
|
251 |
// Archive array
|
|
252 |
RMMCScBkupPointerArray<CMMCScBkupArchive> iArchives;
|
|
253 |
// Current operation
|
|
254 |
TMMCScBkupOperationType iOperationType;
|
|
255 |
// Operational parameters
|
|
256 |
CMMCScBkupOpParamsBase* iParameters;
|
|
257 |
//
|
|
258 |
CMMCScBkupState* iCurrentState;
|
|
259 |
// Current factory
|
|
260 |
CMMCScBkupStateFactory* iFactory;
|
|
261 |
//
|
|
262 |
RPointerArray<CMMCScBkupDataOwnerCollection> iDataOwners;
|
|
263 |
//
|
|
264 |
RPointerArray<CMMCScBkupFileListCollection> iFileLists;
|
|
265 |
//
|
|
266 |
TInt iCurrentArchive;
|
|
267 |
//
|
|
268 |
TInt64 iTotalProgress;
|
|
269 |
//
|
|
270 |
TBool iActiveDataProcessingOngoing;
|
|
271 |
};
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
#endif // __CMMCSCBKUPENGINEIMPL_H__
|
|
277 |
|
|
278 |
//End of File
|