|
1 /* |
|
2 * Copyright (c) 2007 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: External Media Card Test Plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // CLASS DECLARATION |
|
20 #include "diagexternalmediacardplugin.hrh" // ADO & Platformization Changes |
|
21 #include "diagexternalmediacardplugin.h" |
|
22 |
|
23 // SYSTME INCLUDE FILES |
|
24 #include <featmgr.h> // feature manager for MMC support checking |
|
25 #include <features.hrh> |
|
26 //#ifndef RD_MULTIPLE_DRIVE |
|
27 #include <pathinfo.h> //PathInfo |
|
28 //#endif // RD_MULTIPLE_DRIVE |
|
29 #include <sysutil.h> //SysUtil |
|
30 #include <StringLoader.h> // StringLoader |
|
31 |
|
32 #include <DiagTestObserver.h> // MDiagTestObserver |
|
33 #include <DiagTestExecParam.h> // TDiagTestExecParam |
|
34 #include <DiagResultsDbItemBuilder.h> // CDiagResultsDbItemBuilder |
|
35 #include <DiagResultDetailBasic.h> // CDiagResultDetailBasic |
|
36 #include <DiagFrameworkDebug.h> // LOGSTRING |
|
37 #include <devdiagexternalmediacardpluginrsc.rsg> |
|
38 #include <AknDialog.h> // ADO & Platformization Changes |
|
39 #include <aknmessagequerydialog.h> // ADO & Platformization Changes |
|
40 #include <DiagCommonDialog.h> // for EDiagCommonDialogConfirmCancelAll |
|
41 #include <DiagEngineCommon.h> |
|
42 |
|
43 |
|
44 #include <AknQueryDialog.h> |
|
45 #include <avkon.hrh> |
|
46 // EXTERNAL DATA STRUCTURES |
|
47 |
|
48 // EXTERNAL FUNCTION PROTOTYPES |
|
49 |
|
50 // CONSTANTS |
|
51 const TInt KDiagExternalMediaCardStepsMaxCount = 2; //total test steps |
|
52 _LIT( KText1, "PhoneDoctor External Memory Test" ); |
|
53 |
|
54 // MACROS |
|
55 |
|
56 // LOCAL CONSTANTS AND MACROS |
|
57 |
|
58 // MODULE DATA STRUCTURES |
|
59 |
|
60 // LOCAL FUNCTION PROTOTYPES |
|
61 |
|
62 // FORWARD DECLARATIONS |
|
63 |
|
64 // ============================= LOCAL FUNCTIONS ============================== |
|
65 |
|
66 // ========================= MEMBER FUNCTIONS ================================ |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // CDiagExternalMediaCardPlugin::CDiagExternalMediaCardPlugin() |
|
70 // |
|
71 // Constructor |
|
72 // ---------------------------------------------------------------------------- |
|
73 // |
|
74 CDiagExternalMediaCardPlugin::CDiagExternalMediaCardPlugin( |
|
75 CDiagPluginConstructionParam* aParam ) |
|
76 : CDiagTestPluginBase( aParam ) |
|
77 { |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CDiagExternalMediaCardPlugin::NewL() |
|
83 // |
|
84 // Symbian OS default constructor |
|
85 // --------------------------------------------------------------------------- |
|
86 MDiagPlugin* CDiagExternalMediaCardPlugin::NewL( TAny* aInitParams ) |
|
87 { |
|
88 ASSERT( aInitParams ); |
|
89 LOGSTRING( "CDiagExternalMediaCard::NewL" ); |
|
90 |
|
91 CDiagPluginConstructionParam* param = |
|
92 static_cast<CDiagPluginConstructionParam*>( aInitParams ); |
|
93 |
|
94 CleanupStack::PushL( param ); |
|
95 CDiagExternalMediaCardPlugin* self = new( ELeave ) CDiagExternalMediaCardPlugin (param); |
|
96 CleanupStack::Pop( param ); |
|
97 |
|
98 CleanupStack::PushL( self ); |
|
99 self->ConstructL(); |
|
100 CleanupStack::Pop( self ); // self |
|
101 |
|
102 return self; |
|
103 } |
|
104 |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CDiagExternalMediaCardPlugin::ConstructL() |
|
108 // |
|
109 // Symbian OS two-phased constructor |
|
110 // --------------------------------------------------------------------------- |
|
111 void CDiagExternalMediaCardPlugin::ConstructL() |
|
112 { |
|
113 LOGSTRING("CDiagExternalMediaCardPlugin::ConstructL: Plugin created."); |
|
114 BaseConstructL ( KDiagExternalMediaCardPluginResourceFileName ); |
|
115 |
|
116 FeatureManager::InitializeLibL(); |
|
117 idialogOn = EFalse; |
|
118 idialogDismissed = EFalse; |
|
119 } |
|
120 |
|
121 |
|
122 // ---------------------------------------------------------------------------- |
|
123 // CDiagExternalMediaCardPlugin::~CDiagExternalMediaCardPlugin |
|
124 // |
|
125 // Destructor |
|
126 // ---------------------------------------------------------------------------- |
|
127 CDiagExternalMediaCardPlugin::~CDiagExternalMediaCardPlugin() |
|
128 { |
|
129 FeatureManager::UnInitializeLib(); |
|
130 } |
|
131 |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // From MDiagPlugin |
|
135 // CDiagExternalMediaCardPlugin::IsVisible() |
|
136 // --------------------------------------------------------------------------- |
|
137 TBool CDiagExternalMediaCardPlugin::IsVisible() const |
|
138 { |
|
139 return ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ); |
|
140 } |
|
141 |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // From MDiagPlugin |
|
145 // CDiagExternalMediaCardPlugin::IsSupported() |
|
146 // --------------------------------------------------------------------------- |
|
147 TBool CDiagExternalMediaCardPlugin::IsSupported() const |
|
148 { |
|
149 return ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ); |
|
150 } |
|
151 |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // From MDiagTestPlugin |
|
155 // CDiagExternalMediaCardPlugin::RunMode() |
|
156 // --------------------------------------------------------------------------- |
|
157 MDiagTestPlugin::TRunMode CDiagExternalMediaCardPlugin::RunMode() const |
|
158 { |
|
159 return EAutomatic; |
|
160 } |
|
161 |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // From MDiagTestPlugin |
|
165 // CDiagExternalMediaCardPlugin::TotalSteps() |
|
166 // --------------------------------------------------------------------------- |
|
167 TUint CDiagExternalMediaCardPlugin::TotalSteps() const |
|
168 { |
|
169 return KDiagExternalMediaCardStepsMaxCount; |
|
170 } |
|
171 |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // From MDiagPlugin |
|
175 // CDiagExternalMediaCardPlugin::GetPluginNameL |
|
176 // --------------------------------------------------------------------------- |
|
177 HBufC* CDiagExternalMediaCardPlugin::GetPluginNameL( TNameLayoutType aLayoutType ) const |
|
178 { |
|
179 switch ( aLayoutType ) |
|
180 { |
|
181 case ENameLayoutListSingle: |
|
182 return StringLoader::LoadL ( R_DIAG_EXTERNAL_MEDIA_CARD_PLUGIN_NAME ); |
|
183 |
|
184 case ENameLayoutHeadingPane: |
|
185 return StringLoader::LoadL ( R_QTN_DIAG_MSG_TITLE_MMC ); |
|
186 |
|
187 case ENameLayoutPopupInfoPane: |
|
188 //return StringLoader::LoadL ( R_QTN_DIAG_MSG_INFO_MMC ); |
|
189 //Return test name for dispalyin TEST REsults in case of Perform All test |
|
190 //Ravi |
|
191 return StringLoader::LoadL ( R_DIAG_EXTERNAL_MEDIA_CARD_PLUGIN_NAME ); |
|
192 |
|
193 case ENameLayoutTitlePane: |
|
194 return StringLoader::LoadL ( R_QTN_DIAG_TITLE_TEST_EXTERNAL_MEMORY ); |
|
195 |
|
196 case ENameLayoutListSingleGraphic: |
|
197 return StringLoader::LoadL ( R_QTN_DIAG_LST_TEST_MMC ); |
|
198 |
|
199 |
|
200 default: |
|
201 LOGSTRING2( "CDiagExternalMediaCardPlugin::GetPluginNameL: " |
|
202 L"ERROR: Unsupported layout type %d", aLayoutType ) |
|
203 __ASSERT_DEBUG( 0, User::Invariant() ); |
|
204 return StringLoader::LoadL ( R_DIAG_EXTERNAL_MEDIA_CARD_PLUGIN_NAME ); |
|
205 } |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // From MDiagPlugin |
|
210 // CDiagExternalMediaCardPlugin::Uid |
|
211 // --------------------------------------------------------------------------- |
|
212 TUid CDiagExternalMediaCardPlugin::Uid() const |
|
213 { |
|
214 return KDiagExternalMediaCardPluginUid; |
|
215 } |
|
216 |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // From CActive |
|
220 // CDiagExternalMediaCardPlugin::RunL |
|
221 // --------------------------------------------------------------------------- |
|
222 void CDiagExternalMediaCardPlugin::RunL() |
|
223 { |
|
224 switch ( iState ) |
|
225 { |
|
226 case EWriting: |
|
227 //report test progress |
|
228 iCounter--; |
|
229 if ( iCounter > 0 ) |
|
230 { |
|
231 ReportTestProgressL( KDiagExternalMediaCardStepsMaxCount - iCounter ); |
|
232 } |
|
233 |
|
234 if (idialogDismissed) |
|
235 { |
|
236 ReportResultToPluginL( CDiagResultsDatabaseItem::ESkipped ); |
|
237 LOGSTRING("CDiagExternalMediaCardPlugin::RunL dialogDismissed=EWriting"); |
|
238 return; |
|
239 } |
|
240 //check if write is okay |
|
241 if ( iStatus == KErrNone ) |
|
242 { |
|
243 LOGSTRING( "CDiagExternalMediaCard::RunL, write ok" ); |
|
244 iFile.Close(); |
|
245 |
|
246 // read test |
|
247 TInt errorCodeOpen = iFile2.Open( iFs, iFileName, EFileRead ); |
|
248 if ( errorCodeOpen!=KErrNone ) |
|
249 { |
|
250 LOGSTRING( "CDiagExternalMediaCard::RunL,iFile2 open fail" ); |
|
251 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
252 return; |
|
253 } |
|
254 LOGSTRING( "CDiagExternalMediaCard::RunL, iFile2 open okay" ); |
|
255 |
|
256 // Start read test |
|
257 SetState( EReading ); |
|
258 iBufr.Zero(); |
|
259 iFile2.Read( iBufr, iStatus ); |
|
260 |
|
261 SetActive(); |
|
262 } |
|
263 else //write fail |
|
264 { |
|
265 LOGSTRING( "CDiagExternalMediaCard::RunL, write fail" ); |
|
266 //set test result fail |
|
267 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
268 } |
|
269 break; |
|
270 |
|
271 case EReading: |
|
272 |
|
273 if (idialogDismissed) |
|
274 { |
|
275 ReportResultToPluginL( CDiagResultsDatabaseItem::ESkipped ); |
|
276 LOGSTRING("CDiagExternalMediaCardPlugin::RunL dialogDismissed=EReading"); |
|
277 return; |
|
278 } |
|
279 //check if read is okay |
|
280 if( iStatus == KErrNone ) |
|
281 { |
|
282 LOGSTRING( "CDiagExternalMediaCard::RunL, read okay" ); |
|
283 |
|
284 //compare data and set test result |
|
285 CDiagResultsDatabaseItem::TResult result = ( iBufr == iBufw )? |
|
286 CDiagResultsDatabaseItem::ESuccess |
|
287 : CDiagResultsDatabaseItem::EFailed; |
|
288 ReportResultToPluginL( result ); |
|
289 LOGSTRING2( "CDiagExternalMediaCard::RunL,test result %d", result ); |
|
290 } |
|
291 else //read fail |
|
292 { |
|
293 LOGSTRING( "CDiagExternalMediaCard::RunL, read fail" ); |
|
294 //set result fail |
|
295 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
296 } |
|
297 break; |
|
298 |
|
299 default: |
|
300 LOGSTRING( "CDiagExternalMediaCard::RunL, default case" ); |
|
301 //set result fail |
|
302 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
303 break; |
|
304 } |
|
305 } |
|
306 |
|
307 |
|
308 // --------------------------------------------------------------------------- |
|
309 // From CActive |
|
310 // CDiagExternalMediaCardPlugin::DoCancel |
|
311 // --------------------------------------------------------------------------- |
|
312 void CDiagExternalMediaCardPlugin::DoCancel() |
|
313 { |
|
314 switch ( iState ) |
|
315 { |
|
316 case EReading: |
|
317 iFile.ReadCancel(iStatus); |
|
318 break; |
|
319 |
|
320 default: |
|
321 // No action needed |
|
322 break; |
|
323 } |
|
324 // RFile.Write() does not support cancel. |
|
325 // See Symbian FAQ 1409 at |
|
326 // http://www3.symbian.com/faq.nsf/0/C3248753E9B33398802571C3006037CA?OpenDocument |
|
327 // So no cancel is necessary for EWriting |
|
328 |
|
329 } |
|
330 |
|
331 |
|
332 // --------------------------------------------------------------------------- |
|
333 // From CDiagTestPluginBase |
|
334 // CDiagExternalMediaCardPlugin::ShowTitleMessageL() |
|
335 // --------------------------------------------------------------------------- |
|
336 TBool CDiagExternalMediaCardPlugin::ShowTitleMessageL() |
|
337 { |
|
338 TInt aButtonId; |
|
339 ShowMessageQueryL(R_MESSAGEQUERY_TITLE_EXTERNALMEMORY,aButtonId); |
|
340 |
|
341 if(aButtonId == ECBACmdCancel) |
|
342 { |
|
343 ReportResultToPluginL( CDiagResultsDatabaseItem::ESkipped ); |
|
344 return EFalse; |
|
345 } |
|
346 |
|
347 if(aButtonId == ECBACmdSkip) |
|
348 { |
|
349 TInt confirmResult = 0; |
|
350 |
|
351 CAknDialog* dlg = ExecutionParam().Engine(). |
|
352 CreateCommonDialogLC( EDiagCommonDialogConfirmSkipAll, NULL ); |
|
353 |
|
354 if ( !RunWaitingDialogL( dlg, confirmResult ) ) |
|
355 { |
|
356 return EFalse; |
|
357 } |
|
358 |
|
359 if ( confirmResult) |
|
360 { |
|
361 return EFalse; |
|
362 } |
|
363 } |
|
364 return ETrue; |
|
365 } |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // From CDiagTestPluginBase |
|
369 // CDiagExternalMediaCardPlugin::DoRunTestL() |
|
370 // --------------------------------------------------------------------------- |
|
371 void CDiagExternalMediaCardPlugin::DoRunTestL() |
|
372 { |
|
373 //TInt aButtonId; // ADO & Platformization Changes |
|
374 iCounter = KDiagExternalMediaCardStepsMaxCount; |
|
375 // ADO & Platformization Changes |
|
376 if(!ShowTitleMessageL()) |
|
377 return; |
|
378 // Changes Ends |
|
379 |
|
380 //Start my test |
|
381 ShowProgressNoteL(); |
|
382 |
|
383 SetState( EIdle ); |
|
384 |
|
385 //test should not be performed if external media card is not supported |
|
386 ASSERT( FeatureManager::FeatureSupported( KFeatureIdMmc ) ); |
|
387 |
|
388 TInt errorCode( KErrNotFound ); |
|
389 |
|
390 //check the drive number for external card |
|
391 TInt mmcDriveNum( 0 ); |
|
392 |
|
393 // If path length is zero, driveLetterBuf will be empty. |
|
394 TBuf<1> driveLetterBuf; |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 driveLetterBuf = PathInfo::MemoryCardRootPath().Left( 1 ); |
|
401 |
|
402 if ( driveLetterBuf.Length() > 0 ) |
|
403 { |
|
404 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, driveLetterBuf ok" ); |
|
405 TChar driveLetter = driveLetterBuf[0]; |
|
406 errorCode = RFs::CharToDrive( driveLetter, mmcDriveNum ); |
|
407 } |
|
408 else |
|
409 { |
|
410 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, driveLetterBuf empty" ); |
|
411 } |
|
412 |
|
413 if ( errorCode != KErrNone ) |
|
414 { |
|
415 //no such drive exists,act as feature not supported |
|
416 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, no drive" ); |
|
417 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
418 return; |
|
419 } |
|
420 |
|
421 |
|
422 TVolumeInfo volumeinfo; |
|
423 TDriveInfo driveInfo; |
|
424 TInt errorCode2; |
|
425 |
|
426 do |
|
427 { |
|
428 User::LeaveIfError( iFs.Connect() ); // Connects a client process to the fileserver |
|
429 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, iFs connect" ); |
|
430 |
|
431 errorCode = iFs.Volume( volumeinfo, mmcDriveNum ); |
|
432 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, Volume" ); |
|
433 |
|
434 errorCode2 = iFs.Drive( driveInfo, mmcDriveNum ); |
|
435 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, Drive" ); |
|
436 |
|
437 if ( errorCode != KErrNone || errorCode2 != KErrNone ) |
|
438 { |
|
439 //no such drive exists,act as feature not supported |
|
440 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, no drive" ); |
|
441 TInt buttonId; |
|
442 TBool result = EFalse; |
|
443 result = ShowMessageQueryL( R_MESSAGEQUERY_NO_EXTERNALMEMORY, buttonId ); |
|
444 |
|
445 // Check session is valid after dialog dismissed |
|
446 if ( !result ) |
|
447 { |
|
448 LOGSTRING( "CDiagExternalMediaCardPlugin::AfterPlayL - !iSessionValid 1.2" ) |
|
449 return; |
|
450 } |
|
451 |
|
452 // Report Success on Yes |
|
453 if ( (buttonId == EAknSoftkeyYes) || (buttonId == EAknSoftkeyOk)) |
|
454 { |
|
455 LOGSTRING( "CDiagExternalMediaCardPlugin::EAknSoftkeyOk has pressed - return ESuccess" ) |
|
456 } |
|
457 else if ( buttonId == ECBACmdSkip ) |
|
458 { |
|
459 ReportResultToPluginL( CDiagResultsDatabaseItem::ESkipped ); |
|
460 return; |
|
461 } |
|
462 else if ( (buttonId == EAknSoftkeyNo) || (buttonId == ECBACmdNo) ) |
|
463 { |
|
464 if(SinglePluginExecution()) |
|
465 { |
|
466 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed); |
|
467 return; |
|
468 } |
|
469 else |
|
470 { |
|
471 TInt confirmResult = 0; |
|
472 |
|
473 CAknDialog* dlg = ExecutionParam().Engine(). |
|
474 CreateCommonDialogLC( EDiagCommonDialogConfirmCancelAll, NULL ); |
|
475 |
|
476 if ( !RunWaitingDialogL( dlg, confirmResult ) ) |
|
477 { |
|
478 return; |
|
479 } |
|
480 |
|
481 if ( confirmResult) |
|
482 { |
|
483 //CompleteTestL( CDiagResultsDatabaseItem::ECancelled ); |
|
484 return; |
|
485 } |
|
486 } |
|
487 |
|
488 } |
|
489 } |
|
490 |
|
491 } while(errorCode != KErrNone || errorCode2 != KErrNone); |
|
492 |
|
493 |
|
494 //check status of external media card |
|
495 |
|
496 if ( ( driveInfo.iMediaAtt & KMediaAttLocked ) || |
|
497 ( driveInfo.iMediaAtt & KMediaAttWriteProtected ) ) |
|
498 { |
|
499 //card is locked or read only |
|
500 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, card locked or read only" ); |
|
501 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
502 return; |
|
503 } |
|
504 |
|
505 if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, iBufw.MaxLength(), mmcDriveNum ) ) |
|
506 { |
|
507 //card is out of memory |
|
508 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, out of memory" ); |
|
509 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
510 return; |
|
511 } |
|
512 |
|
513 //Try to create a temp file for test |
|
514 TFileName FilePath; |
|
515 TDriveUnit unit( mmcDriveNum ); |
|
516 errorCode = iFs.CreatePrivatePath( unit ); |
|
517 |
|
518 if ( ( errorCode != KErrNone ) && ( errorCode != KErrAlreadyExists ) ) |
|
519 { |
|
520 LOGSTRING( "CDiagExternalMediaCard::DoRunTestL, CreatePrivatePath fail" ); |
|
521 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
522 return; |
|
523 } |
|
524 |
|
525 iFs.PrivatePath( FilePath ); |
|
526 FilePath.Insert( 0, unit.Name() ); |
|
527 |
|
528 errorCode = iFile.Temp( iFs, FilePath, iFileName, EFileWrite ); |
|
529 LOGSTRING2( "CDiagExternalMediaCard::DoRunTestL, Temp err = %d", errorCode ); |
|
530 |
|
531 if ( errorCode != KErrNone ) |
|
532 { |
|
533 //Temp file creation failed |
|
534 ReportResultToPluginL( CDiagResultsDatabaseItem::EFailed ); |
|
535 return; |
|
536 } |
|
537 |
|
538 // Temp file created, start the write test |
|
539 |
|
540 iBufw.Zero(); |
|
541 iBufw.Copy( KText1 ); |
|
542 |
|
543 SetState( EWriting ); |
|
544 |
|
545 iFile.Write( iBufw, iStatus ); |
|
546 SetActive(); |
|
547 } |
|
548 |
|
549 // ---------------------------------------------------------------------------- |
|
550 // CDiagExternalMediaCardPlugin::ShowProgressNoteL |
|
551 // |
|
552 // Progress Note |
|
553 // ---------------------------------------------------------------------------- |
|
554 |
|
555 void CDiagExternalMediaCardPlugin::ShowProgressNoteL() |
|
556 { |
|
557 if ( iWaitDialog ) |
|
558 { |
|
559 delete iWaitDialog; |
|
560 iWaitDialog = NULL; |
|
561 } |
|
562 |
|
563 |
|
564 // WAIT NOTE DIALOG |
|
565 iWaitDialog = new (ELeave) CAknWaitDialog( |
|
566 (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), |
|
567 ETrue); |
|
568 |
|
569 iWaitDialog->PrepareLC(R_EXTMEM_PLUGIN_WAIT_NOTE); |
|
570 iWaitDialog->SetCallback(this); |
|
571 iWaitDialog->RunLD(); |
|
572 idialogOn = ETrue; |
|
573 LOGSTRING("CDiagExternalMediaCardPlugin::ShowProgressNoteL()"); |
|
574 |
|
575 } |
|
576 |
|
577 //********************************************************* |
|
578 // CallBack from AKnWaitDialog when Cancel is pressed |
|
579 //********************************************************* |
|
580 |
|
581 void CDiagExternalMediaCardPlugin::DialogDismissedL( TInt aButtonId ) |
|
582 { |
|
583 LOGSTRING2("CDiagExternalMediaCardPlugin::DialogDismissedL() = %d",aButtonId); |
|
584 |
|
585 if (aButtonId == ECBACmdCancel && idialogOn) |
|
586 { |
|
587 // cancel the tests based on which point the dialog is dismissed |
|
588 LOGSTRING2("CDiagExternalMediaCardPlugin::DialogDismissed @ iState= %d",iState); |
|
589 if (iState == EReading) |
|
590 iFile.ReadCancel(iStatus); |
|
591 |
|
592 iWaitDialog = NULL; |
|
593 idialogOn = EFalse; |
|
594 idialogDismissed = ETrue; |
|
595 } |
|
596 } |
|
597 |
|
598 void CDiagExternalMediaCardPlugin::ReportResultToPluginL(CDiagResultsDatabaseItem::TResult aResult) |
|
599 { |
|
600 // clear the dialogue only if dialog is running. |
|
601 if(idialogOn) |
|
602 iWaitDialog->ProcessFinishedL(); |
|
603 |
|
604 CompleteTestL( aResult ); |
|
605 } |
|
606 |
|
607 //--------------------------------------------------------------------------- |
|
608 // CDiagExternalMediaCardPlugin::DoStopAndCleanupL |
|
609 //--------------------------------------------------------------------------- |
|
610 void CDiagExternalMediaCardPlugin::DoStopAndCleanupL() |
|
611 { |
|
612 switch ( iState ) |
|
613 { |
|
614 case EWriting: |
|
615 iFile.Close(); |
|
616 iFs.Delete( iFileName ); // delete the file created by Temp |
|
617 iFs.Close(); |
|
618 break; |
|
619 |
|
620 case EReading: |
|
621 iFile2.Close(); |
|
622 iFs.Delete( iFileName ); // delete the file created by Temp |
|
623 iFs.Close(); |
|
624 break; |
|
625 |
|
626 case EIdle: |
|
627 iFs.Close(); |
|
628 break; |
|
629 |
|
630 default: |
|
631 ASSERT ( EFalse ); //this should never happen |
|
632 break; |
|
633 } |
|
634 if ( iWaitDialog ) |
|
635 delete iWaitDialog; |
|
636 idialogOn = EFalse; |
|
637 idialogDismissed = EFalse; |
|
638 SetState( EIdle ); |
|
639 } |
|
640 |
|
641 |
|
642 //--------------------------------------------------------------------------- |
|
643 // CDiagExternalMediaCardPlugin::SetState() |
|
644 //--------------------------------------------------------------------------- |
|
645 void CDiagExternalMediaCardPlugin::SetState( TStates aState ) |
|
646 { |
|
647 iState = aState; |
|
648 } |
|
649 |
|
650 // ADO & Platformization Changes |
|
651 TBool CDiagExternalMediaCardPlugin::ShowMessageQueryL( TInt aResourceId, TInt &aButtonId ) |
|
652 { |
|
653 LOGSTRING( "CDiagAudioPlugin::ShowMessageQueryL IN" ) |
|
654 CAknMessageQueryDialog* dlg = NULL; |
|
655 TBool result = EFalse; |
|
656 |
|
657 // Create CAknMessageQueryDialog instance |
|
658 dlg = new ( ELeave ) CAknMessageQueryDialog(); |
|
659 |
|
660 dlg->PrepareLC( aResourceId ); |
|
661 |
|
662 CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer(); |
|
663 |
|
664 switch ( aResourceId ) |
|
665 { |
|
666 case R_MESSAGEQUERY_TITLE_EXTERNALMEMORY: |
|
667 { |
|
668 if ( SinglePluginExecution() ) |
|
669 { |
|
670 cba.SetCommandSetL( R_EXT_MEMORY_SOFTKEYS_OK_CANCEL ); |
|
671 } |
|
672 else |
|
673 { |
|
674 cba.SetCommandSetL( R_EXT_MEMORY_SOFTKEYS_OK_SKIP ); |
|
675 } |
|
676 } |
|
677 break; |
|
678 |
|
679 default: |
|
680 break; |
|
681 } |
|
682 |
|
683 result = RunWaitingDialogL( dlg, aButtonId ); |
|
684 |
|
685 LOGSTRING3( "CDiagAudioPlugin::ShowMessageQueryL() OUT aButtonId=%d result=%d", aButtonId, result ); |
|
686 return result; |
|
687 } |
|
688 |
|
689 // End of File |
|
690 |