equal
deleted
inserted
replaced
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <e32std.h> |
19 #include <e32std.h> |
20 #ifdef RD_MULTIPLE_DRIVE |
|
21 #include <driveinfo.h> |
20 #include <driveinfo.h> |
22 #endif //RD_MULTIPLE_DRIVE |
|
23 #include <mpxlog.h> |
21 #include <mpxlog.h> |
24 #include <mpxmedia.h> |
22 #include <mpxmedia.h> |
25 #include <mpxcollectionutility.h> |
23 #include <mpxcollectionutility.h> |
26 #include <mpxcollectionmessage.h> |
24 #include <mpxcollectionmessage.h> |
27 #include <mpxtaskqueue.h> |
25 #include <mpxtaskqueue.h> |
95 // Format handler for Removable Drive |
93 // Format handler for Removable Drive |
96 iFormatMonitor = CMPXFsFormatMonitor::NewL( *this ); |
94 iFormatMonitor = CMPXFsFormatMonitor::NewL( *this ); |
97 |
95 |
98 // MMC Removal monitor for Removable Drive |
96 // MMC Removal monitor for Removable Drive |
99 TInt removableDrive( EDriveE ); |
97 TInt removableDrive( EDriveE ); |
100 #ifdef RD_MULTIPLE_DRIVE |
|
101 User::LeaveIfError( DriveInfo::GetDefaultDrive( |
98 User::LeaveIfError( DriveInfo::GetDefaultDrive( |
102 DriveInfo::EDefaultRemovableMassStorage, |
99 DriveInfo::EDefaultRemovableMassStorage, |
103 removableDrive ) ); |
100 removableDrive ) ); |
104 #endif // RD_MULTIPLE_DRIVE |
|
105 iMediaRemovalMonitor = CMPXMediaRemovalMonitor::NewL( |
101 iMediaRemovalMonitor = CMPXMediaRemovalMonitor::NewL( |
106 removableDrive, iFsSession, *this ); |
102 removableDrive, iFsSession, *this ); |
107 |
103 |
108 // USB Event monitor |
104 // USB Event monitor |
109 iUSBMonitor = CMPXUsbEventHandler::NewL( *this ); |
105 iUSBMonitor = CMPXUsbEventHandler::NewL( *this ); |
439 // |
435 // |
440 void CMPXHarvesterEngine::HandleSystemEventL( TSystemEvent aEvent, |
436 void CMPXHarvesterEngine::HandleSystemEventL( TSystemEvent aEvent, |
441 TInt aData ) |
437 TInt aData ) |
442 { |
438 { |
443 MPX_DEBUG2("CMPXHarvesterEngine::HandleSystemEventL %i <---", aEvent); |
439 MPX_DEBUG2("CMPXHarvesterEngine::HandleSystemEventL %i <---", aEvent); |
|
440 |
|
441 if( !iTempCollectionUtil ) |
|
442 { |
|
443 iTempCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMcModeDefault ); |
|
444 } |
|
445 |
|
446 // Must close collections ASAP in case drives may dismount soon |
|
447 TRAP_IGNORE( |
|
448 if (aEvent == EUSBMassStorageStartEvent) |
|
449 { |
|
450 DoStopPlaybackL(); |
|
451 iTempCollectionUtil->Collection().CommandL ( EMcCloseCollection, -1 ); |
|
452 iFileHandler->HandleSystemEventL ( EDiskDismountEvent, -1 ); |
|
453 } |
|
454 else if ( aEvent == EDiskDismountEvent ) |
|
455 { |
|
456 DoStopPlaybackL(); |
|
457 iTempCollectionUtil->Collection().CommandL ( EMcCloseCollection, aData ); |
|
458 } |
|
459 ); |
444 |
460 |
445 // The engine is a delegator, it sends the events to |
461 // The engine is a delegator, it sends the events to |
446 // different classes to do the actual work |
462 // different classes to do the actual work |
447 TRAPD( openErr, iFileHandler->HandleSystemEventL( aEvent, aData ) ); |
463 TRAPD( openErr, iFileHandler->HandleSystemEventL( aEvent, aData ) ); |
448 |
464 |
452 switch( aEvent ) |
468 switch( aEvent ) |
453 { |
469 { |
454 case EDiskDismountEvent: |
470 case EDiskDismountEvent: |
455 { |
471 { |
456 notify=EFalse; |
472 notify=EFalse; |
457 TRAP_IGNORE( DoStopPlaybackL() ); |
|
458 break; |
473 break; |
459 } |
474 } |
|
475 case EUSBMassStorageStartEvent: |
|
476 { |
|
477 iDiskOpActive = ETrue; |
|
478 } |
|
479 break; |
460 case EFormatStartEvent: |
480 case EFormatStartEvent: |
461 case EUSBMassStorageStartEvent: // deliberate fall through |
|
462 case EUSBMTPStartEvent: // deliberate fall through |
481 case EUSBMTPStartEvent: // deliberate fall through |
463 case EDiskInsertedEvent: // deliberate fall through |
482 case EDiskInsertedEvent: // deliberate fall through |
464 case EDiskRemovedEvent: // deliberate fall through |
483 case EDiskRemovedEvent: // deliberate fall through |
465 { |
484 { |
466 iDiskOpActive = ETrue; |
485 iDiskOpActive = ETrue; |
469 break; |
488 break; |
470 } |
489 } |
471 |
490 |
472 // Send a message to the collection server about the event |
491 // Send a message to the collection server about the event |
473 // |
492 // |
474 if( !iTempCollectionUtil ) |
|
475 { |
|
476 iTempCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMcModeDefault ); |
|
477 } |
|
478 if( notify ) |
493 if( notify ) |
479 { |
494 { |
480 TRAP_IGNORE( |
495 TRAP_IGNORE( |
481 iTempCollectionUtil->Collection().NotifyL( (TMPXCollectionBroadCastMsg)aEvent, |
496 iTempCollectionUtil->Collection().NotifyL( (TMPXCollectionBroadCastMsg)aEvent, |
482 aData ) |
497 aData ) |
483 ); |
498 ); |
484 } |
499 } |
485 else if ( aEvent == EDiskDismountEvent ) |
|
486 { |
|
487 TRAP_IGNORE |
|
488 ( |
|
489 iTempCollectionUtil->Collection().CommandL ( EMcCloseCollection, aData ) |
|
490 ); |
|
491 } |
|
492 |
500 |
493 // Avoid Message queue already exist problem |
501 // Avoid Message queue already exist problem |
494 // |
502 // |
495 switch( aEvent ) |
503 switch( aEvent ) |
496 { |
504 { |