harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp
branchRCL_3
changeset 50 85f623e1ef41
parent 49 f23c07ec56e2
child 53 29d87345eaeb
--- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp	Tue Aug 31 15:37:30 2010 +0300
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp	Wed Sep 01 12:24:24 2010 +0100
@@ -116,8 +116,7 @@
 	TBool presentState( EFalse );
     
 	TUint32 hdMediaId( 0 );
-	TBool hdPresent( EFalse );
-    hdMediaId = iMountTask->GetInternalDriveMediaId( hdPresent );
+    hdMediaId = iMountTask->GetInternalDriveMediaId();
     
     for( TInt i = medias.Count() - 1; i >=0; i-- )
     	{
@@ -138,10 +137,10 @@
     		}
     	}
  
-    if( hdMediaId == 0 || !hdPresent )
+    if( hdMediaId == 0 )
         {
         // Try to fetch internall mass storage media id again if it was not mounted
-        hdMediaId = iMountTask->GetInternalDriveMediaId( hdPresent );
+        hdMediaId = iMountTask->GetInternalDriveMediaId();
         }
     
     // scan mass storage to catch all chances even if battery dies during operation that should  be catched
@@ -150,7 +149,7 @@
 		TBool exists( EFalse );
 		TRAP_IGNORE( exists= iMdEClient->GetMediaL( hdMediaId, driveLetter, presentState ) );
 		
-		if ( exists && hdPresent )
+		if ( exists )
 			{
 			WRITELOG("CMMCMonitorPlugin::StartMonitoring - start mass storage scan");
 			
@@ -268,39 +267,33 @@
                 if( internalMassStorageError == KErrNone )
                     {
                     const TUint32 massStorageMediaId( internalMassStorageVolumeInfo.iUniqueID );
-                    if( massStorageMediaId == aMediaID &&
-                        massStorageMediaId != 0 )
+                    TUint32 mmcMediaId( 0 );
+                    TInt mmcError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ) );
+                    if( mmcError == KErrNone )
                         {
-                        TUint32 mmcMediaId( 0 );
-                        TInt mmcDrive( -1 );
-                        TInt mmcError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, mmcDrive ) );
+                        TVolumeInfo mmcVolumeInfo;
+                        mmcError = iFs.Volume( mmcVolumeInfo, drive );
                         if( mmcError == KErrNone )
                             {
-                            if( drive != mmcDrive )
-                                {
-                                TVolumeInfo mmcVolumeInfo;
-                                mmcError = iFs.Volume( mmcVolumeInfo, mmcDrive );
-                                if( mmcError == KErrNone )
-                                    {
-                                    mmcMediaId = mmcVolumeInfo.iUniqueID;
-                                    }                        
-                                }
-                            else
-                                {
-                                mmcMediaId = massStorageMediaId;
-                                }
+                            mmcMediaId = mmcVolumeInfo.iUniqueID;
                             }
+                        }
                     
-                        // If removable storage is not found, assume internal mass storage was mounted
-                        if( mmcError )
-                            {
-                            iMdEClient->CheckMassStorageMediaId( massStorageMediaId );              
-                            }
-                        else if( massStorageMediaId != mmcMediaId )
+                    // If removable storage is not found, assume internal mass storage was mounted
+                    if( mmcError )
+                        {
+                        if( massStorageMediaId != 0 && 
+                            massStorageMediaId == aMediaID )
                             {
                             iMdEClient->CheckMassStorageMediaId( massStorageMediaId );
-                            }          
-                        }                    
+                            }                    
+                        }
+                    else if( massStorageMediaId != mmcMediaId && 
+                                massStorageMediaId != 0 && 
+                                massStorageMediaId == aMediaID )
+                        {
+                        iMdEClient->CheckMassStorageMediaId( massStorageMediaId );
+                        }          
                     }
                 }