|
1 /* |
|
2 * Copyright (c) 2005 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 CMMCScBkupWriteDataTransferRequestBase |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ |
|
20 #define __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ |
|
21 |
|
22 // User includes |
|
23 #include "MMCScBkupConfig.h" |
|
24 #include "MMCScBkupSBEUtils.h" |
|
25 #include "TMMCScBkupOwnerDataType.h" |
|
26 #include "CMMCScBkupTransferRequest.h" |
|
27 #include "CMMCScBkupDataOwnerInfo.h" |
|
28 |
|
29 // Classes referenced |
|
30 class CMMCScBkupArchiveFooter; |
|
31 class CMMCScBkupDriveAndOperationTypeManager; |
|
32 |
|
33 /** |
|
34 * |
|
35 * |
|
36 * @since 3.0 |
|
37 */ |
|
38 class MMMCScBkupIndexHandler |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * |
|
44 */ |
|
45 virtual void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) = 0; |
|
46 }; |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 /** |
|
54 * |
|
55 * |
|
56 * @since 3.0 |
|
57 */ |
|
58 NONSHARABLE_CLASS(CMMCScBkupWriteDataTransferRequestBase) : public CMMCScBkupTransferRequestBase |
|
59 { |
|
60 public: |
|
61 |
|
62 /** |
|
63 * C++ destructor |
|
64 */ |
|
65 ~CMMCScBkupWriteDataTransferRequestBase(); |
|
66 |
|
67 public: // API |
|
68 |
|
69 /** |
|
70 * |
|
71 */ |
|
72 void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations ); |
|
73 |
|
74 protected: |
|
75 |
|
76 /** |
|
77 * C++ default constructor |
|
78 */ |
|
79 CMMCScBkupWriteDataTransferRequestBase( MMMCScBkupDriver& aDriver, |
|
80 MMMCScBkupIndexHandler& aIndexHandler, |
|
81 TMMCScBkupOwnerDataType aElementType, |
|
82 TSBDerivedType aExpectedTransferType, |
|
83 TInt aPriority = CActive::EPriorityIdle ); |
|
84 |
|
85 protected: // New Framework API |
|
86 |
|
87 /** |
|
88 * |
|
89 */ |
|
90 virtual CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, |
|
91 TDriveNumber aDrive, TInt aVersion ) const = 0; |
|
92 |
|
93 protected: // From CMMCScBkupTransferRequestBase |
|
94 |
|
95 /** |
|
96 * |
|
97 */ |
|
98 TBool ProcessChunkOfDataL(); |
|
99 |
|
100 /** |
|
101 * |
|
102 */ |
|
103 void PrepareDataTransferL(); |
|
104 |
|
105 /** |
|
106 * |
|
107 */ |
|
108 TDriveNumber CurrentDrive() const; |
|
109 |
|
110 private: // Internal methods |
|
111 |
|
112 /** |
|
113 * |
|
114 */ |
|
115 inline void SetCurrentDrive( TDriveNumber aDrive ) { iCurrentDrive = aDrive; } |
|
116 |
|
117 /** |
|
118 * |
|
119 */ |
|
120 void ValidateTransferInfoL( CSBGenericTransferType* aInfo ); |
|
121 |
|
122 /** |
|
123 * |
|
124 */ |
|
125 void RequestDataTransferL(); |
|
126 |
|
127 private: // From CActive |
|
128 TInt RunError( TInt aError ); |
|
129 |
|
130 private: |
|
131 |
|
132 /** |
|
133 * |
|
134 */ |
|
135 #ifdef DEBUGGING_DATA_TRANSFER |
|
136 void DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const; |
|
137 #endif |
|
138 |
|
139 |
|
140 private: // Member data |
|
141 |
|
142 // Owned by this class |
|
143 // |
|
144 TMMCScBkupDriveFilter iDriveFilter; |
|
145 // |
|
146 MMMCScBkupIndexHandler& iIndexHandler; |
|
147 // |
|
148 const TSBDerivedType iExpectedTransferType; |
|
149 // |
|
150 const CMMCScBkupDriveAndOperationTypeManager* iDriveAndOperations; |
|
151 // |
|
152 RWriteStream iStream; |
|
153 // |
|
154 TBool iStreamIsOpen; |
|
155 // |
|
156 CSBGenericTransferType* iTransferType; |
|
157 // |
|
158 TBool iAdditionalTransferRequired; |
|
159 // |
|
160 TDriveNumber iCurrentDrive; |
|
161 }; |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 /** |
|
174 * |
|
175 * |
|
176 * @since 3.0 |
|
177 */ |
|
178 template <class Type> |
|
179 class CMMCScBkupWriteDataTransferRequest : public CMMCScBkupWriteDataTransferRequestBase |
|
180 { |
|
181 public: // Construction |
|
182 |
|
183 /** |
|
184 * Static constructor |
|
185 */ |
|
186 inline static CMMCScBkupWriteDataTransferRequest* NewL( MMMCScBkupDriver& aDriver, |
|
187 MMMCScBkupIndexHandler& aIndexHandler, |
|
188 TMMCScBkupOwnerDataType aElementType, |
|
189 TSBDerivedType aExpectedTransferType, |
|
190 Type aTransferEnumType, |
|
191 TInt aPriority = CActive::EPriorityIdle ) |
|
192 { |
|
193 CMMCScBkupWriteDataTransferRequest<Type>* self = new(ELeave) CMMCScBkupWriteDataTransferRequest<Type>( aDriver, aIndexHandler, aElementType, aExpectedTransferType, aTransferEnumType, aPriority ); |
|
194 return self; |
|
195 } |
|
196 |
|
197 private: // Internal construction |
|
198 |
|
199 /** |
|
200 * C++ default constructor |
|
201 */ |
|
202 inline CMMCScBkupWriteDataTransferRequest( MMMCScBkupDriver& aDriver, |
|
203 MMMCScBkupIndexHandler& aIndexHandler, |
|
204 TMMCScBkupOwnerDataType aElementType, |
|
205 TSBDerivedType aExpectedTransferType, |
|
206 Type aTransferEnumType, |
|
207 TInt aPriority ) |
|
208 : CMMCScBkupWriteDataTransferRequestBase( aDriver, aIndexHandler, aElementType, aExpectedTransferType, aPriority ), |
|
209 iTransferEnumType( aTransferEnumType ) |
|
210 { |
|
211 } |
|
212 |
|
213 private: // From CMMCScBkupTransferRequest |
|
214 inline CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, |
|
215 TDriveNumber aDrive, TInt aVersion ) const |
|
216 { |
|
217 CSBGenericTransferType* transferType = MMCScBkupSBEUtils::TransferTypeLC( aGeneric, aDrive, |
|
218 iTransferEnumType, aVersion ); |
|
219 CleanupStack::Pop( transferType ); |
|
220 return transferType; |
|
221 } |
|
222 |
|
223 private: // Member data |
|
224 |
|
225 // |
|
226 Type iTransferEnumType; |
|
227 }; |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 #endif // __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ |
|
234 |
|
235 // End of File |