harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp
branchRCL_3
changeset 7 3cebc1a84278
parent 6 646a02f170b9
child 12 9f21bab39f42
equal deleted inserted replaced
6:646a02f170b9 7:3cebc1a84278
   110     TChar driveLetter( 0 );
   110     TChar driveLetter( 0 );
   111 	TBool presentState( EFalse );
   111 	TBool presentState( EFalse );
   112     
   112     
   113 	TUint32 hdMediaId( 0 );
   113 	TUint32 hdMediaId( 0 );
   114     hdMediaId = iMountTask->GetInternalDriveMediaId();
   114     hdMediaId = iMountTask->GetInternalDriveMediaId();
   115     TBool alreadyWaited( EFalse );
       
   116     
   115     
   117     const TInt count( medias.Count() );
   116     const TInt count( medias.Count() );
   118     for ( TInt i = 0; i < count; i++ )
   117     for ( TInt i = 0; i < count; i++ )
   119     	{
   118     	{
   120     	TRAP_IGNORE( iMdEClient->GetMediaL( medias[i].iMediaId, driveLetter, presentState ) );
   119     	TRAP_IGNORE( iMdEClient->GetMediaL( medias[i].iMediaId, driveLetter, presentState ) );
   128     	        iMmcScanner->Cancel();
   127     	        iMmcScanner->Cancel();
   129     	        delete iMmcScanner;
   128     	        delete iMmcScanner;
   130     	        iMmcScanner = NULL;
   129     	        iMmcScanner = NULL;
   131     	        }
   130     	        }
   132     		TRAP_IGNORE( iMmcScanner = CMmcScannerAO::NewL( medias[i].iMediaId, iMdEClient, iObserver,
   131     		TRAP_IGNORE( iMmcScanner = CMmcScannerAO::NewL( medias[i].iMediaId, iMdEClient, iObserver,
   133     		    				aHarvesterPluginFactory, CActive::EPriorityHigh, alreadyWaited ) );
   132     		    				aHarvesterPluginFactory, CActive::EPriorityUserInput ) );
   134     		alreadyWaited = ETrue;
       
   135     		}
   133     		}
   136     	}
   134     	}
   137  
   135  
   138     if( hdMediaId == 0 )
   136     if( hdMediaId == 0 )
   139         {
   137         {
   155 			hdInfo.iMediaId = hdMediaId;
   153 			hdInfo.iMediaId = hdMediaId;
   156 			hdInfo.iDrive = driveLetter;
   154 			hdInfo.iDrive = driveLetter;
   157 			medias.Append( hdInfo );
   155 			medias.Append( hdInfo );
   158 			
   156 			
   159 			TRAP_IGNORE( iHddScanner = CMmcScannerAO::NewL( hdMediaId, iMdEClient, iObserver,
   157 			TRAP_IGNORE( iHddScanner = CMmcScannerAO::NewL( hdMediaId, iMdEClient, iObserver,
   160 			    				aHarvesterPluginFactory, KHarvesterCustomImportantPriority, alreadyWaited ));
   158 			    				aHarvesterPluginFactory, KHarvesterCustomImportantPriority ));
   161 			}
   159 			}
   162 		}
   160 		}
   163 
   161 
   164     iMMCMonitor->StartMonitoring( *this, medias );
   162     iMMCMonitor->StartMonitoring( *this, medias );
   165     
   163     
   249         {
   247         {
   250         case EMounted:
   248         case EMounted:
   251             {
   249             {
   252             WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EMounted" );
   250             WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EMounted" );
   253             mountData->iMountType = TMountData::EMount;
   251             mountData->iMountType = TMountData::EMount;
   254             if( !iMountTask->IsActive() )
       
   255                 {
       
   256                 iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
       
   257                 }
       
   258             iMountTask->StartMount( *mountData );
   252             iMountTask->StartMount( *mountData );
   259             }
   253             }
   260         break;
   254         break;
   261         
   255         
   262         case EDismounted:
   256         case EDismounted:
   267             	}
   261             	}
   268             if( mountData->iMediaID )
   262             if( mountData->iMediaID )
   269             	{
   263             	{
   270 	            WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EDismounted" );
   264 	            WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EDismounted" );
   271 	            mountData->iMountType = TMountData::EUnmount;
   265 	            mountData->iMountType = TMountData::EUnmount;
   272 	            if( !iMountTask->IsActive() )
       
   273 	                {
       
   274 	                iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
       
   275 	                }
       
   276 	            iMountTask->StartUnmount( *mountData );
   266 	            iMountTask->StartUnmount( *mountData );
   277             	}
   267             	}
   278             }
   268             }
   279         break;
   269         break;
   280         
   270         
   281         case EFormatted:
   271         case EFormatted:
   282             {
   272             {
   283             WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EFormatted" );
   273             WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EFormatted" );
   284             mountData->iMountType = TMountData::EFormat;
   274             mountData->iMountType = TMountData::EFormat;
   285             if( !iMountTask->IsActive() )
       
   286                 {
       
   287                 iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
       
   288                 }
       
   289             iMountTask->StartUnmount( *mountData );
   275             iMountTask->StartUnmount( *mountData );
   290             }
   276             }
   291         break;
   277         break;
   292         
   278         
   293         default:
   279         default:
   294             {
   280             {
       
   281 #ifdef _DEBUG
   295             _LIT( KLogPanic, "unknown state" );
   282             _LIT( KLogPanic, "unknown state" );
   296             User::Panic( KLogPanic, KErrArgument );
   283             User::Panic( KLogPanic, KErrArgument );
       
   284 #endif
   297             }
   285             }
   298         break;
   286         break;
   299         }
   287         }
   300     }
   288     }
   301 
   289