harvester/server/src/harvesterao.cpp
changeset 2 b73a2e62868f
parent 1 acef663c1218
child 3 6752808b2036
equal deleted inserted replaced
1:acef663c1218 2:b73a2e62868f
    15 */
    15 */
    16 
    16 
    17 
    17 
    18 #include <e32svr.h>
    18 #include <e32svr.h>
    19 #include <caf/caf.h>
    19 #include <caf/caf.h>
       
    20 #include <driveinfo.h>
    20 
    21 
    21 #include <rlocationobjectmanipulator.h>
    22 #include <rlocationobjectmanipulator.h>
    22 #include <placeholderdata.h>
    23 #include <placeholderdata.h>
    23 #include <harvesterclientdata.h>
    24 #include <harvesterclientdata.h>
    24 
    25 
    45 
    46 
    46 const TInt KPlaceholderQueueSize = 99;
    47 const TInt KPlaceholderQueueSize = 99;
    47 const TInt KContainerPlaceholderQueueSize = 10;
    48 const TInt KContainerPlaceholderQueueSize = 10;
    48 const TInt KObjectDefStrSize = 20;
    49 const TInt KObjectDefStrSize = 20;
    49 
    50 
    50 const TInt KHarvesterAOCustomPriority = 5;
       
    51 
       
    52 _LIT( KTAGDaemonName, "ThumbAGDaemon" );
    51 _LIT( KTAGDaemonName, "ThumbAGDaemon" );
    53 _LIT( KTAGDaemonExe, "thumbagdaemon.exe" );
    52 _LIT( KTAGDaemonExe, "thumbagdaemon.exe" );
    54 
    53 
    55 _LIT(KInUse, "InUse");
    54 _LIT(KInUse, "InUse");
    56 
    55 
   112 
   111 
   113 // ---------------------------------------------------------------------------
   112 // ---------------------------------------------------------------------------
   114 // CHarvesterAO
   113 // CHarvesterAO
   115 // ---------------------------------------------------------------------------
   114 // ---------------------------------------------------------------------------
   116 //
   115 //
   117 CHarvesterAO::CHarvesterAO() : CActive( KHarvesterAOCustomPriority)
   116 CHarvesterAO::CHarvesterAO() : CActive( KHarvesterCustomImportantPriority)
   118     {
   117     {
   119     WRITELOG( "CHarvesterAO::CHarvesterAO() - begin" );
   118     WRITELOG( "CHarvesterAO::CHarvesterAO() - begin" );
   120     
   119     
   121     iServerPaused = ETrue;
   120     iServerPaused = ETrue;
   122     iNextRequest = ERequestIdle;
   121     iNextRequest = ERequestIdle;
   384 //
   383 //
   385 void CHarvesterAO::HandleUnmount( TUint32 aMediaId )
   384 void CHarvesterAO::HandleUnmount( TUint32 aMediaId )
   386 	{
   385 	{
   387 	WRITELOG1( "CHarvesterAO::HandleUnmount(%d)", aMediaId );
   386 	WRITELOG1( "CHarvesterAO::HandleUnmount(%d)", aMediaId );
   388 	
   387 	
   389     TUint32 mediaId(0);
   388     TUint32 mediaId( 0 );
   390     TUint removed(0);
   389     TUint removed( 0 );
   391     CHarvesterData* hd = NULL;
   390     CHarvesterData* hd = NULL;
   392     
   391 
       
   392     TInt err( KErrNone );
       
   393 	
   393 #ifdef _DEBUG
   394 #ifdef _DEBUG
   394     WRITELOG1( "CHarvesterAO::HandleUnmount() iReadyPHArray.Count() = %d", iReadyPHArray.Count() );
   395 	WRITELOG1( "CHarvesterAO::HandleUnmount() iReadyPHArray.Count() = %d", iReadyPHArray.Count() );
   395 #endif
   396 #endif
   396 	if( iReadyPHArray.Count() > 0 )
   397 	TInt arrayCount( iReadyPHArray.Count() );
   397 		{
   398 	if( arrayCount > 0 )
   398 		TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, iReadyPHArray.Count() ) );
   399         {
   399 		TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, iReadyPHArray.Count()) );
   400         for( TInt i=arrayCount-1; i>= 0; i--)
   400 		iReadyPHArray.ResetAndDestroy();
   401             {
   401 		}
   402             hd = iPHArray[i];
   402 
   403             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   403     TInt err( KErrNone );
   404             
       
   405             if( err == KErrNone && mediaId == aMediaId )
       
   406                 {
       
   407                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iReadyPHArray %d", i);
       
   408                 delete hd;
       
   409                 hd = NULL;
       
   410                 iReadyPHArray.Remove( i );
       
   411                 removed++;
       
   412                 arrayCount--;
       
   413                 }
       
   414             }
       
   415         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iReadyPHArray %d", removed);
       
   416         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
       
   417         }
       
   418    
       
   419    removed = 0;
   404 	
   420 	
   405 #ifdef _DEBUG
   421 #ifdef _DEBUG
   406 	WRITELOG1( "CHarvesterAO::HandleUnmount() iPHArray.Count() = %d", iPHArray.Count() );
   422 	WRITELOG1( "CHarvesterAO::HandleUnmount() iPHArray.Count() = %d", iPHArray.Count() );
   407 #endif
   423 #endif
   408    if( iPHArray.Count() > 0 )
   424 	arrayCount = iPHArray.Count();
   409         {
   425    if( arrayCount > 0 )
   410         for( TInt i=iPHArray.Count()-1; i>= 0; i--)
   426         {
       
   427         for( TInt i=arrayCount-1; i>= 0; i--)
   411             {
   428             {
   412             hd = iPHArray[i];
   429             hd = iPHArray[i];
   413             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   430             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   414             
   431             
   415             if( err == KErrNone && mediaId == aMediaId )
   432             if( err == KErrNone && mediaId == aMediaId )
   417                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iPHArray %d", i);
   434                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iPHArray %d", i);
   418                 delete hd;
   435                 delete hd;
   419 				hd = NULL;
   436 				hd = NULL;
   420                 iPHArray.Remove( i );
   437                 iPHArray.Remove( i );
   421                 removed++;
   438                 removed++;
       
   439                 arrayCount--;
   422                 }
   440                 }
   423             }
   441             }
   424         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iPHArray %d", removed);
   442         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iPHArray %d", removed);
   425         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   443         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   426         }
   444         }
   428    removed = 0;
   446    removed = 0;
   429    
   447    
   430 #ifdef _DEBUG
   448 #ifdef _DEBUG
   431    WRITELOG1( "CHarvesterAO::HandleUnmount() iContainerPHArray.Count() = %d", iContainerPHArray.Count() );
   449    WRITELOG1( "CHarvesterAO::HandleUnmount() iContainerPHArray.Count() = %d", iContainerPHArray.Count() );
   432 #endif
   450 #endif
   433    if( iContainerPHArray.Count() > 0 )
   451    arrayCount = iContainerPHArray.Count();
   434         {
   452    if( arrayCount > 0 )
   435         for( TInt i=iContainerPHArray.Count()-1; i>= 0; i--)
   453         {
       
   454         for( TInt i=arrayCount-1; i>= 0; i--)
   436             {
   455             {
   437             hd = iContainerPHArray[i];
   456             hd = iContainerPHArray[i];
   438             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   457             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   439             
   458             
   440             if( err == KErrNone && mediaId == aMediaId )
   459             if( err == KErrNone && mediaId == aMediaId )
   442                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iContainerPHArray %d", i);
   461                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iContainerPHArray %d", i);
   443                 delete hd;
   462                 delete hd;
   444 				hd = NULL;
   463 				hd = NULL;
   445                 iContainerPHArray.Remove( i );
   464                 iContainerPHArray.Remove( i );
   446                 removed++;
   465                 removed++;
       
   466                 arrayCount--;
   447                 }
   467                 }
   448             }
   468             }
   449         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iContainerPHArray %d", removed);
   469         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iContainerPHArray %d", removed);
   450         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   470         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   451         }
   471         }
   452 	
   472 
   453 	TUint count = iQueue->ItemsInQueue();
   473    removed = 0;
       
   474    
       
   475 	const TUint count = iQueue->ItemsInQueue();
   454 	WRITELOG1( "CHarvesterAO::HandleUnmount() iQueue.Count() = %d", count );
   476 	WRITELOG1( "CHarvesterAO::HandleUnmount() iQueue.Count() = %d", count );
   455 	if( count > 0 )
   477 	if( count > 0 )
   456 	    {
   478 	    {
   457 	    WRITELOG( "CHarvesterAO::HandleUnmount() remove iQueue" );
   479 	    WRITELOG( "CHarvesterAO::HandleUnmount() remove iQueue" );
   458 	    TUint removed = iQueue->RemoveItems( aMediaId );
   480 	    removed = iQueue->RemoveItems( aMediaId );
   459 	    WRITELOG1( "CHarvesterAO::HandleUnmount() removed iQueue = %d", removed );
   481 	    WRITELOG1( "CHarvesterAO::HandleUnmount() removed iQueue = %d", removed );
   460 	    TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed ) );
   482 	    TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed ) );
   461         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
   483         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
   462 	    }
   484 	    }
   463 	
   485 	
   464 	iMediaIdUtil->RemoveMediaId( aMediaId );
   486 	iMediaIdUtil->RemoveMediaId( aMediaId );
   465 	
   487 	
   466 	removed = 0;
   488 	removed = 0;
   467 	
   489 	
   468 	RPointerArray<CHarvesterPluginInfo>& hpiArray = iHarvesterPluginFactory->GetPluginInfos();
   490 	RPointerArray<CHarvesterPluginInfo>& hpiArray = iHarvesterPluginFactory->GetPluginInfos();
   469 	const TInt arrayCount( hpiArray.Count() );
   491 	const TInt hpiArrayCount( hpiArray.Count() );
   470 	if( arrayCount > 0 )
   492 	if( hpiArrayCount > 0 )
   471 		{
   493 		{
   472 		RArray<TItemId> placeholders;
   494 		RArray<TItemId> placeholders;
   473 		
   495 		
   474 		TUint32 mediaId( 0 );
   496 		TUint32 mediaId( 0 );
   475 		TInt err( KErrNone );
   497 		TInt err( KErrNone );
   476 		
   498 		
   477 		for( TInt i = arrayCount; --i >= 0; )
   499 		for( TInt i = hpiArrayCount; --i >= 0; )
   478 			{
   500 			{
   479 			CHarvesterPluginInfo* hpi = hpiArray[i];
   501 			CHarvesterPluginInfo* hpi = hpiArray[i];
   480 			for( TInt j = hpi->iQueue.Count(); --j >= 0; )
   502 			for( TInt j = hpi->iQueue.Count(); --j >= 0; )
   481 				{
   503 				{
   482 				CHarvesterData* hd = hpi->iQueue[j];
   504 				CHarvesterData* hd = hpi->iQueue[j];
   666 
   688 
   667 	TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   689 	TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   668 	
   690 	
   669 	TInt fastHarvestPlaceholderCount = 0;
   691 	TInt fastHarvestPlaceholderCount = 0;
   670 	
   692 	
   671 	for (TInt i = iPHArray.Count() ; --i >= 0;)
   693 	TInt endindex( iPHArray.Count() );
       
   694 	for( TInt i = 0; i < endindex; i++ )
   672 		{
   695 		{
   673 		CHarvesterData* hd = iPHArray[i];
   696 		CHarvesterData* hd = iPHArray[i];
   674 		
   697 		
   675 		if( aCheck && iHarvesterPluginFactory->IsContainerFileL( hd->Uri() ) )
   698 		if( aCheck && iHarvesterPluginFactory->IsContainerFileL( hd->Uri() ) )
   676 			{
   699 			{
   677 			iContainerPHArray.Append( hd );
   700 			iContainerPHArray.Append( hd );
   678 			iPHArray.Remove( i );
   701 			iPHArray.Remove( i );
       
   702             i--;
       
   703             endindex--;
   679 			continue;
   704 			continue;
   680 			}
   705 			}
   681 		TBuf<KObjectDefStrSize> objDefStr;
   706 		TBuf<KObjectDefStrSize> objDefStr;
   682 		iHarvesterPluginFactory->GetObjectDefL( *hd, objDefStr );
   707 		iHarvesterPluginFactory->GetObjectDefL( *hd, objDefStr );
   683 	    
   708 	    
   688             // notify observer, notification is needed even if file is not supported
   713             // notify observer, notification is needed even if file is not supported
   689             HarvestCompleted( hd->ClientId(), hd->Uri(), error );
   714             HarvestCompleted( hd->ClientId(), hd->Uri(), error );
   690 			delete hd;
   715 			delete hd;
   691 			hd = NULL;
   716 			hd = NULL;
   692 			iPHArray.Remove( i );
   717 			iPHArray.Remove( i );
       
   718             i--;
       
   719             endindex--;
   693 			iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 );
   720 			iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 );
   694 			continue;
   721 			continue;
   695 			}
   722 			}
   696 
   723 
   697 		CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL();
   724 		CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL();
   715 	    		// notify observer
   742 	    		// notify observer
   716 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), err );
   743 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), err );
   717 				delete hd;
   744 				delete hd;
   718 				hd = NULL;
   745 				hd = NULL;
   719 				iPHArray.Remove( i );
   746 				iPHArray.Remove( i );
       
   747 	            i--;
       
   748 	            endindex--;
   720 				iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 );
   749 				iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 );
   721 				CleanupStack::PopAndDestroy( entry );
   750 				CleanupStack::PopAndDestroy( entry );
   722 				CleanupStack::PopAndDestroy( phData );
   751 				CleanupStack::PopAndDestroy( phData );
   723 				continue;
   752 				continue;
   724 		    	}
   753 		    	}
   741 	    		// notify observer
   770 	    		// notify observer
   742 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), error );
   771 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), error );
   743 				delete hd;
   772 				delete hd;
   744 				hd = NULL;
   773 				hd = NULL;
   745 				iPHArray.Remove( i );
   774 				iPHArray.Remove( i );
       
   775 	            i--;
       
   776 	            endindex--;
   746 				iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 );
   777 				iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 );
   747 				continue;
   778 				continue;
   748 		    	}	
   779 		    	}	
   749 			CleanupStack::PushL( phData );
   780 			CleanupStack::PushL( phData );
   750 			}	
   781 			}	
   762 
   793 
   763 	    // set file size
   794 	    // set file size
   764     	mdeObject->AddUint32PropertyL( *iPropDefs->iSizePropertyDef, phData->FileSize() );
   795     	mdeObject->AddUint32PropertyL( *iPropDefs->iSizePropertyDef, phData->FileSize() );
   765 
   796 
   766 	    // set creation date
   797 	    // set creation date
   767     	TTime localModifiedDate = phData->Modified() + timeOffsetSeconds;
   798     	const TTime localModifiedDate = phData->Modified() + timeOffsetSeconds;
   768     	mdeObject->AddTimePropertyL( *iPropDefs->iCreationDatePropertyDef, localModifiedDate );
   799     	mdeObject->AddTimePropertyL( *iPropDefs->iCreationDatePropertyDef, localModifiedDate );
   769 
   800 
   770 	    // set modification date
   801 	    // set modification date
   771     	mdeObject->AddTimePropertyL( *iPropDefs->iLastModifiedDatePropertyDef, phData->Modified() );
   802     	mdeObject->AddTimePropertyL( *iPropDefs->iLastModifiedDatePropertyDef, phData->Modified() );
   772 	    
   803 	    
   810 		
   841 		
   811 	    CleanupStack::PopAndDestroy( phData );
   842 	    CleanupStack::PopAndDestroy( phData );
   812 		
   843 		
   813 		iReadyPHArray.Append( hd );
   844 		iReadyPHArray.Append( hd );
   814 		iPHArray.Remove( i );
   845 		iPHArray.Remove( i );
       
   846         i--;
       
   847         endindex--;
   815 		}
   848 		}
   816 	
   849 	
   817 	const TInt objectCount = mdeObjectArray.Count();  
   850 	const TInt objectCount = mdeObjectArray.Count();  
   818 	
   851 	
   819     if( objectCount > 0 )
   852     if( objectCount > 0 )
  1217             {
  1250             {
  1218             TRAP_IGNORE( BootRomScanL() );
  1251             TRAP_IGNORE( BootRomScanL() );
  1219             }
  1252             }
  1220         TRAP_IGNORE( BootPartialRestoreScanL() );
  1253         TRAP_IGNORE( BootPartialRestoreScanL() );
  1221 #endif
  1254 #endif
       
  1255         
       
  1256         if( !iMassMemoryIdChecked )
       
  1257             {
       
  1258             TInt drive( -1 );
       
  1259             TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) );
       
  1260             if( massStorageError == KErrNone )
       
  1261                 {
       
  1262                 TVolumeInfo massStorageVolumeInfo;
       
  1263                 iFs.Volume( massStorageVolumeInfo, drive );
       
  1264                 const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID );
       
  1265                 massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive );
       
  1266                 if( massStorageError == KErrNone )
       
  1267                     {
       
  1268                     iFs.Volume( massStorageVolumeInfo, drive );
       
  1269                     // Update mass storage media id if the mass storage is not memory card
       
  1270                     if( massStorageVolumeInfo.iUniqueID != massStorageMediaId && massStorageMediaId != 0 )
       
  1271                         {
       
  1272                         iMdEHarvesterSession->CheckMassStorageMediaId( massStorageMediaId );
       
  1273                         }
       
  1274                     }
       
  1275                 }
       
  1276             }
  1222         }
  1277         }
  1223     else
  1278     else
  1224         {
  1279         {
  1225         iServerPaused = ETrue;    
  1280         iServerPaused = ETrue;    
  1226         WRITELOG1( "HarvesterThread::HandleSessionOpened() - Failed: %d!", aError );
  1281         WRITELOG1( "HarvesterThread::HandleSessionOpened() - Failed: %d!", aError );
  1342 				if(iReadyPHArray.Count() > 0)
  1397 				if(iReadyPHArray.Count() > 0)
  1343             		{
  1398             		{
  1344 #ifdef _DEBUG
  1399 #ifdef _DEBUG
  1345             		WRITELOG1("CHarvesterAO::RunL - items in ready pharray: %d", iReadyPHArray.Count() );
  1400             		WRITELOG1("CHarvesterAO::RunL - items in ready pharray: %d", iReadyPHArray.Count() );
  1346 #endif   		
  1401 #endif   		
  1347             		const TInt beginIndex( iReadyPHArray.Count() );
  1402             		const TInt arrayCount( iReadyPHArray.Count() );
  1348             		TInt endIndex( beginIndex - KPlaceholderQueueSize );
  1403             		TInt endIndex( KPlaceholderQueueSize );
  1349             		if( endIndex < 0 )
  1404             		if( arrayCount < KPlaceholderQueueSize )
  1350             		    {
  1405             		    {
  1351             		    endIndex = 0;
  1406             		    endIndex = arrayCount;
  1352             		    }
  1407             		    }
  1353             		for ( TInt i = beginIndex; --i >= endIndex; )
  1408             		for( TInt i = 0; i < endIndex; i++ )
  1354             			{
  1409             			{
  1355                 		CheckFileExtensionAndHarvestL( iReadyPHArray[i] );
  1410                 		CheckFileExtensionAndHarvestL( iReadyPHArray[i] );
  1356                 		iReadyPHArray.Remove( i );
  1411                 		iReadyPHArray.Remove( i );
       
  1412                         // correct the index so harvesting order remains ok
       
  1413                         i--;
       
  1414                         endIndex--;
  1357             			}
  1415             			}
  1358             		if( iReadyPHArray.Count() )
  1416             		if( iReadyPHArray.Count() )
  1359             		    {
  1417             		    {
  1360             		    SetNextRequest( ERequestHarvest );
  1418             		    SetNextRequest( ERequestHarvest );
  1361             		    break;
  1419             		    break;
  2253 		const RPointerArray<HBufC>& aIgnorePaths,
  2311 		const RPointerArray<HBufC>& aIgnorePaths,
  2254         TBool aCheckDrive )
  2312         TBool aCheckDrive )
  2255 	{
  2313 	{
  2256 	WRITELOG("CHarvesterAO::BootScanL() - begin");
  2314 	WRITELOG("CHarvesterAO::BootScanL() - begin");
  2257 
  2315 
       
  2316 	
       
  2317     TInt drive( -1 );
       
  2318     TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) );
       
  2319     if( massStorageError == KErrNone )
       
  2320         {
       
  2321         TVolumeInfo massStorageVolumeInfo;
       
  2322         iFs.Volume( massStorageVolumeInfo, drive );
       
  2323         const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID );
       
  2324         massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive );
       
  2325         if( massStorageError == KErrNone )
       
  2326             {
       
  2327             iFs.Volume( massStorageVolumeInfo, drive );
       
  2328             // Update mass storage media id if the mass storage is not memory card
       
  2329             if( massStorageVolumeInfo.iUniqueID != massStorageMediaId && massStorageMediaId != 0 )
       
  2330                 {
       
  2331                 iMdEHarvesterSession->CheckMassStorageMediaId( massStorageMediaId );
       
  2332                 }
       
  2333             }
       
  2334         }
       
  2335 	
  2258 	TVolumeInfo volumeInfo;
  2336 	TVolumeInfo volumeInfo;
  2259 	iFs.Volume( volumeInfo, EDriveC );
  2337 	iFs.Volume( volumeInfo, EDriveC );
  2260 
  2338 
  2261 	iMdEHarvesterSession->SetFilesToNotPresent( volumeInfo.iUniqueID, ETrue );
  2339 	iMdEHarvesterSession->SetFilesToNotPresent( volumeInfo.iUniqueID, ETrue );
  2262 	
  2340 	
  2266 	WRITELOG1("CHarvesterAO::BootScanL() - item count: %d", aScanItems.Count() );
  2344 	WRITELOG1("CHarvesterAO::BootScanL() - item count: %d", aScanItems.Count() );
  2267 #endif
  2345 #endif
  2268 	
  2346 	
  2269 	RPointerArray<CHarvesterData> hdArray;
  2347 	RPointerArray<CHarvesterData> hdArray;
  2270 	CleanupClosePushL( hdArray );
  2348 	CleanupClosePushL( hdArray );
       
  2349 	TBool rootDir( ETrue );
  2271 	
  2350 	
  2272 	while( aScanItems.Count() > 0 )
  2351 	while( aScanItems.Count() > 0 )
  2273 		{
  2352 		{
  2274 		HBufC* folder = aScanItems[0]->iPath;
  2353 		HBufC* folder = aScanItems[0]->iPath;
  2275 		TUint32 preinstalled = aScanItems[0]->iPreinstalled;
  2354 		TUint32 preinstalled = aScanItems[0]->iPreinstalled;
  2276 
  2355 
  2277 		CDir* directory = NULL;
  2356 		CDir* directory = NULL;
  2278 		TInt error = iFs.GetDir( folder->Des(), KEntryAttDir, KHarvesterGetDirFlags, directory );
  2357 		TInt error( KErrNone );
  2279 		
  2358         if( rootDir )
       
  2359             {
       
  2360             error = iFs.GetDir( folder->Des(), KEntryAttDir, KHarvesterGetRootDirFlags, directory );
       
  2361             rootDir = EFalse;
       
  2362             }
       
  2363         else
       
  2364             {
       
  2365             error = iFs.GetDir( folder->Des(), KEntryAttDir, KHarvesterGetDirFlags, directory );
       
  2366             }
       
  2367 
  2280 		if ( error == KErrNone )
  2368 		if ( error == KErrNone )
  2281 			{
  2369 			{
  2282 			CleanupStack::PushL( directory );
  2370 			CleanupStack::PushL( directory );
  2283 
  2371 
  2284 			TInt count = directory->Count();
  2372 			TInt count = directory->Count();
  2405 	iQueue->MonitorEvent( hdArray );
  2493 	iQueue->MonitorEvent( hdArray );
  2406 	CleanupStack::PopAndDestroy( &hdArray ); 
  2494 	CleanupStack::PopAndDestroy( &hdArray ); 
  2407 
  2495 
  2408 	iMdEHarvesterSession->RemoveFilesNotPresent( volumeInfo.iUniqueID, ETrue );
  2496 	iMdEHarvesterSession->RemoveFilesNotPresent( volumeInfo.iUniqueID, ETrue );
  2409 	
  2497 	
       
  2498 	iMassMemoryIdChecked = ETrue;
       
  2499 	
  2410 	WRITELOG("CHarvesterAO::BootScanL() - end");
  2500 	WRITELOG("CHarvesterAO::BootScanL() - end");
  2411 	}
  2501 	}
  2412 
  2502 
  2413 void CHarvesterAO::SetHarvesterStatusObserver( MHarvesterStatusObserver* aObserver )
  2503 void CHarvesterAO::SetHarvesterStatusObserver( MHarvesterStatusObserver* aObserver )
  2414 	{
  2504 	{