211 } |
198 } |
212 |
199 |
213 // Create the database synchronizer |
200 // Create the database synchronizer |
214 iDbSynchronizer = CMPXDbSynchronizer::NewL(*this,*iDBManager,iMusicCollectionId, |
201 iDbSynchronizer = CMPXDbSynchronizer::NewL(*this,*iDBManager,iMusicCollectionId, |
215 iPodcastCollectionId,iFs, iDisablePodcasting); |
202 iPodcastCollectionId,iFs, iDisablePodcasting); |
216 |
|
217 #ifdef RD_MULTIPLE_DRIVE |
|
218 // Use default MMC drive as the Removable drive |
|
219 User::LeaveIfError( DriveInfo::GetDefaultDrive( |
|
220 DriveInfo::EDefaultRemovableMassStorage, |
|
221 iRemovedDrive ) ); |
|
222 #endif |
|
223 |
203 |
224 // Create DRM Notifier and register for AddRemove event |
204 // Create DRM Notifier and register for AddRemove event |
225 iDrmNotifier = CDRMNotifier::NewL(); |
205 iDrmNotifier = CDRMNotifier::NewL(); |
226 iDrmNotifier->RegisterEventObserverL( *this, KEventAddRemove ); |
206 iDrmNotifier->RegisterEventObserverL( *this, KEventAddRemove ); |
227 iCurUSBEvent = KErrNotFound; |
207 iCurUSBEvent = KErrNotFound; |
438 // 4: USB end we re-open all db and scan for new files |
415 // 4: USB end we re-open all db and scan for new files |
439 // 5: MTP start we stop monitoring for new files (no dismount) |
416 // 5: MTP start we stop monitoring for new files (no dismount) |
440 // 6: MTP end we re-open all db, files added already, restart monitor |
417 // 6: MTP end we re-open all db, files added already, restart monitor |
441 // 7: Disk dismount: stop scanning, close the dismounting DB |
418 // 7: Disk dismount: stop scanning, close the dismounting DB |
442 // |
419 // |
443 #ifdef RD_MULTIPLE_DRIVE |
|
444 // Get all visible drives |
420 // Get all visible drives |
445 TDriveList driveList; |
421 TDriveList driveList; |
446 TInt driveCount(0); |
422 TInt driveCount(0); |
447 TPtrC drivePresent(_L("present")); |
423 TPtrC drivePresent(_L("present")); |
448 TPtrC driveNotPresent(_L("not present")); |
424 TPtrC driveNotPresent(_L("not present")); |
471 (driveStatus&DriveInfo::EDrivePresent)?&drivePresent:&driveNotPresent, |
447 (driveStatus&DriveInfo::EDrivePresent)?&drivePresent:&driveNotPresent, |
472 (driveStatus&DriveInfo::EDriveInUse)?&driveInUse:&driveAvailable, |
448 (driveStatus&DriveInfo::EDriveInUse)?&driveInUse:&driveAvailable, |
473 (driveStatus&DriveInfo::EDriveFormatted)?&driveFormatted:&driveNotFormatted); |
449 (driveStatus&DriveInfo::EDriveFormatted)?&driveFormatted:&driveNotFormatted); |
474 } |
450 } |
475 } |
451 } |
476 #endif //RD_MULTIPLE_DRIVE |
452 |
477 switch( aEvent ) |
453 switch( aEvent ) |
478 { |
454 { |
479 case EFormatStartEvent: |
455 case EFormatStartEvent: |
480 { |
456 { |
481 MPX_DEBUG1("Disk Format start event"); |
457 MPX_DEBUG2("Disk Format start event, drive %d", aData); |
|
458 iIdle->Cancel(); |
482 CancelScan(); |
459 CancelScan(); |
483 iDBManager->CloseDatabase( (TDriveNumber) aData ); |
460 iDBManager->CloseDatabase( (TDriveNumber) aData ); |
|
461 RefreshScanDrivesL(); |
484 break; |
462 break; |
485 } |
463 } |
486 case EDiskRemovedEvent: |
464 case EDiskRemovedEvent: |
487 { |
465 { |
488 MPX_DEBUG1("Disk Removed event"); |
466 MPX_DEBUG2("Disk Removed event, drive %d", aData); |
489 iIdle->Cancel(); |
467 iIdle->Cancel(); |
490 CancelScan(); |
468 CancelScan(); |
491 #ifdef RD_MULTIPLE_DRIVE |
469 iDBManager->DropDatabase ( TDriveNumber( aData ) ); |
492 TBool dbClosed( EFalse ); |
470 RefreshScanDrivesL(); |
493 for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) |
|
494 { |
|
495 if (driveList[driveNum] && (!iDBManager->IsRemoteDrive(static_cast<TDriveNumber>(driveNum)))) |
|
496 { |
|
497 TUint driveStatus(0); |
|
498 User::LeaveIfError( DriveInfo::GetDriveStatus( |
|
499 iFs, driveNum, driveStatus ) ); |
|
500 if (!(driveStatus & DriveInfo::EDrivePresent )) |
|
501 { |
|
502 // Close database for non-present drive |
|
503 iDBManager->CloseDatabase( (TDriveNumber) driveNum ); |
|
504 // Save the drive |
|
505 iRemovedDrive = driveNum; |
|
506 dbClosed = ETrue; |
|
507 break; |
|
508 } |
|
509 } |
|
510 } |
|
511 |
|
512 if( !dbClosed ) |
|
513 { |
|
514 // GetUserVisibleDrives / RFs::DriveList does not return drive at all |
|
515 // if it is dismounted using file server methods. This occurs at least |
|
516 // when removing card using power menu eject. |
|
517 // If the drive reported as removed is not ready, close db on that drive. |
|
518 TUint driveStatus(0); |
|
519 TInt err( DriveInfo::GetDriveStatus( iFs, aData, driveStatus ) ); |
|
520 MPX_DEBUG4("Drive %d status 0x%x, err %d", aData, driveStatus, err); |
|
521 if( err == KErrNotReady ) |
|
522 { |
|
523 iDBManager->CloseDatabase( (TDriveNumber) aData ); |
|
524 iRemovedDrive = aData; |
|
525 } |
|
526 } |
|
527 #else |
|
528 iDBManager->CloseDatabase( (TDriveNumber) aData ); |
|
529 #endif // RD_MULTIPLE_DRIVE |
|
530 break; |
471 break; |
531 } |
472 } |
532 case EFormatEndEvent: |
473 case EFormatEndEvent: |
533 { |
474 { |
534 MPX_DEBUG1("Disk Format end event"); |
475 MPX_DEBUG2("Disk Format end event, drive %d", aData); |
535 CancelScan(); |
476 CancelScan(); |
536 iDBManager->OpenDatabaseL( (TDriveNumber) aData ); |
477 iDBManager->OpenDatabaseL( (TDriveNumber) aData ); |
|
478 RefreshScanDrivesL(); |
537 break; |
479 break; |
538 } |
480 } |
539 case EDiskInsertedEvent: |
481 case EDiskInsertedEvent: |
540 { |
482 { |
541 MPX_DEBUG1("Disk Insert event"); |
483 MPX_DEBUG2("Disk Insert event %d", aData); |
542 CancelScan(); |
484 CancelScan(); |
543 #ifdef RD_MULTIPLE_DRIVE |
|
544 iDBManager->OpenDatabaseL( (TDriveNumber) iRemovedDrive ); |
|
545 #else |
|
546 iDBManager->OpenDatabaseL( (TDriveNumber) aData ); |
485 iDBManager->OpenDatabaseL( (TDriveNumber) aData ); |
547 #endif // RD_MULTIPLE_DRIVE |
486 RefreshScanDrivesL(); |
548 break; |
487 break; |
549 } |
488 } |
550 case EUSBMassStorageStartEvent: |
489 case EUSBMassStorageStartEvent: |
551 { |
490 { |
552 if (iCurUSBEvent == EUSBMassStorageStartEvent) |
491 if (iCurUSBEvent == EUSBMassStorageStartEvent) |
553 { |
492 { |
554 break; |
493 break; |
555 } |
494 } |
556 iIdle->Cancel(); |
495 iIdle->Cancel(); |
|
496 iDBManager->CloseMassStorageDatabases(); |
|
497 RefreshScanDrivesL(); |
557 CancelScan(); |
498 CancelScan(); |
558 #ifdef RD_MULTIPLE_DRIVE |
|
559 // Close all databases other than the phone memory database |
|
560 for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) |
|
561 { |
|
562 if (driveList[driveNum] && (!iDBManager->IsRemoteDrive(static_cast<TDriveNumber>(driveNum)))) |
|
563 { |
|
564 if ( driveNum != EDriveC ) |
|
565 { |
|
566 iDBManager->CloseDatabase( (TDriveNumber) driveNum ); |
|
567 } |
|
568 } |
|
569 } |
|
570 #else |
|
571 iDBManager->CloseDatabase( (TDriveNumber) aData ); |
|
572 #endif // RD_MULTIPLE_DRIVE |
|
573 iCurUSBEvent = EUSBMassStorageStartEvent; |
499 iCurUSBEvent = EUSBMassStorageStartEvent; |
574 break; |
500 break; |
575 } |
501 } |
576 case EUSBMassStorageEndEvent: |
502 case EUSBMassStorageEndEvent: |
577 { |
503 { |
578 #ifdef RD_MULTIPLE_DRIVE |
504 iDBManager->OpenAllDatabasesL(); |
579 // Open all databases other than the phone memory |
505 RefreshScanDrivesL(); |
580 for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) |
|
581 { |
|
582 if (driveList[driveNum] && (!iDBManager->IsRemoteDrive(static_cast<TDriveNumber>(driveNum)))) |
|
583 { |
|
584 if ( driveNum != EDriveC ) |
|
585 { |
|
586 iDBManager->OpenDatabaseL( (TDriveNumber) driveNum ); |
|
587 } |
|
588 } |
|
589 } |
|
590 #else |
|
591 iDBManager->OpenDatabaseL( (TDriveNumber) aData ); |
|
592 #endif // RD_MULTIPLE_DRIVE |
|
593 iCurUSBEvent = EUSBMassStorageEndEvent; |
506 iCurUSBEvent = EUSBMassStorageEndEvent; |
594 break; |
507 break; |
595 } |
508 } |
596 case EUSBMTPNotActiveEvent: // deliberate fall through |
509 case EUSBMTPNotActiveEvent: |
597 { |
510 { |
598 if (iCurUSBEvent == EUSBMTPNotActiveEvent) |
511 if (iCurUSBEvent == EUSBMTPNotActiveEvent) |
599 { |
512 { |
600 break; |
513 break; |
601 } |
514 } |
610 } |
523 } |
611 case EUSBMTPStartEvent: |
524 case EUSBMTPStartEvent: |
612 { |
525 { |
613 CancelScan(); |
526 CancelScan(); |
614 iCurUSBEvent = EUSBMTPStartEvent; |
527 iCurUSBEvent = EUSBMTPStartEvent; |
615 // nothing to do, db is needed for MTP |
|
616 #ifdef __RAMDISK_PERF_ENABLE |
528 #ifdef __RAMDISK_PERF_ENABLE |
617 // if statement needed because of fall through above. |
529 iDBManager->CopyDBsToRamL(ETrue); |
618 if ( aEvent == EUSBMTPStartEvent ) |
|
619 { |
|
620 // copy dbs to ram drive |
|
621 iDBManager->CopyDBsToRamL(ETrue); |
|
622 } |
|
623 #endif //__RAMDISK_PERF_ENABLE |
530 #endif //__RAMDISK_PERF_ENABLE |
624 break; |
531 break; |
625 } |
532 } |
626 case EUSBMTPEndEvent: |
533 case EUSBMTPEndEvent: |
627 { |
534 { |
628 iCurUSBEvent = EUSBMTPEndEvent; |
535 iCurUSBEvent = EUSBMTPEndEvent; |
629 // nothing to do, db is updated by MTP |
|
630 #ifdef __RAMDISK_PERF_ENABLE |
536 #ifdef __RAMDISK_PERF_ENABLE |
631 // copy dbs from ram drive |
537 // copy dbs from ram drive |
632 iDBManager->CopyDBsFromRamL(); |
538 iDBManager->CopyDBsFromRamL(); |
633 #endif //__RAMDISK_PERF_ENABLE |
539 #endif //__RAMDISK_PERF_ENABLE |
634 break; |
540 break; |
635 } |
541 } |
636 case EDiskDismountEvent: |
542 case EDiskDismountEvent: |
637 { |
543 { |
638 MPX_DEBUG2("Disk dismount notification, drive %d", aData); |
544 MPX_DEBUG2("Disk dismount notification, drive %d", aData); |
|
545 iIdle->Cancel(); |
|
546 if ( aData < 0 ) |
|
547 { |
|
548 iDBManager->CloseMassStorageDatabases(); |
|
549 } |
|
550 else |
|
551 { |
|
552 iDBManager->CloseDatabase( (TDriveNumber) aData ); |
|
553 } |
|
554 RefreshScanDrivesL(); |
639 CancelScan(); |
555 CancelScan(); |
640 iDBManager->CloseDatabase( (TDriveNumber) aData ); |
|
641 break; |
556 break; |
642 } |
557 } |
643 default: |
558 default: |
644 { |
559 { |
645 MPX_DEBUG1("CCMPXHarvesterFileHandlerImp::HandleSystemEventL Unknown system event!"); |
560 MPX_DEBUG1("CCMPXHarvesterFileHandlerImp::HandleSystemEventL Unknown system event!"); |
928 // Re-create all databases |
843 // Re-create all databases |
929 // --------------------------------------------------------------------------- |
844 // --------------------------------------------------------------------------- |
930 // |
845 // |
931 void CMPXHarvesterFileHandlerImp::RecreateDatabases() |
846 void CMPXHarvesterFileHandlerImp::RecreateDatabases() |
932 { |
847 { |
933 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RecreateDatabasesL <--"); |
848 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RecreateDatabases <--"); |
934 iDBManager->RecreateDatabases(); |
849 iDBManager->RecreateDatabases(); |
935 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RecreateDatabasesL -->"); |
850 TRAP_IGNORE(RefreshScanDrivesL()); |
|
851 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RecreateDatabases -->"); |
936 } |
852 } |
937 |
853 |
938 // --------------------------------------------------------------------------- |
854 // --------------------------------------------------------------------------- |
939 // Close database transaction |
855 // Close database transaction |
940 // --------------------------------------------------------------------------- |
856 // --------------------------------------------------------------------------- |
1257 // Handle a change in the file system, could be a file added/removed |
1173 // Handle a change in the file system, could be a file added/removed |
1258 // --------------------------------------------------------------------------- |
1174 // --------------------------------------------------------------------------- |
1259 // |
1175 // |
1260 void CMPXHarvesterFileHandlerImp::HandleDirectoryChangedL( const TDesC& aPath ) |
1176 void CMPXHarvesterFileHandlerImp::HandleDirectoryChangedL( const TDesC& aPath ) |
1261 { |
1177 { |
|
1178 MPX_DEBUG2("--->CMPXHarvesterFileHandlerImp::HandleDirectoryChangedL path=%S", &aPath); |
1262 // Delay the scanning for a few seconds so the files are finished |
1179 // Delay the scanning for a few seconds so the files are finished |
1263 // copying. If already active, means we just append onto the list |
1180 // copying. If already active, means we just append onto the list |
1264 // |
1181 // But don't scan if there is no DB == drive does not exist any more |
1265 iAutoScanPaths.AppendL( aPath ); |
1182 TParsePtrC parse( aPath ); |
1266 if( !iIdle->IsActive() ) |
1183 TDriveUnit drive ( parse.Drive() ); |
1267 { |
1184 if ( iDBManager->DatabaseIsOpen ((TDriveNumber) (TInt) drive) ) |
1268 TCallBack cb( Callback, this ); |
1185 { |
1269 iIdle->Start( TTimeIntervalMicroSeconds32( KAutoScanDelay ), |
1186 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleDirectoryChangedL adding in iAutoScanPaths"); |
1270 TTimeIntervalMicroSeconds32( KAutoScanAfter ), |
1187 iAutoScanPaths.AppendL( aPath ); |
1271 cb ); |
1188 if( !iIdle->IsActive() ) |
1272 } |
1189 { |
1273 |
1190 TCallBack cb( Callback, this ); |
|
1191 iIdle->Start( TTimeIntervalMicroSeconds32( KAutoScanDelay ), |
|
1192 TTimeIntervalMicroSeconds32( KAutoScanAfter ), |
|
1193 cb ); |
|
1194 } |
|
1195 } |
1274 } |
1196 } |
1275 |
1197 |
1276 // --------------------------------------------------------------------------- |
1198 // --------------------------------------------------------------------------- |
1277 // Handles opening the drive |
1199 // Handles opening the drive |
1278 // --------------------------------------------------------------------------- |
1200 // --------------------------------------------------------------------------- |
1279 // |
1201 // |
1280 void CMPXHarvesterFileHandlerImp::HandleOpenDriveL( TDriveNumber aDrive, |
1202 void CMPXHarvesterFileHandlerImp::HandleOpenDriveL( TDriveNumber aDrive, |
1281 const TDesC& aFolder ) |
1203 const TDesC& aFolder ) |
1282 { |
1204 { |
|
1205 MPX_DEBUG3("--->CMPXHarvesterFileHandlerImp::HandleOpenDriveL drive=%d, folder=%S", aDrive, &aFolder); |
1283 #ifdef __PRINTDB__ |
1206 #ifdef __PRINTDB__ |
1284 if( iCurTable ) |
1207 if( iCurTable ) |
1285 iCurTable->PrintItemsInTableL(); |
1208 iCurTable->PrintItemsInTableL(); |
1286 #endif //__PRINTDB__ |
1209 #endif //__PRINTDB__ |
1287 |
1210 |
1292 Reset(); |
1215 Reset(); |
1293 #ifdef __RAMDISK_PERF_ENABLE |
1216 #ifdef __RAMDISK_PERF_ENABLE |
1294 // EnsureRamSpaceL will copy dbs from ram if ram space is low or dbs exceeded max space. |
1217 // EnsureRamSpaceL will copy dbs from ram if ram space is low or dbs exceeded max space. |
1295 iDBManager->EnsureRamSpaceL(); |
1218 iDBManager->EnsureRamSpaceL(); |
1296 #endif // __RAMDISK_PERF_ENABLE |
1219 #endif // __RAMDISK_PERF_ENABLE |
1297 MPX_TRAPD( err, iCurDB = &iDBManager->GetDatabaseL( aDrive ) ); |
1220 iCurDB = &iDBManager->GetDatabaseL( aDrive ); |
1298 if ( err != KErrNone ) |
|
1299 { |
|
1300 iDBManager->OpenAllDatabasesL(); |
|
1301 iCurDB = &iDBManager->GetDatabaseL( aDrive ); |
|
1302 } |
|
1303 |
|
1304 if( iDrivesToScan.Find( aFolder ) != KErrNotFound ) |
1221 if( iDrivesToScan.Find( aFolder ) != KErrNotFound ) |
1305 { |
1222 { |
1306 iCurTable = iCurDB->OpenAllFilesTableL(); |
1223 iCurTable = iCurDB->OpenAllFilesTableL(); |
1307 } |
1224 } |
1308 else |
1225 else |
1309 { |
1226 { |
1310 iCurTable = iCurDB->OpenDirectoryL( aFolder ); |
1227 iCurTable = iCurDB->OpenDirectoryL( aFolder ); |
1311 } |
1228 } |
1312 iCurList = iCurTable->CreateTableRepresentationL(); |
1229 iCurList = iCurTable->CreateTableRepresentationL(); |
|
1230 MPX_DEBUG1("<--CMPXHarvesterFileHandlerImp::HandleOpenDriveL"); |
1313 } |
1231 } |
1314 |
1232 |
1315 // --------------------------------------------------------------------------- |
1233 // --------------------------------------------------------------------------- |
1316 // Is this a media file we are interested in |
1234 // Is this a media file we are interested in |
1317 // --------------------------------------------------------------------------- |
1235 // --------------------------------------------------------------------------- |
1899 monitor->StartL( array->MdcaPoint(i) ); |
1817 monitor->StartL( array->MdcaPoint(i) ); |
1900 } |
1818 } |
1901 CleanupStack::PopAndDestroy( array ); |
1819 CleanupStack::PopAndDestroy( array ); |
1902 } |
1820 } |
1903 |
1821 |
|
1822 // --------------------------------------------------------------------------- |
|
1823 // Refreshes scan drives |
|
1824 // --------------------------------------------------------------------------- |
|
1825 // |
|
1826 void CMPXHarvesterFileHandlerImp::RefreshScanDrivesL() |
|
1827 { |
|
1828 iDrivesToScan.Reset(); |
|
1829 for (TInt i = 0; i < iConfiguredDrivesToScan.Count(); ++i) |
|
1830 { |
|
1831 const TDesC& path = iConfiguredDrivesToScan[i]; |
|
1832 TParsePtrC parse(path); |
|
1833 TDriveUnit drive(parse.Drive()); |
|
1834 if ( iDBManager->DatabaseIsOpen( (TDriveNumber)(TInt) drive) ) |
|
1835 { |
|
1836 iDrivesToScan.AppendL(path); |
|
1837 } |
|
1838 } |
|
1839 } |
|
1840 |
1904 // --------------------------------------------------------------------------- |
1841 // --------------------------------------------------------------------------- |
1905 // Resets the scanning table and array |
1842 // Resets the scanning table and array |
1906 // --------------------------------------------------------------------------- |
1843 // --------------------------------------------------------------------------- |
1907 // |
1844 // |
1908 void CMPXHarvesterFileHandlerImp::Reset() |
1845 void CMPXHarvesterFileHandlerImp::Reset() |
2345 CleanupStack::PopAndDestroy( tempList ); |
2310 CleanupStack::PopAndDestroy( tempList ); |
2346 CleanupStack::PopAndDestroy( table ); |
2311 CleanupStack::PopAndDestroy( table ); |
2347 } |
2312 } |
2348 } |
2313 } |
2349 } |
2314 } |
2350 #else |
|
2351 //ensure drive E is ready |
|
2352 //otherwise GetDataBaseL will leave if MMC is removed |
|
2353 if ( IsDriveReady( EDriveE ) ) |
|
2354 { |
|
2355 // Get DRM files from database in E drive |
|
2356 db = &iDBManager->GetDatabaseL( EDriveE ); |
|
2357 table = db->OpenDrmFileL(); |
|
2358 CleanupStack::PushL( table ); |
|
2359 tempList = table->CreateTableRepresentationL(); |
|
2360 CleanupStack::PushL( tempList ); |
|
2361 // copy content to drm file list |
|
2362 for ( TInt i=0; i<tempList->Count(); i++ ) |
|
2363 { |
|
2364 drmFileList->AppendL( (*tempList)[i] ); |
|
2365 } |
|
2366 // reset |
|
2367 tempList->Reset(); |
|
2368 CleanupStack::PopAndDestroy( tempList ); |
|
2369 CleanupStack::PopAndDestroy( table ); |
|
2370 } |
|
2371 |
|
2372 // Get DRM files from database in C drive |
|
2373 db = &iDBManager->GetDatabaseL( EDriveC ); |
|
2374 table = db->OpenDrmFileL(); |
|
2375 CleanupStack::PushL( table ); |
|
2376 tempList = table->CreateTableRepresentationL(); |
|
2377 CleanupStack::PushL( tempList ); |
|
2378 // copy content to iCurList |
|
2379 for ( TInt i=0; i<tempList->Count(); i++ ) |
|
2380 { |
|
2381 drmFileList->AppendL( (*tempList)[i] ); |
|
2382 } |
|
2383 tempList->Reset(); |
|
2384 CleanupStack::PopAndDestroy( tempList ); |
|
2385 CleanupStack::PopAndDestroy( table ); |
|
2386 #endif |
|
2387 CleanupStack::Pop( drmFileList ); |
2315 CleanupStack::Pop( drmFileList ); |
2388 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetDrmFiles --->"); |
2316 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetDrmFiles --->"); |
2389 return drmFileList; |
2317 return drmFileList; |
2390 } |
2318 } |
2391 |
2319 |
2392 // --------------------------------------------------------------------------- |
|
2393 // Verifies if aDrive is ready. |
|
2394 // --------------------------------------------------------------------------- |
|
2395 // |
|
2396 TBool CMPXHarvesterFileHandlerImp::IsDriveReady( TDriveNumber aDrive ) |
|
2397 { |
|
2398 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::IsDriveReady <---"); |
|
2399 |
|
2400 TDriveInfo driveInfo; |
|
2401 TInt error = iFs.Drive( driveInfo, aDrive ); |
|
2402 TBool ready = ETrue; |
|
2403 if ( error != KErrNone ) |
|
2404 { |
|
2405 ready = EFalse; |
|
2406 } |
|
2407 else if ( driveInfo.iDriveAtt == static_cast<TUint>( KDriveAbsent ) ) |
|
2408 { |
|
2409 //aDrive is absent |
|
2410 ready = EFalse; |
|
2411 } |
|
2412 else |
|
2413 { |
|
2414 TVolumeInfo volumeInfo; |
|
2415 TInt errCode = iFs.Volume( volumeInfo, aDrive ); |
|
2416 if( errCode != KErrNone ) |
|
2417 { |
|
2418 //aDrive is ready for use |
|
2419 ready = EFalse; |
|
2420 } |
|
2421 } |
|
2422 |
|
2423 MPX_DEBUG1("CMPXHarvesterFileHandlerImp::IsDriveReady --->"); |
|
2424 return ready; |
|
2425 } |
|
2426 |
|
2427 // END OF FILE |
2320 // END OF FILE |