harvester/server/src/harvesterao.cpp
branchRCL_3
changeset 46 63c982fb92f2
parent 34 9422ed56ee45
child 47 b73252188534
equal deleted inserted replaced
34:9422ed56ee45 46:63c982fb92f2
    40 #include "mdeobjecthandler.h"
    40 #include "mdeobjecthandler.h"
    41 #include "harvestereventmanager.h"
    41 #include "harvestereventmanager.h"
    42 #include "harvestercenreputil.h"
    42 #include "harvestercenreputil.h"
    43 #include "restorewatcher.h"
    43 #include "restorewatcher.h"
    44 #include "backupsubscriber.h"
    44 #include "backupsubscriber.h"
       
    45 #include "OstTraceDefinitions.h"
       
    46 #ifdef OST_TRACE_COMPILER_IN_USE
       
    47 #include "harvesteraoTraces.h"
       
    48 #endif
       
    49 
    45 
    50 
    46 // constants
    51 // constants
    47 const TInt32 KFileMonitorPluginUid = 0x20007186;  // file monitor plugin implementation uid
    52 const TInt32 KFileMonitorPluginUid = 0x20007186;  // file monitor plugin implementation uid
    48 
    53 
    49 const TInt KPlaceholderQueueSize = 99;
    54 const TInt KPlaceholderQueueSize = 99;
   102 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
   103 //
   108 //
   104 CHarvesterAO* CHarvesterAO::NewLC()
   109 CHarvesterAO* CHarvesterAO::NewLC()
   105     {
   110     {
   106     WRITELOG( "CHarvesterAO::NewLC() - begin" );
   111     WRITELOG( "CHarvesterAO::NewLC() - begin" );
       
   112     OstTrace0( TRACE_NORMAL, CHARVESTERAO_NEWLC, "CHarvesterAO::NewLC" );    
   107     
   113     
   108     CHarvesterAO* self = new (ELeave) CHarvesterAO();
   114     CHarvesterAO* self = new (ELeave) CHarvesterAO();
   109     CleanupStack::PushL( self );
   115     CleanupStack::PushL( self );
   110     self->ConstructL();
   116     self->ConstructL();
   111     return self;
   117     return self;
   116 // ---------------------------------------------------------------------------
   122 // ---------------------------------------------------------------------------
   117 //
   123 //
   118 CHarvesterAO* CHarvesterAO::NewL()
   124 CHarvesterAO* CHarvesterAO::NewL()
   119     {
   125     {
   120     WRITELOG( "CHarvesterAO::NewL() - begin" );
   126     WRITELOG( "CHarvesterAO::NewL() - begin" );
       
   127     OstTrace0( TRACE_NORMAL, CHARVESTERAO_NEWL, "CHarvesterAO::NewL" );
   121     
   128     
   122     CHarvesterAO* self = CHarvesterAO::NewLC();
   129     CHarvesterAO* self = CHarvesterAO::NewLC();
   123     CleanupStack::Pop( self );
   130     CleanupStack::Pop( self );
   124     return self;
   131     return self;
   125     }
   132     }
   129 // ---------------------------------------------------------------------------
   136 // ---------------------------------------------------------------------------
   130 //
   137 //
   131 CHarvesterAO::CHarvesterAO() : CActive( KHarvesterPriorityHarvestingPlugin )
   138 CHarvesterAO::CHarvesterAO() : CActive( KHarvesterPriorityHarvestingPlugin )
   132     {
   139     {
   133     WRITELOG( "CHarvesterAO::CHarvesterAO() - begin" );
   140     WRITELOG( "CHarvesterAO::CHarvesterAO() - begin" );
       
   141     OstTrace0( TRACE_NORMAL, CHARVESTERAO_CHARVESTERAO, "CHarvesterAO::CHarvesterAO" );
   134     
   142     
   135     iServerPaused = ETrue;
   143     iServerPaused = ETrue;
   136     iNextRequest = ERequestIdle;
   144     iNextRequest = ERequestIdle;
   137     
   145     
   138     iContextEngineInitialized = EFalse;
   146     iContextEngineInitialized = EFalse;
   153 // ---------------------------------------------------------------------------
   161 // ---------------------------------------------------------------------------
   154 //
   162 //
   155 CHarvesterAO::~CHarvesterAO()
   163 CHarvesterAO::~CHarvesterAO()
   156     {
   164     {
   157     WRITELOG( "CHarvesterAO::~CHarvesterAO()" );
   165     WRITELOG( "CHarvesterAO::~CHarvesterAO()" );
       
   166     OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_CHARVESTERAO, "CHarvesterAO::~CHarvesterAO" );
   158     
   167     
   159     Cancel();
   168     Cancel();
   160 
   169 
   161 	iFs.Close();
   170 	iFs.Close();
   162 	
   171 	
   244 // ---------------------------------------------------------------------------
   253 // ---------------------------------------------------------------------------
   245 //
   254 //
   246 void CHarvesterAO::ConstructL()
   255 void CHarvesterAO::ConstructL()
   247     {
   256     {
   248     WRITELOG( "CHarvesterAO::ConstructL() - begin" );
   257     WRITELOG( "CHarvesterAO::ConstructL() - begin" );
   249     
   258     OstTrace0( TRACE_NORMAL, CHARVESTERAO_CONSTRUCTL, "CHarvesterAO::ConstructL - begin" );
       
   259      
   250     CActiveScheduler::Add( this );
   260     CActiveScheduler::Add( this );
   251 
   261 
   252 	User::LeaveIfError( iFs.Connect() );
   262 	User::LeaveIfError( iFs.Connect() );
   253 	
   263 	
   254     // Setting up MdE Session
   264     // Setting up MdE Session
   321     iPhoneSoundsPath = phoneSoundPath.AllocL();
   331     iPhoneSoundsPath = phoneSoundPath.AllocL();
   322 
   332 
   323     TFileName mmcSoundPath( mmcRoot );
   333     TFileName mmcSoundPath( mmcRoot );
   324     mmcSoundPath.Append( sounds );
   334     mmcSoundPath.Append( sounds );
   325     iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL();
   335     iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL();
   326     
   336    		
       
   337     OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_CONSTRUCTL, "CHarvesterAO::ConstructL - end" );    
       
   338 	
   327     WRITELOG( "CHarvesterAO::ConstructL() - end" );
   339     WRITELOG( "CHarvesterAO::ConstructL() - end" );
   328     }
   340     }
   329 
   341 
   330 // ---------------------------------------------------------------------------
   342 // ---------------------------------------------------------------------------
   331 // LoadMonitorPluginsL
   343 // LoadMonitorPluginsL
   332 // ---------------------------------------------------------------------------
   344 // ---------------------------------------------------------------------------
   333 //
   345 //
   334 void CHarvesterAO::LoadMonitorPluginsL()
   346 void CHarvesterAO::LoadMonitorPluginsL()
   335     {
   347     {
   336     WRITELOG( "CHarvesterAO::LoadMonitorPluginsL()" );
   348     WRITELOG( "CHarvesterAO::LoadMonitorPluginsL()" );
       
   349     OstTrace0( TRACE_NORMAL, CHARVESTERAO_LOADMONITORPLUGINSL, "CHarvesterAO::LoadMonitorPluginsL" );
   337     
   350     
   338     RImplInfoPtrArray infoArray;
   351     RImplInfoPtrArray infoArray;
   339     
   352     
   340     TCleanupItem cleanupItem( MdsUtils::CleanupEComArray, &infoArray );
   353     TCleanupItem cleanupItem( MdsUtils::CleanupEComArray, &infoArray );
   341     CleanupStack::PushL( cleanupItem );
   354     CleanupStack::PushL( cleanupItem );
   362                 }
   375                 }
   363             }
   376             }
   364         else
   377         else
   365             {
   378             {
   366             WRITELOG( "CHarvesterAO::LoadMonitorPlugins() - Failed to load a monitor plugin!" );
   379             WRITELOG( "CHarvesterAO::LoadMonitorPlugins() - Failed to load a monitor plugin!" );
       
   380             OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_LOADMONITORPLUGINSL, "CHarvesterAO::LoadMonitorPluginsL  - Failed to load a monitor plugin!" );
       
   381             
   367             delete plugin;
   382             delete plugin;
   368             plugin = NULL;
   383             plugin = NULL;
   369             }
   384             }
   370         }
   385         }
   371     
   386     
   377 // ---------------------------------------------------------------------------
   392 // ---------------------------------------------------------------------------
   378 //
   393 //
   379 void CHarvesterAO::DeleteMonitorPlugins()
   394 void CHarvesterAO::DeleteMonitorPlugins()
   380     {
   395     {
   381     WRITELOG( "CHarvesterAO::DeleteMonitorPlugins()" );
   396     WRITELOG( "CHarvesterAO::DeleteMonitorPlugins()" );
       
   397     OstTrace0( TRACE_NORMAL, CHARVESTERAO_DELETEMONITORPLUGINS, "CHarvesterAO::DeleteMonitorPlugins" );
   382     
   398     
   383     iMonitorPluginArray.ResetAndDestroy();
   399     iMonitorPluginArray.ResetAndDestroy();
   384     iMonitorPluginArray.Close();
   400     iMonitorPluginArray.Close();
       
   401     OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_DELETEMONITORPLUGINS, "CHarvesterAO::DeleteMonitorPlugins - end" );    
   385     WRITELOG( "CHarvesterAO::DeleteMonitorPlugins() - end" );
   402     WRITELOG( "CHarvesterAO::DeleteMonitorPlugins() - end" );
   386     }
   403     }
   387 
   404 
   388 // ---------------------------------------------------------------------------
   405 // ---------------------------------------------------------------------------
   389 // StartMonitoring
   406 // StartMonitoring
   390 // ---------------------------------------------------------------------------
   407 // ---------------------------------------------------------------------------
   391 //
   408 //
   392 void CHarvesterAO::StartMonitoring()
   409 void CHarvesterAO::StartMonitoring()
   393     {
   410     {
   394     WRITELOG( "CHarvesterAO::StartMonitoring()" );
   411     WRITELOG( "CHarvesterAO::StartMonitoring()" );
   395 
   412     OstTrace0( TRACE_NORMAL, CHARVESTERAO_STARTMONITORING, "CHarvesterAO::StartMonitoring" );    
       
   413     
   396     const TInt count( iMonitorPluginArray.Count() );  
   414     const TInt count( iMonitorPluginArray.Count() );  
   397     
   415     
   398     for ( TInt i = 0; i < count; i++ )
   416     for ( TInt i = 0; i < count; i++ )
   399         {
   417         {
   400         iMonitorPluginArray[i]->StartMonitoring( *iQueue, iMdESession, NULL, 
   418         iMonitorPluginArray[i]->StartMonitoring( *iQueue, iMdESession, NULL, 
   407 // ---------------------------------------------------------------------------
   425 // ---------------------------------------------------------------------------
   408 //
   426 //
   409 void CHarvesterAO::StopMonitoring()
   427 void CHarvesterAO::StopMonitoring()
   410     {
   428     {
   411     WRITELOG( "CHarvesterAO::StopMonitoring()" );
   429     WRITELOG( "CHarvesterAO::StopMonitoring()" );
       
   430     
       
   431     OstTrace0( TRACE_NORMAL, CHARVESTERAO_STOPMONITORING, "CHarvesterAO::StopMonitoring" );
   412 
   432 
   413     const TInt count( iMonitorPluginArray.Count() );
   433     const TInt count( iMonitorPluginArray.Count() );
   414     
   434     
   415     for ( TInt i = 0; i < count; i++ )
   435     for ( TInt i = 0; i < count; i++ )
   416         {
   436         {
   423 // ---------------------------------------------------------------------------
   443 // ---------------------------------------------------------------------------
   424 //
   444 //
   425 void CHarvesterAO::PauseMonitoring()
   445 void CHarvesterAO::PauseMonitoring()
   426     {
   446     {
   427     WRITELOG( "CHarvesterAO::PauseMonitoring()" );
   447     WRITELOG( "CHarvesterAO::PauseMonitoring()" );
       
   448     OstTrace0( TRACE_NORMAL, CHARVESTERAO_PAUSEMONITORING, "CHarvesterAO::PauseMonitoring" );
       
   449     
   428     const TInt count( iMonitorPluginArray.Count() );
   450     const TInt count( iMonitorPluginArray.Count() );
   429     
   451     
   430     for ( TInt i = 0; i<count; i++ )
   452     for ( TInt i = 0; i<count; i++ )
   431         {
   453         {
   432         iMonitorPluginArray[i]->PauseMonitoring();
   454         iMonitorPluginArray[i]->PauseMonitoring();
   433         }
   455         }
       
   456     OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_PAUSEMONITORING, "CHarvesterAO::PauseMonitoring - end" );    
   434     WRITELOG( "CHarvesterAO::PauseMonitoring() - end" );
   457     WRITELOG( "CHarvesterAO::PauseMonitoring() - end" );
   435     }
   458     }
   436 
   459 
   437 // ---------------------------------------------------------------------------
   460 // ---------------------------------------------------------------------------
   438 // ResumeMonitoring
   461 // ResumeMonitoring
   439 // ---------------------------------------------------------------------------
   462 // ---------------------------------------------------------------------------
   440 //
   463 //
   441 void CHarvesterAO::ResumeMonitoring()
   464 void CHarvesterAO::ResumeMonitoring()
   442     {
   465     {
   443     WRITELOG( "CHarvesterAO::ResumeMonitoring()" );
   466     WRITELOG( "CHarvesterAO::ResumeMonitoring()" );
       
   467     OstTrace0( TRACE_NORMAL, CHARVESTERAO_RESUMEMONITORING, "CHarvesterAO::ResumeMonitoring" );
   444     
   468     
   445     const TInt count( iMonitorPluginArray.Count() );
   469     const TInt count( iMonitorPluginArray.Count() );
   446     
   470     
   447     for ( TInt i=0; i < count; i++ )
   471     for ( TInt i=0; i < count; i++ )
   448         {
   472         {
   457 // ---------------------------------------------------------------------------
   481 // ---------------------------------------------------------------------------
   458 //
   482 //
   459 void CHarvesterAO::HandleUnmount( TUint32 aMediaId )
   483 void CHarvesterAO::HandleUnmount( TUint32 aMediaId )
   460 	{
   484 	{
   461     WRITELOG1( "CHarvesterAO::HandleUnmount(%d)", aMediaId );    
   485     WRITELOG1( "CHarvesterAO::HandleUnmount(%d)", aMediaId );    
       
   486 	OstTrace1( TRACE_NORMAL, CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount;aMediaId=%d", aMediaId );
   462     
   487     
   463     iUnmountDetected = ETrue;
   488     iUnmountDetected = ETrue;
   464     
   489     
   465     if( !iServerPaused )
   490     if( !iServerPaused )
   466         {
   491         {
   475 
   500 
   476     TInt err( KErrNone );
   501     TInt err( KErrNone );
   477 	
   502 	
   478 #ifdef _DEBUG
   503 #ifdef _DEBUG
   479 	WRITELOG1( "CHarvesterAO::HandleUnmount() iReadyPHArray.Count() = %d", iReadyPHArray.Count() );
   504 	WRITELOG1( "CHarvesterAO::HandleUnmount() iReadyPHArray.Count() = %d", iReadyPHArray.Count() );
       
   505 	OstTrace1( TRACE_NORMAL, DUP1_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount;iReadyPHArray.Count()=%d", iReadyPHArray.Count() );
       
   506 	
   480 #endif
   507 #endif
   481 	TInt arrayCount( iReadyPHArray.Count() );
   508 	TInt arrayCount( iReadyPHArray.Count() );
   482 	if( arrayCount > 0 )
   509 	if( arrayCount > 0 )
   483         {
   510         {
   484         for( TInt i=arrayCount-1; i>= 0; i--)
   511         for( TInt i=arrayCount-1; i>= 0; i--)
   487             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   514             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   488             
   515             
   489             if( err == KErrNone && mediaId == aMediaId )
   516             if( err == KErrNone && mediaId == aMediaId )
   490                 {
   517                 {
   491                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iReadyPHArray %d", i);
   518                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iReadyPHArray %d", i);
       
   519                 OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove iReadyPHArray %d", i );
       
   520                 
   492                 delete hd;
   521                 delete hd;
   493                 hd = NULL;
   522                 hd = NULL;
   494                 iReadyPHArray.Remove( i );
   523                 iReadyPHArray.Remove( i );
   495                 removed++;
   524                 removed++;
   496                 arrayCount--;
   525                 arrayCount--;
   499         if( iReadyPHArray.Count() == 0 )
   528         if( iReadyPHArray.Count() == 0 )
   500             {
   529             {
   501             iReadyPHArray.Compress();
   530             iReadyPHArray.Compress();
   502             }
   531             }
   503         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iReadyPHArray %d", removed);
   532         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iReadyPHArray %d", removed);
       
   533         OstTrace1( TRACE_NORMAL, DUP3_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount DecreaseItemCountL iReadyPHArray %d", removed );
       
   534         
   504         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   535         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   505         }
   536         }
   506    
   537    
   507    removed = 0;
   538    removed = 0;
   508 	
   539 	
   509 #ifdef _DEBUG
   540 #ifdef _DEBUG
   510 	WRITELOG1( "CHarvesterAO::HandleUnmount() iPHArray.Count() = %d", iPHArray.Count() );
   541 	WRITELOG1( "CHarvesterAO::HandleUnmount() iPHArray.Count() = %d", iPHArray.Count() );
       
   542 	OstTrace1( TRACE_NORMAL, DUP4_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount iPHArray.Count()=%d", iPHArray.Count() );
       
   543 	
   511 #endif
   544 #endif
   512 	arrayCount = iPHArray.Count();
   545 	arrayCount = iPHArray.Count();
   513    if( arrayCount > 0 )
   546    if( arrayCount > 0 )
   514         {
   547         {
   515         for( TInt i=arrayCount-1; i>= 0; i--)
   548         for( TInt i=arrayCount-1; i>= 0; i--)
   518             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   551             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   519             
   552             
   520             if( err == KErrNone && mediaId == aMediaId )
   553             if( err == KErrNone && mediaId == aMediaId )
   521                 {
   554                 {
   522                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iPHArray %d", i);
   555                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iPHArray %d", i);
       
   556                 OstTrace1( TRACE_NORMAL, DUP5_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove iPHArray %d", i );
       
   557                 
   523                 delete hd;
   558                 delete hd;
   524 				hd = NULL;
   559 				hd = NULL;
   525                 iPHArray.Remove( i );
   560                 iPHArray.Remove( i );
   526                 removed++;
   561                 removed++;
   527                 arrayCount--;
   562                 arrayCount--;
   530         if( iPHArray.Count() == 0 )
   565         if( iPHArray.Count() == 0 )
   531             {
   566             {
   532             iPHArray.Compress();
   567             iPHArray.Compress();
   533             }
   568             }
   534         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iPHArray %d", removed);
   569         WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iPHArray %d", removed);
       
   570         OstTrace1( TRACE_NORMAL, DUP6_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount DecreaseItemCountL iPHArray %d", removed );        
   535         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   571         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
   536         }
   572         }
   537    
   573    
   538    removed = 0;
   574    removed = 0;
   539    
   575    
   540 #ifdef _DEBUG
   576 #ifdef _DEBUG
   541    WRITELOG1( "CHarvesterAO::HandleUnmount() iContainerPHArray.Count() = %d", iContainerPHArray.Count() );
   577    WRITELOG1( "CHarvesterAO::HandleUnmount() iContainerPHArray.Count() = %d", iContainerPHArray.Count() );
       
   578    OstTrace1( TRACE_NORMAL, DUP7_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount iContainerPHArray.Count()=%d", iContainerPHArray.Count() );
       
   579    
   542 #endif
   580 #endif
   543    arrayCount = iContainerPHArray.Count();
   581    arrayCount = iContainerPHArray.Count();
   544    if( arrayCount > 0 )
   582    if( arrayCount > 0 )
   545         {
   583         {
   546         for( TInt i=arrayCount-1; i>= 0; i--)
   584         for( TInt i=arrayCount-1; i>= 0; i--)
   549             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   587             err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
   550             
   588             
   551             if( err == KErrNone && mediaId == aMediaId )
   589             if( err == KErrNone && mediaId == aMediaId )
   552                 {
   590                 {
   553                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iContainerPHArray %d", i);
   591                 WRITELOG1( "CHarvesterAO::HandleUnmount() remove iContainerPHArray %d", i);
       
   592                 OstTrace1( TRACE_NORMAL, DUP8_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove iContainerPHArray %d", i );
       
   593                 
   554                 delete hd;
   594                 delete hd;
   555 				hd = NULL;
   595 				hd = NULL;
   556                 iContainerPHArray.Remove( i );
   596                 iContainerPHArray.Remove( i );
   557                 removed++;
   597                 removed++;
   558                 arrayCount--;
   598                 arrayCount--;
   599    
   639    
   600    removed = 0;
   640    removed = 0;
   601    
   641    
   602 	const TUint count = iQueue->ItemsInQueue();
   642 	const TUint count = iQueue->ItemsInQueue();
   603 	WRITELOG1( "CHarvesterAO::HandleUnmount() iQueue.Count() = %d", count );
   643 	WRITELOG1( "CHarvesterAO::HandleUnmount() iQueue.Count() = %d", count );
       
   644 	OstTrace1( TRACE_NORMAL, DUP10_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount iQueue.Count() = %d", count );
       
   645 	
   604 	if( count > 0 )
   646 	if( count > 0 )
   605 	    {
   647 	    {
   606 	    WRITELOG( "CHarvesterAO::HandleUnmount() remove iQueue" );
   648 	    WRITELOG( "CHarvesterAO::HandleUnmount() remove iQueue" );
       
   649 	    OstTrace0( TRACE_NORMAL, DUP11_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove iQueue" );	    
   607 	    removed = iQueue->RemoveItems( aMediaId );
   650 	    removed = iQueue->RemoveItems( aMediaId );
   608 	    WRITELOG1( "CHarvesterAO::HandleUnmount() removed iQueue = %d", removed );
   651 	    WRITELOG1( "CHarvesterAO::HandleUnmount() removed iQueue = %d", removed );
       
   652 	    OstTrace1( TRACE_NORMAL, DUP12_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount removed iQueue = %d", removed );
       
   653 	    
   609 	    TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed ) );
   654 	    TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed ) );
   610         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
   655         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
   611 	    }
   656 	    }
   612 	
   657 	
   613 	removed = 0;
   658 	removed = 0;
   648 			}
   693 			}
   649 		
   694 		
   650 		if( removed )
   695 		if( removed )
   651 		    {
   696 		    {
   652             WRITELOG1( "CHarvesterAO::HandleUnmount() remove from plugins = %d", removed);
   697             WRITELOG1( "CHarvesterAO::HandleUnmount() remove from plugins = %d", removed);
       
   698             OstTrace1( TRACE_NORMAL, DUP13_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove from plugins = %d", removed );
       
   699             
   653             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed ) );
   700             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed ) );
   654             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
   701             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
   655 		    }
   702 		    }
   656 		}
   703 		}
   657 	
   704 	
   671 // ---------------------------------------------------------------------------
   718 // ---------------------------------------------------------------------------
   672 //
   719 //
   673 void CHarvesterAO::StartComposersL()
   720 void CHarvesterAO::StartComposersL()
   674     {
   721     {
   675     WRITELOG( "CHarvesterAO::StartComposersL()" );
   722     WRITELOG( "CHarvesterAO::StartComposersL()" );
   676     
   723     OstTrace0( TRACE_NORMAL, CHARVESTERAO_STARTCOMPOSERSL, "CHarvesterAO::StartComposersL" );
       
   724         
   677     RImplInfoPtrArray infoArray;
   725     RImplInfoPtrArray infoArray;
   678     TCleanupItem cleanupItem( MdsUtils::CleanupEComArray, &infoArray );
   726     TCleanupItem cleanupItem( MdsUtils::CleanupEComArray, &infoArray );
   679     CleanupStack::PushL( cleanupItem );
   727     CleanupStack::PushL( cleanupItem );
   680     CComposerPlugin::ListImplementationsL( infoArray );
   728     CComposerPlugin::ListImplementationsL( infoArray );
   681     const TInt count( infoArray.Count() );
   729     const TInt count( infoArray.Count() );
   705 // ---------------------------------------------------------------------------
   753 // ---------------------------------------------------------------------------
   706 //
   754 //
   707 void CHarvesterAO::StopComposers()
   755 void CHarvesterAO::StopComposers()
   708     {
   756     {
   709     WRITELOG( "CHarvesterAO::StopComposers()" );
   757     WRITELOG( "CHarvesterAO::StopComposers()" );
       
   758     OstTrace0( TRACE_NORMAL, CHARVESTERAO_STOPCOMPOSERS, "CHarvesterAO::StopComposers" );    
   710     
   759     
   711     const TInt count( iComposerPluginArray.Count() );
   760     const TInt count( iComposerPluginArray.Count() );
   712     for ( TInt i = count; --i >= 0; )
   761     for ( TInt i = count; --i >= 0; )
   713         {
   762         {
   714         iComposerPluginArray[i]->RemoveSession();
   763         iComposerPluginArray[i]->RemoveSession();
   722 // ---------------------------------------------------------------------------
   771 // ---------------------------------------------------------------------------
   723 //
   772 //
   724 void CHarvesterAO::DeleteComposers()
   773 void CHarvesterAO::DeleteComposers()
   725     {
   774     {
   726     WRITELOG( "CHarvesterAO::DeleteComposers()" );
   775     WRITELOG( "CHarvesterAO::DeleteComposers()" );
       
   776     OstTrace0( TRACE_NORMAL, CHARVESTERAO_DELETECOMPOSERS, "CHarvesterAO::DeleteComposers" );
   727     
   777     
   728     iComposerPluginArray.ResetAndDestroy();
   778     iComposerPluginArray.ResetAndDestroy();
   729     iComposerPluginArray.Close();
   779     iComposerPluginArray.Close();
   730 
   780 
   731     WRITELOG( "CHarvesterAO::DeleteComposers() - end" );
   781     WRITELOG( "CHarvesterAO::DeleteComposers() - end" );
   736 // ---------------------------------------------------------------------------
   786 // ---------------------------------------------------------------------------
   737 //
   787 //
   738 TBool CHarvesterAO::IsComposingReady()
   788 TBool CHarvesterAO::IsComposingReady()
   739     {
   789     {
   740     WRITELOG( "CHarvesterAO::IsComposingReady()" );
   790     WRITELOG( "CHarvesterAO::IsComposingReady()" );
       
   791     OstTrace0( TRACE_NORMAL, CHARVESTERAO_ISCOMPOSINGREADY, "CHarvesterAO::IsComposingReady" );
   741     
   792     
   742     const TInt count( iComposerPluginArray.Count() );
   793     const TInt count( iComposerPluginArray.Count() );
   743     for ( TInt i = count; --i >= 0; )
   794     for ( TInt i = count; --i >= 0; )
   744         {
   795         {
   745         if ( iComposerPluginArray[i]->IsComposingComplete() == EFalse )
   796         if ( iComposerPluginArray[i]->IsComposingComplete() == EFalse )
   757 // ---------------------------------------------------------------------------
   808 // ---------------------------------------------------------------------------
   758 //
   809 //
   759 void CHarvesterAO::ReadItemFromQueueL()
   810 void CHarvesterAO::ReadItemFromQueueL()
   760     {
   811     {
   761     WRITELOG( "CHarvesterAO::ReadItemFromQueueL()" );
   812     WRITELOG( "CHarvesterAO::ReadItemFromQueueL()" );
       
   813     OstTrace0( TRACE_NORMAL, CHARVESTERAO_READITEMFROMQUEUEL, "CHarvesterAO::ReadItemFromQueueL" );
   762     
   814     
   763     CHarvesterData* hd = iQueue->GetNextItem();
   815     CHarvesterData* hd = iQueue->GetNextItem();
   764     
   816     
   765     if ( hd->ObjectType() == EPlaceholder )
   817     if ( hd->ObjectType() == EPlaceholder )
   766     	{
   818     	{
   871 // ---------------------------------------------------------------------------
   923 // ---------------------------------------------------------------------------
   872 //
   924 //
   873 void CHarvesterAO::HandlePlaceholdersL( TBool aCheck )
   925 void CHarvesterAO::HandlePlaceholdersL( TBool aCheck )
   874 	{
   926 	{
   875 	WRITELOG( "CHarvesterAO::HandlePlaceholdersL()" );
   927 	WRITELOG( "CHarvesterAO::HandlePlaceholdersL()" );
       
   928     OstTrace0( TRACE_NORMAL, CHARVESTERAO_HANDLEPLACEHOLDERSL, "CHarvesterAO::HandlePlaceholdersL" );
   876 
   929 
   877 	RPointerArray<CMdEObject> mdeObjectArray;
   930 	RPointerArray<CMdEObject> mdeObjectArray;
   878 	CleanupClosePushL( mdeObjectArray );
   931 	CleanupClosePushL( mdeObjectArray );
   879 
   932 
   880 	TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   933 	TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   972 		    const TDesC& uri = hd->Uri();
  1025 		    const TDesC& uri = hd->Uri();
   973 		    const TInt err = iFs.Entry( uri, *entry );
  1026 		    const TInt err = iFs.Entry( uri, *entry );
   974 		    if ( err != KErrNone )
  1027 		    if ( err != KErrNone )
   975 		    	{
  1028 		    	{
   976 		    	WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - cannot create placeholder data object for camera. file does not exists" );
  1029 		    	WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - cannot create placeholder data object for camera. file does not exists" );
       
  1030 		    	OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HANDLEPLACEHOLDERSL, "CHarvesterAO::HandlePlaceholdersL- cannot create placeholder data object for camera. file does not exists" );
       
  1031 		    	
   977 	    		// notify observer
  1032 	    		// notify observer
   978 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), err );
  1033 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), err );
   979 				delete hd;
  1034 				delete hd;
   980 				hd = NULL;
  1035 				hd = NULL;
   981 				iPHArray.Remove( i );
  1036 				iPHArray.Remove( i );
  1000 			{
  1055 			{
  1001 			phData = static_cast<CPlaceholderData*> ( hd->ClientData() );
  1056 			phData = static_cast<CPlaceholderData*> ( hd->ClientData() );
  1002 		    if( !phData )
  1057 		    if( !phData )
  1003 		    	{
  1058 		    	{
  1004 		    	WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - Placeholder data object NULL - abort" );
  1059 		    	WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - Placeholder data object NULL - abort" );
       
  1060 		    	OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_HANDLEPLACEHOLDERSL, "CHarvesterAO::HandlePlaceholdersL - Placeholder data object NULL - abort" );
       
  1061 		    	
  1005 		    	const TInt error( KErrUnknown );
  1062 		    	const TInt error( KErrUnknown );
  1006 	    		// notify observer
  1063 	    		// notify observer
  1007 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), error );
  1064 	    	    HarvestCompleted( hd->ClientId(), hd->Uri(), error );
  1008 				delete hd;
  1065 				delete hd;
  1009 				hd = NULL;
  1066 				hd = NULL;
  1086     	
  1143     	
  1087 	    const TInt isPreinstalled = ph->Preinstalled();
  1144 	    const TInt isPreinstalled = ph->Preinstalled();
  1088 	    if( isPreinstalled == MdeConstants::MediaObject::EPreinstalled )
  1145 	    if( isPreinstalled == MdeConstants::MediaObject::EPreinstalled )
  1089 	    	{
  1146 	    	{
  1090 	    	WRITELOG("CHarvesterAO::HandlePlaceholdersL() - preinstalled");
  1147 	    	WRITELOG("CHarvesterAO::HandlePlaceholdersL() - preinstalled");
       
  1148 	    	OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_HANDLEPLACEHOLDERSL, "CHarvesterAO::HandlePlaceholdersL - preinstalled" );
       
  1149 	    	
  1091 	    	mdeObject->AddInt32PropertyL( *iPropDefs->iPreinstalledPropertyDef, isPreinstalled );
  1150 	    	mdeObject->AddInt32PropertyL( *iPropDefs->iPreinstalledPropertyDef, isPreinstalled );
  1092 	    	}
  1151 	    	}
  1093 		
  1152 		
  1094 	    hd->SetEventType( EHarvesterEdit );
  1153 	    hd->SetEventType( EHarvesterEdit );
  1095 		
  1154 		
  1191             }
  1250             }
  1192 		
  1251 		
  1193 		if( objDefStr.Length() == 0 )
  1252 		if( objDefStr.Length() == 0 )
  1194 			{
  1253 			{
  1195 			WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - cannot get object definition" );
  1254 			WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - cannot get object definition" );
       
  1255 			OstTrace0( TRACE_NORMAL, CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - cannot get object definition" );
       
  1256 			
  1196 			isError = ETrue;
  1257 			isError = ETrue;
  1197 			}
  1258 			}
  1198 		else if( objDefStr == KInUse )
  1259 		else if( objDefStr == KInUse )
  1199 		    {
  1260 		    {
  1200             aHD->SetErrorCode( KMdEErrHarvestingFailed );
  1261             aHD->SetErrorCode( KMdEErrHarvestingFailed );
  1219 				aHD->SetEventType( EHarvesterEdit );
  1280 				aHD->SetEventType( EHarvesterEdit );
  1220 				}
  1281 				}
  1221 			else
  1282 			else
  1222 				{
  1283 				{
  1223 				WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - getting mdeobject" );
  1284 				WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - getting mdeobject" );
       
  1285 				OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - getting mdeobject" );
       
  1286 				
  1224 				TRAP( mdeError, mdeObject = iMdeObjectHandler->GetMetadataObjectL( *aHD, objDefStr ) );
  1287 				TRAP( mdeError, mdeObject = iMdeObjectHandler->GetMetadataObjectL( *aHD, objDefStr ) );
  1225 				}
  1288 				}
  1226 			TInt harvesterError = KErrNone;
  1289 			TInt harvesterError = KErrNone;
  1227 			if( mdeError != KErrNone)
  1290 			if( mdeError != KErrNone)
  1228 				{
  1291 				{
  1229 				WRITELOG1( "CHarvesterAO::CheckFileExtensionAndHarvestL() - cannot get mde object. error: %d", mdeError );
  1292 				WRITELOG1( "CHarvesterAO::CheckFileExtensionAndHarvestL() - cannot get mde object. error: %d", mdeError );
       
  1293 				OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - cannot get mde object. error: %d", mdeError );
       
  1294 				
  1230 				MdsUtils::ConvertTrapError( mdeError, harvesterError );
  1295 				MdsUtils::ConvertTrapError( mdeError, harvesterError );
  1231 				if( harvesterError == KMdEErrHarvestingFailedPermanent )
  1296 				if( harvesterError == KMdEErrHarvestingFailedPermanent )
  1232 					{
  1297 					{
  1233 					WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - permanent fail" );
  1298 					WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - permanent fail" );
       
  1299 					OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - permanent fail" );
       
  1300 					
  1234 					isError = ETrue;
  1301 					isError = ETrue;
  1235 					}
  1302 					}
  1236 				else if ( harvesterError == KMdEErrHarvestingFailed )
  1303 				else if ( harvesterError == KMdEErrHarvestingFailed )
  1237 					{
  1304 					{
  1238 	                WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - KMdEErrHarvestingFailed");
  1305 	                WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - KMdEErrHarvestingFailed");
       
  1306 	                OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - KMdEErrHarvestingFailed" );
       
  1307 	                
  1239 	                aHD->SetErrorCode( KMdEErrHarvestingFailed );
  1308 	                aHD->SetErrorCode( KMdEErrHarvestingFailed );
  1240 	                HarvestingCompleted( aHD );
  1309 	                HarvestingCompleted( aHD );
  1241 	                return;
  1310 	                return;
  1242 					}
  1311 					}
  1243 				}
  1312 				}
  1244 
  1313 
  1245 			if( !mdeObject )
  1314 			if( !mdeObject )
  1246 				{
  1315 				{
  1247 				WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - mde object is null. stop harvesting" );
  1316 				WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - mde object is null. stop harvesting" );
       
  1317 				OstTrace0( TRACE_NORMAL, DUP5_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - mde object is null. stop harvesting" );
       
  1318 				
  1248 				isError = ETrue;
  1319 				isError = ETrue;
  1249 				}
  1320 				}
  1250 			}
  1321 			}
  1251 		if( isError )
  1322 		if( isError )
  1252 			{
  1323 			{
  1282 	TInt pluginErr = KErrNone;
  1353 	TInt pluginErr = KErrNone;
  1283     TRAPD( err, pluginErr = iHarvesterPluginFactory->HarvestL( aHD ));
  1354     TRAPD( err, pluginErr = iHarvesterPluginFactory->HarvestL( aHD ));
  1284     if ( err != KErrNone )
  1355     if ( err != KErrNone )
  1285     	{
  1356     	{
  1286     	WRITELOG1( "CHarvesterAO::CheckFileExtensionAndHarvestL() - plugin error: %d", err );
  1357     	WRITELOG1( "CHarvesterAO::CheckFileExtensionAndHarvestL() - plugin error: %d", err );
       
  1358     	OstTrace1( TRACE_NORMAL, DUP6_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - plugin error: %d", err );
       
  1359     	
  1287     	if ( err == KErrInUse )
  1360     	if ( err == KErrInUse )
  1288     		{
  1361     		{
  1289             WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - item in use" );
  1362             WRITELOG( "CHarvesterAO::CheckFileExtensionAndHarvestL() - item in use" );
       
  1363             OstTrace0( TRACE_NORMAL, DUP7_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL - item in use" );
       
  1364             
  1290             aHD->SetErrorCode( KMdEErrHarvestingFailed );
  1365             aHD->SetErrorCode( KMdEErrHarvestingFailed );
  1291             HarvestingCompleted( aHD );
  1366             HarvestingCompleted( aHD );
  1292             return;
  1367             return;
  1293     		}
  1368     		}
  1294     	
  1369     	
  1303     	HarvestingCompleted( aHD );
  1378     	HarvestingCompleted( aHD );
  1304     	return;
  1379     	return;
  1305     	}
  1380     	}
  1306     
  1381     
  1307     WRITELOG1("CHarvesterAO::CheckFileExtensionAndHarvestL() - ends with error %d", pluginErr );
  1382     WRITELOG1("CHarvesterAO::CheckFileExtensionAndHarvestL() - ends with error %d", pluginErr );
       
  1383     OstTrace1( TRACE_NORMAL, DUP8_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL) - ends with error %d", pluginErr );
       
  1384     
  1308     SetNextRequest( ERequestHarvest );
  1385     SetNextRequest( ERequestHarvest );
  1309     }
  1386     }
  1310 
  1387 
  1311 // ---------------------------------------------------------------------------
  1388 // ---------------------------------------------------------------------------
  1312 // HarvestingCompleted
  1389 // HarvestingCompleted
  1313 // ---------------------------------------------------------------------------
  1390 // ---------------------------------------------------------------------------
  1314 //
  1391 //
  1315 void CHarvesterAO::HarvestingCompleted( CHarvesterData* aHD )
  1392 void CHarvesterAO::HarvestingCompleted( CHarvesterData* aHD )
  1316     {
  1393     {
  1317     WRITELOG( "CHarvesterAO::HarvestingCompleted()" );
  1394     WRITELOG( "CHarvesterAO::HarvestingCompleted()" );
  1318     
  1395     OstTrace0( TRACE_NORMAL, CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted" );
       
  1396         
  1319     if ( aHD->ErrorCode() == KErrNone )
  1397     if ( aHD->ErrorCode() == KErrNone )
  1320         {
  1398         {
  1321         iReHarvester->CheckItem( *aHD );
  1399         iReHarvester->CheckItem( *aHD );
  1322 
  1400 
  1323         TInt mdeError = KErrNone;
  1401         TInt mdeError = KErrNone;
  1324         if( !aHD->TakeSnapshot() )
  1402         if( !aHD->TakeSnapshot() )
  1325         	{
  1403         	{
  1326         	WRITELOG( "CHarvesterAO::HarvestingCompleted() origin is not camera or clf" );
  1404         	WRITELOG( "CHarvesterAO::HarvestingCompleted() origin is not camera or clf" );
       
  1405         	OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted origin is not camera or clf" );
       
  1406         	
  1327             aHD->MdeObject().SetPlaceholder( EFalse );
  1407             aHD->MdeObject().SetPlaceholder( EFalse );
  1328             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder ) );
  1408             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder ) );
  1329         	TRAP( mdeError, iMdeObjectHandler->SetMetadataObjectL( *aHD ) );
  1409         	TRAP( mdeError, iMdeObjectHandler->SetMetadataObjectL( *aHD ) );
  1330         	}
  1410         	}
  1331 
  1411 
  1332         if(mdeError != KErrNone)
  1412         if(mdeError != KErrNone)
  1333         	{
  1413         	{
  1334         	WRITELOG( "==============================ERROR===============================" );
  1414         	WRITELOG( "==============================ERROR===============================" );
  1335             WRITELOG( "CHarvesterAO::HarvestingCompleted() - cannot set metadata object" );
  1415             WRITELOG( "CHarvesterAO::HarvestingCompleted() - cannot set metadata object" );
  1336             WRITELOG( "==============================ERROR done =========================" );
  1416             WRITELOG( "==============================ERROR done =========================" );
       
  1417             OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - cannot set metadata object" );
       
  1418             
  1337             delete aHD;
  1419             delete aHD;
  1338             aHD = NULL;
  1420             aHD = NULL;
  1339 
  1421 
  1340             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ) );
  1422             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ) );
  1341         	}
  1423         	}
  1342         else
  1424         else
  1343         	{
  1425         	{
  1344         	WRITELOG( "CHarvesterAO::HarvestingCompleted() mdeError == KErrNone" );
  1426         	WRITELOG( "CHarvesterAO::HarvestingCompleted() mdeError == KErrNone" );
       
  1427         	OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted mdeError == KErrNone" );
       
  1428         	
  1345 	        if ( aHD->TakeSnapshot() && iCtxEngine )
  1429 	        if ( aHD->TakeSnapshot() && iCtxEngine )
  1346 	            {
  1430 	            {
  1347 	            WRITELOG( "CHarvesterAO::HarvestingCompleted() - Taking a context snapshot." );
  1431 	            WRITELOG( "CHarvesterAO::HarvestingCompleted() - Taking a context snapshot." );
       
  1432 	            OstTrace0( TRACE_NORMAL, DUP5_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - Taking a context snapshot." );
       
  1433 	            
  1348 	            iCtxEngine->ContextSnapshot( *this, *aHD );
  1434 	            iCtxEngine->ContextSnapshot( *this, *aHD );
  1349 	            }
  1435 	            }
  1350 	        else
  1436 	        else
  1351 	        	{
  1437 	        	{
  1352 	        	TLocationData* locData = aHD->LocationData();
  1438 	        	TLocationData* locData = aHD->LocationData();
  1353 	        	if( locData )
  1439 	        	if( locData )
  1354 	        		{
  1440 	        		{
  1355 	        		WRITELOG( "CHarvesterAO::HarvestingCompleted() - Creating location object. " );
  1441 	        		WRITELOG( "CHarvesterAO::HarvestingCompleted() - Creating location object. " );
       
  1442 	        		OstTrace0( TRACE_NORMAL, DUP6_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - Creating location object." );
       
  1443 	        		
  1356 	        		RLocationObjectManipulator lo;
  1444 	        		RLocationObjectManipulator lo;
  1357 	        		
  1445 	        		
  1358 	        		const TInt loError = lo.Connect();     		
  1446 	        		const TInt loError = lo.Connect();     		
  1359 	        		
  1447 	        		
  1360 	        		if (loError == KErrNone)
  1448 	        		if (loError == KErrNone)
  1361 	        			{
  1449 	        			{
  1362 	        			TInt err = lo.CreateLocationObject( *locData, aHD->MdeObject().Id() );
  1450 	        			TInt err = lo.CreateLocationObject( *locData, aHD->MdeObject().Id() );
  1363 	        			if( err != KErrNone )
  1451 	        			if( err != KErrNone )
  1364 	        				{
  1452 	        				{
  1365 	        				WRITELOG( "CHarvesterAO::HarvestingCompleted() - Location object creation failed!!!" );
  1453 	        				WRITELOG( "CHarvesterAO::HarvestingCompleted() - Location object creation failed!!!" );
       
  1454 	        				OstTrace0( TRACE_NORMAL, DUP7_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - Location object creation failed!!!" );
       
  1455 	        				
  1366 	        				}
  1456 	        				}
  1367 	        			}
  1457 	        			}
  1368 	        		else
  1458 	        		else
  1369 	        			{
  1459 	        			{
  1370 	        			WRITELOG( "CHarvesterAO::HarvestingCompleted() - LocationObjectManipulator connect failed!!!" );
  1460 	        			WRITELOG( "CHarvesterAO::HarvestingCompleted() - LocationObjectManipulator connect failed!!!" );
       
  1461 	        			OstTrace0( TRACE_NORMAL, DUP8_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - LocationObjectManipulator connect failed!!" );	        			
  1371 	        			}
  1462 	        			}
  1372 	        		
  1463 	        		
  1373 	        		lo.Close();
  1464 	        		lo.Close();
  1374 	        		}
  1465 	        		}
  1375 	        	
  1466 	        	
  1383     else
  1474     else
  1384         {
  1475         {
  1385 #ifdef _DEBUG
  1476 #ifdef _DEBUG
  1386         WRITELOG( "==============================ERROR===============================" );
  1477         WRITELOG( "==============================ERROR===============================" );
  1387         WRITELOG1( "CHarvesterAO::HarvestingCompleted() - not OK! Error: %d", aHD->ErrorCode() );
  1478         WRITELOG1( "CHarvesterAO::HarvestingCompleted() - not OK! Error: %d", aHD->ErrorCode() );
       
  1479         OstTrace1( TRACE_NORMAL, DUP9_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - not OK! Error: %d", aHD->ErrorCode() );
       
  1480         
  1388 #endif
  1481 #endif
  1389 				 
  1482 				 
  1390 		const TInt errorCode( aHD->ErrorCode() );
  1483 		const TInt errorCode( aHD->ErrorCode() );
  1391         if ( errorCode== KMdEErrHarvestingFailed )
  1484         if ( errorCode== KMdEErrHarvestingFailed )
  1392             {
  1485             {
  1393 #ifdef _DEBUG
  1486 #ifdef _DEBUG
  1394             WRITELOG1("CHarvesterAO::HarvestingCompleted() - KMdEErrHarvestingFailed - %S - reharvesting", &aHD->Uri() );
  1487             WRITELOG1("CHarvesterAO::HarvestingCompleted() - KMdEErrHarvestingFailed - %S - reharvesting", &aHD->Uri() );
       
  1488             OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - KMdEErrHarvestingFailed - reharvesting" );
  1395 #endif
  1489 #endif
  1396             iReHarvester->AddItem( aHD );
  1490             iReHarvester->AddItem( aHD );
  1397             }
  1491             }
  1398         else if ( errorCode == KMdEErrHarvestingFailedPermanent ||
  1492         else if ( errorCode == KMdEErrHarvestingFailedPermanent ||
  1399                 errorCode == KMdEErrHarvestingFailedUnknown )
  1493                 errorCode == KMdEErrHarvestingFailedUnknown )
  1400             {
  1494             {
  1401             WRITELOG( "CHarvesterAO::HarvestingCompleted() - KMdEErrHarvestingFailedPermanent - no need to re-harvest!" );
  1495             WRITELOG( "CHarvesterAO::HarvestingCompleted() - KMdEErrHarvestingFailedPermanent - no need to re-harvest!" );
  1402             
  1496             OstTrace0( TRACE_NORMAL, DUP10_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - KMdEErrHarvestingFailedPermanent - no need to re-harvest!" );            
  1403             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ) );
  1497             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ) );
  1404             
  1498             
  1405             delete aHD;
  1499             delete aHD;
  1406 			aHD = NULL;
  1500 			aHD = NULL;
  1407             }
  1501             }
  1408         else
  1502         else
  1409             {
  1503             {
  1410             WRITELOG1( "CHarvesterAO::HarvestingCompleted() - unknown error: %d", errorCode );
  1504             WRITELOG1( "CHarvesterAO::HarvestingCompleted() - unknown error: %d", errorCode );
       
  1505             OstTrace1( TRACE_NORMAL, DUP11_CHARVESTERAO_HARVESTINGCOMPLETED, "CHarvesterAO::HarvestingCompleted - unknown error: %d", errorCode );
       
  1506             
  1411             delete aHD;
  1507             delete aHD;
  1412             aHD = NULL;
  1508             aHD = NULL;
  1413             }
  1509             }
  1414         
  1510         
  1415         WRITELOG( "==============================ERROR done =========================" );
  1511         WRITELOG( "==============================ERROR done =========================" );
       
  1512         OstTrace0( TRACE_NORMAL, DUP12_CHARVESTERAO_HARVESTINGCOMPLETED, "==============================ERROR done =========================" );
       
  1513         
  1416         }
  1514         }
  1417            
  1515            
  1418     SetNextRequest( ERequestHarvest );
  1516     SetNextRequest( ERequestHarvest );
  1419     }
  1517     }
  1420 
  1518 
  1423 // ---------------------------------------------------------------------------
  1521 // ---------------------------------------------------------------------------
  1424 //
  1522 //
  1425 void CHarvesterAO::HandleSessionOpened( CMdESession& aSession, TInt aError )
  1523 void CHarvesterAO::HandleSessionOpened( CMdESession& aSession, TInt aError )
  1426     {
  1524     {
  1427     WRITELOG( "HarvesterThread::HandleSessionOpened()" );
  1525     WRITELOG( "HarvesterThread::HandleSessionOpened()" );
  1428     
  1526     OstTrace0( TRACE_NORMAL, CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened" );
       
  1527         
  1429     if ( KErrNone == aError )
  1528     if ( KErrNone == aError )
  1430         {
  1529         {
  1431         TBool isTNMDaemonEnabled( EFalse );
  1530         TBool isTNMDaemonEnabled( EFalse );
  1432         TRAP_IGNORE( CHarvesterCenRepUtil::IsThumbnailDaemonEnabledL( isTNMDaemonEnabled ) );
  1531         TRAP_IGNORE( CHarvesterCenRepUtil::IsThumbnailDaemonEnabledL( isTNMDaemonEnabled ) );
  1433 
  1532 
  1442         	iMdeSessionInitialized = ETrue;
  1541         	iMdeSessionInitialized = ETrue;
  1443             }
  1542             }
  1444         else
  1543         else
  1445         	{
  1544         	{
  1446             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error creating mde harvester session" );
  1545             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error creating mde harvester session" );
       
  1546             OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened) - error creating mde harvester session" );
  1447         	}
  1547         	}
  1448 
  1548 
  1449         // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
  1549         // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
  1450         TRAP( errorTrap, iCtxEngine = CContextEngine::GetInstanceL( this ) ); // Create the context engine 
  1550         TRAP( errorTrap, iCtxEngine = CContextEngine::GetInstanceL( this ) ); // Create the context engine 
  1451         if ( errorTrap != KErrNone )
  1551         if ( errorTrap != KErrNone )
  1452                 {
  1552                 {
  1453                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - Context Engine creation failed" );
  1553                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - Context Engine creation failed" );
       
  1554                 OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - Context Engine creation failed" );                
  1454                 }
  1555                 }
  1455         
  1556         
  1456 #ifdef _DEBUG        
  1557 #ifdef _DEBUG        
  1457         TRAP( errorTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1558         TRAP( errorTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1458         if ( errorTrap != KErrNone )
  1559         if ( errorTrap != KErrNone )
  1459                 {
  1560                 {
  1460                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - ObjectHandler creation failed" );
  1561                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - ObjectHandler creation failed" );
       
  1562                 OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - ObjectHandler creation failed" );
  1461                 }
  1563                 }
  1462         
  1564         
  1463         // Setting up monitor plugins
  1565         // Setting up monitor plugins
  1464         TRAP( errorTrap, LoadMonitorPluginsL() );
  1566         TRAP( errorTrap, LoadMonitorPluginsL() );
  1465         if ( errorTrap != KErrNone )
  1567         if ( errorTrap != KErrNone )
  1466             {
  1568             {
  1467             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error loading monitor plugins" );
  1569             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error loading monitor plugins" );
       
  1570             OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - error loading monitor plugins" );            
  1468             }
  1571             }
  1469 
  1572 
  1470         // To check if the default namespace structure is in order
  1573         // To check if the default namespace structure is in order
  1471         TRAP( errorTrap, PreallocateNamespaceL( aSession.GetDefaultNamespaceDefL() ) );
  1574         TRAP( errorTrap, PreallocateNamespaceL( aSession.GetDefaultNamespaceDefL() ) );
  1472         if ( errorTrap != KErrNone )
  1575         if ( errorTrap != KErrNone )
  1473             {
  1576             {
  1474             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error loading default schema" );
  1577             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error loading default schema" );
       
  1578             OstTrace0( TRACE_NORMAL, DUP5_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - error loading default schema" );            
  1475             }
  1579             }
  1476         
  1580         
  1477         TRAP( errorTrap, StartComposersL() );
  1581         TRAP( errorTrap, StartComposersL() );
  1478         if ( errorTrap != KErrNone )
  1582         if ( errorTrap != KErrNone )
  1479             {
  1583             {
  1480             WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start composer plugins" );
  1584             WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start composer plugins" );
       
  1585             OstTrace0( TRACE_NORMAL, DUP6_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - couldn't start composer plugins" );
       
  1586             
  1481             }
  1587             }
  1482 #else
  1588 #else
  1483         // The idea here is that all of these  methods needs to be called,
  1589         // The idea here is that all of these  methods needs to be called,
  1484         // even if some leave, thus the several TRAPs
  1590         // even if some leave, thus the several TRAPs
  1485         TRAP_IGNORE( iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1591         TRAP_IGNORE( iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1493 
  1599 
  1494         TRAP( errorTrap, iDiskFullNotifier = CMdSHarvesterDiskspaceObserverAO::NewL( *this, KDiskFullThreshold, KMdsSqlDbDefaultName ) );
  1600         TRAP( errorTrap, iDiskFullNotifier = CMdSHarvesterDiskspaceObserverAO::NewL( *this, KDiskFullThreshold, KMdsSqlDbDefaultName ) );
  1495         if ( errorTrap != KErrNone )
  1601         if ( errorTrap != KErrNone )
  1496             {
  1602             {
  1497             WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start diskspace observer" );
  1603             WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start diskspace observer" );
       
  1604             OstTrace0( TRACE_NORMAL, DUP7_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - couldn't start diskspace observer" );            
  1498             }
  1605             }
  1499         
  1606         
  1500         TRAP( errorTrap, iOnDemandAO = COnDemandAO::NewL( *iMdESession, *iQueue, 
  1607         TRAP( errorTrap, iOnDemandAO = COnDemandAO::NewL( *iMdESession, *iQueue, 
  1501         		*iHarvesterPluginFactory, &iReadyPHArray ) );
  1608         		*iHarvesterPluginFactory, &iReadyPHArray ) );
  1502         if ( errorTrap == KErrNone )
  1609         if ( errorTrap == KErrNone )
  1503         	{
  1610         	{
  1504         	TRAP( errorTrap, iOnDemandAO->StartL() );
  1611         	TRAP( errorTrap, iOnDemandAO->StartL() );
  1505         	if ( errorTrap != KErrNone )
  1612         	if ( errorTrap != KErrNone )
  1506         		{
  1613         		{
  1507         		WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start on demand observer" );
  1614         		WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start on demand observer" );
       
  1615         		OstTrace0( TRACE_NORMAL, DUP8_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - couldn't start on demand observer" );        		
  1508         		}
  1616         		}
  1509         	}
  1617         	}
  1510         else
  1618         else
  1511         	{
  1619         	{
  1512         	WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't create on demand observer" );
  1620         	WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't create on demand observer" );
       
  1621         	OstTrace0( TRACE_NORMAL, DUP9_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - couldn't create on demand observer" );        	
  1513         	}
  1622         	}
  1514     	
  1623     	
  1515         // Initializing pause indicator
  1624         // Initializing pause indicator
  1516         iServerPaused = EFalse;
  1625         iServerPaused = EFalse;
  1517 		
  1626 		
  1518 #ifdef _DEBUG
  1627 #ifdef _DEBUG
  1519         WRITELOG( "HarvesterThread::HandleSessionOpened() - Succeeded!" );
  1628         WRITELOG( "HarvesterThread::HandleSessionOpened() - Succeeded!" );
  1520         
  1629         OstTrace0( TRACE_NORMAL, DUP10_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - Succeeded!" );
       
  1630                 
  1521         TBool isRomScanEnabled( EFalse );
  1631         TBool isRomScanEnabled( EFalse );
  1522         TRAP_IGNORE( CHarvesterCenRepUtil::IsRomScanEnabledL( isRomScanEnabled ) );
  1632         TRAP_IGNORE( CHarvesterCenRepUtil::IsRomScanEnabledL( isRomScanEnabled ) );
  1523         
  1633         
  1524         if( isRomScanEnabled )
  1634         if( isRomScanEnabled )
  1525             {
  1635             {
  1526             TRAP( errorTrap, BootRomScanL() );
  1636             TRAP( errorTrap, BootRomScanL() );
  1527             if( errorTrap != KErrNone )
  1637             if( errorTrap != KErrNone )
  1528                 {
  1638                 {
  1529                 WRITELOG1( "CHarvesterAO::HandleSessionOpened() - BootRomScanL() returned error: %d", errorTrap );
  1639                 WRITELOG1( "CHarvesterAO::HandleSessionOpened() - BootRomScanL() returned error: %d", errorTrap );
       
  1640                 OstTrace1( TRACE_NORMAL, DUP11_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - BootRomScanL() returned error: %d", errorTrap );
  1530                 }
  1641                 }
  1531             }
  1642             }
  1532 
  1643 
  1533         TRAP( errorTrap, BootPartialRestoreScanL() );
  1644         TRAP( errorTrap, BootPartialRestoreScanL() );
  1534         if( errorTrap != KErrNone )
  1645         if( errorTrap != KErrNone )
  1535         	{
  1646         	{
  1536         	WRITELOG1( "CHarvesterAO::HandleSessionOpened() - BootPartialRestoreScanL() returned error: %d", errorTrap );
  1647         	WRITELOG1( "CHarvesterAO::HandleSessionOpened() - BootPartialRestoreScanL() returned error: %d", errorTrap );
       
  1648         	OstTrace1( TRACE_NORMAL, DUP12_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - BootPartialRestoreScanL() returned error: %d", errorTrap );        	
  1537         	}
  1649         	}
  1538 #else
  1650 #else
  1539         // The idea here is that all of these three methods needs to be called,
  1651         // The idea here is that all of these three methods needs to be called,
  1540         // even if some leave, thus the two TRAPs
  1652         // even if some leave, thus the two TRAPs
  1541         TBool isRomScanEnabled( EFalse );
  1653         TBool isRomScanEnabled( EFalse );
  1572         }
  1684         }
  1573     else
  1685     else
  1574         {
  1686         {
  1575         iServerPaused = ETrue;    
  1687         iServerPaused = ETrue;    
  1576         WRITELOG1( "HarvesterThread::HandleSessionOpened() - Failed: %d!", aError );
  1688         WRITELOG1( "HarvesterThread::HandleSessionOpened() - Failed: %d!", aError );
       
  1689         OstTrace1( TRACE_NORMAL, DUP13_CHARVESTERAO_HANDLESESSIONOPENED, "CHarvesterAO::HandleSessionOpened - Failed: %d!", aError );
  1577         }
  1690         }
  1578     }
  1691     }
  1579 
  1692 
  1580 // ---------------------------------------------------------------------------
  1693 // ---------------------------------------------------------------------------
  1581 // HandleSessionError
  1694 // HandleSessionError
  1583 //
  1696 //
  1584 void CHarvesterAO::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
  1697 void CHarvesterAO::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
  1585     {       
  1698     {       
  1586     if ( KErrNone != aError )
  1699     if ( KErrNone != aError )
  1587         {
  1700         {
  1588         WRITELOG1( "HarvesterThread::HandleSessionError() - Error: %d!", aError );        
  1701         WRITELOG1( "HarvesterThread::HandleSessionError() - Error: %d!", aError );
       
  1702         OstTrace1( TRACE_NORMAL, CHARVESTERAO_HANDLESESSIONERROR, "CHarvesterAO::HandleSessionError - Error: %d!", aError );
  1589         }
  1703         }
  1590     }
  1704     }
  1591 
  1705 
  1592 // ---------------------------------------------------------------------------
  1706 // ---------------------------------------------------------------------------
  1593 // ContextInitializationStatus
  1707 // ContextInitializationStatus
  1594 // ---------------------------------------------------------------------------
  1708 // ---------------------------------------------------------------------------
  1595 //
  1709 //
  1596 void CHarvesterAO::ContextInitializationStatus( TInt aErrorCode )
  1710 void CHarvesterAO::ContextInitializationStatus( TInt aErrorCode )
  1597     {
  1711     {
  1598     WRITELOG( "CHarvesterAO::ContextInitializationStatus()" );
  1712     WRITELOG( "CHarvesterAO::ContextInitializationStatus()" );
       
  1713     OstTrace0( TRACE_NORMAL, CHARVESTERAO_CONTEXTINITIALIZATIONSTATUS, "CHarvesterAO::ContextInitializationStatus" );    
  1599     
  1714     
  1600     if ( KErrNone == aErrorCode )
  1715     if ( KErrNone == aErrorCode )
  1601         {
  1716         {
  1602         WRITELOG( "HarvesterThread::ContextInitializationStatus() - Succeeded!" );
  1717         WRITELOG( "HarvesterThread::ContextInitializationStatus() - Succeeded!" );
       
  1718         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_CONTEXTINITIALIZATIONSTATUS, "CHarvesterAO::ContextInitializationStatus - Succeeded!" );
       
  1719         
  1603         iContextEngineInitialized = ETrue;
  1720         iContextEngineInitialized = ETrue;
  1604         if ( iMdeSessionInitialized )
  1721         if ( iMdeSessionInitialized )
  1605             {
  1722             {
  1606             iCtxEngine->SetMdeSession( iMdESession );
  1723             iCtxEngine->SetMdeSession( iMdESession );
  1607             }
  1724             }
  1608         }
  1725         }
  1609     else
  1726     else
  1610         {
  1727         {
  1611         WRITELOG1( "HarvesterThread::ContextInitializationStatus() - Failed: %d!", aErrorCode );
  1728         WRITELOG1( "HarvesterThread::ContextInitializationStatus() - Failed: %d!", aErrorCode );
       
  1729         OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_CONTEXTINITIALIZATIONSTATUS, "CHarvesterAO::ContextInitializationStatus - Failed: %d!", aErrorCode );
       
  1730         
  1612         }
  1731         }
  1613     }
  1732     }
  1614 
  1733 
  1615 // ---------------------------------------------------------------------------
  1734 // ---------------------------------------------------------------------------
  1616 // PauseHarvester
  1735 // PauseHarvester
  1617 // ---------------------------------------------------------------------------
  1736 // ---------------------------------------------------------------------------
  1618 //
  1737 //
  1619 TInt CHarvesterAO::PauseHarvester()
  1738 TInt CHarvesterAO::PauseHarvester()
  1620     {
  1739     {
  1621     WRITELOG( "CHarvesterAO::PauseHarvester()" );
  1740     WRITELOG( "CHarvesterAO::PauseHarvester()" );
       
  1741     OstTrace0( TRACE_NORMAL, CHARVESTERAO_PAUSEHARVESTER, "CHarvesterAO::PauseHarvester" );
  1622     
  1742     
  1623     iHarvesterPluginFactory->PauseHarvester( ETrue );
  1743     iHarvesterPluginFactory->PauseHarvester( ETrue );
  1624     iServerPaused = ETrue;
  1744     iServerPaused = ETrue;
  1625     
  1745     
  1626     if( !iRamFull && !iDiskFull && !iUnmountDetected )
  1746     if( !iRamFull && !iDiskFull && !iUnmountDetected )
  1628         iManualPauseEnabled = ETrue;
  1748         iManualPauseEnabled = ETrue;
  1629         }
  1749         }
  1630     
  1750     
  1631     // Everything is paused
  1751     // Everything is paused
  1632     WRITELOG( "CHarvesterAO::PauseHarvester() - Moving paused state paused" );
  1752     WRITELOG( "CHarvesterAO::PauseHarvester() - Moving paused state paused" );
  1633     
  1753     OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_PAUSEHARVESTER, "CHarvesterAO::PauseHarvester - Moving paused state paused" );
       
  1754         
  1634     return KErrNone;
  1755     return KErrNone;
  1635     }
  1756     }
  1636 
  1757 
  1637 // ---------------------------------------------------------------------------
  1758 // ---------------------------------------------------------------------------
  1638 // ResumeHarvester
  1759 // ResumeHarvester
  1639 // ---------------------------------------------------------------------------
  1760 // ---------------------------------------------------------------------------
  1640 //
  1761 //
  1641 void CHarvesterAO::ResumeHarvesterL()
  1762 void CHarvesterAO::ResumeHarvesterL()
  1642     {
  1763     {
  1643     WRITELOG( "CHarvesterAO::ResumeHarvesterL()" );
  1764     WRITELOG( "CHarvesterAO::ResumeHarvesterL()" );
       
  1765     OstTrace0( TRACE_NORMAL, CHARVESTERAO_RESUMEHARVESTERL, "CHarvesterAO::ResumeHarvesterL" );
  1644     
  1766     
  1645     iHarvesterPluginFactory->PauseHarvester( EFalse );
  1767     iHarvesterPluginFactory->PauseHarvester( EFalse );
  1646     iServerPaused = EFalse;
  1768     iServerPaused = EFalse;
  1647     
  1769     
  1648     if( !iManualPauseEnabled &&
  1770     if( !iManualPauseEnabled &&
  1659 // ---------------------------------------------------------------------------
  1781 // ---------------------------------------------------------------------------
  1660 //
  1782 //
  1661 void CHarvesterAO::RunL()
  1783 void CHarvesterAO::RunL()
  1662     {
  1784     {
  1663     WRITELOG( "CHarvesterAO::RunL" );
  1785     WRITELOG( "CHarvesterAO::RunL" );
       
  1786     OstTrace0( TRACE_NORMAL, CHARVESTERAO_RUNL, "CHarvesterAO::RunL" );
       
  1787     
  1664     // check if pause is requested
  1788     // check if pause is requested
  1665     if ( this->iServerPaused && iNextRequest != ERequestPause && iNextRequest != ERequestResume)
  1789     if ( this->iServerPaused && iNextRequest != ERequestPause && iNextRequest != ERequestResume)
  1666     	{
  1790     	{
  1667     	iNextRequest = ERequestIdle;
  1791     	iNextRequest = ERequestIdle;
  1668     	}
  1792     	}
  1677         {
  1801         {
  1678         // no more items in queue
  1802         // no more items in queue
  1679         case ERequestIdle:
  1803         case ERequestIdle:
  1680             {
  1804             {
  1681             WRITELOG( "CHarvesterAO::RunL - ERequestIdle" );
  1805             WRITELOG( "CHarvesterAO::RunL - ERequestIdle" );
       
  1806             OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - ERequestIdle" );
       
  1807             
  1682             iReadyPHArray.Compress();
  1808             iReadyPHArray.Compress();
  1683             iContainerPHArray.Compress();
  1809             iContainerPHArray.Compress();
  1684             iPHArray.Compress();
  1810             iPHArray.Compress();
  1685             iTempReadyPHArray.Compress();
  1811             iTempReadyPHArray.Compress();
  1686             }
  1812             }
  1688 
  1814 
  1689         // data added to harvester queue
  1815         // data added to harvester queue
  1690         case ERequestHarvest:
  1816         case ERequestHarvest:
  1691             {
  1817             {
  1692             WRITELOG( "CHarvesterAO::RunL - ERequestHarvest" );
  1818             WRITELOG( "CHarvesterAO::RunL - ERequestHarvest" );
       
  1819             OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - ERequestHarvest" );
  1693             
  1820             
  1694             // harvest new items first...
  1821             // harvest new items first...
  1695             if ( iQueue->ItemsInQueue() > 0 )
  1822             if ( iQueue->ItemsInQueue() > 0 )
  1696                 {
  1823                 {
  1697                 WRITELOG( "CHarvesterAO::RunL - Items in queue - calling ReadItemFromQueueL()" );
  1824                 WRITELOG( "CHarvesterAO::RunL - Items in queue - calling ReadItemFromQueueL()" );
  1733                 const TInt arrayCount( iReadyPHArray.Count() );
  1860                 const TInt arrayCount( iReadyPHArray.Count() );
  1734 				if( arrayCount > 0 )
  1861 				if( arrayCount > 0 )
  1735             		{
  1862             		{
  1736 #ifdef _DEBUG
  1863 #ifdef _DEBUG
  1737             		WRITELOG1("CHarvesterAO::RunL - items in ready pharray: %d", arrayCount );
  1864             		WRITELOG1("CHarvesterAO::RunL - items in ready pharray: %d", arrayCount );
       
  1865             		OstTrace1( TRACE_NORMAL, DUP3_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - items in ready pharray: %d", arrayCount );
  1738 #endif   		
  1866 #endif   		
  1739             		TInt endIndex( KPlaceholderQueueSize );
  1867             		TInt endIndex( KPlaceholderQueueSize );
  1740             		if( arrayCount < KPlaceholderQueueSize )
  1868             		if( arrayCount < KPlaceholderQueueSize )
  1741             		    {
  1869             		    {
  1742             		    endIndex = arrayCount;
  1870             		    endIndex = arrayCount;
  1768         
  1896         
  1769         case ERequestContainerPlaceholder:
  1897         case ERequestContainerPlaceholder:
  1770         	{
  1898         	{
  1771 #ifdef _DEBUG
  1899 #ifdef _DEBUG
  1772         	WRITELOG( "CHarvesterAO::RunL - ERequestContainerPlaceholder" );
  1900         	WRITELOG( "CHarvesterAO::RunL - ERequestContainerPlaceholder" );
       
  1901         	OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - ERequestContainerPlaceholder" );        	
  1773         	WRITELOG1( "CHarvesterAO::RunL - Items in container pharray: %d", iContainerPHArray.Count() );
  1902         	WRITELOG1( "CHarvesterAO::RunL - Items in container pharray: %d", iContainerPHArray.Count() );
       
  1903         	OstTrace1( TRACE_NORMAL, DUP5_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - Items in container pharray: %d", iContainerPHArray.Count() );
  1774 #endif
  1904 #endif
  1775         	TInt count = iContainerPHArray.Count() > KContainerPlaceholderQueueSize ? KContainerPlaceholderQueueSize : iContainerPHArray.Count();
  1905         	TInt count = iContainerPHArray.Count() > KContainerPlaceholderQueueSize ? KContainerPlaceholderQueueSize : iContainerPHArray.Count();
  1776         	TInt i = 0;
  1906         	TInt i = 0;
  1777         	while( i < count )
  1907         	while( i < count )
  1778         		{
  1908         		{
  1797         
  1927         
  1798         // pause request
  1928         // pause request
  1799         case ERequestPause:
  1929         case ERequestPause:
  1800             {
  1930             {
  1801             WRITELOG( "CHarvesterAO::RunL - ERequestPause" );
  1931             WRITELOG( "CHarvesterAO::RunL - ERequestPause" );
       
  1932             OstTrace0( TRACE_NORMAL, DUP6_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - ERequestPause" );
  1802             User::LeaveIfError( PauseHarvester() );
  1933             User::LeaveIfError( PauseHarvester() );
  1803             iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStatePaused );
  1934             iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStatePaused );
  1804             if( iHarvesterStatusObserver )
  1935             if( iHarvesterStatusObserver )
  1805             	{
  1936             	{
  1806             	iHarvesterStatusObserver->PauseReady( KErrNone );
  1937             	iHarvesterStatusObserver->PauseReady( KErrNone );
  1810 
  1941 
  1811         // resume request
  1942         // resume request
  1812         case ERequestResume:
  1943         case ERequestResume:
  1813             {
  1944             {
  1814             WRITELOG( "CHarvesterAO::RunL - ERequestResume" );
  1945             WRITELOG( "CHarvesterAO::RunL - ERequestResume" );
       
  1946             OstTrace0( TRACE_NORMAL, DUP7_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - ERequestResume" );
  1815             ResumeHarvesterL();
  1947             ResumeHarvesterL();
  1816             iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateResumed );
  1948             iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateResumed );
  1817             if( iHarvesterStatusObserver )
  1949             if( iHarvesterStatusObserver )
  1818             	{
  1950             	{
  1819                 iHarvesterStatusObserver->ResumeReady( KErrNone );
  1951                 iHarvesterStatusObserver->ResumeReady( KErrNone );
  1823         break;
  1955         break;
  1824         
  1956         
  1825         default:
  1957         default:
  1826             {
  1958             {
  1827             WRITELOG( "CHarvesterAO::RunL - Not supported request" );
  1959             WRITELOG( "CHarvesterAO::RunL - Not supported request" );
       
  1960             OstTrace0( TRACE_NORMAL, DUP8_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - Not supported request" );
  1828             User::Leave( KErrNotSupported );
  1961             User::Leave( KErrNotSupported );
  1829             }
  1962             }
  1830         break;
  1963         break;
  1831         }
  1964         }
  1832     }
  1965     }
  1836 // ---------------------------------------------------------------------------
  1969 // ---------------------------------------------------------------------------
  1837 //
  1970 //
  1838 void CHarvesterAO::DoCancel()
  1971 void CHarvesterAO::DoCancel()
  1839     {
  1972     {
  1840     WRITELOG( "CHarvesterAO::DoCancel()" );
  1973     WRITELOG( "CHarvesterAO::DoCancel()" );
       
  1974     OstTrace0( TRACE_NORMAL, CHARVESTERAO_DOCANCEL, "CHarvesterAO::DoCancel" );
  1841     }
  1975     }
  1842     
  1976     
  1843 // ---------------------------------------------------------------------------
  1977 // ---------------------------------------------------------------------------
  1844 // RunError
  1978 // RunError
  1845 // ---------------------------------------------------------------------------
  1979 // ---------------------------------------------------------------------------
  1846 //
  1980 //
  1847 TInt CHarvesterAO::RunError( TInt aError )
  1981 TInt CHarvesterAO::RunError( TInt aError )
  1848     {
  1982     {
  1849     WRITELOG( "CHarvesterAO::RunError" );
  1983     WRITELOG( "CHarvesterAO::RunError" );
       
  1984     OstTrace0( TRACE_NORMAL, CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError" );
       
  1985     
  1850     switch( iNextRequest )
  1986     switch( iNextRequest )
  1851         {
  1987         {
  1852         case ERequestHarvest:
  1988         case ERequestHarvest:
  1853             {
  1989             {
  1854             WRITELOG( "CHarvesterAO::RunError - state ERequestHarvest" );
  1990             WRITELOG( "CHarvesterAO::RunError - state ERequestHarvest" );
       
  1991             OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError - state ERequestHarvest" );
  1855             }
  1992             }
  1856         break;
  1993         break;
  1857         
  1994         
  1858         case ERequestPause:
  1995         case ERequestPause:
  1859             {
  1996             {
  1860             WRITELOG( "CHarvesterAO::RunError - state ERequestPause" );
  1997             WRITELOG( "CHarvesterAO::RunError - state ERequestPause" );
       
  1998             OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError - state ERequestPause" );
       
  1999             
  1861             if ( aError == KErrNotReady )
  2000             if ( aError == KErrNotReady )
  1862                 {
  2001                 {
  1863                 SetNextRequest( ERequestPause );
  2002                 SetNextRequest( ERequestPause );
  1864                 }
  2003                 }
  1865             else if( iHarvesterStatusObserver )
  2004             else if( iHarvesterStatusObserver )
  1870         break;
  2009         break;
  1871         
  2010         
  1872         case ERequestResume:
  2011         case ERequestResume:
  1873             {
  2012             {
  1874             WRITELOG( "CHarvesterAO::RunError - state ERequestResume" );
  2013             WRITELOG( "CHarvesterAO::RunError - state ERequestResume" );
       
  2014             OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError - state ERequestResume" );
       
  2015             
  1875             if( iHarvesterStatusObserver )
  2016             if( iHarvesterStatusObserver )
  1876             	{
  2017             	{
  1877                 iHarvesterStatusObserver->ResumeReady( aError );
  2018                 iHarvesterStatusObserver->ResumeReady( aError );
  1878             	}
  2019             	}
  1879             }
  2020             }
  1880         break;
  2021         break;
  1881         
  2022         
  1882         default:
  2023         default:
  1883             {
  2024             {
  1884             WRITELOG( "CHarvesterAO::RunError - unknown state" );
  2025             WRITELOG( "CHarvesterAO::RunError - unknown state" );
       
  2026             OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError - unknown state" );
  1885             }
  2027             }
  1886         break;
  2028         break;
  1887         }
  2029         }
  1888         
  2030         
  1889     return KErrNone;
  2031     return KErrNone;
  1894 // ---------------------------------------------------------------------------
  2036 // ---------------------------------------------------------------------------
  1895 //
  2037 //
  1896 void CHarvesterAO::SetNextRequest( TRequest aRequest )
  2038 void CHarvesterAO::SetNextRequest( TRequest aRequest )
  1897     {
  2039     {
  1898     WRITELOG( "CHarvesterAO::SetNextRequest" );
  2040     WRITELOG( "CHarvesterAO::SetNextRequest" );
       
  2041     OstTrace0( TRACE_NORMAL, CHARVESTERAO_SETNEXTREQUEST, "CHarvesterAO::SetNextRequest" );
       
  2042     
  1899     iNextRequest = aRequest;
  2043     iNextRequest = aRequest;
  1900             
  2044             
  1901     if ( !IsActive() )
  2045     if ( !IsActive() )
  1902         {
  2046         {
  1903         iStatus = KRequestPending;
  2047         iStatus = KRequestPending;
  1912 // ---------------------------------------------------------------------------
  2056 // ---------------------------------------------------------------------------
  1913 //
  2057 //
  1914 TBool CHarvesterAO::IsServerPaused()
  2058 TBool CHarvesterAO::IsServerPaused()
  1915     {
  2059     {
  1916     WRITELOG( "CHarvesterAO::IsServerPaused" );
  2060     WRITELOG( "CHarvesterAO::IsServerPaused" );
       
  2061     OstTrace0( TRACE_NORMAL, CHARVESTERAO_ISSERVERPAUSED, "CHarvesterAO::IsServerPaused" );
       
  2062     
  1917     return iServerPaused;
  2063     return iServerPaused;
  1918     }
  2064     }
  1919 
  2065 
  1920 // ---------------------------------------------------------------------------
  2066 // ---------------------------------------------------------------------------
  1921 // From MBackupRestoreObserver.
  2067 // From MBackupRestoreObserver.
  1925 //
  2071 //
  1926 void CHarvesterAO::BackupRestoreStart()
  2072 void CHarvesterAO::BackupRestoreStart()
  1927     {
  2073     {
  1928     // close blacklist database connection
  2074     // close blacklist database connection
  1929     WRITELOG( "CHarvesterAO::BackupRestoreStart" );
  2075     WRITELOG( "CHarvesterAO::BackupRestoreStart" );
       
  2076     OstTrace0( TRACE_NORMAL, CHARVESTERAO_BACKUPRESTORESTART, "CHarvesterAO::BackupRestoreStart" );
       
  2077     
  1930     iBlacklist->CloseDatabase();
  2078     iBlacklist->CloseDatabase();
  1931     }
  2079     }
  1932 
  2080 
  1933 // ---------------------------------------------------------------------------
  2081 // ---------------------------------------------------------------------------
  1934 // From MBackupRestoreObserver.
  2082 // From MBackupRestoreObserver.
  1938 //
  2086 //
  1939 void CHarvesterAO::BackupRestoreReady()
  2087 void CHarvesterAO::BackupRestoreReady()
  1940     {
  2088     {
  1941     // restart blacklist database connection
  2089     // restart blacklist database connection
  1942     WRITELOG( "CHarvesterAO::BackupRestoreReady" );
  2090     WRITELOG( "CHarvesterAO::BackupRestoreReady" );
       
  2091     OstTrace0( TRACE_NORMAL, CHARVESTERAO_BACKUPRESTOREREADY, "CHarvesterAO::BackupRestoreReady" );
       
  2092     
  1943     iBlacklist->OpenDatabase();
  2093     iBlacklist->OpenDatabase();
  1944     }
  2094     }
  1945 
  2095 
  1946 // ---------------------------------------------------------------------------
  2096 // ---------------------------------------------------------------------------
  1947 // From MMdSHarvesterDiskSpaceObserver.
  2097 // From MMdSHarvesterDiskSpaceObserver.
  1949 // ---------------------------------------------------------------------------
  2099 // ---------------------------------------------------------------------------
  1950 //
  2100 //
  1951 void CHarvesterAO::HandleDiskSpaceNotificationL( TDiskSpaceDirection aDiskSpaceDirection )
  2101 void CHarvesterAO::HandleDiskSpaceNotificationL( TDiskSpaceDirection aDiskSpaceDirection )
  1952     {
  2102     {
  1953     WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL()");
  2103     WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL()");
       
  2104     OstTrace0( TRACE_NORMAL, CHARVESTERAO_HANDLEDISKSPACENOTIFICATIONL, "CHarvesterAO::HandleDiskSpaceNotificationL" );
       
  2105     
  1954     if( MMdSHarvesterDiskSpaceObserver::EMore == aDiskSpaceDirection )
  2106     if( MMdSHarvesterDiskSpaceObserver::EMore == aDiskSpaceDirection )
  1955         {
  2107         {
  1956         WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk full");
  2108         WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk full");
       
  2109         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HANDLEDISKSPACENOTIFICATIONL, "CHarvesterAO::HandleDiskSpaceNotificationL - disk full" );        
  1957         iDiskFull = EFalse;
  2110         iDiskFull = EFalse;
  1958         }
  2111         }
  1959     else
  2112     else
  1960         {
  2113         {
  1961         WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk space available");
  2114         WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk space available");
       
  2115         OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_HANDLEDISKSPACENOTIFICATIONL, "CHarvesterAO::HandleDiskSpaceNotificationL - disk space available" );
  1962         iDiskFull = ETrue;
  2116         iDiskFull = ETrue;
  1963         if( iServerPaused )
  2117         if( iServerPaused )
  1964             {
  2118             {
  1965             return;
  2119             return;
  1966             }
  2120             }
  1985 // ---------------------------------------------------------------------------
  2139 // ---------------------------------------------------------------------------
  1986 //
  2140 //
  1987 void CHarvesterAO::HarvestFile( const RMessage2& aMessage )
  2141 void CHarvesterAO::HarvestFile( const RMessage2& aMessage )
  1988     {
  2142     {
  1989     WRITELOG( "CHarvesterAO::HarvestFile" );
  2143     WRITELOG( "CHarvesterAO::HarvestFile" );
       
  2144     OstTrace0( TRACE_NORMAL, CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile" );
       
  2145     
  1990     const TInt KParamUri = 0;
  2146     const TInt KParamUri = 0;
  1991     const TInt KParamAlbumIds = 1;
  2147     const TInt KParamAlbumIds = 1;
  1992     const TInt KParamAddLocation = 2;
  2148     const TInt KParamAddLocation = 2;
  1993     
  2149     
  1994     // read uri
  2150     // read uri
  1995     HBufC* uri = HBufC::New( KMaxFileName );
  2151     HBufC* uri = HBufC::New( KMaxFileName );
  1996     
  2152     
  1997     if ( ! uri )
  2153     if ( ! uri )
  1998         {
  2154         {
  1999         WRITELOG( "CHarvesterAO::HarvestFile - out of memory creating uri container" );
  2155         WRITELOG( "CHarvesterAO::HarvestFile - out of memory creating uri container" );
       
  2156         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - out of memory creating uri container" );
       
  2157         
  2000         if (!aMessage.IsNull())
  2158         if (!aMessage.IsNull())
  2001             {
  2159             {
  2002             aMessage.Complete( KErrNoMemory );
  2160             aMessage.Complete( KErrNoMemory );
  2003             }
  2161             }
  2004         return;
  2162         return;
  2007     TPtr uriPtr( uri->Des() );
  2165     TPtr uriPtr( uri->Des() );
  2008     TInt err = aMessage.Read( KParamUri, uriPtr );
  2166     TInt err = aMessage.Read( KParamUri, uriPtr );
  2009     if ( err != KErrNone )
  2167     if ( err != KErrNone )
  2010         {
  2168         {
  2011         WRITELOG1( "CHarvesterAO::HarvestFile - error in reading aMessage (uri): %d", err );
  2169         WRITELOG1( "CHarvesterAO::HarvestFile - error in reading aMessage (uri): %d", err );
       
  2170         OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - error in reading aMessage (uri): %d", err );
       
  2171         
  2012         if (!aMessage.IsNull())
  2172         if (!aMessage.IsNull())
  2013             {
  2173             {
  2014             aMessage.Complete( err );
  2174             aMessage.Complete( err );
  2015             }
  2175             }
  2016         delete uri;
  2176         delete uri;
  2026         {
  2186         {
  2027         HBufC8* albumIdBuf = HBufC8::New( KAlbumIdsLength );
  2187         HBufC8* albumIdBuf = HBufC8::New( KAlbumIdsLength );
  2028         if ( !albumIdBuf )
  2188         if ( !albumIdBuf )
  2029             {
  2189             {
  2030             WRITELOG( "CHarvesterAO::HarvestFile - error creating album id buffer." );
  2190             WRITELOG( "CHarvesterAO::HarvestFile - error creating album id buffer." );
       
  2191             OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - error creating album id buffer." );
       
  2192             
  2031             if (!aMessage.IsNull())
  2193             if (!aMessage.IsNull())
  2032                 {
  2194                 {
  2033                 aMessage.Complete( KErrNoMemory );
  2195                 aMessage.Complete( KErrNoMemory );
  2034                 }
  2196                 }
  2035             delete uri;
  2197             delete uri;
  2039         TPtr8 ptr( albumIdBuf->Des() );
  2201         TPtr8 ptr( albumIdBuf->Des() );
  2040         err = aMessage.Read( KParamAlbumIds, ptr );
  2202         err = aMessage.Read( KParamAlbumIds, ptr );
  2041         if ( err != KErrNone )
  2203         if ( err != KErrNone )
  2042             {
  2204             {
  2043             WRITELOG1( "CHarvesterAO::HarvestFile - error in reading aMessage (albumIds): %d", err );
  2205             WRITELOG1( "CHarvesterAO::HarvestFile - error in reading aMessage (albumIds): %d", err );
       
  2206             OstTrace1( TRACE_NORMAL, DUP4_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - error in reading aMessage (albumIds): %d", err );
  2044             delete albumIdBuf;
  2207             delete albumIdBuf;
  2045             albumIdBuf = NULL;
  2208             albumIdBuf = NULL;
  2046             delete uri;
  2209             delete uri;
  2047             uri = NULL;
  2210             uri = NULL;
  2048             if (!aMessage.IsNull())
  2211             if (!aMessage.IsNull())
  2054 
  2217 
  2055         TRAPD( err, DeserializeArrayL( ptr, albumIds ) );
  2218         TRAPD( err, DeserializeArrayL( ptr, albumIds ) );
  2056         if ( err != KErrNone )
  2219         if ( err != KErrNone )
  2057             {
  2220             {
  2058             WRITELOG1( "CHarvesterAO::HarvestFile - error in reading album id array: %d", err );
  2221             WRITELOG1( "CHarvesterAO::HarvestFile - error in reading album id array: %d", err );
       
  2222             OstTrace1( TRACE_NORMAL, DUP5_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - error in reading album id array: %d", err );
       
  2223             
  2059             delete albumIdBuf;
  2224             delete albumIdBuf;
  2060             albumIdBuf = NULL;
  2225             albumIdBuf = NULL;
  2061             delete uri;
  2226             delete uri;
  2062             uri = NULL;
  2227             uri = NULL;
  2063             if (!aMessage.IsNull())
  2228             if (!aMessage.IsNull())
  2077         
  2242         
  2078         delete albumIdBuf;
  2243         delete albumIdBuf;
  2079         albumIdBuf = NULL;
  2244         albumIdBuf = NULL;
  2080         
  2245         
  2081         WRITELOG1( "CHarvesterAO::HarvestFile - album id count: %d", albumIds.Count() );
  2246         WRITELOG1( "CHarvesterAO::HarvestFile - album id count: %d", albumIds.Count() );
       
  2247         OstTrace1( TRACE_NORMAL, DUP6_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - album id count: %d", albumIds.Count() );
       
  2248         
  2082         }
  2249         }
  2083     
  2250     
  2084     TBool addLocation;    
  2251     TBool addLocation;    
  2085     TPckg<TBool> location( addLocation );	
  2252     TPckg<TBool> location( addLocation );	
  2086 		err = aMessage.Read(KParamAddLocation, location);
  2253 		err = aMessage.Read(KParamAddLocation, location);
  2087 		if ( err != KErrNone )
  2254 		if ( err != KErrNone )
  2088 			{
  2255 			{
  2089 			WRITELOG1( "CHarvesterAO::HarvestFile - error in reading aMessage (addLocation): %d", err );
  2256 			WRITELOG1( "CHarvesterAO::HarvestFile - error in reading aMessage (addLocation): %d", err );
       
  2257 			OstTrace1( TRACE_NORMAL, DUP7_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - error in reading aMessage (addLocation): %d", err );
       
  2258 			
  2090 			delete uri;
  2259 			delete uri;
  2091 			uri = NULL;
  2260 			uri = NULL;
  2092 			if (!aMessage.IsNull())
  2261 			if (!aMessage.IsNull())
  2093 				{
  2262 				{
  2094 				aMessage.Complete( err );
  2263 				aMessage.Complete( err );
  2095 				}
  2264 				}
  2096 			return;
  2265 			return;
  2097 			}	
  2266 			}	
  2098 	
  2267 	
  2099 		WRITELOG1( "RHarvesterClient::HarvestFile - add location: %d", addLocation );
  2268 		WRITELOG1( "RHarvesterClient::HarvestFile - add location: %d", addLocation );
       
  2269 		OstTrace1( TRACE_NORMAL, DUP8_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - add location: %d", addLocation );
       
  2270 		
  2100     
  2271     
  2101     CHarvesterData* hd = NULL;
  2272     CHarvesterData* hd = NULL;
  2102     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  2273     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  2103     if ( err != KErrNone || !hd )
  2274     if ( err != KErrNone || !hd )
  2104         {
  2275         {
  2105         WRITELOG( "CHarvesterAO::HarvestFile - creating harvUri failed" );
  2276         WRITELOG( "CHarvesterAO::HarvestFile - creating harvUri failed" );
       
  2277         OstTrace0( TRACE_NORMAL, DUP9_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - creating harvUri failed" );
       
  2278         
  2106         albumIds.Close();
  2279         albumIds.Close();
  2107         delete uri;
  2280         delete uri;
  2108         uri = NULL;
  2281         uri = NULL;
  2109         if (!aMessage.IsNull())
  2282         if (!aMessage.IsNull())
  2110             {
  2283             {
  2127         hd->SetClientData( clientData ); // ownership is transferred
  2300         hd->SetClientData( clientData ); // ownership is transferred
  2128         }
  2301         }
  2129     else
  2302     else
  2130         {
  2303         {
  2131         WRITELOG( "CHarvesterAO::HarvestFile - creating clientData failed" );
  2304         WRITELOG( "CHarvesterAO::HarvestFile - creating clientData failed" );
       
  2305         OstTrace0( TRACE_NORMAL, DUP10_CHARVESTERAO_HARVESTFILE, "CHarvesterAO::HarvestFile - creating clientData failed" );        
  2132         }
  2306         }
  2133 
  2307 
  2134     if( iQueue )
  2308     if( iQueue )
  2135         {
  2309         {
  2136         iQueue->Append( hd );
  2310         iQueue->Append( hd );
  2162 // ---------------------------------------------------------------------------
  2336 // ---------------------------------------------------------------------------
  2163 //
  2337 //
  2164 void CHarvesterAO::HarvestFileWithUID( const RMessage2& aMessage )
  2338 void CHarvesterAO::HarvestFileWithUID( const RMessage2& aMessage )
  2165     {
  2339     {
  2166     WRITELOG( "CHarvesterAO::HarvestFileWithUID" );
  2340     WRITELOG( "CHarvesterAO::HarvestFileWithUID" );
       
  2341     OstTrace0( TRACE_NORMAL, CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID" );
       
  2342     
  2167     const TInt KParamUri = 0;
  2343     const TInt KParamUri = 0;
  2168     const TInt KParamAlbumIds = 1;
  2344     const TInt KParamAlbumIds = 1;
  2169     const TInt KParamAddLocation = 2;
  2345     const TInt KParamAddLocation = 2;
  2170     
  2346     
  2171     // read uri
  2347     // read uri
  2172     HBufC* uri = HBufC::New( KMaxFileName );
  2348     HBufC* uri = HBufC::New( KMaxFileName );
  2173     
  2349     
  2174     if ( ! uri )
  2350     if ( ! uri )
  2175         {
  2351         {
  2176         WRITELOG( "CHarvesterAO::HarvestFileWithUID - out of memory creating uri container" );
  2352         WRITELOG( "CHarvesterAO::HarvestFileWithUID - out of memory creating uri container" );
       
  2353         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - out of memory creating uri container" );
       
  2354         
  2177         if (!aMessage.IsNull())
  2355         if (!aMessage.IsNull())
  2178             {
  2356             {
  2179             aMessage.Complete( KErrNoMemory );
  2357             aMessage.Complete( KErrNoMemory );
  2180             }
  2358             }
  2181         return;
  2359         return;
  2184     TPtr uriPtr( uri->Des() );
  2362     TPtr uriPtr( uri->Des() );
  2185     TInt err = aMessage.Read( KParamUri, uriPtr );
  2363     TInt err = aMessage.Read( KParamUri, uriPtr );
  2186     if ( err != KErrNone )
  2364     if ( err != KErrNone )
  2187         {
  2365         {
  2188         WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (uri): %d", err );
  2366         WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (uri): %d", err );
       
  2367         OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (uri): %d", err );
       
  2368         
  2189         if (!aMessage.IsNull())
  2369         if (!aMessage.IsNull())
  2190             {
  2370             {
  2191             aMessage.Complete( err );
  2371             aMessage.Complete( err );
  2192             }
  2372             }
  2193         delete uri;
  2373         delete uri;
  2203         {
  2383         {
  2204         HBufC8* albumIdBuf = HBufC8::New( KAlbumIdsLength );
  2384         HBufC8* albumIdBuf = HBufC8::New( KAlbumIdsLength );
  2205         if ( !albumIdBuf )
  2385         if ( !albumIdBuf )
  2206             {
  2386             {
  2207             WRITELOG( "CHarvesterAO::HarvestFileWithUID - error creating album id buffer." );
  2387             WRITELOG( "CHarvesterAO::HarvestFileWithUID - error creating album id buffer." );
       
  2388             OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - error creating album id buffer." );
       
  2389             
  2208             if (!aMessage.IsNull())
  2390             if (!aMessage.IsNull())
  2209                 {
  2391                 {
  2210                 aMessage.Complete( KErrNoMemory );
  2392                 aMessage.Complete( KErrNoMemory );
  2211                 }
  2393                 }
  2212             delete uri;
  2394             delete uri;
  2216         TPtr8 ptr( albumIdBuf->Des() );
  2398         TPtr8 ptr( albumIdBuf->Des() );
  2217         err = aMessage.Read( KParamAlbumIds, ptr );
  2399         err = aMessage.Read( KParamAlbumIds, ptr );
  2218         if ( err != KErrNone )
  2400         if ( err != KErrNone )
  2219             {
  2401             {
  2220             WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (albumIds): %d", err );
  2402             WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (albumIds): %d", err );
       
  2403             OstTrace1( TRACE_NORMAL, DUP4_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (albumIds): %d", err );
       
  2404             
  2221             delete albumIdBuf;
  2405             delete albumIdBuf;
  2222             albumIdBuf = NULL;
  2406             albumIdBuf = NULL;
  2223             delete uri;
  2407             delete uri;
  2224             uri = NULL;
  2408             uri = NULL;
  2225             if (!aMessage.IsNull())
  2409             if (!aMessage.IsNull())
  2231 
  2415 
  2232         TRAPD( err, DeserializeArrayL( ptr, albumIds ) );
  2416         TRAPD( err, DeserializeArrayL( ptr, albumIds ) );
  2233         if ( err != KErrNone )
  2417         if ( err != KErrNone )
  2234             {
  2418             {
  2235             WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading album id array: %d", err );
  2419             WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading album id array: %d", err );
       
  2420             OstTrace1( TRACE_NORMAL, DUP5_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - error in reading album id array: %d", err );
       
  2421             
  2236             delete albumIdBuf;
  2422             delete albumIdBuf;
  2237             albumIdBuf = NULL;
  2423             albumIdBuf = NULL;
  2238             delete uri;
  2424             delete uri;
  2239             uri = NULL;
  2425             uri = NULL;
  2240             if (!aMessage.IsNull())
  2426             if (!aMessage.IsNull())
  2255         delete albumIdBuf;
  2441         delete albumIdBuf;
  2256         albumIdBuf = NULL;
  2442         albumIdBuf = NULL;
  2257 		
  2443 		
  2258 #ifdef _DEBUG        
  2444 #ifdef _DEBUG        
  2259         WRITELOG1( "CHarvesterAO::HarvestFileWithUID - album id count: %d", albumIds.Count() );
  2445         WRITELOG1( "CHarvesterAO::HarvestFileWithUID - album id count: %d", albumIds.Count() );
       
  2446         OstTrace1( TRACE_NORMAL, DUP6_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - album id count: %d", albumIds.Count() );
  2260 #endif
  2447 #endif
  2261         }
  2448         }
  2262     
  2449     
  2263     TBool addLocation;    
  2450     TBool addLocation;    
  2264     TPckg<TBool> location( addLocation );   
  2451     TPckg<TBool> location( addLocation );   
  2265         err = aMessage.Read(KParamAddLocation, location);
  2452         err = aMessage.Read(KParamAddLocation, location);
  2266         if ( err != KErrNone )
  2453         if ( err != KErrNone )
  2267             {
  2454             {
  2268             WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (addLocation): %d", err );
  2455             WRITELOG1( "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (addLocation): %d", err );
       
  2456             OstTrace1( TRACE_NORMAL, DUP7_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - error in reading aMessage (addLocation): %d", err );
       
  2457             
  2269             delete uri;
  2458             delete uri;
  2270             uri = NULL;
  2459             uri = NULL;
  2271             if (!aMessage.IsNull())
  2460             if (!aMessage.IsNull())
  2272                 {
  2461                 {
  2273                 aMessage.Complete( err );
  2462                 aMessage.Complete( err );
  2274                 }
  2463                 }
  2275             return;
  2464             return;
  2276             }   
  2465             }   
  2277     
  2466     
  2278         WRITELOG1( "RHarvesterClient::HarvestFileWithUID - add location: %d", addLocation );
  2467         WRITELOG1( "RHarvesterClient::HarvestFileWithUID - add location: %d", addLocation );
       
  2468         OstTrace1( TRACE_NORMAL, DUP8_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - add location: %d", addLocation );
       
  2469         
  2279     
  2470     
  2280     CHarvesterData* hd = NULL;
  2471     CHarvesterData* hd = NULL;
  2281     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  2472     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  2282     if ( err != KErrNone || !hd )
  2473     if ( err != KErrNone || !hd )
  2283         {
  2474         {
  2284         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating harvUri failed" );
  2475         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating harvUri failed" );
       
  2476         OstTrace0( TRACE_NORMAL, DUP9_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - creating harvUri failed" );
       
  2477         
  2285         albumIds.Close();
  2478         albumIds.Close();
  2286         delete uri;
  2479         delete uri;
  2287         uri = NULL;
  2480         uri = NULL;
  2288         if (!aMessage.IsNull())
  2481         if (!aMessage.IsNull())
  2289             {
  2482             {
  2306         hd->SetClientData( clientData ); // ownership is transferred
  2499         hd->SetClientData( clientData ); // ownership is transferred
  2307         }
  2500         }
  2308     else
  2501     else
  2309         {
  2502         {
  2310         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating clientData failed" );
  2503         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating clientData failed" );
       
  2504         OstTrace0( TRACE_NORMAL, DUP10_CHARVESTERAO_HARVESTFILEWITHUID, "CHarvesterAO::HarvestFileWithUID - creating clientData failed" );
  2311         }
  2505         }
  2312 
  2506 
  2313     if( iQueue )
  2507     if( iQueue )
  2314     	{
  2508     	{
  2315     	iQueue->Append( hd );
  2509     	iQueue->Append( hd );
  2339 // ---------------------------------------------------------------------------
  2533 // ---------------------------------------------------------------------------
  2340 //
  2534 //
  2341 void CHarvesterAO::RegisterProcessOrigin( const RMessage2& aMessage )
  2535 void CHarvesterAO::RegisterProcessOrigin( const RMessage2& aMessage )
  2342     {
  2536     {
  2343     WRITELOG( "CHarvesterAO::RegisterProcessOrigin" );
  2537     WRITELOG( "CHarvesterAO::RegisterProcessOrigin" );
       
  2538     OstTrace0( TRACE_NORMAL, CHARVESTERAO_REGISTERPROCESSORIGIN, "CHarvesterAO::RegisterProcessOrigin" );
  2344     
  2539     
  2345     if ( !iProcessOriginMapper )
  2540     if ( !iProcessOriginMapper )
  2346         {
  2541         {
  2347         WRITELOG( "CHarvesterAO::RegisterProcessOrigin - mapper not available." );
  2542         WRITELOG( "CHarvesterAO::RegisterProcessOrigin - mapper not available." );
       
  2543         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_REGISTERPROCESSORIGIN, "CHarvesterAO::RegisterProcessOrigin - mapper not available." );
       
  2544         
  2348         if (!aMessage.IsNull())
  2545         if (!aMessage.IsNull())
  2349             {
  2546             {
  2350             aMessage.Complete( KErrNotSupported );
  2547             aMessage.Complete( KErrNotSupported );
  2351             }
  2548             }
  2352         return;
  2549         return;
  2355     TUid processId = { 0 };
  2552     TUid processId = { 0 };
  2356     processId.iUid = aMessage.Int0();
  2553     processId.iUid = aMessage.Int0();
  2357     if ( MdsUtils::IsValidProcessId( processId ) )
  2554     if ( MdsUtils::IsValidProcessId( processId ) )
  2358         {
  2555         {
  2359         WRITELOG1( "CHarvesterAO::RegisterProcessOrigin - error reading processId. Read: %d", processId.iUid );
  2556         WRITELOG1( "CHarvesterAO::RegisterProcessOrigin - error reading processId. Read: %d", processId.iUid );
       
  2557         OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_REGISTERPROCESSORIGIN, "CHarvesterAO::RegisterProcessOrigin - error reading processId. Read: %d", processId.iUid );
       
  2558         
  2360         if (!aMessage.IsNull())
  2559         if (!aMessage.IsNull())
  2361             {
  2560             {
  2362             aMessage.Complete( KErrCorrupt );
  2561             aMessage.Complete( KErrCorrupt );
  2363             }
  2562             }
  2364         return;
  2563         return;
  2366     
  2565     
  2367     // read origin
  2566     // read origin
  2368 
  2567 
  2369     TOrigin origin = STATIC_CAST( TOrigin, aMessage.Int1() );
  2568     TOrigin origin = STATIC_CAST( TOrigin, aMessage.Int1() );
  2370     WRITELOG1( "CHarvesterAO::RegisterProcessOrigin - origin: %d", origin );
  2569     WRITELOG1( "CHarvesterAO::RegisterProcessOrigin - origin: %d", origin );
       
  2570     OstTrace1( TRACE_NORMAL, DUP3_CHARVESTERAO_REGISTERPROCESSORIGIN, "CHarvesterAO::RegisterProcessOrigin - origin: %d", origin );
       
  2571     
  2371     if ( origin < 0 )
  2572     if ( origin < 0 )
  2372         {
  2573         {
  2373         WRITELOG( "CHarvesterAO::RegisterProcessOrigin - error reading origin from aMessage (negative)." );
  2574         WRITELOG( "CHarvesterAO::RegisterProcessOrigin - error reading origin from aMessage (negative)." );
       
  2575         OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_REGISTERPROCESSORIGIN, "CHarvesterAO::RegisterProcessOrigin - error reading origin from aMessage (negative)." );
       
  2576         
  2374         if (!aMessage.IsNull())
  2577         if (!aMessage.IsNull())
  2375             {
  2578             {
  2376             aMessage.Complete( KErrCorrupt );
  2579             aMessage.Complete( KErrCorrupt );
  2377             }
  2580             }
  2378         return;
  2581         return;
  2380 
  2583 
  2381     TRAPD( err, iProcessOriginMapper->RegisterProcessL( processId, origin ) );
  2584     TRAPD( err, iProcessOriginMapper->RegisterProcessL( processId, origin ) );
  2382     if ( err != KErrNone )
  2585     if ( err != KErrNone )
  2383         {
  2586         {
  2384         WRITELOG1( "CHarvesterAO::RegisterProcessOrigin - error registering mapping: %d", err );
  2587         WRITELOG1( "CHarvesterAO::RegisterProcessOrigin - error registering mapping: %d", err );
       
  2588         OstTrace1( TRACE_NORMAL, DUP5_CHARVESTERAO_REGISTERPROCESSORIGIN, "CHarvesterAO::RegisterProcessOrigin - error registering mapping: %d", err );
       
  2589         
  2385         if (!aMessage.IsNull())
  2590         if (!aMessage.IsNull())
  2386             {
  2591             {
  2387             aMessage.Complete( err );
  2592             aMessage.Complete( err );
  2388             }
  2593             }
  2389         return;
  2594         return;
  2399 // ---------------------------------------------------------------------------
  2604 // ---------------------------------------------------------------------------
  2400 //
  2605 //
  2401 void CHarvesterAO::UnregisterProcessOrigin( const RMessage2& aMessage )
  2606 void CHarvesterAO::UnregisterProcessOrigin( const RMessage2& aMessage )
  2402     {
  2607     {
  2403     WRITELOG( "CHarvesterAO::UnregisterProcessOrigin" );
  2608     WRITELOG( "CHarvesterAO::UnregisterProcessOrigin" );
  2404     
  2609     OstTrace0( TRACE_NORMAL, CHARVESTERAO_UNREGISTERPROCESSORIGIN, "CHarvesterAO::UnregisterProcessOrigin" );
       
  2610         
  2405     if ( !iProcessOriginMapper )
  2611     if ( !iProcessOriginMapper )
  2406         {
  2612         {
  2407         WRITELOG( "CHarvesterAO::RegisterProcessOrigin - mapper not available." );
  2613         WRITELOG( "CHarvesterAO::RegisterProcessOrigin - mapper not available." );
       
  2614         OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_UNREGISTERPROCESSORIGIN, "CHarvesterAO::UnregisterProcessOrigin - mapper not available." );
       
  2615         
  2408         if (!aMessage.IsNull())
  2616         if (!aMessage.IsNull())
  2409             {
  2617             {
  2410             aMessage.Complete( KErrNotSupported );
  2618             aMessage.Complete( KErrNotSupported );
  2411             }
  2619             }
  2412         return;
  2620         return;
  2415     TUid processId = { 0 };
  2623     TUid processId = { 0 };
  2416     processId.iUid = aMessage.Int0();
  2624     processId.iUid = aMessage.Int0();
  2417     if ( MdsUtils::IsValidProcessId( processId ) )
  2625     if ( MdsUtils::IsValidProcessId( processId ) )
  2418         {
  2626         {
  2419         WRITELOG1( "CHarvesterAO::UnregisterProcessOrigin - error reading processId. Read: %d", processId.iUid );
  2627         WRITELOG1( "CHarvesterAO::UnregisterProcessOrigin - error reading processId. Read: %d", processId.iUid );
       
  2628         OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_UNREGISTERPROCESSORIGIN, "CHarvesterAO::UnregisterProcessOrigin - error reading processId. Read: %d", processId.iUid );
       
  2629         
  2420         if (!aMessage.IsNull())
  2630         if (!aMessage.IsNull())
  2421             {
  2631             {
  2422             aMessage.Complete( KErrCorrupt );
  2632             aMessage.Complete( KErrCorrupt );
  2423             }
  2633             }
  2424         return;
  2634         return;
  2426     
  2636     
  2427     TRAPD( err, iProcessOriginMapper->UnregisterProcessL( processId ) );
  2637     TRAPD( err, iProcessOriginMapper->UnregisterProcessL( processId ) );
  2428     if ( err != KErrNone )
  2638     if ( err != KErrNone )
  2429         {
  2639         {
  2430         WRITELOG1( "CHarvesterAO::UnregisterProcessOrigin - error unregistering mapping: %d", err );
  2640         WRITELOG1( "CHarvesterAO::UnregisterProcessOrigin - error unregistering mapping: %d", err );
       
  2641         OstTrace1( TRACE_NORMAL, DUP3_CHARVESTERAO_UNREGISTERPROCESSORIGIN, "CHarvesterAO::UnregisterProcessOrigin - error unregistering mapping: %d", err );
       
  2642         
  2431         if (!aMessage.IsNull())
  2643         if (!aMessage.IsNull())
  2432             {
  2644             {
  2433             aMessage.Complete( err );
  2645             aMessage.Complete( err );
  2434             }
  2646             }
  2435         return;
  2647         return;
  2445 // ---------------------------------------------------------------------------
  2657 // ---------------------------------------------------------------------------
  2446 //
  2658 //
  2447 TInt CHarvesterAO::RegisterHarvestComplete( const CHarvesterServerSession& aSession, const RMessage2& aMessage )
  2659 TInt CHarvesterAO::RegisterHarvestComplete( const CHarvesterServerSession& aSession, const RMessage2& aMessage )
  2448     {
  2660     {
  2449     WRITELOG( "CHarvesterAO::RegisterHarvestComplete" );
  2661     WRITELOG( "CHarvesterAO::RegisterHarvestComplete" );
  2450     
  2662     OstTrace0( TRACE_NORMAL, CHARVESTERAO_REGISTERHARVESTCOMPLETE, "CHarvesterAO::RegisterHarvestComplete" );
       
  2663         
  2451     return iHarvestFileMessages.Append( 
  2664     return iHarvestFileMessages.Append( 
  2452     		THarvestFileRequest( aSession, aMessage ) );
  2665     		THarvestFileRequest( aSession, aMessage ) );
  2453     }
  2666     }
  2454 
  2667 
  2455 // ---------------------------------------------------------------------------
  2668 // ---------------------------------------------------------------------------
  2457 // ---------------------------------------------------------------------------
  2670 // ---------------------------------------------------------------------------
  2458 //
  2671 //
  2459 TInt CHarvesterAO::UnregisterHarvestComplete( const CHarvesterServerSession& aSession )
  2672 TInt CHarvesterAO::UnregisterHarvestComplete( const CHarvesterServerSession& aSession )
  2460     {    
  2673     {    
  2461     WRITELOG( "CHarvesterAO::UnregisterHarvestComplete" );
  2674     WRITELOG( "CHarvesterAO::UnregisterHarvestComplete" );
       
  2675     OstTrace0( TRACE_NORMAL, CHARVESTERAO_UNREGISTERHARVESTCOMPLETE, "CHarvesterAO::UnregisterHarvestComplete" );
  2462     
  2676     
  2463     TInt err( KErrNotFound );
  2677     TInt err( KErrNotFound );
  2464     if ( iHarvestFileMessages.Count() > 0 )
  2678     if ( iHarvestFileMessages.Count() > 0 )
  2465         {
  2679         {
  2466         for ( TInt i = iHarvestFileMessages.Count()-1; i >= 0; --i )
  2680         for ( TInt i = iHarvestFileMessages.Count()-1; i >= 0; --i )
  2500 // ---------------------------------------------------------------------------
  2714 // ---------------------------------------------------------------------------
  2501 //
  2715 //
  2502 void CHarvesterAO::RegisterHarvesterEvent( const RMessage2& aMessage )
  2716 void CHarvesterAO::RegisterHarvesterEvent( const RMessage2& aMessage )
  2503     {
  2717     {
  2504     WRITELOG( "CHarvesterAO::RegisterHarvesterEvent" );
  2718     WRITELOG( "CHarvesterAO::RegisterHarvesterEvent" );
       
  2719     OstTrace0( TRACE_NORMAL, CHARVESTERAO_REGISTERHARVESTEREVENT, "CHarvesterAO::RegisterHarvesterEvent" );    
  2505 
  2720 
  2506     TRAPD( err, iHarvesterEventManager->RegisterEventObserverL( aMessage ) );
  2721     TRAPD( err, iHarvesterEventManager->RegisterEventObserverL( aMessage ) );
  2507     aMessage.Complete( err );
  2722     aMessage.Complete( err );
  2508     }
  2723     }
  2509 
  2724 
  2512 // ---------------------------------------------------------------------------
  2727 // ---------------------------------------------------------------------------
  2513 //
  2728 //
  2514 void CHarvesterAO::UnregisterHarvesterEvent( const RMessage2& aMessage )
  2729 void CHarvesterAO::UnregisterHarvesterEvent( const RMessage2& aMessage )
  2515     {
  2730     {
  2516     WRITELOG( "CHarvesterAO::UnregisterHarvesterEvent" );
  2731     WRITELOG( "CHarvesterAO::UnregisterHarvesterEvent" );
       
  2732     OstTrace0( TRACE_NORMAL, CHARVESTERAO_UNREGISTERHARVESTEREVENT, "CHarvesterAO::UnregisterHarvesterEvent" );    
  2517     
  2733     
  2518     const TInt err = iHarvesterEventManager->UnregisterEventObserver( aMessage );
  2734     const TInt err = iHarvesterEventManager->UnregisterEventObserver( aMessage );
  2519     aMessage.Complete( err );
  2735     aMessage.Complete( err );
  2520     }
  2736     }
  2521 
  2737 
  2522 void CHarvesterAO::GetLastObserverId( const RMessage2& aMessage )
  2738 void CHarvesterAO::GetLastObserverId( const RMessage2& aMessage )
  2523 	{
  2739 	{
  2524 	WRITELOG( "CHarvesterAO::GetLastObserverId" );
  2740 	WRITELOG( "CHarvesterAO::GetLastObserverId" );
       
  2741 	OstTrace0( TRACE_NORMAL, CHARVESTERAO_GETLASTOBSERVERID, "CHarvesterAO::GetLastObserverId" );
  2525 	
  2742 	
  2526 	TUint observerId = iHarvesterEventManager->GetLastClientId();
  2743 	TUint observerId = iHarvesterEventManager->GetLastClientId();
  2527 	
  2744 	
  2528 	TPckg<TUint> pckgId( observerId );
  2745 	TPckg<TUint> pckgId( observerId );
  2529 	aMessage.Write( 0, pckgId );
  2746 	aMessage.Write( 0, pckgId );
  2535 // ---------------------------------------------------------------------------
  2752 // ---------------------------------------------------------------------------
  2536 //
  2753 //
  2537 void CHarvesterAO::ContextSnapshotStatus( CHarvesterData* aHD )
  2754 void CHarvesterAO::ContextSnapshotStatus( CHarvesterData* aHD )
  2538     {
  2755     {
  2539     WRITELOG( "CHarvesterAO::ContextSnapshotStatus()" );
  2756     WRITELOG( "CHarvesterAO::ContextSnapshotStatus()" );
  2540     
  2757     OstTrace0( TRACE_NORMAL, CHARVESTERAO_CONTEXTSNAPSHOTSTATUS, "CHarvesterAO::ContextSnapshotStatus" );
       
  2758         
  2541     HarvestCompleted( aHD->ClientId(), aHD->Uri(), aHD->ErrorCode() );
  2759     HarvestCompleted( aHD->ClientId(), aHD->Uri(), aHD->ErrorCode() );
  2542 
  2760 
  2543     const TInt errorCode = aHD->ErrorCode();
  2761     const TInt errorCode = aHD->ErrorCode();
  2544     if( errorCode != KErrNone && errorCode != KErrCompletion )
  2762     if( errorCode != KErrNone && errorCode != KErrCompletion )
  2545     	{
  2763     	{
  2546         WRITELOG1( "CHarvesterAO::ContextSnapshotStatus() - error occurred: %d", errorCode );    	
  2764         WRITELOG1( "CHarvesterAO::ContextSnapshotStatus() - error occurred: %d", errorCode );
       
  2765         OstTrace1( TRACE_NORMAL, DUP1_CHARVESTERAO_CONTEXTSNAPSHOTSTATUS, "CHarvesterAO::ContextSnapshotStatus - error occurred: %d", errorCode );        
  2547     	}
  2766     	}
  2548     else
  2767     else
  2549     	{
  2768     	{
  2550         if( errorCode == KErrCompletion )
  2769         if( errorCode == KErrCompletion )
  2551             {
  2770             {
  2552             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - snapshot could not be completed" );
  2771             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - snapshot could not be completed" );
       
  2772             OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_CONTEXTSNAPSHOTSTATUS, "CHarvesterAO::ContextSnapshotStatus - snapshot could not be completed" );            
  2553             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - processing non-context data anyway" );   
  2773             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - processing non-context data anyway" );   
       
  2774             OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_CONTEXTSNAPSHOTSTATUS, "CHarvesterAO::ContextSnapshotStatus - processing non-context data anyway" );
  2554             }
  2775             }
  2555         else
  2776         else
  2556             {
  2777             {
  2557             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - successfully completed" );
  2778             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - successfully completed" );
       
  2779             OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_CONTEXTSNAPSHOTSTATUS, "CHarvesterAO::ContextSnapshotStatus - successfully completed" );
  2558             }
  2780             }
  2559         if( aHD->Origin() == MdeConstants::Object::ECamera )
  2781         if( aHD->Origin() == MdeConstants::Object::ECamera )
  2560         	{
  2782         	{
  2561             aHD->MdeObject().SetPlaceholder( EFalse );
  2783             aHD->MdeObject().SetPlaceholder( EFalse );
  2562             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder ) );
  2784             TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder ) );
  2564         	if(mdeError != KErrNone)
  2786         	if(mdeError != KErrNone)
  2565             	{
  2787             	{
  2566             	WRITELOG( "==============================ERROR===============================" );
  2788             	WRITELOG( "==============================ERROR===============================" );
  2567                 WRITELOG( "CHarvesterAO::HarvestingCompleted() - cannot set metadata object" );
  2789                 WRITELOG( "CHarvesterAO::HarvestingCompleted() - cannot set metadata object" );
  2568                 WRITELOG( "==============================ERROR done =========================" );
  2790                 WRITELOG( "==============================ERROR done =========================" );
       
  2791                 OstTrace0( TRACE_NORMAL, DUP5_CHARVESTERAO_CONTEXTSNAPSHOTSTATUS, "CHarvesterAO::ContextSnapshotStatus - cannot set metadata object" );                
  2569             	}
  2792             	}
  2570         	}
  2793         	}
  2571     	}
  2794     	}
  2572 
  2795 
  2573     delete aHD;
  2796     delete aHD;
  2596             {
  2819             {
  2597             RMessage2& msg = iHarvestFileMessages[i].iMessage;
  2820             RMessage2& msg = iHarvestFileMessages[i].iMessage;
  2598             if ( aClientId == msg.Identity() )
  2821             if ( aClientId == msg.Identity() )
  2599                 {
  2822                 {
  2600                 WRITELOG1( "CHarvesterAO::HarvestingCompleted() - Completing Fast Harvest request! Error code: %d", aErr );
  2823                 WRITELOG1( "CHarvesterAO::HarvestingCompleted() - Completing Fast Harvest request! Error code: %d", aErr );
       
  2824                 OstTrace1( TRACE_NORMAL, CHARVESTERAO_HARVESTCOMPLETED, "CHarvesterAO::HarvestCompleted - Completing Fast Harvest request! Error code: %d", aErr );
       
  2825                 
  2601                 if (!msg.IsNull())
  2826                 if (!msg.IsNull())
  2602                 	{
  2827                 	{
  2603                 	msg.Write( KParamUri, aUri );
  2828                 	msg.Write( KParamUri, aUri );
  2604                 	msg.Complete( aErr );
  2829                 	msg.Complete( aErr );
  2605                 	}
  2830                 	}
  2606                 else
  2831                 else
  2607                 	{
  2832                 	{
  2608                 	WRITELOG("CHarvesterAO::HarvestingCompleted() NOT COMPLETING AS msg->iMessage->IsNull returns ETrue");
  2833                 	WRITELOG("CHarvesterAO::HarvestingCompleted() NOT COMPLETING AS msg->iMessage->IsNull returns ETrue");
       
  2834                 	OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HARVESTCOMPLETED, "CHarvesterAO::HarvestCompleted NOT COMPLETING AS msg->iMessage->IsNull returns ETrue" );
  2609                 	} 
  2835                 	} 
  2610                 iHarvestFileMessages.Remove( i );
  2836                 iHarvestFileMessages.Remove( i );
  2611                 if( iHarvestFileMessages.Count() == 0 )
  2837                 if( iHarvestFileMessages.Count() == 0 )
  2612                     {
  2838                     {
  2613                     iHarvestFileMessages.Compress();
  2839                     iHarvestFileMessages.Compress();
  2618 	}
  2844 	}
  2619 
  2845 
  2620 void CHarvesterAO::BootRomScanL()
  2846 void CHarvesterAO::BootRomScanL()
  2621 	{
  2847 	{
  2622 	WRITELOG("CHarvesterAO::BootRomScanL()");
  2848 	WRITELOG("CHarvesterAO::BootRomScanL()");
       
  2849     OstTrace0( TRACE_NORMAL, CHARVESTERAO_BOOTROMSCANL, "CHarvesterAO::BootRomScanL" );
  2623 
  2850 
  2624     if( !iMdeSessionInitialized )
  2851     if( !iMdeSessionInitialized )
  2625         {
  2852         {
  2626         return;
  2853         return;
  2627         }
  2854         }
  2664 	    }
  2891 	    }
  2665 	
  2892 	
  2666 	iMdEHarvesterSession->ChangeCDriveMediaId();
  2893 	iMdEHarvesterSession->ChangeCDriveMediaId();
  2667 
  2894 
  2668 	WRITELOG("CHarvesterAO::BootPartialRestoreScanL() - partial restore");
  2895 	WRITELOG("CHarvesterAO::BootPartialRestoreScanL() - partial restore");
  2669 		
  2896     OstTrace0( TRACE_NORMAL, CHARVESTERAO_BOOTPARTIALRESTORESCANL, "CHarvesterAO::BootPartialRestoreScanL - partial restore" );
       
  2897     
  2670 	RPointerArray<TScanItem> scanItems;
  2898 	RPointerArray<TScanItem> scanItems;
  2671 	TCleanupItem cleanupItem( MdsUtils::CleanupPtrArray<TScanItem>, &scanItems );
  2899 	TCleanupItem cleanupItem( MdsUtils::CleanupPtrArray<TScanItem>, &scanItems );
  2672     CleanupStack::PushL( cleanupItem );
  2900     CleanupStack::PushL( cleanupItem );
  2673 
  2901 
  2674 	CHarvesterCenRepUtil::GetPartialRestorePathsL( scanItems );
  2902 	CHarvesterCenRepUtil::GetPartialRestorePathsL( scanItems );
  2680 	CHarvesterCenRepUtil::GetIgnoredPartialRestorePathsL( ignorePaths );
  2908 	CHarvesterCenRepUtil::GetIgnoredPartialRestorePathsL( ignorePaths );
  2681 
  2909 
  2682 	BootScanL( scanItems, ignorePaths, EFalse );
  2910 	BootScanL( scanItems, ignorePaths, EFalse );
  2683 	
  2911 	
  2684 	WRITELOG("CHarvesterAO::BootPartialRestoreScanL() - iRestoreWatcher->UnregisterL()");
  2912 	WRITELOG("CHarvesterAO::BootPartialRestoreScanL() - iRestoreWatcher->UnregisterL()");
       
  2913 	OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_BOOTPARTIALRESTORESCANL, "CHarvesterAO::BootPartialRestoreScanL - iRestoreWatcher->UnregisterL()" );
       
  2914 	
  2685 	iRestoreWatcher->UnregisterL();
  2915 	iRestoreWatcher->UnregisterL();
  2686 
  2916 
  2687 	CleanupStack::PopAndDestroy( &ignorePaths );
  2917 	CleanupStack::PopAndDestroy( &ignorePaths );
  2688 	CleanupStack::PopAndDestroy( &scanItems );
  2918 	CleanupStack::PopAndDestroy( &scanItems );
  2689 	}
  2919 	}
  2708 void CHarvesterAO::BootScanL( RPointerArray<TScanItem>& aScanItems, 
  2938 void CHarvesterAO::BootScanL( RPointerArray<TScanItem>& aScanItems, 
  2709 		const RPointerArray<HBufC>& aIgnorePaths,
  2939 		const RPointerArray<HBufC>& aIgnorePaths,
  2710         TBool aCheckDrive )
  2940         TBool aCheckDrive )
  2711 	{
  2941 	{
  2712 	WRITELOG("CHarvesterAO::BootScanL() - begin");
  2942 	WRITELOG("CHarvesterAO::BootScanL() - begin");
  2713 
  2943     OstTrace0( TRACE_NORMAL, CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - begin" );
  2714 	
  2944     	
  2715     TInt drive( -1 );
  2945     TInt drive( -1 );
  2716     TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) );
  2946     TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) );
  2717     if( massStorageError == KErrNone )
  2947     if( massStorageError == KErrNone )
  2718         {
  2948         {
  2719         TVolumeInfo massStorageVolumeInfo;
  2949         TVolumeInfo massStorageVolumeInfo;
  2738 	
  2968 	
  2739 	_LIT( KDirectorySeparator, "\\" );
  2969 	_LIT( KDirectorySeparator, "\\" );
  2740 
  2970 
  2741 #ifdef _DEBUG
  2971 #ifdef _DEBUG
  2742 	WRITELOG1("CHarvesterAO::BootScanL() - item count: %d", aScanItems.Count() );
  2972 	WRITELOG1("CHarvesterAO::BootScanL() - item count: %d", aScanItems.Count() );
       
  2973 	OstTrace1( TRACE_NORMAL, DUP1_CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - item count: %d", aScanItems.Count() );
  2743 #endif
  2974 #endif
  2744 	
  2975 	
  2745 	RPointerArray<CHarvesterData> hdArray;
  2976 	RPointerArray<CHarvesterData> hdArray;
  2746 	CleanupClosePushL( hdArray );
  2977 	CleanupClosePushL( hdArray );
  2747 	TBool rootDir( ETrue );
  2978 	TBool rootDir( ETrue );
  2806 						path.Set( (*name).Mid( 2 ) );
  3037 						path.Set( (*name).Mid( 2 ) );
  2807 						}
  3038 						}
  2808 					if( !IsDescInArray( path, aIgnorePaths ) )
  3039 					if( !IsDescInArray( path, aIgnorePaths ) )
  2809 						{
  3040 						{
  2810 						WRITELOG("CHarvesterAO::BootScanL() - scanFolders.AppendL");
  3041 						WRITELOG("CHarvesterAO::BootScanL() - scanFolders.AppendL");
       
  3042 						OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - scanFolders.AppendL" );
  2811 						TScanItem* item = new (ELeave) TScanItem();
  3043 						TScanItem* item = new (ELeave) TScanItem();
  2812 						item->iPath = name->AllocL();
  3044 						item->iPath = name->AllocL();
  2813 						item->iPreinstalled = MdeConstants::MediaObject::ENotPreinstalled;
  3045 						item->iPreinstalled = MdeConstants::MediaObject::ENotPreinstalled;
  2814 						aScanItems.AppendL( item );
  3046 						aScanItems.AppendL( item );
  2815 						}
  3047 						}
  2822 						filename.Set( (*name).Mid( 2 ) );
  3054 						filename.Set( (*name).Mid( 2 ) );
  2823 						}
  3055 						}
  2824 					if( !IsDescInArray( filename, aIgnorePaths ) )
  3056 					if( !IsDescInArray( filename, aIgnorePaths ) )
  2825 						{
  3057 						{
  2826 						WRITELOG("CHarvesterAO::BootScanL() - check files");
  3058 						WRITELOG("CHarvesterAO::BootScanL() - check files");
       
  3059 						OstTrace0( TRACE_NORMAL, DUP3_CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - check files" );
  2827 						
  3060 						
  2828 					    RArray<TPtrC> uris;
  3061 					    RArray<TPtrC> uris;
  2829 					    RArray<TMdSFileInfo> fileInfos;
  3062 					    RArray<TMdSFileInfo> fileInfos;
  2830 					    RArray<TFilePresentStates> results;
  3063 					    RArray<TFilePresentStates> results;
  2831 					    CleanupClosePushL( uris );
  3064 					    CleanupClosePushL( uris );
  2886 		delete aScanItems[0];
  3119 		delete aScanItems[0];
  2887 		aScanItems.Remove( 0 );
  3120 		aScanItems.Remove( 0 );
  2888 		}
  3121 		}
  2889 	
  3122 	
  2890 	WRITELOG("CHarvesterAO::BootScanL() - iQueue->Append");
  3123 	WRITELOG("CHarvesterAO::BootScanL() - iQueue->Append");
       
  3124 	OstTrace0( TRACE_NORMAL, DUP4_CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - iQueue->Append" );
       
  3125 	
  2891 	iQueue->MonitorEvent( hdArray );
  3126 	iQueue->MonitorEvent( hdArray );
  2892 	CleanupStack::PopAndDestroy( &hdArray ); 
  3127 	CleanupStack::PopAndDestroy( &hdArray ); 
  2893 
  3128 
  2894 	iMdEHarvesterSession->RemoveFilesNotPresent( volumeInfo.iUniqueID, ETrue );
  3129 	iMdEHarvesterSession->RemoveFilesNotPresent( volumeInfo.iUniqueID, ETrue );
  2895 	
  3130 	
  2896 	iMassMemoryIdChecked = ETrue;
  3131 	iMassMemoryIdChecked = ETrue;
  2897 	
  3132 	
  2898 	WRITELOG("CHarvesterAO::BootScanL() - end");
  3133 	WRITELOG("CHarvesterAO::BootScanL() - end");
       
  3134 	OstTrace0( TRACE_NORMAL, DUP5_CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - end" );
  2899 	}
  3135 	}
  2900 
  3136 
  2901 void CHarvesterAO::SetHarvesterStatusObserver( MHarvesterStatusObserver* aObserver )
  3137 void CHarvesterAO::SetHarvesterStatusObserver( MHarvesterStatusObserver* aObserver )
  2902 	{
  3138 	{
  2903 	iHarvesterStatusObserver = aObserver;
  3139 	iHarvesterStatusObserver = aObserver;
  2971     }
  3207     }
  2972 
  3208 
  2973 void CHarvesterAO::MemoryLow()
  3209 void CHarvesterAO::MemoryLow()
  2974 	{
  3210 	{
  2975     WRITELOG("CHarvesterAO::MemoryLow()");
  3211     WRITELOG("CHarvesterAO::MemoryLow()");
       
  3212     OstTrace0( TRACE_NORMAL, CHARVESTERAO_MEMORYLOW, "CHarvesterAO::MemoryLow" );
       
  3213     
  2976     iRamFull = ETrue;
  3214     iRamFull = ETrue;
  2977     
  3215     
  2978     if( iServerPaused )
  3216     if( iServerPaused )
  2979         {
  3217         {
  2980         return;
  3218         return;
  2990 	}
  3228 	}
  2991 
  3229 
  2992 void CHarvesterAO::MemoryGood()
  3230 void CHarvesterAO::MemoryGood()
  2993 	{
  3231 	{
  2994     WRITELOG("CHarvesterAO::MemoryGood()");    
  3232     WRITELOG("CHarvesterAO::MemoryGood()");    
       
  3233     OstTrace0( TRACE_NORMAL, CHARVESTERAO_MEMORYGOOD, "CHarvesterAO::MemoryGood" );
       
  3234     
  2995     iRamFull = EFalse;
  3235     iRamFull = EFalse;
  2996     
  3236     
  2997     if( !iDiskFull && !iManualPauseEnabled && iServerPaused )
  3237     if( !iDiskFull && !iManualPauseEnabled && iServerPaused )
  2998         {
  3238         {
  2999         // resume monitoring
  3239         // resume monitoring