harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp
changeset 1 acef663c1218
parent 0 c53acadfccc6
child 2 b73a2e62868f
equal deleted inserted replaced
0:c53acadfccc6 1:acef663c1218
    30 const TUid KRepositoryUid = { 0x20007183 };
    30 const TUid KRepositoryUid = { 0x20007183 };
    31 const TUint32 KScanDelayKey = 0x00000001;
    31 const TUint32 KScanDelayKey = 0x00000001;
    32 
    32 
    33 CMmcScannerAO::CMmcScannerAO( TUint32 aMediaId, 
    33 CMmcScannerAO::CMmcScannerAO( TUint32 aMediaId, 
    34 		CMdEHarvesterSession* aMdEClient, MMonitorPluginObserver* aObserver, 
    34 		CMdEHarvesterSession* aMdEClient, MMonitorPluginObserver* aObserver, 
    35 		CHarvesterPluginFactory* aHarvesterPluginFactory, CActive::TPriority aPriority ) : 
    35 		CHarvesterPluginFactory* aHarvesterPluginFactory, const TInt aPriority ) : 
    36 		CTimer( aPriority ), iState( EUninitialized ), iMmcFileList( NULL )   
    36 		CTimer( aPriority ), iState( EUninitialized ), iMmcFileList( NULL )   
    37 	{
    37 	{
    38 	iMediaId = aMediaId;
    38 	iMediaId = aMediaId;
    39 	iMdEClient = aMdEClient;
    39 	iMdEClient = aMdEClient;
    40 	iObserver = aObserver;
    40 	iObserver = aObserver;
    41 	iHarvesterPluginFactory = aHarvesterPluginFactory;
    41 	iHarvesterPluginFactory = aHarvesterPluginFactory;
    42 	}
    42 	}
    43 
    43 
    44 CMmcScannerAO* CMmcScannerAO::NewL( TUint32 aMediaId, CMdEHarvesterSession* aMdEClient,
    44 CMmcScannerAO* CMmcScannerAO::NewL( TUint32 aMediaId, CMdEHarvesterSession* aMdEClient,
    45 		MMonitorPluginObserver* aObserver, CHarvesterPluginFactory* aHarvesterPluginFactory, 
    45 		MMonitorPluginObserver* aObserver, CHarvesterPluginFactory* aHarvesterPluginFactory, 
    46 		CActive::TPriority aPriority, TBool aAlreadyWaited )
    46 		const TInt aPriority, TBool aAlreadyWaited )
    47 	{
    47 	{
    48 	CMmcScannerAO* self = new ( ELeave ) CMmcScannerAO( aMediaId, aMdEClient, aObserver, 
    48 	CMmcScannerAO* self = new ( ELeave ) CMmcScannerAO( aMediaId, aMdEClient, aObserver, 
    49 			aHarvesterPluginFactory, aPriority );
    49 			aHarvesterPluginFactory, aPriority );
    50 	
    50 	
    51 	CleanupStack::PushL( self );
    51 	CleanupStack::PushL( self );
    65 	if( !aAlreadyWaited )
    65 	if( !aAlreadyWaited )
    66 	    {
    66 	    {
    67         TInt tmpDelay( KDefaultDelay );
    67         TInt tmpDelay( KDefaultDelay );
    68         TTimeIntervalMicroSeconds32 delay( tmpDelay * KMillion ); 
    68         TTimeIntervalMicroSeconds32 delay( tmpDelay * KMillion ); 
    69         CRepository* repo = CRepository::NewLC( KRepositoryUid );
    69         CRepository* repo = CRepository::NewLC( KRepositoryUid );
    70         TInt err = repo->Get( KScanDelayKey, tmpDelay );
    70         const TInt err = repo->Get( KScanDelayKey, tmpDelay );
    71         if ( err == KErrNone )
    71         if ( err == KErrNone )
    72             {
    72             {
    73             delay = tmpDelay * KMillion;
    73             delay = tmpDelay * KMillion;
    74             }
    74             }
    75         CleanupStack::PopAndDestroy( repo );
    75         CleanupStack::PopAndDestroy( repo );
   144 			if( iEntryArray.Count() > 0 )
   144 			if( iEntryArray.Count() > 0 )
   145 				{
   145 				{
   146 				WRITELOG("CMmcScannerAO::RunL - handling file list");
   146 				WRITELOG("CMmcScannerAO::RunL - handling file list");
   147 				iMmcFileList->HandleFileEntryL( *iMdEClient, iEntryArray, 
   147 				iMmcFileList->HandleFileEntryL( *iMdEClient, iEntryArray, 
   148 						iHarvestEntryArray, iMediaId, iHarvesterPluginFactory );
   148 						iHarvestEntryArray, iMediaId, iHarvesterPluginFactory );
   149 				SetState( EHarvestFiles );
   149 				SetState( EProcessFiles );
   150 				}
   150                 }
   151 			else 
   151             else 
   152 				{
   152                 {
   153 				SetState( ERemoveNPFiles );
   153                 SetState( EHarvestFiles );
   154 				}
   154                 }
   155 			break;
   155 			break;
   156 			}
   156 			}
   157 		
   157 		
   158 		case( EHarvestFiles ):
   158 		case( EHarvestFiles ):
   159 			{
   159 			{
   163 				HandleReharvestL();
   163 				HandleReharvestL();
   164 				SetState( EHarvestFiles );
   164 				SetState( EHarvestFiles );
   165 				}
   165 				}
   166 			else
   166 			else
   167 				{
   167 				{
   168 				SetState( EProcessFiles );
   168 				SetState( ERemoveNPFiles );
   169 				}
   169 				}
   170 			break;
   170 			break;
   171 			}
   171 			}
   172 		
   172 		
   173 		case( ERemoveNPFiles ):
   173 		case( ERemoveNPFiles ):
   179 			}
   179 			}
   180 		
   180 		
   181 		case( EDone ):
   181 		case( EDone ):
   182 			{
   182 			{
   183 			iFs.Close();
   183 			iFs.Close();
       
   184 			iEntryArray.Compress();
       
   185 			iHarvestEntryArray.Compress();
   184 			break;
   186 			break;
   185 			}
   187 			}
   186 		
   188 		
   187 		default: 
   189 		default: 
   188 			break;
   190 			break;