harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp
changeset 1 acef663c1218
parent 0 c53acadfccc6
child 2 b73a2e62868f
equal deleted inserted replaced
0:c53acadfccc6 1:acef663c1218
   232                 iHEM->DecreaseItemCountL( EHEObserverTypeMMC, harvestEntryCount );
   232                 iHEM->DecreaseItemCountL( EHEObserverTypeMMC, harvestEntryCount );
   233                 }
   233                 }
   234 			
   234 			
   235 			RMsgQueue<TInt> unmountQueue;
   235 			RMsgQueue<TInt> unmountQueue;
   236 			_LIT( KUnmountHandlerAOString, "unmounthandlerao" );
   236 			_LIT( KUnmountHandlerAOString, "unmounthandlerao" );
   237 			TInt err = unmountQueue.OpenGlobal( KUnmountHandlerAOString );
   237 			const TInt err = unmountQueue.OpenGlobal( KUnmountHandlerAOString );
   238 			if( err == KErrNone )
   238 			if( err == KErrNone )
   239 				{
   239 				{
   240 				unmountQueue.Send( iMountData->iMediaID );
   240 				unmountQueue.Send( iMountData->iMediaID );
   241 				}
   241 				}
   242 			
   242 			
   279 						}
   279 						}
   280 					Deinitialize();
   280 					Deinitialize();
   281 					SetNextRequest( ERequestStartTask );
   281 					SetNextRequest( ERequestStartTask );
   282 					break;
   282 					break;
   283 					}
   283 					}
       
   284 				
       
   285 	            if ( iEntryArray.Count() > 0 )
       
   286 	                {
       
   287 	                SetNextRequest( ERequestHandleFileEntry );
       
   288 	                break;
       
   289 	                }
       
   290 				}
       
   291 			
       
   292 		    if ( iHarvestEntryArray.Count() > 0 )
       
   293 				{
       
   294 				SetNextRequest( ERequestHandleReharvest );
       
   295 				break;
   284 				}
   296 				}
   285 			else
   297 			else
   286 				{
   298 				{
   287 				RemoveNotPresentFromMDE();
   299                 // All detected entries are set as present at this stage, clear not present entries
   288 				SetNextRequest( ERequestCleanup );
   300                 RemoveNotPresentFromMDE();
   289 				break;
   301                 SetNextRequest( ERequestCleanup );
   290 				}
   302                 break;
   291 				
       
   292 			if ( iHarvestEntryArray.Count() > 0 )
       
   293 				{
       
   294 				SetNextRequest( ERequestHandleReharvest );
       
   295 				}
       
   296 			else
       
   297 				{
       
   298 				SetNextRequest( ERequestHandleFileEntry );
       
   299 				}
   303 				}
   300 			}
   304 			}
   301 		break;
   305 		break;
   302 		
   306 		
   303 		case ERequestHandleReharvest:
   307 		case ERequestHandleReharvest:
   428 		
   432 		
   429 		hdArray.Append( hd );
   433 		hdArray.Append( hd );
   430 		aArray.Remove( 0 );
   434 		aArray.Remove( 0 );
   431 		}
   435 		}
   432 	
   436 	
   433 	aArray.Compress();
   437     if( aArray.Count() == 0 )
       
   438         {
       
   439         aArray.Compress();
       
   440         }
   434 			
   441 			
   435 	if ( iObserver )
   442 	if ( iObserver )
   436 		{
   443 		{
   437 		if( hdArray.Count() > 0)
   444 		if( hdArray.Count() > 0)
   438 			{
   445 			{
   471 	}
   478 	}
   472 	
   479 	
   473 void CMMCMountTaskAO::Initialize()
   480 void CMMCMountTaskAO::Initialize()
   474 	{
   481 	{
   475 	WRITELOG( "CMMCMountTaskAO::Initialize" );
   482 	WRITELOG( "CMMCMountTaskAO::Initialize" );
   476 	iEntryArray.Reset();
   483     iEntryArray.ResetAndDestroy();
   477 	iHarvestEntryArray.Reset();
   484     iHarvestEntryArray.ResetAndDestroy();
   478 	}
   485 	}
   479 	
   486 	
   480 void CMMCMountTaskAO::Deinitialize()
   487 void CMMCMountTaskAO::Deinitialize()
   481 	{
   488 	{
   482 	WRITELOG( "CMMCMountTaskAO::Deinitialize" );
   489 	WRITELOG( "CMMCMountTaskAO::Deinitialize" );
   509 	    
   516 	    
   510 	TDriveInfo driveInfo;
   517 	TDriveInfo driveInfo;
   511 	TDriveList driveList;
   518 	TDriveList driveList;
   512     TInt numOfElements( 0 );
   519     TInt numOfElements( 0 );
   513 
   520 
   514     TInt err = DriveInfo::GetUserVisibleDrives( 
   521     const TInt err = DriveInfo::GetUserVisibleDrives( 
   515     		iFs, driveList, numOfElements, 
   522     		iFs, driveList, numOfElements, 
   516     		KDriveAttExclude | KDriveAttRemote | KDriveAttRom );
   523     		KDriveAttExclude | KDriveAttRemote | KDriveAttRom );
   517     if( err != KErrNone )
   524     if( err != KErrNone )
   518     	{
   525     	{
   519     	return 0;
   526     	return 0;
   529 	    	iFs.Drive( driveInfo, i );
   536 	    	iFs.Drive( driveInfo, i );
   530 	        if ( driveInfo.iType == EMediaHardDisk )
   537 	        if ( driveInfo.iType == EMediaHardDisk )
   531 	        	{
   538 	        	{
   532 	        	// check if disk is internal
   539 	        	// check if disk is internal
   533 	        	TUint driveStatus;
   540 	        	TUint driveStatus;
   534 	        	TInt err = DriveInfo::GetDriveStatus( iFs, i, driveStatus );
   541 	        	const TInt err = DriveInfo::GetDriveStatus( iFs, i, driveStatus );
   535 	        	if ( (err == KErrNone ) && ( driveStatus & DriveInfo::EDriveInternal ) )
   542 	        	if ( (err == KErrNone ) && ( driveStatus & DriveInfo::EDriveInternal ) )
   536 	        		{
   543 	        		{
   537 	        		// get media id
   544 	        		// get media id
   538 	        		hdMediaId = FSUtil::MediaID( iFs, i );
   545 	        		hdMediaId = FSUtil::MediaID( iFs, i );
   539 	        		break;
   546 	        		break;