equal
deleted
inserted
replaced
36 #include "mpxharvestercommon.h" |
36 #include "mpxharvestercommon.h" |
37 #include "mpxharvesterengine.h" |
37 #include "mpxharvesterengine.h" |
38 #include "mpxfsformatmonitor.h" |
38 #include "mpxfsformatmonitor.h" |
39 #include "mpxmediaremovalmonitor.h" |
39 #include "mpxmediaremovalmonitor.h" |
40 #include "mpxusbeventhandler.h" |
40 #include "mpxusbeventhandler.h" |
41 #include "mpxmmcejectmonitor.h" |
|
42 #include "mpxharvesterfilehandler.h" |
41 #include "mpxharvesterfilehandler.h" |
43 #include "mpxharvesterengineobserver.h" |
42 #include "mpxharvesterengineobserver.h" |
44 #include "mpxhvsmsg.h" |
43 #include "mpxhvsmsg.h" |
45 |
44 |
46 // ======== MEMBER FUNCTIONS ======== |
45 // ======== MEMBER FUNCTIONS ======== |
62 MPX_DEBUG1("CMPXHarvesterEngine::~CMPXHarvesterEngine <---"); |
61 MPX_DEBUG1("CMPXHarvesterEngine::~CMPXHarvesterEngine <---"); |
63 |
62 |
64 delete iFormatMonitor; |
63 delete iFormatMonitor; |
65 delete iMediaRemovalMonitor; |
64 delete iMediaRemovalMonitor; |
66 delete iUSBMonitor; |
65 delete iUSBMonitor; |
67 delete iMMCMonitor; |
|
68 |
66 |
69 delete iFileHandler; |
67 delete iFileHandler; |
70 iFsSession.Close(); |
68 iFsSession.Close(); |
71 |
69 |
72 if( iTaskQueue ) |
70 if( iTaskQueue ) |
108 removableDrive, iFsSession, *this ); |
106 removableDrive, iFsSession, *this ); |
109 |
107 |
110 // USB Event monitor |
108 // USB Event monitor |
111 iUSBMonitor = CMPXUsbEventHandler::NewL( *this ); |
109 iUSBMonitor = CMPXUsbEventHandler::NewL( *this ); |
112 |
110 |
113 // MMC Event handling |
|
114 iMMCMonitor = CMPXMMCEjectMonitor::NewL( *this ); |
|
115 |
111 |
116 // File handler to handle file related events |
112 // File handler to handle file related events |
117 iFileHandler = CMPXHarvesterFileHandler::NewL( iFsSession ); |
113 iFileHandler = CMPXHarvesterFileHandler::NewL( iFsSession ); |
118 |
114 |
119 // Active task queue for async requests |
115 // Active task queue for async requests |
453 // Avoid Message queue already exist problem |
449 // Avoid Message queue already exist problem |
454 // |
450 // |
455 TBool notify(ETrue); |
451 TBool notify(ETrue); |
456 switch( aEvent ) |
452 switch( aEvent ) |
457 { |
453 { |
458 case EPowerKeyEjectEvent: |
454 case EDiskDismountEvent: |
459 { |
455 { |
460 notify=EFalse; |
456 notify=EFalse; |
461 TRAP_IGNORE( DoStopPlaybackL() ); |
457 TRAP_IGNORE( DoStopPlaybackL() ); |
462 break; |
458 break; |
463 } |
459 } |
468 case EDiskRemovedEvent: // deliberate fall through |
464 case EDiskRemovedEvent: // deliberate fall through |
469 { |
465 { |
470 iDiskOpActive = ETrue; |
466 iDiskOpActive = ETrue; |
471 TRAP_IGNORE( DoStopPlaybackL() ); |
467 TRAP_IGNORE( DoStopPlaybackL() ); |
472 } |
468 } |
473 default: //lint !e616 !e825 |
|
474 if( !iTempCollectionUtil ) |
|
475 { |
|
476 iTempCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMcModeDefault ); |
|
477 } |
|
478 break; |
469 break; |
479 } |
470 } |
480 |
471 |
481 // Send a message to the collection server about the event |
472 // Send a message to the collection server about the event |
482 // |
473 // |
|
474 if( !iTempCollectionUtil ) |
|
475 { |
|
476 iTempCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMcModeDefault ); |
|
477 } |
483 if( notify ) |
478 if( notify ) |
484 { |
479 { |
485 TRAP_IGNORE( |
480 TRAP_IGNORE( |
486 iTempCollectionUtil->Collection().NotifyL( (TMPXCollectionBroadCastMsg)aEvent, |
481 iTempCollectionUtil->Collection().NotifyL( (TMPXCollectionBroadCastMsg)aEvent, |
487 aData ) |
482 aData ) |
488 ); |
483 ); |
489 } |
484 } |
|
485 else if ( aEvent == EDiskDismountEvent ) |
|
486 { |
|
487 TRAP_IGNORE |
|
488 ( |
|
489 iTempCollectionUtil->Collection().CommandL ( EMcCloseCollection, aData ) |
|
490 ); |
|
491 } |
490 |
492 |
491 // Avoid Message queue already exist problem |
493 // Avoid Message queue already exist problem |
492 // |
494 // |
493 switch( aEvent ) |
495 switch( aEvent ) |
494 { |
496 { |
512 { |
514 { |
513 iTempCollectionUtil->Close(); |
515 iTempCollectionUtil->Close(); |
514 iTempCollectionUtil = NULL; |
516 iTempCollectionUtil = NULL; |
515 } |
517 } |
516 } |
518 } |
|
519 |
|
520 if ( aEvent == EUSBMassStorageEndEvent ) |
|
521 { |
|
522 // In some cases visit to USB Mass Storage mode can be so brief |
|
523 // that drives are actually not dismounted at all even though we |
|
524 // get a NotifyDismount event. In such cases we need to re-issue |
|
525 // the NotifyDismount requests. |
|
526 iMediaRemovalMonitor->CheckDriveStatus(); |
|
527 } |
517 } |
528 } |
518 |
529 |
519 // --------------------------------------------------------------------------- |
530 // --------------------------------------------------------------------------- |
520 // Execute task queue events |
531 // Execute task queue events |
521 // --------------------------------------------------------------------------- |
532 // --------------------------------------------------------------------------- |