harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp
changeset 1 acef663c1218
parent 0 c53acadfccc6
child 3 b73a2e62868f
equal deleted inserted replaced
0:c53acadfccc6 1:acef663c1218
    22 #include "harvestercenreputil.h"
    22 #include "harvestercenreputil.h"
    23 #include <driveinfo.h>
    23 #include <driveinfo.h>
    24 
    24 
    25 #include <e32cmn.h>
    25 #include <e32cmn.h>
    26 
    26 
       
    27 const TInt KMassStorageScanCustomPriority = 5;
       
    28 
    27 _LIT( KColon, ":" );
    29 _LIT( KColon, ":" );
    28 
    30 
    29 // construct/destruct
    31 // construct/destruct
    30 CMMCMonitorPlugin* CMMCMonitorPlugin::NewL()
    32 CMMCMonitorPlugin* CMMCMonitorPlugin::NewL()
    31     {
    33     {
   104     
   106     
   105 	TUint32 hdMediaId( 0 );
   107 	TUint32 hdMediaId( 0 );
   106     hdMediaId = iMountTask->GetInternalDriveMediaId();
   108     hdMediaId = iMountTask->GetInternalDriveMediaId();
   107     TBool alreadyWaited( EFalse );
   109     TBool alreadyWaited( EFalse );
   108     
   110     
   109     
   111     const TInt count( medias.Count() );
   110     for ( TInt i = 0; i < medias.Count(); i++ )
   112     for ( TInt i = 0; i < count; i++ )
   111     	{
   113     	{
   112     	TRAP_IGNORE( iMdEClient->GetMediaL( medias[i].iMediaId, driveLetter, presentState ) );
   114     	TRAP_IGNORE( iMdEClient->GetMediaL( medias[i].iMediaId, driveLetter, presentState ) );
   113     	
   115     	
   114     	if ( presentState && medias[i].iMediaId != hdMediaId )
   116     	if ( presentState && medias[i].iMediaId != hdMediaId )
   115     		{
   117     		{
   134 			hdInfo.iMediaId = hdMediaId;
   136 			hdInfo.iMediaId = hdMediaId;
   135 			hdInfo.iDrive = driveLetter;
   137 			hdInfo.iDrive = driveLetter;
   136 			medias.Append( hdInfo );
   138 			medias.Append( hdInfo );
   137 			
   139 			
   138 			TRAP_IGNORE( iHddScanner = CMmcScannerAO::NewL( hdMediaId, iMdEClient, iObserver,
   140 			TRAP_IGNORE( iHddScanner = CMmcScannerAO::NewL( hdMediaId, iMdEClient, iObserver,
   139 			    				aHarvesterPluginFactory, CActive::EPriorityUserInput, alreadyWaited ));
   141 			    				aHarvesterPluginFactory, KMassStorageScanCustomPriority, alreadyWaited ));
   140 			}
   142 			}
   141 		}
   143 		}
   142 
   144 
   143     iMMCMonitor->StartMonitoring( *this, medias );
   145     iMMCMonitor->StartMonitoring( *this, medias );
   144     
   146     
   277     }
   279     }
   278 
   280 
   279 void CMMCMonitorPlugin::StartMonitoringAllMMCsL( RArray<TMdEMediaInfo>& aMedias )
   281 void CMMCMonitorPlugin::StartMonitoringAllMMCsL( RArray<TMdEMediaInfo>& aMedias )
   280     {
   282     {
   281     WRITELOG( "CMMCMonitorPlugin::StartMonitoringAllMMCs" );
   283     WRITELOG( "CMMCMonitorPlugin::StartMonitoringAllMMCs" );
   282     TInt count( 0 );
       
   283     
   284     
   284     RFs fs;
   285     RFs fs;
   285     User::LeaveIfError( fs.Connect() );
   286     User::LeaveIfError( fs.Connect() );
   286     CleanupClosePushL( fs );
   287     CleanupClosePushL( fs );
   287         
   288         
   295     
   296     
   296     TInt i( 0 );
   297     TInt i( 0 );
   297     TChar drive;
   298     TChar drive;
   298     const TInt acount = driveList.Length();
   299     const TInt acount = driveList.Length();
   299     const TInt mediaCount = aMedias.Count();
   300     const TInt mediaCount = aMedias.Count();
       
   301     TInt count( 0 );
   300     
   302     
   301     // set removed medias to not present
   303     // set removed medias to not present
   302     for ( i = 0; i < mediaCount; i++ )
   304     for ( i = 0; i < mediaCount; i++ )
   303     	{
   305     	{
   304     	TInt driveNum(0);
   306     	TInt driveNum(0);