20
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2010 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: CSConSBEClient implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
#include <pathinfo.h>
|
|
22 |
#include <mmf/common/mmfcontrollerpluginresolver.h>
|
|
23 |
|
|
24 |
#include "sconsbeclient.h"
|
|
25 |
#include "debug.h"
|
|
26 |
|
|
27 |
const TInt KDataBufExpandSize( 1024 );
|
|
28 |
const TInt KMaxObjectSize( 1048576 - 1024 ); // Max chunk size is 1MB, but give some space for ConML wbxml
|
|
29 |
_LIT( KSConNoDrive, "\x0" );
|
|
30 |
_LIT( KSConDriveExists, "\x1" );
|
|
31 |
// ============================= MEMBER FUNCTIONS ==============================
|
|
32 |
|
|
33 |
// -----------------------------------------------------------------------------
|
|
34 |
// CSConSBEClient::NewL( cosnt TInt aMaxObjectSize )
|
|
35 |
// Two-phase constructor
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
//
|
|
38 |
CSConSBEClient* CSConSBEClient::NewL( const TInt aMaxObjectSize, RFs& aFs )
|
|
39 |
{
|
|
40 |
TRACE_FUNC;
|
|
41 |
CSConSBEClient* self = new (ELeave) CSConSBEClient( aMaxObjectSize, aFs );
|
|
42 |
return self;
|
|
43 |
}
|
|
44 |
|
|
45 |
// -----------------------------------------------------------------------------
|
|
46 |
// CSConSBEClient::CSConSBEClient( const TInt aMaxObjectSize )
|
|
47 |
// Constructor
|
|
48 |
// -----------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
CSConSBEClient::CSConSBEClient( const TInt /*aMaxObjectSize*/, RFs& aFs ) :
|
|
51 |
CActive( EPriorityStandard ), iBURModeNormal( ETrue ), iFs( aFs )
|
|
52 |
{
|
|
53 |
|
|
54 |
}
|
|
55 |
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
// CSConSBEClient::~CSConSBEClient()
|
|
58 |
// Initializes member data
|
|
59 |
// -----------------------------------------------------------------------------
|
|
60 |
//
|
|
61 |
CSConSBEClient::~CSConSBEClient()
|
|
62 |
{
|
|
63 |
TRACE_FUNC_ENTRY;
|
|
64 |
TInt err( KErrNone );
|
|
65 |
|
|
66 |
if( !iBURModeNormal && iSBEClient )
|
|
67 |
{
|
|
68 |
TDriveList driveList;
|
|
69 |
|
|
70 |
for( TInt i = 0; i<KMaxDrives; i++ )
|
|
71 |
{
|
|
72 |
if( i == EDriveC || i == EDriveE )
|
|
73 |
{
|
|
74 |
driveList.Append( KSConDriveExists );
|
|
75 |
}
|
|
76 |
else
|
|
77 |
{
|
|
78 |
driveList.Append( KSConNoDrive );
|
|
79 |
}
|
|
80 |
}
|
|
81 |
|
|
82 |
TRAP( err, iSBEClient->SetBURModeL( driveList, EBURNormal, ENoBackup ) );
|
|
83 |
}
|
|
84 |
|
|
85 |
if( iSBEClient )
|
|
86 |
{
|
|
87 |
delete iSBEClient;
|
|
88 |
iSBEClient = NULL;
|
|
89 |
}
|
|
90 |
|
|
91 |
delete iDataBuffer;
|
|
92 |
TRACE_FUNC_EXIT;
|
|
93 |
}
|
|
94 |
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
// CSConSBEClient::SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
97 |
// Set backup/restore mode
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
void CSConSBEClient::SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
101 |
{
|
|
102 |
TRACE_FUNC_ENTRY;
|
|
103 |
iCallerStatus = &aStatus;
|
|
104 |
*iCallerStatus = KRequestPending;
|
|
105 |
|
|
106 |
iCurrentTask = aTask;
|
|
107 |
|
|
108 |
TRequestStatus* status = &iStatus;
|
|
109 |
User::RequestComplete( status, KErrNone );
|
|
110 |
SetActive();
|
|
111 |
TRACE_FUNC_EXIT;
|
|
112 |
}
|
|
113 |
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
// CSConSBEClient::ListPublicFiles( TRequestStatus& aStatus,
|
|
116 |
// CSConTask*& aTask )
|
|
117 |
// Lists public files from data owners
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
void CSConSBEClient::ListPublicFiles( TRequestStatus& aStatus,
|
|
121 |
CSConTask*& aTask )
|
|
122 |
{
|
|
123 |
TRACE_FUNC_ENTRY;
|
|
124 |
iCallerStatus = &aStatus;
|
|
125 |
*iCallerStatus = KRequestPending;
|
|
126 |
|
|
127 |
iCurrentTask = aTask;
|
|
128 |
|
|
129 |
TRequestStatus* status = &iStatus;
|
|
130 |
User::RequestComplete( status, KErrNone );
|
|
131 |
SetActive();
|
|
132 |
TRACE_FUNC_EXIT;
|
|
133 |
}
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
// CSConSBEClient::ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
137 |
// Lists participant data owners
|
|
138 |
// -----------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CSConSBEClient::ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
141 |
{
|
|
142 |
TRACE_FUNC_ENTRY;
|
|
143 |
iCallerStatus = &aStatus;
|
|
144 |
*iCallerStatus = KRequestPending;
|
|
145 |
|
|
146 |
iCurrentTask = aTask;
|
|
147 |
|
|
148 |
TRequestStatus* status = &iStatus;
|
|
149 |
User::RequestComplete( status, KErrNone );
|
|
150 |
SetActive();
|
|
151 |
TRACE_FUNC_EXIT;
|
|
152 |
}
|
|
153 |
|
|
154 |
// -----------------------------------------------------------------------------
|
|
155 |
// CSConSBEClient::GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
156 |
// Lists data sizes from data owners
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
void CSConSBEClient::GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
160 |
{
|
|
161 |
TRACE_FUNC_ENTRY;
|
|
162 |
iCallerStatus = &aStatus;
|
|
163 |
*iCallerStatus = KRequestPending;
|
|
164 |
|
|
165 |
iCurrentTask = aTask;
|
|
166 |
|
|
167 |
TRequestStatus* status = &iStatus;
|
|
168 |
User::RequestComplete( status, KErrNone );
|
|
169 |
SetActive();
|
|
170 |
TRACE_FUNC_EXIT;
|
|
171 |
}
|
|
172 |
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
// CSConSBEClient::RequestData( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
175 |
// Request a data from a data owner
|
|
176 |
// -----------------------------------------------------------------------------
|
|
177 |
//
|
|
178 |
void CSConSBEClient::RequestData( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
179 |
{
|
|
180 |
TRACE_FUNC_ENTRY;
|
|
181 |
iCallerStatus = &aStatus;
|
|
182 |
*iCallerStatus = KRequestPending;
|
|
183 |
|
|
184 |
iCurrentTask = aTask;
|
|
185 |
|
|
186 |
TRequestStatus* status = &iStatus;
|
|
187 |
User::RequestComplete( status, KErrNone );
|
|
188 |
SetActive();
|
|
189 |
TRACE_FUNC_EXIT;
|
|
190 |
}
|
|
191 |
|
|
192 |
// -----------------------------------------------------------------------------
|
|
193 |
// CSConSBEClient::GetDataOwnerStatus( TRequestStatus& aStatus,
|
|
194 |
// CSConTask*& aTask )
|
|
195 |
// Lists the status of data owners
|
|
196 |
// -----------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
void CSConSBEClient::GetDataOwnerStatus( TRequestStatus& aStatus,
|
|
199 |
CSConTask*& aTask )
|
|
200 |
{
|
|
201 |
TRACE_FUNC_ENTRY;
|
|
202 |
iCallerStatus = &aStatus;
|
|
203 |
*iCallerStatus = KRequestPending;
|
|
204 |
|
|
205 |
iCurrentTask = aTask;
|
|
206 |
|
|
207 |
TRequestStatus* status = &iStatus;
|
|
208 |
User::RequestComplete( status, KErrNone );
|
|
209 |
SetActive();
|
|
210 |
|
|
211 |
TRACE_FUNC_EXIT;
|
|
212 |
}
|
|
213 |
|
|
214 |
// -----------------------------------------------------------------------------
|
|
215 |
// CSConSBEClient::SupplyData( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
216 |
// Supplies a data to a data owner
|
|
217 |
// -----------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CSConSBEClient::SupplyData( TRequestStatus& aStatus, CSConTask*& aTask )
|
|
220 |
{
|
|
221 |
TRACE_FUNC_ENTRY;
|
|
222 |
iCallerStatus = &aStatus;
|
|
223 |
*iCallerStatus = KRequestPending;
|
|
224 |
|
|
225 |
iCurrentTask = aTask;
|
|
226 |
|
|
227 |
TRequestStatus* status = &iStatus;
|
|
228 |
User::RequestComplete( status, KErrNone );
|
|
229 |
SetActive();
|
|
230 |
TRACE_FUNC_EXIT;
|
|
231 |
}
|
|
232 |
|
|
233 |
// -----------------------------------------------------------------------------
|
|
234 |
// CSConSBEClient::DoCancel()
|
|
235 |
// Implementation of CActive::DoCancel()
|
|
236 |
// -----------------------------------------------------------------------------
|
|
237 |
//
|
|
238 |
void CSConSBEClient::DoCancel()
|
|
239 |
{
|
|
240 |
TRACE_FUNC;
|
|
241 |
}
|
|
242 |
|
|
243 |
// -----------------------------------------------------------------------------
|
|
244 |
// CSConSBEClient::RunL()
|
|
245 |
// Implementation of CActive::RunL()
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CSConSBEClient::RunL()
|
|
249 |
{
|
|
250 |
TRACE_FUNC_ENTRY;
|
|
251 |
TInt err( KErrNone );
|
|
252 |
TInt ret( KErrNone );
|
|
253 |
|
|
254 |
//Initialize a connection to the backup server
|
|
255 |
if( !iSBEClient )
|
|
256 |
{
|
|
257 |
iSBEClient = CSBEClient::NewL();
|
|
258 |
}
|
|
259 |
|
|
260 |
switch( iCurrentTask->GetServiceId() )
|
|
261 |
{
|
|
262 |
case ESetBURMode :
|
|
263 |
LOGGER_WRITE( "CSConSBEClient::RunL() : ESetBURMode" );
|
|
264 |
TRAP( err, ProcessSetBURModeL() );
|
|
265 |
LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessSetBURModeL() : returned %d", err );
|
|
266 |
break;
|
|
267 |
case EListPublicFiles :
|
|
268 |
LOGGER_WRITE( "CSConSBEClient::RunL() : EListPublicFiles" );
|
|
269 |
TRAP( err, ProcessListPublicFilesL() );
|
|
270 |
LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessListPublicFilesL() : returned %d", err );
|
|
271 |
break;
|
|
272 |
case EListDataOwners :
|
|
273 |
LOGGER_WRITE( "CSConSBEClient::RunL() : EListDataOwners" );
|
|
274 |
TRAP( err, ProcessListDataOwnersL() );
|
|
275 |
LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessListDataOwnersL() : returned %d", err );
|
|
276 |
break;
|
|
277 |
case EGetDataSize :
|
|
278 |
LOGGER_WRITE( "CSConSBEClient::RunL() : EGetDataSize" );
|
|
279 |
TRAP( err, ProcessGetDataSizeL() );
|
|
280 |
LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessGetDataSizeL() : returned %d", err );
|
|
281 |
break;
|
|
282 |
case ERequestData :
|
|
283 |
LOGGER_WRITE( "CSConSBEClient::RunL() : ERequestData" );
|
|
284 |
TRAP( err, ret = ProcessRequestDataL() );
|
|
285 |
LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessRequestDataL() : returned %d", err );
|
|
286 |
break;
|
|
287 |
case EGetDataOwnerStatus :
|
|
288 |
LOGGER_WRITE( "CSConSBEClient::RunL() : EGetDataOwnerStatus" );
|
|
289 |
TRAP( err, ProcessGetDataOwnerStatusL() );
|
|
290 |
LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessGetDataOwnerStatusL() : returned %d", err );
|
|
291 |
break;
|
|
292 |
case ESupplyData :
|
|
293 |
LOGGER_WRITE( "CSConSBEClient::RunL() : ESupplyData" );
|
|
294 |
TRAP( err, ret = ProcessSupplyDataL() );
|
|
295 |
LOGGER_WRITE_1( "CSConSBEClient::RunL() : SupplyDataL() : returned %d", err );
|
|
296 |
break;
|
|
297 |
default :
|
|
298 |
err = KErrNotSupported;
|
|
299 |
LOGGER_WRITE( "CSConSBEClient::RunL() : ERROR! Unknown!" );
|
|
300 |
break;
|
|
301 |
}
|
|
302 |
|
|
303 |
if ( err )
|
|
304 |
{
|
|
305 |
HandleSBEErrorL( err );
|
|
306 |
}
|
|
307 |
else
|
|
308 |
{
|
|
309 |
err = ret;
|
|
310 |
}
|
|
311 |
User::RequestComplete( iCallerStatus, err );
|
|
312 |
|
|
313 |
TRACE_FUNC_EXIT;
|
|
314 |
}
|
|
315 |
|
|
316 |
// -----------------------------------------------------------------------------
|
|
317 |
// CSConSBEClient::ProcessSetBURModeL()
|
|
318 |
// Executes SetBURMode task
|
|
319 |
// -----------------------------------------------------------------------------
|
|
320 |
//
|
|
321 |
void CSConSBEClient::ProcessSetBURModeL()
|
|
322 |
{
|
|
323 |
TRACE_FUNC_ENTRY;
|
|
324 |
|
|
325 |
iAllSnapshotsSuppliedCalled = EFalse;
|
|
326 |
iLastChunk = EFalse;
|
|
327 |
|
|
328 |
TDriveList driveList = iCurrentTask->iBURModeParams->iDriveList;
|
|
329 |
|
|
330 |
TBURPartType partialType = EBURUnset;
|
|
331 |
iRestoreMode = EFalse;
|
|
332 |
|
|
333 |
switch( iCurrentTask->iBURModeParams->iPartialType )
|
|
334 |
{
|
|
335 |
case ESConBurNormal :
|
|
336 |
partialType = EBURNormal;
|
|
337 |
break;
|
|
338 |
case ESConBurBackupFull :
|
|
339 |
partialType = EBURBackupFull;
|
|
340 |
break;
|
|
341 |
case ESConBurBackupPartial :
|
|
342 |
partialType = EBURBackupPartial;
|
|
343 |
break;
|
|
344 |
case ESConBurRestoreFull :
|
|
345 |
partialType = EBURRestoreFull;
|
|
346 |
iRestoreMode = ETrue;
|
|
347 |
break;
|
|
348 |
case ESConBurRestorePartial :
|
|
349 |
partialType = EBURRestorePartial;
|
|
350 |
iRestoreMode = ETrue;
|
|
351 |
break;
|
|
352 |
default :
|
|
353 |
partialType = EBURUnset;
|
|
354 |
break;
|
|
355 |
}
|
|
356 |
|
|
357 |
if ( partialType == EBURBackupFull || partialType == ESConBurBackupPartial )
|
|
358 |
{
|
|
359 |
// initialize buffer
|
|
360 |
if ( !iDataBuffer )
|
|
361 |
iDataBuffer = CBufFlat::NewL( KDataBufExpandSize );
|
|
362 |
else
|
|
363 |
iDataBuffer->Reset();
|
|
364 |
iDataBufferSize=0;
|
|
365 |
}
|
|
366 |
else
|
|
367 |
{
|
|
368 |
delete iDataBuffer;
|
|
369 |
iDataBuffer = 0;
|
|
370 |
}
|
|
371 |
|
|
372 |
TBackupIncType incType = ENoBackup;
|
|
373 |
|
|
374 |
switch( iCurrentTask->iBURModeParams->iIncType )
|
|
375 |
{
|
|
376 |
case ESConNoBackup :
|
|
377 |
incType = ENoBackup;
|
|
378 |
break;
|
|
379 |
case ESConBackupBase :
|
|
380 |
incType = EBackupBase;
|
|
381 |
break;
|
|
382 |
case ESConBackupIncrement :
|
|
383 |
incType = EBackupIncrement;
|
|
384 |
break;
|
|
385 |
default :
|
|
386 |
incType = ENoBackup;
|
|
387 |
break;
|
|
388 |
}
|
|
389 |
|
|
390 |
iSBEClient->SetBURModeL( driveList, partialType, incType );
|
|
391 |
|
|
392 |
if( partialType != EBURNormal )
|
|
393 |
{
|
|
394 |
iBURModeNormal = EFalse;
|
|
395 |
}
|
|
396 |
else
|
|
397 |
{
|
|
398 |
iBURModeNormal = ETrue;
|
|
399 |
}
|
|
400 |
TRACE_FUNC_EXIT;
|
|
401 |
}
|
|
402 |
|
|
403 |
// -----------------------------------------------------------------------------
|
|
404 |
// CSConSBEClient::ProcessListPublicFilesL()
|
|
405 |
// Executes ListPublicFiles task
|
|
406 |
// -----------------------------------------------------------------------------
|
|
407 |
//
|
|
408 |
void CSConSBEClient::ProcessListPublicFilesL()
|
|
409 |
{
|
|
410 |
TRACE_FUNC_ENTRY;
|
|
411 |
//Get the secure id
|
|
412 |
TSecureId sid = iCurrentTask->iPubFilesParams->iDataOwners[0]->iUid;
|
|
413 |
TSecureId packageSid;
|
|
414 |
LOGGER_WRITE_1("DO: 0x%08x", sid.iId);
|
|
415 |
TPtrC packageName(KNullDesC);
|
|
416 |
const TUint KSConUidLength = 8; // 8 digits (hex)
|
|
417 |
const TUint KSConUidPrefixLength = 3; // prefix is '#0x'
|
|
418 |
|
|
419 |
TInt packageNameLength = iCurrentTask->iPubFilesParams->iDataOwners[0]->iPackageName.Length();
|
|
420 |
|
|
421 |
if ( packageNameLength > KSConUidLength )
|
|
422 |
{
|
|
423 |
// remove uid from package name
|
|
424 |
packageName.Set(
|
|
425 |
iCurrentTask->iPubFilesParams->iDataOwners[0]->
|
|
426 |
iPackageName.Left( packageNameLength - (KSConUidLength + KSConUidPrefixLength) ) );
|
|
427 |
LOGGER_WRITE_1("PackageName: %S", &packageName );
|
|
428 |
|
|
429 |
TPtrC sidPtr( iCurrentTask->iPubFilesParams->iDataOwners[0]->
|
|
430 |
iPackageName.Right( KSConUidLength ) );
|
|
431 |
TLex lex(sidPtr);
|
|
432 |
TInt err = lex.Val( packageSid.iId, EHex );
|
|
433 |
if ( err )
|
|
434 |
{
|
|
435 |
LOGGER_WRITE_1("lex.Val error: %d", err);
|
|
436 |
packageName.Set( KNullDesC );
|
|
437 |
packageSid.iId = 0;
|
|
438 |
}
|
|
439 |
LOGGER_WRITE_1("packageSid: 0x%08x", packageSid.iId );
|
|
440 |
}
|
|
441 |
|
|
442 |
//Get the drive list
|
|
443 |
TDriveList driveList =
|
|
444 |
iCurrentTask->iPubFilesParams->iDataOwners[0]->iDriveList;
|
|
445 |
|
|
446 |
RFileArray files;
|
|
447 |
CleanupClosePushL( files );
|
|
448 |
//Go through all the drives in the list
|
|
449 |
for( TInt i = 0; i < KMaxDrives; i++ )
|
|
450 |
{
|
|
451 |
if( driveList[i] )
|
|
452 |
{
|
|
453 |
//Get files from the drive
|
|
454 |
TDriveNumber driveNumber = GetDriveNumber( i );
|
|
455 |
LOGGER_WRITE_1("driveNumber: %d", driveNumber);
|
|
456 |
|
|
457 |
LOGGER_WRITE("List public files using CSBSecureId");
|
|
458 |
CSBSecureId* secureId = CSBSecureId::NewL( sid );
|
|
459 |
CleanupStack::PushL( secureId );
|
|
460 |
|
|
461 |
TRAPD( err, iSBEClient->PublicFileListL( driveNumber, *secureId, files ) );
|
|
462 |
|
|
463 |
if( err != KErrNone && err != KErrNotFound )
|
|
464 |
{
|
|
465 |
LOGGER_WRITE_1("iSBEClient->PublicFileListL leaved: %d", err);
|
|
466 |
User::LeaveIfError( err );
|
|
467 |
}
|
|
468 |
|
|
469 |
CleanupStack::PopAndDestroy( secureId );
|
|
470 |
LOGGER_WRITE_1("public files: %d", files.Count());
|
|
471 |
AppendFilesToFilelistL( files, iCurrentTask->iPubFilesParams->iFiles) ;
|
|
472 |
|
|
473 |
if ( packageName.Length() > 0 )
|
|
474 |
{
|
|
475 |
LOGGER_WRITE("Append files registered to packages. Using CSBPackageId");
|
|
476 |
|
|
477 |
CSBPackageId* packageId = CSBPackageId::NewL(
|
|
478 |
iCurrentTask->iPubFilesParams->iDataOwners[0]->iUid,
|
|
479 |
packageSid,
|
|
480 |
packageName );
|
|
481 |
CleanupStack::PushL( packageId );
|
|
482 |
|
|
483 |
TRAPD( err, iSBEClient->PublicFileListL( driveNumber, *packageId, files ) );
|
|
484 |
if( err != KErrNone && err != KErrNotFound )
|
|
485 |
{
|
|
486 |
LOGGER_WRITE_1("iSBEClient->PublicFileListL leaved: %d", err);
|
|
487 |
User::LeaveIfError( err );
|
|
488 |
}
|
|
489 |
CleanupStack::PopAndDestroy( packageId );
|
|
490 |
|
|
491 |
LOGGER_WRITE_1("public files: %d", files.Count());
|
|
492 |
AppendFilesToFilelistL( files, iCurrentTask->iPubFilesParams->iFiles) ;
|
|
493 |
}
|
|
494 |
|
|
495 |
files.Reset();
|
|
496 |
}
|
|
497 |
}
|
|
498 |
CleanupStack::PopAndDestroy( &files );
|
|
499 |
TRACE_FUNC_EXIT;
|
|
500 |
}
|
|
501 |
|
|
502 |
|
|
503 |
// -----------------------------------------------------------------------------
|
|
504 |
// CSConSBEClient::ProcessListDataOwnersL()
|
|
505 |
// Executes ListDataOwners task
|
|
506 |
// -----------------------------------------------------------------------------
|
|
507 |
//
|
|
508 |
void CSConSBEClient::ProcessListDataOwnersL()
|
|
509 |
{
|
|
510 |
TRACE_FUNC_ENTRY;
|
|
511 |
TBool includeToList( ETrue );
|
|
512 |
RPointerArray<CDataOwnerInfo> dataOwners;
|
|
513 |
RArray<TUid> packageArray;
|
|
514 |
CleanupResetAndDestroyPushL( dataOwners );
|
|
515 |
CleanupClosePushL( packageArray );
|
|
516 |
|
|
517 |
iSBEClient->ListOfDataOwnersL( dataOwners );
|
|
518 |
LOGGER_WRITE_1( "dataOwners count: %d", dataOwners.Count() );
|
|
519 |
|
|
520 |
|
|
521 |
for( TInt i = 0; i < dataOwners.Count(); i++ )
|
|
522 |
{
|
|
523 |
LOGGER_WRITE_2("handling do: %d, count: %d", i, dataOwners.Count());
|
|
524 |
CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner();
|
|
525 |
CleanupStack::PushL( dataOwner );
|
|
526 |
// default values
|
|
527 |
TSecureId sid( 0 );
|
|
528 |
includeToList = ETrue;
|
|
529 |
|
|
530 |
TCommonBURSettings commonOptions = dataOwners[i]->CommonSettings();
|
|
531 |
TPassiveBURSettings passiveOptions = dataOwners[i]->PassiveSettings();
|
|
532 |
TActiveBURSettings activeOptions = dataOwners[i]->ActiveSettings();
|
|
533 |
|
|
534 |
//active, passive or hybrid? (common)
|
|
535 |
if( commonOptions & EActiveBUR && commonOptions & EPassiveBUR )
|
|
536 |
{
|
|
537 |
dataOwner->iType = EHybridDataOwner;
|
|
538 |
}
|
|
539 |
else if( commonOptions & EActiveBUR )
|
|
540 |
{
|
|
541 |
dataOwner->iType = EActiveDataOwner;
|
|
542 |
}
|
|
543 |
else if( commonOptions & EPassiveBUR )
|
|
544 |
{
|
|
545 |
dataOwner->iType = EPassiveDataOwner;
|
|
546 |
}
|
|
547 |
|
|
548 |
//requires reboot? (common)
|
|
549 |
if( commonOptions & ERequiresReboot )
|
|
550 |
{
|
|
551 |
dataOwner->iReqReboot = ETrue;
|
|
552 |
}
|
|
553 |
else
|
|
554 |
{
|
|
555 |
dataOwner->iReqReboot = EFalse;
|
|
556 |
}
|
|
557 |
|
|
558 |
//has system files? (common)
|
|
559 |
if( commonOptions & EHasSystemFiles )
|
|
560 |
{
|
|
561 |
dataOwner->iHasFiles = ESystemFiles;
|
|
562 |
}
|
|
563 |
|
|
564 |
//supports selective? (common)
|
|
565 |
if( commonOptions & ESupportsSelective )
|
|
566 |
{
|
|
567 |
dataOwner->iSupportsSel = ETrue;
|
|
568 |
}
|
|
569 |
else
|
|
570 |
{
|
|
571 |
dataOwner->iSupportsSel = EFalse;
|
|
572 |
}
|
|
573 |
|
|
574 |
//has public files? (passive)
|
|
575 |
if( passiveOptions & EHasPublicFiles )
|
|
576 |
{
|
|
577 |
if( dataOwner->iHasFiles == ESystemFiles )
|
|
578 |
{
|
|
579 |
dataOwner->iHasFiles = EPublicSystemFiles;
|
|
580 |
}
|
|
581 |
else
|
|
582 |
{
|
|
583 |
dataOwner->iHasFiles = EPublicFiles;
|
|
584 |
}
|
|
585 |
}
|
|
586 |
|
|
587 |
//supports incremental? (active and passive)
|
|
588 |
if( activeOptions & EActiveSupportsInc ||
|
|
589 |
passiveOptions & EPassiveSupportsInc )
|
|
590 |
{
|
|
591 |
dataOwner->iSupportsInc = ETrue;
|
|
592 |
}
|
|
593 |
else
|
|
594 |
{
|
|
595 |
dataOwner->iSupportsInc = EFalse;
|
|
596 |
}
|
|
597 |
|
|
598 |
//delay to prepare data? (active)
|
|
599 |
if( activeOptions & EDelayToPrepareData )
|
|
600 |
{
|
|
601 |
dataOwner->iDelayToPrep = ETrue;
|
|
602 |
}
|
|
603 |
else
|
|
604 |
{
|
|
605 |
dataOwner->iDelayToPrep = EFalse;
|
|
606 |
}
|
|
607 |
|
|
608 |
//fill drivelist
|
|
609 |
dataOwner->iDriveList = dataOwners[i]->DriveList();
|
|
610 |
//filter the drive list
|
|
611 |
FilterDriveList( dataOwner->iDriveList );
|
|
612 |
|
|
613 |
CSBGenericDataType* genericData = &( dataOwners[i]->Identifier() );
|
|
614 |
TSBDerivedType derived = genericData->DerivedTypeL();
|
|
615 |
|
|
616 |
if( derived == ESIDDerivedType )
|
|
617 |
{
|
|
618 |
//Uif of the data owner
|
|
619 |
CSBSecureId* secureId = CSBSecureId::NewL( genericData );
|
|
620 |
CleanupStack::PushL( secureId );
|
|
621 |
sid = secureId->SecureIdL();
|
|
622 |
|
|
623 |
dataOwner->iUid.iUid = (TInt32)sid.iId;
|
|
624 |
LOGGER_WRITE_1("ESIDDerivedType, sid: 0x%08x", dataOwner->iUid.iUid );
|
|
625 |
|
|
626 |
CleanupStack::PopAndDestroy( secureId );
|
|
627 |
}
|
|
628 |
else if( derived == EPackageDerivedType )
|
|
629 |
{
|
|
630 |
//Package name and uid of the data owner
|
|
631 |
CSBPackageId* packageId = CSBPackageId::NewL( genericData );
|
|
632 |
CleanupStack::PushL( packageId );
|
|
633 |
|
|
634 |
dataOwner->iPackageName = packageId->PackageNameL();
|
|
635 |
dataOwner->iUid.iUid = packageId->PackageIdL().iUid;
|
|
636 |
LOGGER_WRITE_1("EPackageDerivedType, uid: 0x%08x", dataOwner->iUid.iUid );
|
|
637 |
sid = packageId->SecureIdL();
|
|
638 |
LOGGER_WRITE_1("sid: 0x%08x", sid.iId );
|
|
639 |
|
|
640 |
// owerload the package name, also add sid information.
|
|
641 |
_LIT(KSidFormat, "#0x%08x");
|
|
642 |
const TInt KSidFormatLength = 11;
|
|
643 |
TBuf<KSidFormatLength> sidFormat;
|
|
644 |
sidFormat.Format( KSidFormat, sid.iId );
|
|
645 |
if ( dataOwner->iPackageName.Length() + sidFormat.Length()
|
|
646 |
<= dataOwner->iPackageName.MaxLength() )
|
|
647 |
{
|
|
648 |
dataOwner->iPackageName.Append( sidFormat );
|
|
649 |
}
|
|
650 |
else
|
|
651 |
{
|
|
652 |
LOGGER_WRITE("WARNING: Package name too long, sid not included.");
|
|
653 |
}
|
|
654 |
|
|
655 |
LOGGER_WRITE_1("Package name: %S", &dataOwner->iPackageName );
|
|
656 |
if( sid )
|
|
657 |
{
|
|
658 |
//Find if the package is already included to dataowner list
|
|
659 |
if( packageArray.Find( packageId->PackageIdL(),
|
|
660 |
CSConSBEClient::Match ) != KErrNotFound )
|
|
661 |
{
|
|
662 |
LOGGER_WRITE("dataowner was already included to list");
|
|
663 |
//Don't include dataowner to list again
|
|
664 |
includeToList = EFalse;
|
|
665 |
}
|
|
666 |
else
|
|
667 |
{
|
|
668 |
//Store package's id for filtering
|
|
669 |
LOGGER_WRITE_1( "Storing package id for filtering, uid: 0x%08x", dataOwner->iUid.iUid );
|
|
670 |
packageArray.Append( dataOwner->iUid );
|
|
671 |
}
|
|
672 |
}
|
|
673 |
|
|
674 |
CleanupStack::PopAndDestroy( packageId );
|
|
675 |
}
|
|
676 |
else if( derived == EJavaDerivedType )
|
|
677 |
{
|
|
678 |
//Hash
|
|
679 |
CSBJavaId* javaId = CSBJavaId::NewL( genericData );
|
|
680 |
CleanupStack::PushL( javaId );
|
|
681 |
|
|
682 |
//Initialize with hash data length and copy hash
|
|
683 |
dataOwner->iJavaHash = HBufC::NewL( javaId->SuiteHashL().Length() );
|
|
684 |
dataOwner->iJavaHash->Des().Copy( javaId->SuiteHashL() );
|
|
685 |
|
|
686 |
//For ConML: set as passive package
|
|
687 |
dataOwner->iType = EPassiveDataOwner;
|
|
688 |
dataOwner->iPackageName.Copy( javaId->SuiteNameL() );
|
|
689 |
|
|
690 |
#ifdef _DEBUG
|
|
691 |
LOGGER_WRITE("EJavaDerivedType" );
|
|
692 |
LOGGER_WRITE_1("Package name: %S", &dataOwner->iPackageName );
|
|
693 |
TPtrC hash( dataOwner->iJavaHash->Des() );
|
|
694 |
LOGGER_WRITE_1("JavaHash: %S", &hash );
|
|
695 |
#endif
|
|
696 |
|
|
697 |
CleanupStack::PopAndDestroy( javaId );
|
|
698 |
}
|
|
699 |
else
|
|
700 |
{
|
|
701 |
LOGGER_WRITE("Unknown type, ignored from list" );
|
|
702 |
//Unknown type => ignore from list
|
|
703 |
includeToList = EFalse;
|
|
704 |
}
|
|
705 |
|
|
706 |
if( includeToList )
|
|
707 |
{
|
|
708 |
LOGGER_WRITE_1( "Appending to list, uid: 0x%08x", dataOwner->iUid.iUid );
|
|
709 |
iCurrentTask->iListDataOwnersParams->iDataOwners.AppendL( dataOwner );
|
|
710 |
CleanupStack::Pop( dataOwner );
|
|
711 |
}
|
|
712 |
|
|
713 |
if( sid )
|
|
714 |
{
|
|
715 |
LOGGER_WRITE_1( "Appending package sid to list, sid: 0x%08x", sid.iId );
|
|
716 |
CSConDataOwner* packageDataOwner = dataOwner->CopyL();
|
|
717 |
CleanupStack::PushL( packageDataOwner );
|
|
718 |
//Clear package name
|
|
719 |
packageDataOwner->iPackageName = KNullDesC();
|
|
720 |
//Add sid
|
|
721 |
packageDataOwner->iUid.iUid = sid.iId;
|
|
722 |
iCurrentTask->iListDataOwnersParams->iDataOwners.AppendL( packageDataOwner );
|
|
723 |
CleanupStack::Pop( packageDataOwner );
|
|
724 |
}
|
|
725 |
|
|
726 |
if( !includeToList )
|
|
727 |
{
|
|
728 |
//Not included to list => delete memory allocation
|
|
729 |
CleanupStack::PopAndDestroy( dataOwner );
|
|
730 |
}
|
|
731 |
}
|
|
732 |
|
|
733 |
packageArray.Reset();
|
|
734 |
CleanupStack::PopAndDestroy( &packageArray );
|
|
735 |
CleanupStack::PopAndDestroy( &dataOwners );
|
|
736 |
TRACE_FUNC_EXIT;
|
|
737 |
}
|
|
738 |
|
|
739 |
// -----------------------------------------------------------------------------
|
|
740 |
// CSConSBEClient::ProcessGetDataSizeL()
|
|
741 |
// Executes GetDataSize task
|
|
742 |
// -----------------------------------------------------------------------------
|
|
743 |
//
|
|
744 |
void CSConSBEClient::ProcessGetDataSizeL()
|
|
745 |
{
|
|
746 |
TRACE_FUNC_ENTRY;
|
|
747 |
|
|
748 |
if ( !iAllSnapshotsSuppliedCalled )
|
|
749 |
{
|
|
750 |
TInt err(KErrNone);
|
|
751 |
// we have to call AllSnapshotsSupplied() to inform active
|
|
752 |
// data owners to start prepare their base data.
|
|
753 |
TRAP( err, iSBEClient->AllSnapshotsSuppliedL() );
|
|
754 |
LOGGER_WRITE_1( "AllSnapshotsSuppliedL() leaved: %d", err );
|
|
755 |
iAllSnapshotsSuppliedCalled = ETrue;
|
|
756 |
}
|
|
757 |
|
|
758 |
|
|
759 |
TBool packageData( EFalse );
|
|
760 |
|
|
761 |
//Calculate data size for every data owner received from the task
|
|
762 |
for( TInt i = 0; i < iCurrentTask->iGetDataSizeParams->iDataOwners.Count();
|
|
763 |
i++ )
|
|
764 |
{
|
|
765 |
packageData = EFalse;
|
|
766 |
CSConDataOwner* dataOwner =
|
|
767 |
iCurrentTask->iGetDataSizeParams->iDataOwners[i];
|
|
768 |
|
|
769 |
TTransferDataType tdt( ERegistrationData );
|
|
770 |
TPackageDataType pdt( ESystemData );
|
|
771 |
|
|
772 |
LOGGER_WRITE_2( "ProcessGetDataSizeL DO %d of %d", i, iCurrentTask->iGetDataSizeParams->iDataOwners.Count() );
|
|
773 |
LOGGER_WRITE_1( "ProcessGetDataSizeL SID 0x%08x", dataOwner->iUid );
|
|
774 |
switch( dataOwner->iTransDataType )
|
|
775 |
{
|
|
776 |
case ESConRegistrationData :
|
|
777 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ERegistrationData" );
|
|
778 |
tdt = ERegistrationData;
|
|
779 |
break;
|
|
780 |
case ESConPassiveSnapshotData :
|
|
781 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveSnapshotData" );
|
|
782 |
tdt = EPassiveSnapshotData;
|
|
783 |
break;
|
|
784 |
case ESConPassiveBaseData :
|
|
785 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveBaseData" );
|
|
786 |
tdt = EPassiveBaseData;
|
|
787 |
break;
|
|
788 |
case ESConPassiveIncrementalData :
|
|
789 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveIncrementalData" );
|
|
790 |
tdt = EPassiveIncrementalData;
|
|
791 |
break;
|
|
792 |
case ESConActiveSnapshotData :
|
|
793 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveSnapshotData" );
|
|
794 |
tdt = EActiveSnapshotData;
|
|
795 |
break;
|
|
796 |
case ESConActiveBaseData :
|
|
797 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveBaseData" );
|
|
798 |
tdt = EActiveBaseData;
|
|
799 |
break;
|
|
800 |
case ESConActiveIncrementalData :
|
|
801 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveIncrementalData" );
|
|
802 |
tdt = EActiveIncrementalData;
|
|
803 |
break;
|
|
804 |
case ESConSystemData :
|
|
805 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ESystemData" );
|
|
806 |
pdt = ESystemData;
|
|
807 |
packageData = ETrue;
|
|
808 |
break;
|
|
809 |
case ESConSystemSnapshotData :
|
|
810 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ESystemSnapshotData" );
|
|
811 |
pdt = ESystemSnapshotData;
|
|
812 |
packageData = ETrue;
|
|
813 |
break;
|
|
814 |
default :
|
|
815 |
break;
|
|
816 |
}
|
|
817 |
|
|
818 |
if( packageData && !dataOwner->iJavaHash )
|
|
819 |
{
|
|
820 |
dataOwner->iSize = PackageDataSizeL( dataOwner->iUid, dataOwner->iDriveList, pdt );
|
|
821 |
}
|
|
822 |
else if( !dataOwner->iJavaHash )
|
|
823 |
{
|
|
824 |
dataOwner->iSize = SidDataSizeL( dataOwner->iUid, dataOwner->iDriveList, tdt );
|
|
825 |
}
|
|
826 |
else
|
|
827 |
{
|
|
828 |
dataOwner->iSize = JavaDataSizeL( dataOwner->iJavaHash->Des(),
|
|
829 |
dataOwner->iDriveList );
|
|
830 |
}
|
|
831 |
}
|
|
832 |
|
|
833 |
TRACE_FUNC_EXIT;
|
|
834 |
}
|
|
835 |
|
|
836 |
|
|
837 |
// -----------------------------------------------------------------------------
|
|
838 |
// CSConSBEClient::ProcessRequestDataL()
|
|
839 |
// Executes RequestData task
|
|
840 |
// -----------------------------------------------------------------------------
|
|
841 |
//
|
|
842 |
TInt CSConSBEClient::ProcessRequestDataL()
|
|
843 |
{
|
|
844 |
TRACE_FUNC_ENTRY;
|
|
845 |
TInt ret( KErrNone );
|
|
846 |
|
|
847 |
TBool packageData = EFalse;
|
|
848 |
TTransferDataType transferDataType( ERegistrationData );
|
|
849 |
TPackageDataType packageDataType( ESystemSnapshotData );
|
|
850 |
LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() iTransDataType: %d",
|
|
851 |
(TInt)iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType);
|
|
852 |
|
|
853 |
switch( iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType )
|
|
854 |
{
|
|
855 |
case ESConRegistrationData :
|
|
856 |
transferDataType = ERegistrationData;
|
|
857 |
break;
|
|
858 |
case ESConPassiveSnapshotData :
|
|
859 |
transferDataType = EPassiveSnapshotData;
|
|
860 |
break;
|
|
861 |
case ESConPassiveBaseData :
|
|
862 |
transferDataType = EPassiveBaseData;
|
|
863 |
break;
|
|
864 |
case ESConPassiveIncrementalData :
|
|
865 |
transferDataType = EPassiveIncrementalData;
|
|
866 |
break;
|
|
867 |
case ESConActiveSnapshotData :
|
|
868 |
transferDataType = EActiveSnapshotData;
|
|
869 |
break;
|
|
870 |
case ESConActiveBaseData :
|
|
871 |
transferDataType = EActiveBaseData;
|
|
872 |
break;
|
|
873 |
case ESConActiveIncrementalData :
|
|
874 |
transferDataType = EActiveIncrementalData;
|
|
875 |
break;
|
|
876 |
case ESConSystemData :
|
|
877 |
packageDataType = ESystemData;
|
|
878 |
packageData = ETrue;
|
|
879 |
break;
|
|
880 |
case ESConSystemSnapshotData:
|
|
881 |
packageDataType = ESystemSnapshotData;
|
|
882 |
packageData = ETrue;
|
|
883 |
break;
|
|
884 |
default :
|
|
885 |
break;
|
|
886 |
}
|
|
887 |
|
|
888 |
|
|
889 |
//Get the drive number
|
|
890 |
TDriveNumber driveNumber = EDriveC;
|
|
891 |
TDriveList driveList = iCurrentTask->iRequestDataParams->
|
|
892 |
iDataOwner->iDriveList;
|
|
893 |
|
|
894 |
for( TInt i = 0; i < KMaxDrives; i++ )
|
|
895 |
{
|
|
896 |
if( driveList[i] )
|
|
897 |
{
|
|
898 |
driveNumber = GetDriveNumber( i );
|
|
899 |
break;
|
|
900 |
}
|
|
901 |
}
|
|
902 |
|
|
903 |
//Get UID, SID or Java hash
|
|
904 |
TUid uid;
|
|
905 |
TSecureId sid;
|
|
906 |
|
|
907 |
uid.iUid = 0;
|
|
908 |
sid.iId = 0;
|
|
909 |
|
|
910 |
if( packageData && !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
|
|
911 |
{
|
|
912 |
uid = iCurrentTask->iRequestDataParams->iDataOwner->iUid;
|
|
913 |
LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() uid: 0x%08x", uid.iUid);
|
|
914 |
}
|
|
915 |
else if( !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
|
|
916 |
{
|
|
917 |
sid = iCurrentTask->iRequestDataParams->iDataOwner->iUid;
|
|
918 |
LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() sid: 0x%08x", sid.iId);
|
|
919 |
}
|
|
920 |
|
|
921 |
|
|
922 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \
|
|
923 |
Begin - Package data: %d", packageData );
|
|
924 |
|
|
925 |
LOGGER_WRITE_1("iLastChunk: %d", (TInt) iLastChunk );
|
|
926 |
LOGGER_WRITE_1("iDataBufferSize: %d", iDataBufferSize );
|
|
927 |
|
|
928 |
// if was't last chunk and there are free space left on our packet
|
|
929 |
if( !iLastChunk && iDataBufferSize < KMaxObjectSize )
|
|
930 |
{
|
|
931 |
//No data left, request more from the server
|
|
932 |
if( packageData && !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
|
|
933 |
{
|
|
934 |
CSBPackageTransferType* ptt = CSBPackageTransferType::NewL(
|
|
935 |
uid, driveNumber, packageDataType );
|
|
936 |
CleanupStack::PushL( ptt );
|
|
937 |
|
|
938 |
RequestDataL( *ptt );
|
|
939 |
|
|
940 |
CleanupStack::PopAndDestroy( ptt );
|
|
941 |
}
|
|
942 |
else if( !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
|
|
943 |
{
|
|
944 |
CSBSIDTransferType* stt = CSBSIDTransferType::NewL(
|
|
945 |
sid, driveNumber, transferDataType );
|
|
946 |
CleanupStack::PushL( stt );
|
|
947 |
|
|
948 |
RequestDataL( *stt );
|
|
949 |
|
|
950 |
CleanupStack::PopAndDestroy( stt );
|
|
951 |
}
|
|
952 |
else
|
|
953 |
{
|
|
954 |
TPtr javaHashPtr = iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash->Des();
|
|
955 |
CSBJavaTransferType* jtt( NULL );
|
|
956 |
//When ESystemData is requested, request EJavaMIDlet
|
|
957 |
if( packageDataType == ESystemData )
|
|
958 |
{
|
|
959 |
jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDlet );
|
|
960 |
}
|
|
961 |
//When EPassiveBaseData is requested, request EJavaMIDletData
|
|
962 |
else if( transferDataType == EPassiveBaseData )
|
|
963 |
{
|
|
964 |
jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDletData );
|
|
965 |
}
|
|
966 |
|
|
967 |
if( packageDataType == ESystemData || transferDataType == EPassiveBaseData )
|
|
968 |
{
|
|
969 |
CleanupStack::PushL( jtt );
|
|
970 |
|
|
971 |
RequestDataL( *jtt );
|
|
972 |
|
|
973 |
CleanupStack::PopAndDestroy( jtt );
|
|
974 |
}
|
|
975 |
else
|
|
976 |
{
|
|
977 |
//No data
|
|
978 |
iDataBuffer->Reset();
|
|
979 |
iDataBufferSize = 0;
|
|
980 |
iLastChunk = ETrue;
|
|
981 |
}
|
|
982 |
}
|
|
983 |
}
|
|
984 |
|
|
985 |
LOGGER_WRITE_1("readed iLastChunk: %d", (TInt) iLastChunk );
|
|
986 |
LOGGER_WRITE_1("readed iDataBufferSize: %d", iDataBufferSize );
|
|
987 |
|
|
988 |
|
|
989 |
|
|
990 |
if( iCurrentTask->iRequestDataParams->iBackupData )
|
|
991 |
{
|
|
992 |
delete iCurrentTask->iRequestDataParams->iBackupData;
|
|
993 |
iCurrentTask->iRequestDataParams->iBackupData = NULL;
|
|
994 |
}
|
|
995 |
|
|
996 |
TInt dataToRead = KMaxObjectSize;
|
|
997 |
if ( dataToRead > iDataBufferSize )
|
|
998 |
dataToRead = iDataBufferSize;
|
|
999 |
|
|
1000 |
//Initialize the task data buffer
|
|
1001 |
iCurrentTask->iRequestDataParams->iBackupData = HBufC8::NewL( dataToRead );
|
|
1002 |
//Get descriptor task's buffer
|
|
1003 |
TPtr8 backupDataPtr = iCurrentTask->iRequestDataParams->iBackupData->Des();
|
|
1004 |
|
|
1005 |
|
|
1006 |
iDataBuffer->Read(0, backupDataPtr, dataToRead );
|
|
1007 |
iDataBuffer->Delete(0, dataToRead);
|
|
1008 |
iDataBufferSize -= dataToRead;
|
|
1009 |
|
|
1010 |
if ( !iLastChunk || iDataBufferSize>0 )
|
|
1011 |
{
|
|
1012 |
LOGGER_WRITE( "CSConSBEClient::ProcessRequestDataL() : There are more data available" );
|
|
1013 |
iCurrentTask->iRequestDataParams->iMoreData = ETrue;
|
|
1014 |
//Another task is needed to transfer the data to the client
|
|
1015 |
ret = KErrCompletion;
|
|
1016 |
}
|
|
1017 |
else
|
|
1018 |
{
|
|
1019 |
LOGGER_WRITE( "CSConSBEClient::ProcessRequestDataL() : All data readed" );
|
|
1020 |
iDataBuffer->Reset();
|
|
1021 |
iDataBufferSize = 0;
|
|
1022 |
// task will be completed, initialize iLastChunk value for next operation
|
|
1023 |
iLastChunk = EFalse;
|
|
1024 |
}
|
|
1025 |
|
|
1026 |
|
|
1027 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : returned %d", ret );
|
|
1028 |
return ret;
|
|
1029 |
}
|
|
1030 |
|
|
1031 |
void CSConSBEClient::RequestDataL( CSBGenericTransferType& aGenericTransferType )
|
|
1032 |
{
|
|
1033 |
TRACE_FUNC_ENTRY;
|
|
1034 |
if ( !iDataBuffer )
|
|
1035 |
User::Leave( KErrArgument );
|
|
1036 |
|
|
1037 |
do
|
|
1038 |
{
|
|
1039 |
LOGGER_WRITE( "iSBEClient->RequestDataL() : start" );
|
|
1040 |
TRequestStatus status;
|
|
1041 |
iSBEClient->RequestDataL( aGenericTransferType, status );
|
|
1042 |
User::WaitForRequest( status );
|
|
1043 |
LOGGER_WRITE_1( "iSBEClient->RequestDataL() : status.Int() %d", status.Int() );
|
|
1044 |
User::LeaveIfError( status.Int() );
|
|
1045 |
|
|
1046 |
//Get the data and store the handle
|
|
1047 |
CSBGenericTransferType* gtt = NULL;
|
|
1048 |
const TPtrC8& dataPtr = iSBEClient->TransferDataInfoL( gtt, iLastChunk );
|
|
1049 |
LOGGER_WRITE_1("data size: %d", dataPtr.Length());
|
|
1050 |
delete gtt;
|
|
1051 |
iDataBuffer->ExpandL( iDataBufferSize, dataPtr.Length() );
|
|
1052 |
iDataBuffer->Write(iDataBufferSize, dataPtr);
|
|
1053 |
iDataBufferSize += dataPtr.Length();
|
|
1054 |
LOGGER_WRITE_1("total buffer size: %d", iDataBufferSize);
|
|
1055 |
}
|
|
1056 |
// Continue if there are more data, and our packet is not full
|
|
1057 |
while ( !iLastChunk && iDataBufferSize < KMaxObjectSize );
|
|
1058 |
|
|
1059 |
TRACE_FUNC_EXIT;
|
|
1060 |
}
|
|
1061 |
|
|
1062 |
// -----------------------------------------------------------------------------
|
|
1063 |
// CSConSBEClient::ProcessGetDataOwnerStatusL()
|
|
1064 |
// Executes GetDataOwnerStatus task
|
|
1065 |
// -----------------------------------------------------------------------------
|
|
1066 |
//
|
|
1067 |
void CSConSBEClient::ProcessGetDataOwnerStatusL()
|
|
1068 |
{
|
|
1069 |
TRACE_FUNC_ENTRY;
|
|
1070 |
|
|
1071 |
//If restore-mode, call AllSystemFilesRestored()
|
|
1072 |
if( iRestoreMode )
|
|
1073 |
{
|
|
1074 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataOwnerStatusL() : iSBEClient->AllSystemFilesRestored() start" );
|
|
1075 |
iSBEClient->AllSystemFilesRestored();
|
|
1076 |
LOGGER_WRITE( "CSConSBEClient::ProcessGetDataOwnerStatusL() : iSBEClient->AllSystemFilesRestored() end" );
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
RSIDStatusArray sidStatus;
|
|
1080 |
CleanupClosePushL(sidStatus);
|
|
1081 |
|
|
1082 |
for( TInt i = 0; i < iCurrentTask->iGetDataOwnerParams->iDataOwners.Count();
|
|
1083 |
i++ )
|
|
1084 |
{
|
|
1085 |
CSConDataOwner* dataOwner =
|
|
1086 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[i];
|
|
1087 |
TSecureId sid( dataOwner->iUid );
|
|
1088 |
TDataOwnerStatus dataOwnerStatus = EUnset;
|
|
1089 |
TInt dataOwnerError = 0;
|
|
1090 |
|
|
1091 |
TDataOwnerAndStatus dataOwnerAndStatus( sid, dataOwnerStatus,
|
|
1092 |
dataOwnerError );
|
|
1093 |
|
|
1094 |
sidStatus.Append( dataOwnerAndStatus );
|
|
1095 |
}
|
|
1096 |
|
|
1097 |
iSBEClient->SIDStatusL( sidStatus );
|
|
1098 |
|
|
1099 |
for( TInt j = 0; j < sidStatus.Count(); j++ )
|
|
1100 |
{
|
|
1101 |
switch( sidStatus[j].iStatus )
|
|
1102 |
{
|
|
1103 |
case EUnset :
|
|
1104 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
|
|
1105 |
iDataOwnStatus = ESConUnset;
|
|
1106 |
break;
|
|
1107 |
case EDataOwnerNotFound :
|
|
1108 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
|
|
1109 |
iDataOwnStatus = ESConNotFound;
|
|
1110 |
break;
|
|
1111 |
case EDataOwnerReady :
|
|
1112 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
|
|
1113 |
iDataOwnStatus = ESConReady;
|
|
1114 |
break;
|
|
1115 |
case EDataOwnerNotReady :
|
|
1116 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
|
|
1117 |
iDataOwnStatus = ESConNotReady;
|
|
1118 |
break;
|
|
1119 |
case EDataOwnerFailed :
|
|
1120 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
|
|
1121 |
iDataOwnStatus = ESConFailed;
|
|
1122 |
break;
|
|
1123 |
case EDataOwnerNotConnected :
|
|
1124 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
|
|
1125 |
iDataOwnStatus = ESConNotConnected;
|
|
1126 |
break;
|
|
1127 |
case EDataOwnerReadyNoImpl :
|
|
1128 |
iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
|
|
1129 |
iDataOwnStatus = ESConNotImplemented;
|
|
1130 |
break;
|
|
1131 |
default :
|
|
1132 |
break;
|
|
1133 |
}
|
|
1134 |
}
|
|
1135 |
sidStatus.Reset();
|
|
1136 |
CleanupStack::PopAndDestroy( &sidStatus );
|
|
1137 |
|
|
1138 |
TRACE_FUNC_EXIT;
|
|
1139 |
}
|
|
1140 |
|
|
1141 |
// -----------------------------------------------------------------------------
|
|
1142 |
// CSConSBEClient::ProcessSupplyDataL()
|
|
1143 |
// Executes SupplyData task
|
|
1144 |
// -----------------------------------------------------------------------------
|
|
1145 |
//
|
|
1146 |
TInt CSConSBEClient::ProcessSupplyDataL()
|
|
1147 |
{
|
|
1148 |
TRACE_FUNC_ENTRY;
|
|
1149 |
TBool packageData = EFalse;
|
|
1150 |
TBool lastChunk = ETrue;
|
|
1151 |
TTransferDataType transferDataType( ERegistrationData );
|
|
1152 |
TPackageDataType packageDataType( ESystemSnapshotData );
|
|
1153 |
LOGGER_WRITE_1("CSConSBEClient::ProcessSupplyDataL() iTransDataType: %d",
|
|
1154 |
(TInt)iCurrentTask->iSupplyDataParams->iDataOwner->iTransDataType);
|
|
1155 |
switch( iCurrentTask->iSupplyDataParams->iDataOwner->iTransDataType )
|
|
1156 |
{
|
|
1157 |
case ESConRegistrationData :
|
|
1158 |
transferDataType = ERegistrationData;
|
|
1159 |
break;
|
|
1160 |
case ESConPassiveSnapshotData :
|
|
1161 |
transferDataType = EPassiveSnapshotData;
|
|
1162 |
break;
|
|
1163 |
case ESConPassiveBaseData :
|
|
1164 |
transferDataType = EPassiveBaseData;
|
|
1165 |
break;
|
|
1166 |
case ESConPassiveIncrementalData :
|
|
1167 |
transferDataType = EPassiveIncrementalData;
|
|
1168 |
break;
|
|
1169 |
case ESConActiveSnapshotData :
|
|
1170 |
transferDataType = EActiveSnapshotData;
|
|
1171 |
break;
|
|
1172 |
case ESConActiveBaseData :
|
|
1173 |
transferDataType = EActiveBaseData;
|
|
1174 |
break;
|
|
1175 |
case ESConActiveIncrementalData :
|
|
1176 |
transferDataType = EActiveIncrementalData;
|
|
1177 |
break;
|
|
1178 |
case ESConSystemData :
|
|
1179 |
packageDataType = ESystemData;
|
|
1180 |
packageData = ETrue;
|
|
1181 |
break;
|
|
1182 |
case ESConSystemSnapshotData:
|
|
1183 |
packageDataType = ESystemSnapshotData;
|
|
1184 |
packageData = ETrue;
|
|
1185 |
break;
|
|
1186 |
default :
|
|
1187 |
break;
|
|
1188 |
}
|
|
1189 |
|
|
1190 |
//Get the drive number
|
|
1191 |
TDriveNumber driveNumber = EDriveC;
|
|
1192 |
TDriveList driveList = iCurrentTask->iSupplyDataParams->iDataOwner->
|
|
1193 |
iDriveList;
|
|
1194 |
|
|
1195 |
for( TInt i = 0; i < KMaxDrives; i++ )
|
|
1196 |
{
|
|
1197 |
if( driveList[i] )
|
|
1198 |
{
|
|
1199 |
driveNumber = GetDriveNumber( i );
|
|
1200 |
break;
|
|
1201 |
}
|
|
1202 |
}
|
|
1203 |
|
|
1204 |
//Get UID or SID
|
|
1205 |
TUid uid;
|
|
1206 |
TSecureId sid;
|
|
1207 |
|
|
1208 |
uid.iUid = 0;
|
|
1209 |
sid.iId = 0;
|
|
1210 |
|
|
1211 |
if( packageData && !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
|
|
1212 |
{
|
|
1213 |
uid = iCurrentTask->iSupplyDataParams->iDataOwner->iUid;
|
|
1214 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() uid: 0x%08x", uid.iUid );
|
|
1215 |
}
|
|
1216 |
else if( !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
|
|
1217 |
{
|
|
1218 |
sid = iCurrentTask->iSupplyDataParams->iDataOwner->iUid;
|
|
1219 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() sid: 0x%08x", sid.iId );
|
|
1220 |
}
|
|
1221 |
|
|
1222 |
|
|
1223 |
if( packageData && !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
|
|
1224 |
{
|
|
1225 |
CSBPackageTransferType* ptt = CSBPackageTransferType::NewL( uid, driveNumber,
|
|
1226 |
packageDataType );
|
|
1227 |
CleanupStack::PushL( ptt );
|
|
1228 |
|
|
1229 |
//Write restore data to chunk
|
|
1230 |
LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" );
|
|
1231 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() :\
|
|
1232 |
Received data length: %d", iCurrentTask->iSupplyDataParams->iRestoreData->Length() );
|
|
1233 |
iSBEClient->TransferDataAddressL().Copy( iCurrentTask->
|
|
1234 |
iSupplyDataParams->iRestoreData->Des() );
|
|
1235 |
LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" );
|
|
1236 |
|
|
1237 |
delete iCurrentTask->iSupplyDataParams->iRestoreData;
|
|
1238 |
iCurrentTask->iSupplyDataParams->iRestoreData = NULL;
|
|
1239 |
|
|
1240 |
//Supply data
|
|
1241 |
lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData );
|
|
1242 |
LOGGER_WRITE( "iSBEClient->SupplyDataL( ptt, lastChunk ) : start" );
|
|
1243 |
TRequestStatus status;
|
|
1244 |
iSBEClient->SupplyDataL( *ptt, lastChunk, status );
|
|
1245 |
User::WaitForRequest( status );
|
|
1246 |
LOGGER_WRITE( "iSBEClient->SupplyDataL( ptt, lastChunk ) : stop" );
|
|
1247 |
|
|
1248 |
User::LeaveIfError( status.Int() );
|
|
1249 |
|
|
1250 |
CleanupStack::PopAndDestroy( ptt );
|
|
1251 |
}
|
|
1252 |
else if( !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
|
|
1253 |
{
|
|
1254 |
CSBSIDTransferType* stt = CSBSIDTransferType::NewL( sid, driveNumber, transferDataType );
|
|
1255 |
CleanupStack::PushL( stt );
|
|
1256 |
|
|
1257 |
//Write restore data to chunk
|
|
1258 |
LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" );
|
|
1259 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : Received data length: %d",
|
|
1260 |
iCurrentTask->iSupplyDataParams->iRestoreData->Length() );
|
|
1261 |
iSBEClient->TransferDataAddressL().Copy( iCurrentTask->
|
|
1262 |
iSupplyDataParams->iRestoreData->Des() );
|
|
1263 |
LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" );
|
|
1264 |
|
|
1265 |
delete iCurrentTask->iSupplyDataParams->iRestoreData;
|
|
1266 |
iCurrentTask->iSupplyDataParams->iRestoreData = NULL;
|
|
1267 |
|
|
1268 |
//Supply data
|
|
1269 |
lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData );
|
|
1270 |
LOGGER_WRITE( "iSBEClient->SupplyDataL( stt, lastChunk ) : start" );
|
|
1271 |
TRequestStatus status;
|
|
1272 |
iSBEClient->SupplyDataL( *stt, lastChunk, status );
|
|
1273 |
User::WaitForRequest( status );
|
|
1274 |
LOGGER_WRITE( "iSBEClient->SupplyDataL( stt, lastChunk ) : stop" );
|
|
1275 |
|
|
1276 |
User::LeaveIfError( status.Int() );
|
|
1277 |
|
|
1278 |
CleanupStack::PopAndDestroy( stt );
|
|
1279 |
}
|
|
1280 |
else
|
|
1281 |
{
|
|
1282 |
TPtr javaHashPtr = iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash->Des();
|
|
1283 |
CSBJavaTransferType* jtt( NULL );
|
|
1284 |
if( packageDataType == ESystemData )
|
|
1285 |
{
|
|
1286 |
LOGGER_WRITE( "iSBEClient->SupplyDataL java ESystemData" );
|
|
1287 |
jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDlet );
|
|
1288 |
}
|
|
1289 |
else if( transferDataType == EPassiveBaseData )
|
|
1290 |
{
|
|
1291 |
LOGGER_WRITE( "iSBEClient->SupplyDataL java EPassiveBaseData" );
|
|
1292 |
jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDletData );
|
|
1293 |
}
|
|
1294 |
|
|
1295 |
if( packageDataType == ESystemData || transferDataType == EPassiveBaseData )
|
|
1296 |
{
|
|
1297 |
CleanupStack::PushL( jtt );
|
|
1298 |
//Write restore data to chunk
|
|
1299 |
LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" );
|
|
1300 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : Received data length: %d",
|
|
1301 |
iCurrentTask->iSupplyDataParams->iRestoreData->Length() );
|
|
1302 |
iSBEClient->TransferDataAddressL().Copy( iCurrentTask->
|
|
1303 |
iSupplyDataParams->iRestoreData->Des() );
|
|
1304 |
LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" );
|
|
1305 |
|
|
1306 |
delete iCurrentTask->iSupplyDataParams->iRestoreData;
|
|
1307 |
iCurrentTask->iSupplyDataParams->iRestoreData = NULL;
|
|
1308 |
|
|
1309 |
//Supply data
|
|
1310 |
lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData );
|
|
1311 |
LOGGER_WRITE( "iSBEClient->SupplyDataL( jtt, lastChunk ) : start" );
|
|
1312 |
TRequestStatus status;
|
|
1313 |
iSBEClient->SupplyDataL( *jtt, lastChunk, status );
|
|
1314 |
User::WaitForRequest( status );
|
|
1315 |
LOGGER_WRITE( "iSBEClient->SupplyDataL( jtt, lastChunk ) : stop" );
|
|
1316 |
|
|
1317 |
User::LeaveIfError( status.Int() );
|
|
1318 |
|
|
1319 |
CleanupStack::PopAndDestroy( jtt );
|
|
1320 |
}
|
|
1321 |
}
|
|
1322 |
|
|
1323 |
TInt ret( KErrNone );
|
|
1324 |
|
|
1325 |
if( !lastChunk )
|
|
1326 |
{
|
|
1327 |
ret = KErrCompletion;
|
|
1328 |
}
|
|
1329 |
|
|
1330 |
LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : returned %d", ret );
|
|
1331 |
return ret;
|
|
1332 |
}
|
|
1333 |
|
|
1334 |
// -----------------------------------------------------------------------------
|
|
1335 |
// CSConSBEClient::GetDriveNumber( const TInt& aDrive ) const
|
|
1336 |
// Maps TInt drive number to TDriveNumber
|
|
1337 |
// -----------------------------------------------------------------------------
|
|
1338 |
//
|
|
1339 |
TDriveNumber CSConSBEClient::GetDriveNumber( const TInt& aDrive ) const
|
|
1340 |
{
|
|
1341 |
TDriveNumber driveNumber;
|
|
1342 |
switch( aDrive )
|
|
1343 |
{
|
|
1344 |
case 0 :
|
|
1345 |
driveNumber = EDriveA;
|
|
1346 |
break;
|
|
1347 |
case 1 :
|
|
1348 |
driveNumber = EDriveB;
|
|
1349 |
break;
|
|
1350 |
case 2 :
|
|
1351 |
driveNumber = EDriveC;
|
|
1352 |
break;
|
|
1353 |
case 3 :
|
|
1354 |
driveNumber = EDriveD;
|
|
1355 |
break;
|
|
1356 |
case 4 :
|
|
1357 |
driveNumber = EDriveE;
|
|
1358 |
break;
|
|
1359 |
case 5 :
|
|
1360 |
driveNumber = EDriveF;
|
|
1361 |
break;
|
|
1362 |
case 6 :
|
|
1363 |
driveNumber = EDriveG;
|
|
1364 |
break;
|
|
1365 |
case 7 :
|
|
1366 |
driveNumber = EDriveH;
|
|
1367 |
break;
|
|
1368 |
case 8 :
|
|
1369 |
driveNumber = EDriveI;
|
|
1370 |
break;
|
|
1371 |
case 9 :
|
|
1372 |
driveNumber = EDriveJ;
|
|
1373 |
break;
|
|
1374 |
case 10 :
|
|
1375 |
driveNumber = EDriveK;
|
|
1376 |
break;
|
|
1377 |
case 11 :
|
|
1378 |
driveNumber = EDriveL;
|
|
1379 |
break;
|
|
1380 |
case 12 :
|
|
1381 |
driveNumber = EDriveM;
|
|
1382 |
break;
|
|
1383 |
case 13 :
|
|
1384 |
driveNumber = EDriveN;
|
|
1385 |
break;
|
|
1386 |
case 14 :
|
|
1387 |
driveNumber = EDriveO;
|
|
1388 |
break;
|
|
1389 |
case 15 :
|
|
1390 |
driveNumber = EDriveP;
|
|
1391 |
break;
|
|
1392 |
case 16 :
|
|
1393 |
driveNumber = EDriveQ;
|
|
1394 |
break;
|
|
1395 |
case 17 :
|
|
1396 |
driveNumber = EDriveR;
|
|
1397 |
break;
|
|
1398 |
case 18 :
|
|
1399 |
driveNumber = EDriveS;
|
|
1400 |
break;
|
|
1401 |
case 19 :
|
|
1402 |
driveNumber = EDriveT;
|
|
1403 |
break;
|
|
1404 |
case 20 :
|
|
1405 |
driveNumber = EDriveU;
|
|
1406 |
break;
|
|
1407 |
case 21 :
|
|
1408 |
driveNumber = EDriveV;
|
|
1409 |
break;
|
|
1410 |
case 22 :
|
|
1411 |
driveNumber = EDriveW;
|
|
1412 |
break;
|
|
1413 |
case 23 :
|
|
1414 |
driveNumber = EDriveX;
|
|
1415 |
break;
|
|
1416 |
case 24 :
|
|
1417 |
driveNumber = EDriveY;
|
|
1418 |
break;
|
|
1419 |
case 25 :
|
|
1420 |
driveNumber = EDriveZ;
|
|
1421 |
break;
|
|
1422 |
default :
|
|
1423 |
driveNumber = EDriveC;
|
|
1424 |
break;
|
|
1425 |
}
|
|
1426 |
|
|
1427 |
return driveNumber;
|
|
1428 |
}
|
|
1429 |
|
|
1430 |
// -----------------------------------------------------------------------------
|
|
1431 |
// CSConSBEClient::FilterDriveList( TDriveList& aDriveList ) const
|
|
1432 |
// Filters the drive list
|
|
1433 |
// -----------------------------------------------------------------------------
|
|
1434 |
//
|
|
1435 |
void CSConSBEClient::FilterDriveList( TDriveList& aDriveList ) const
|
|
1436 |
{
|
|
1437 |
TDriveInfo info;
|
|
1438 |
|
|
1439 |
for ( TInt i = 0; i < aDriveList.Length(); i++ )
|
|
1440 |
{
|
|
1441 |
if ( aDriveList[i] )
|
|
1442 |
{
|
|
1443 |
iFs.Drive( info, i );
|
|
1444 |
#ifdef __WINS__
|
|
1445 |
if ( i == EDriveD )
|
|
1446 |
{
|
|
1447 |
LOGGER_WRITE( "EDriveD skipped on WINS build" );
|
|
1448 |
aDriveList[i] = '\x0';
|
|
1449 |
}
|
|
1450 |
#else
|
|
1451 |
if ( info.iType == EMediaRam )
|
|
1452 |
{
|
|
1453 |
aDriveList[i] = '\x0';
|
|
1454 |
}
|
|
1455 |
#endif
|
|
1456 |
}
|
|
1457 |
}
|
|
1458 |
|
|
1459 |
}
|
|
1460 |
|
|
1461 |
// -----------------------------------------------------------------------------
|
|
1462 |
// CSConSBEClient::Match( const CSConTask& aFirst, const CSConTask& aSecond )
|
|
1463 |
// Matches the uids
|
|
1464 |
// -----------------------------------------------------------------------------
|
|
1465 |
//
|
|
1466 |
TInt CSConSBEClient::Match( const TUid& aFirst, const TUid& aSecond )
|
|
1467 |
{
|
|
1468 |
if( aFirst == aSecond )
|
|
1469 |
{
|
|
1470 |
return ETrue;
|
|
1471 |
}
|
|
1472 |
|
|
1473 |
return EFalse;
|
|
1474 |
}
|
|
1475 |
|
|
1476 |
// -----------------------------------------------------------------------------
|
|
1477 |
// CSConSBEClient::HandleSBEErrorL( TInt& aErr )
|
|
1478 |
// Handle error received from Secure Backup Engine
|
|
1479 |
// -----------------------------------------------------------------------------
|
|
1480 |
//
|
|
1481 |
void CSConSBEClient::HandleSBEErrorL( TInt& aErr )
|
|
1482 |
{
|
|
1483 |
TRACE_FUNC_ENTRY;
|
|
1484 |
LOGGER_WRITE_1( " aErr: %d", aErr );
|
|
1485 |
if( aErr == KErrServerTerminated )
|
|
1486 |
{
|
|
1487 |
LOGGER_WRITE( "Re-connecting to SBE..." );
|
|
1488 |
//Session has been terminated, recreate it..
|
|
1489 |
delete iSBEClient;
|
|
1490 |
iSBEClient = NULL;
|
|
1491 |
iSBEClient = CSBEClient::NewL();
|
|
1492 |
}
|
|
1493 |
else if ( aErr ) // error
|
|
1494 |
{
|
|
1495 |
if ( iDataBuffer )
|
|
1496 |
{
|
|
1497 |
iDataBuffer->Reset();
|
|
1498 |
iDataBufferSize = 0;
|
|
1499 |
}
|
|
1500 |
iLastChunk = EFalse;
|
|
1501 |
}
|
|
1502 |
TRACE_FUNC_EXIT;
|
|
1503 |
}
|
|
1504 |
|
|
1505 |
// -----------------------------------------------------------------------------
|
|
1506 |
// CSConSBEClient::AppendFilesToFilelistL()
|
|
1507 |
// Appends files from RFileArray to RPointerArray<CSConFile>
|
|
1508 |
// -----------------------------------------------------------------------------
|
|
1509 |
//
|
|
1510 |
void CSConSBEClient::AppendFilesToFilelistL( const RFileArray& aFiles, RPointerArray<CSConFile>& aSconFiles )
|
|
1511 |
{
|
|
1512 |
TRACE_FUNC_ENTRY;
|
|
1513 |
_LIT( KSConXmlDate, "%F%Y%M%DT%H%T%SZ" );
|
|
1514 |
for( TInt j = 0; j < aFiles.Count(); j++ )
|
|
1515 |
{
|
|
1516 |
CSConFile* fileInfo = new (ELeave) CSConFile();
|
|
1517 |
CleanupStack::PushL( fileInfo );
|
|
1518 |
fileInfo->iPath = aFiles[j].iName;
|
|
1519 |
LOGGER_WRITE_1("file: %S", &fileInfo->iPath );
|
|
1520 |
|
|
1521 |
fileInfo->iSize = aFiles[j].iSize;
|
|
1522 |
|
|
1523 |
switch( aFiles[j].iAtt )
|
|
1524 |
{
|
|
1525 |
case KEntryAttNormal :
|
|
1526 |
fileInfo->iUserPerm = EPermNormal;
|
|
1527 |
break;
|
|
1528 |
case KEntryAttReadOnly :
|
|
1529 |
fileInfo->iUserPerm = EPermReadOnly;
|
|
1530 |
break;
|
|
1531 |
default :
|
|
1532 |
fileInfo->iUserPerm = EPermNormal;
|
|
1533 |
break;
|
|
1534 |
}
|
|
1535 |
|
|
1536 |
TTime time( aFiles[j].iModified );
|
|
1537 |
HBufC* timeBuf = HBufC::NewLC( KMaxTimeFormatSpec );
|
|
1538 |
TPtr timePtr = timeBuf->Des();
|
|
1539 |
time.FormatL( timePtr, KSConXmlDate );
|
|
1540 |
|
|
1541 |
fileInfo->iModified.Copy( timePtr );
|
|
1542 |
|
|
1543 |
CleanupStack::PopAndDestroy( timeBuf );
|
|
1544 |
|
|
1545 |
aSconFiles.Append( fileInfo );
|
|
1546 |
CleanupStack::Pop( fileInfo );
|
|
1547 |
}
|
|
1548 |
TRACE_FUNC_EXIT;
|
|
1549 |
}
|
|
1550 |
|
|
1551 |
|
|
1552 |
// -----------------------------------------------------------------------------
|
|
1553 |
// CSConSBEClient::PackageDataSizeL()
|
|
1554 |
// Gets Package dataowner size
|
|
1555 |
// -----------------------------------------------------------------------------
|
|
1556 |
//
|
|
1557 |
TUint CSConSBEClient::PackageDataSizeL( TUid aPackageId, const TDriveList& aDriveList,
|
|
1558 |
TPackageDataType aPackageDataType ) const
|
|
1559 |
{
|
|
1560 |
TUint dataSize(0);
|
|
1561 |
//Ask data size from every drive
|
|
1562 |
for( TInt j = 0; j < KMaxDrives; j++ )
|
|
1563 |
{
|
|
1564 |
if( aDriveList[j] )
|
|
1565 |
{
|
|
1566 |
CSBPackageTransferType* ptt( NULL );
|
|
1567 |
TDriveNumber driveNumber = GetDriveNumber( j );
|
|
1568 |
LOGGER_WRITE_1( "Drive %d", driveNumber );
|
|
1569 |
ptt = CSBPackageTransferType::NewL( aPackageId, driveNumber, aPackageDataType );
|
|
1570 |
CleanupStack::PushL( ptt );
|
|
1571 |
//Get the size and store it to a variable
|
|
1572 |
TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *ptt ) );
|
|
1573 |
CleanupStack::PopAndDestroy( ptt );
|
|
1574 |
LOGGER_WRITE_1( "ExpectedDataSizeL returned for package %d", err );
|
|
1575 |
if( err != KErrNone && err != KErrNotFound )
|
|
1576 |
{
|
|
1577 |
LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
|
|
1578 |
User::Leave( err );
|
|
1579 |
}
|
|
1580 |
}
|
|
1581 |
}
|
|
1582 |
return dataSize;
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
// -----------------------------------------------------------------------------
|
|
1586 |
// CSConSBEClient::SidDataSizeL()
|
|
1587 |
// Gets Sid (SecureId) dataowner size
|
|
1588 |
// -----------------------------------------------------------------------------
|
|
1589 |
//
|
|
1590 |
TUint CSConSBEClient::SidDataSizeL( TUid aSid, const TDriveList& aDriveList,
|
|
1591 |
TTransferDataType aTransferDataType ) const
|
|
1592 |
{
|
|
1593 |
TUint dataSize(0);
|
|
1594 |
//Ask data size from every drive
|
|
1595 |
for( TInt j = 0; j < KMaxDrives; j++ )
|
|
1596 |
{
|
|
1597 |
if( aDriveList[j] )
|
|
1598 |
{
|
|
1599 |
CSBSIDTransferType* stt( NULL );
|
|
1600 |
TDriveNumber driveNumber = GetDriveNumber( j );
|
|
1601 |
LOGGER_WRITE_1( "Drive %d", driveNumber );
|
|
1602 |
stt = CSBSIDTransferType::NewL( aSid, driveNumber, aTransferDataType );
|
|
1603 |
CleanupStack::PushL( stt );
|
|
1604 |
//Get the size and store it to a variable
|
|
1605 |
TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *stt ) );
|
|
1606 |
CleanupStack::PopAndDestroy( stt );
|
|
1607 |
LOGGER_WRITE_1( "ExpectedDataSizeL returned for DO %d", err );
|
|
1608 |
if( err != KErrNone && err != KErrNotFound )
|
|
1609 |
{
|
|
1610 |
LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
|
|
1611 |
User::Leave( err );
|
|
1612 |
}
|
|
1613 |
}
|
|
1614 |
}
|
|
1615 |
return dataSize;
|
|
1616 |
}
|
|
1617 |
|
|
1618 |
// -----------------------------------------------------------------------------
|
|
1619 |
// CSConSBEClient::JavaDataSizeL()
|
|
1620 |
// Gets Java dataowner size
|
|
1621 |
// -----------------------------------------------------------------------------
|
|
1622 |
//
|
|
1623 |
TUint CSConSBEClient::JavaDataSizeL( const TDesC& aJavaHash, const TDriveList& aDriveList ) const
|
|
1624 |
{
|
|
1625 |
TUint dataSize(0);
|
|
1626 |
//Ask data size from every drive
|
|
1627 |
for( TInt j = 0; j < KMaxDrives; j++ )
|
|
1628 |
{
|
|
1629 |
if( aDriveList[j] )
|
|
1630 |
{
|
|
1631 |
CSBJavaTransferType* jtt( NULL );
|
|
1632 |
|
|
1633 |
TDriveNumber driveNumber = GetDriveNumber( j );
|
|
1634 |
LOGGER_WRITE_1( "Drive %d", driveNumber );
|
|
1635 |
jtt = CSBJavaTransferType::NewL( aJavaHash,
|
|
1636 |
driveNumber,
|
|
1637 |
EJavaMIDlet );
|
|
1638 |
CleanupStack::PushL( jtt );
|
|
1639 |
//Get the size and store it to a variable
|
|
1640 |
TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *jtt ) );
|
|
1641 |
CleanupStack::PopAndDestroy( jtt );
|
|
1642 |
LOGGER_WRITE_1( "ExpectedDataSizeL returned for Java(EJavaMIDlet) DO %d", err );
|
|
1643 |
if( err != KErrNone && err != KErrNotFound )
|
|
1644 |
{
|
|
1645 |
LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
|
|
1646 |
User::Leave( err );
|
|
1647 |
}
|
|
1648 |
|
|
1649 |
jtt = NULL;
|
|
1650 |
jtt = CSBJavaTransferType::NewL( aJavaHash,
|
|
1651 |
driveNumber,
|
|
1652 |
EJavaMIDletData );
|
|
1653 |
CleanupStack::PushL( jtt );
|
|
1654 |
//Get the size and store it to a variable
|
|
1655 |
TRAP( err, dataSize += iSBEClient->ExpectedDataSizeL( *jtt ) );
|
|
1656 |
CleanupStack::PopAndDestroy( jtt );
|
|
1657 |
LOGGER_WRITE_1( "ExpectedDataSizeL returned for Java(EJavaMIDletData) DO %d", err );
|
|
1658 |
if( err != KErrNone && err != KErrNotFound )
|
|
1659 |
{
|
|
1660 |
LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
|
|
1661 |
User::Leave( err );
|
|
1662 |
}
|
|
1663 |
}
|
|
1664 |
}
|
|
1665 |
|
|
1666 |
return dataSize;
|
|
1667 |
}
|
|
1668 |
// End of file
|