imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp
branchRCL_3
changeset 22 9d4d3445ce6e
parent 21 6257223ede8a
equal deleted inserted replaced
21:6257223ede8a 22:9d4d3445ce6e
    26 
    26 
    27 #include "thumbagdaemon.h"
    27 #include "thumbagdaemon.h"
    28 #include "thumbnaillog.h"
    28 #include "thumbnaillog.h"
    29 #include "thumbnailmanagerconstants.h"
    29 #include "thumbnailmanagerconstants.h"
    30 #include "thumbnailmanagerprivatecrkeys.h"
    30 #include "thumbnailmanagerprivatecrkeys.h"
    31 #include "OstTraceDefinitions.h"
       
    32 #ifdef OST_TRACE_COMPILER_IN_USE
       
    33 #include "thumbagdaemonTraces.h"
       
    34 #endif
       
    35 
    31 
    36 
    32 
    37 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    38 // NewLC
    34 // NewLC
    39 // ---------------------------------------------------------------------------
    35 // ---------------------------------------------------------------------------
    40 //
    36 //
    41 CThumbAGDaemon* CThumbAGDaemon::NewLC()
    37 CThumbAGDaemon* CThumbAGDaemon::NewLC()
    42     {
    38     {
    43     TN_DEBUG1( "CThumbAGDaemon::NewLC() - begin" );
    39     TN_DEBUG1( "CThumbAGDaemon::NewLC() - begin" );
    44     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_NEWLC, "CThumbAGDaemon::NewLC - begin" );
       
    45     
    40     
    46 	CThumbAGDaemon* self = new (ELeave) CThumbAGDaemon();
    41 	CThumbAGDaemon* self = new (ELeave) CThumbAGDaemon();
    47 	CleanupStack::PushL( self );
    42 	CleanupStack::PushL( self );
    48 	self->ConstructL();
    43 	self->ConstructL();
    49 	return self;
    44 	return self;
    54 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    55 //
    50 //
    56 CThumbAGDaemon* CThumbAGDaemon::NewL()
    51 CThumbAGDaemon* CThumbAGDaemon::NewL()
    57 	{
    52 	{
    58 	TN_DEBUG1( "CThumbAGDaemon::NewL() - begin" );
    53 	TN_DEBUG1( "CThumbAGDaemon::NewL() - begin" );
    59     OstTrace0( TRACE_NORMAL, CTHUMBAGDAEMON_NEWL, "CThumbAGDaemon::NewL" );
       
    60     
    54     
    61 	CThumbAGDaemon* self = CThumbAGDaemon::NewLC();
    55 	CThumbAGDaemon* self = CThumbAGDaemon::NewLC();
    62 	CleanupStack::Pop( self );
    56 	CleanupStack::Pop( self );
    63 	return self;
    57 	return self;
    64 	}
    58 	}
    79 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
    80 //
    74 //
    81 void CThumbAGDaemon::ConstructL()
    75 void CThumbAGDaemon::ConstructL()
    82 	{
    76 	{
    83 	TN_DEBUG1( "CThumbAGDaemon::ConstructL() - begin" );
    77 	TN_DEBUG1( "CThumbAGDaemon::ConstructL() - begin" );
    84 	OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_CONSTRUCTL, "CThumbAGDaemon::ConstructL - begin" );
       
    85 	
    78 	
    86 	StartL( KTAGDaemonName );
    79 	StartL( KTAGDaemonName );
    87 	
    80 	
    88 #ifdef _DEBUG
    81 #ifdef _DEBUG
    89     iAddCounter = 0;
    82     iAddCounter = 0;
    91 #endif
    84 #endif
    92     
    85     
    93     InitializeL();
    86     InitializeL();
    94     	
    87     	
    95 	TN_DEBUG1( "CThumbAGDaemon::ConstructL() - end" );
    88 	TN_DEBUG1( "CThumbAGDaemon::ConstructL() - end" );
    96 	OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_CONSTRUCTL, "CThumbAGDaemon::ConstructL - end" );
       
    97 	}
    89 	}
    98 
    90 
    99 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
   100 // ~CThumbAGDaemon
    92 // ~CThumbAGDaemon
   101 // ---------------------------------------------------------------------------
    93 // ---------------------------------------------------------------------------
   102 //
    94 //
   103 void CThumbAGDaemon::InitializeL()
    95 void CThumbAGDaemon::InitializeL()
   104     {
    96     {
   105     TN_DEBUG1( "CThumbAGDaemon::InitializeL() - begin" );
    97     TN_DEBUG1( "CThumbAGDaemon::InitializeL() - begin" );
   106     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_INITIALIZEL, "CThumbAGDaemon::InitializeL - begin" );
       
   107     
    98     
   108     if (DaemonEnabledL())
    99     if (DaemonEnabledL())
   109         {
   100         {
   110         TN_DEBUG1( "CThumbAGDaemon::InitializeL() - create observers" );
   101         TN_DEBUG1( "CThumbAGDaemon::InitializeL() - create observers" );
   111         OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_INITIALIZEL, "CThumbAGDaemon::InitializeL - create observers" );
       
   112         
   102         
   113         // create shutdown observer
   103         // create shutdown observer
   114         if(iMDSShutdownObserver)
   104         if(iMDSShutdownObserver)
   115             {
   105             {
   116             delete iMDSShutdownObserver;
   106             delete iMDSShutdownObserver;
   177         {
   167         {
   178         // no error here, but need to shutdown daemon neatly
   168         // no error here, but need to shutdown daemon neatly
   179         User::Leave(KErrNone);
   169         User::Leave(KErrNone);
   180         }
   170         }
   181         TN_DEBUG1( "CThumbAGDaemon::InitializeL() - end" );
   171         TN_DEBUG1( "CThumbAGDaemon::InitializeL() - end" );
   182         OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_INITIALIZEL, "CThumbAGDaemon::InitializeL - end" );
       
   183     }
   172     }
   184 
   173 
   185 // ---------------------------------------------------------------------------
   174 // ---------------------------------------------------------------------------
   186 // ~CThumbAGDaemon
   175 // ~CThumbAGDaemon
   187 // ---------------------------------------------------------------------------
   176 // ---------------------------------------------------------------------------
   188 //
   177 //
   189 CThumbAGDaemon::~CThumbAGDaemon()
   178 CThumbAGDaemon::~CThumbAGDaemon()
   190     {
   179     {
   191     TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - begin" );
   180     TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - begin" );
   192     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_CTHUMBAGDAEMON, "CThumbAGDaemon::~CThumbAGDaemon - begin" );
       
   193     
   181     
   194     iShutdown = ETrue;
   182     iShutdown = ETrue;
   195     
   183     
   196     delete iImageObserver;
   184     delete iImageObserver;
   197     iImageObserver = NULL;
   185     iImageObserver = NULL;
   238         delete iMdESession;
   226         delete iMdESession;
   239         iMdESession = NULL;
   227         iMdESession = NULL;
   240         }
   228         }
   241     
   229     
   242     TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - end" );
   230     TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - end" );
   243     OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_CTHUMBAGDAEMON, "CThumbAGDaemon::~CThumbAGDaemon - end" );
       
   244     }
   231     }
   245 
   232 
   246 // -----------------------------------------------------------------------------
   233 // -----------------------------------------------------------------------------
   247 // CThumbnailServer::NewSessionL()
   234 // CThumbnailServer::NewSessionL()
   248 // -----------------------------------------------------------------------------
   235 // -----------------------------------------------------------------------------
   262 // ---------------------------------------------------------------------------
   249 // ---------------------------------------------------------------------------
   263 //
   250 //
   264 void CThumbAGDaemon::ThreadFunctionL()
   251 void CThumbAGDaemon::ThreadFunctionL()
   265     {
   252     {
   266 	TN_DEBUG1( "CThumbAGDaemon::ThreadFunctionL() - begin" );
   253 	TN_DEBUG1( "CThumbAGDaemon::ThreadFunctionL() - begin" );
   267     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_THREADFUNCTIONL, "CThumbAGDaemon::ThreadFunctionL - begin" );
       
   268     
   254     
   269     User::LeaveIfError( User::RenameThread( KTAGDaemonName ) );
   255     User::LeaveIfError( User::RenameThread( KTAGDaemonName ) );
   270 
   256 
   271     CThumbAGDaemon* server = NULL;
   257     CThumbAGDaemon* server = NULL;
   272     CActiveScheduler* scheduler = new( ELeave )CActiveScheduler();
   258     CActiveScheduler* scheduler = new( ELeave )CActiveScheduler();
   288         
   274         
   289         CleanupStack::PopAndDestroy( scheduler );
   275         CleanupStack::PopAndDestroy( scheduler );
   290         }
   276         }
   291     
   277     
   292     TN_DEBUG1( "CThumbAGDaemon::ThreadFunctionL() - end" );
   278     TN_DEBUG1( "CThumbAGDaemon::ThreadFunctionL() - end" );
   293 	OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_THREADFUNCTIONL, "CThumbAGDaemon::ThreadFunctionL - end" );
       
   294 	}
   279 	}
   295 
   280 
   296 // -----------------------------------------------------------------------------
   281 // -----------------------------------------------------------------------------
   297 // CThumbAGDaemon::HandleSessionOpened
   282 // CThumbAGDaemon::HandleSessionOpened
   298 // -----------------------------------------------------------------------------
   283 // -----------------------------------------------------------------------------
   299 //
   284 //
   300 void CThumbAGDaemon::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
   285 void CThumbAGDaemon::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
   301     {
   286     {
   302     TN_DEBUG1( "CThumbAGDaemon::HandleSessionOpened");
   287     TN_DEBUG1( "CThumbAGDaemon::HandleSessionOpened");
   303     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_HANDLESESSIONOPENED, "CThumbAGDaemon::HandleSessionOpened" );
       
   304     
   288     
   305     if (aError == KErrNone)
   289     if (aError == KErrNone)
   306         {
   290         {
   307         TRAPD(err, iProcessor->SetMdESessionL(iMdESession));
   291         TRAPD(err, iProcessor->SetMdESessionL(iMdESession));
   308         
   292         
   309         TRAP( err, AddObserversL() );
   293         TRAP( err, AddObserversL() );
   310         if (err != KErrNone)
   294         if (err != KErrNone)
   311             {
   295             {
   312             TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened, AddObserversL error == %d", err );
   296             TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened, AddObserversL error == %d", err );
   313             OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLESESSIONOPENED, "CThumbAGDaemon::HandleSessionOpened;err=%d", err );
       
   314             }
   297             }
   315         }
   298         }
   316     else
   299     else
   317         {
   300         {
   318         TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened error == %d", aError );
   301         TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened error == %d", aError );
   319         OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLESESSIONOPENED, "CThumbAGDaemon::HandleSessionOpened;aError=%d", aError );
       
   320         }
   302         }
   321     }
   303     }
   322 
   304 
   323 // -----------------------------------------------------------------------------
   305 // -----------------------------------------------------------------------------
   324 // CThumbAGDaemon::HandleSessionError
   306 // CThumbAGDaemon::HandleSessionError
   325 // -----------------------------------------------------------------------------
   307 // -----------------------------------------------------------------------------
   326 //
   308 //
   327 void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
   309 void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
   328     {
   310     {
   329     TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
   311     TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
   330     OstTrace1( TRACE_FATAL, CTHUMBAGDAEMON_HANDLESESSIONERROR, "CThumbAGDaemon::HandleSessionError;aError=%d", aError );
       
   331     if (aError != KErrNone && !iShutdown && !iSessionError)
   312     if (aError != KErrNone && !iShutdown && !iSessionError)
   332         {
   313         {
   333         iSessionError = ETrue;
   314         iSessionError = ETrue;
   334     
   315     
   335 	    delete iImageObserver;
   316 	    delete iImageObserver;
   356             {
   337             {
   357             iReconnect->Start( KMdEReconnect, KMdEReconnect, 
   338             iReconnect->Start( KMdEReconnect, KMdEReconnect, 
   358                                TCallBack(ReconnectCallBack, this));
   339                                TCallBack(ReconnectCallBack, this));
   359             
   340             
   360             TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" );
   341             TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" );
   361             OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLESESSIONERROR, "CThumbAGDaemon::HandleSessionError - reconnect timer started" );
       
   362             }
   342             }
   363 
   343 
   364         }   
   344         }   
   365     }
   345     }
   366 
   346 
   374         TObserverNotificationType aType,
   354         TObserverNotificationType aType,
   375         const RArray<TItemId>& aObjectIdArray,
   355         const RArray<TItemId>& aObjectIdArray,
   376         const RPointerArray<HBufC>& aObjectUriArray)
   356         const RPointerArray<HBufC>& aObjectUriArray)
   377     {
   357     {
   378     TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - begin" );
   358     TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - begin" );
   379     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_HANDLEURIOBJECTNOTIFICATION, "CThumbAGDaemon::HandleUriObjectNotification - begin" );
       
   380     
   359     
   381     if(!iProcessor || iShutdown)
   360     if(!iProcessor || iShutdown)
   382         {
   361         {
   383         return;
   362         return;
   384         }
   363         }
   385     
   364     
   386     if(aType == ENotifyRemove)
   365     if(aType == ENotifyRemove)
   387         {
   366         {
   388         TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed");
   367         TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed");
   389         OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLEURIOBJECTNOTIFICATION, "CThumbAGDaemon::HandleUriObjectNotification - removed" );
       
   390         TInt err(0);
   368         TInt err(0);
   391         TRAP(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, aObjectUriArray, EFalse));
   369         TRAP(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, aObjectUriArray, EFalse));
   392         __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGDaemon::HandleUriObjectNotification()"), err));
   370         __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGDaemon::HandleUriObjectNotification()"), err));
   393 
   371 
   394         err = KErrNone;
   372         err = KErrNone;
   395         }
   373         }
   396     TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - end" );
   374     TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - end" );
   397     OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLEURIOBJECTNOTIFICATION, "CThumbAGDaemon::HandleUriObjectNotification - end" );
       
   398     }
   375     }
   399 #endif
   376 #endif
   400 
   377 
   401 // -----------------------------------------------------------------------------
   378 // -----------------------------------------------------------------------------
   402 // CThumbAGDaemon::HandleObjectNotification
   379 // CThumbAGDaemon::HandleObjectNotification
   405 void CThumbAGDaemon::HandleObjectNotification( CMdESession& /*aSession*/, 
   382 void CThumbAGDaemon::HandleObjectNotification( CMdESession& /*aSession*/, 
   406                                                TObserverNotificationType aType,
   383                                                TObserverNotificationType aType,
   407                                                const RArray<TItemId>& aObjectIdArray )
   384                                                const RArray<TItemId>& aObjectIdArray )
   408     {
   385     {
   409     TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - begin" );
   386     TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - begin" );
   410     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - begin" );
       
   411 
   387 
   412     // no processor or shutting down
   388     // no processor or shutting down
   413     if (!iProcessor || iShutdown)
   389     if (!iProcessor || iShutdown)
   414         {
   390         {
   415         return;
   391         return;
   417     
   393     
   418 #ifdef _DEBUG
   394 #ifdef _DEBUG
   419     if (aType == ENotifyRemove)
   395     if (aType == ENotifyRemove)
   420         {
   396         {
   421         TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyRemove %d", aObjectIdArray.Count() );
   397         TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyRemove %d", aObjectIdArray.Count() );
   422         OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - ENotifyRemove;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
       
   423         iDelCounter = aObjectIdArray.Count();
   398         iDelCounter = aObjectIdArray.Count();
   424         }
   399         }
   425 #endif
   400 #endif
   426     
   401     
   427     if ( aType == ENotifyRemove && aObjectIdArray.Count() > 0 )
   402     if ( aType == ENotifyRemove && aObjectIdArray.Count() > 0 )
   428         {
   403         {
   429         TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - AddToQueueL" );
   404         TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - AddToQueueL" );
   430 		OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - AddToQueueL" );
       
   431 		
   405 		
   432         // If delete event, remove IDs from Modify and Add queues
   406         // If delete event, remove IDs from Modify and Add queues
   433         iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
   407         iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
   434         
   408         
   435         // Add event to processing queue by type and enable force run        
   409         // Add event to processing queue by type and enable force run        
   436         RPointerArray<HBufC> dummyArray;
   410         RPointerArray<HBufC> dummyArray;
   437         TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, dummyArray, EFalse));
   411         TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, dummyArray, EFalse));
   438         if (err != KErrNone)
   412         if (err != KErrNone)
   439             {
   413             {
   440             TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - error adding to queue" );
   414             TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - error adding to queue" );
   441             OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - error adding to queue" );
       
   442             }
   415             }
   443         }
   416         }
   444     else
   417     else
   445         {
   418         {
   446         TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - bad notification" );
   419         TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - bad notification" );
   447         OstTrace0( TRACE_FATAL, DUP4_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - bad notification" );
       
   448         }
   420         }
   449     
   421     
   450 #ifdef _DEBUG
   422 #ifdef _DEBUG
   451     TN_DEBUG2( "CThumbAGDaemon::IN-COUNTERS---------- Delete = %d", iDelCounter );
   423     TN_DEBUG2( "CThumbAGDaemon::IN-COUNTERS---------- Delete = %d", iDelCounter );
   452     OstTrace1( TRACE_FATAL, DUP5_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::IN-COUNTERS---------- Delete;iDelCounter=%u", iDelCounter );
       
   453     iDelCounter = 0;
   424     iDelCounter = 0;
   454 #endif
   425 #endif
   455 
   426 
   456     TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - end" );
   427     TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - end" );
   457     OstTrace0( TRACE_FATAL, DUP6_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - end" );
       
   458     }
   428     }
   459 
   429 
   460 // -----------------------------------------------------------------------------
   430 // -----------------------------------------------------------------------------
   461 // CThumbAGDaemon::HandleObjectPresentNotification
   431 // CThumbAGDaemon::HandleObjectPresentNotification
   462 // -----------------------------------------------------------------------------
   432 // -----------------------------------------------------------------------------
   463 //
   433 //
   464 void CThumbAGDaemon::HandleObjectPresentNotification(CMdESession& /*aSession*/, 
   434 void CThumbAGDaemon::HandleObjectPresentNotification(CMdESession& /*aSession*/, 
   465                TBool aPresent, const RArray<TItemId>& aObjectIdArray)
   435                TBool aPresent, const RArray<TItemId>& aObjectIdArray)
   466     {
   436     {
   467     TN_DEBUG3( "CThumbAGDaemon::HandleObjectPresentNotification() - aPresent == %d count == %d", aPresent, aObjectIdArray.Count() );
   437     TN_DEBUG3( "CThumbAGDaemon::HandleObjectPresentNotification() - aPresent == %d count == %d", aPresent, aObjectIdArray.Count() );
   468     OstTraceExt2( TRACE_FATAL, CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification;aPresent=%d;aObjectIdArray.Count()=%d", aPresent, aObjectIdArray.Count() );
       
   469     
   438     
   470     // no processor or shutting down
   439     // no processor or shutting down
   471     if (!iProcessor || iShutdown)
   440     if (!iProcessor || iShutdown)
   472         {
   441         {
   473         return;
   442         return;
   483 		    // do not force run of these items
   452 		    // do not force run of these items
   484             RPointerArray<HBufC> dummyArray;
   453             RPointerArray<HBufC> dummyArray;
   485             TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, EGenerationItemTypeUnknown, aObjectIdArray, dummyArray, ETrue));
   454             TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, EGenerationItemTypeUnknown, aObjectIdArray, dummyArray, ETrue));
   486            
   455            
   487             TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd unknown items %d", aObjectIdArray.Count() );     
   456             TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd unknown items %d", aObjectIdArray.Count() );     
   488             OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - ENotifyAdd unknown items;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
       
   489            #ifdef _DEBUG
   457            #ifdef _DEBUG
   490            iAddCounter = aObjectIdArray.Count();
   458            iAddCounter = aObjectIdArray.Count();
   491            if (err != KErrNone)
   459            if (err != KErrNone)
   492                {
   460                {
   493                TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - error adding to queue" );
   461                TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - error adding to queue" );
   494                OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - error adding to queue" );
       
   495                }
   462                }
   496            #endif
   463            #endif
   497            }
   464            }
   498         }
   465         }
   499     else
   466     else
   500         {
   467         {
   501         TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - handle not present" );
   468         TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - handle not present" );
   502         OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - handle not present" );
       
   503 
   469 
   504         #ifdef _DEBUG    
   470         #ifdef _DEBUG    
   505         if( iAddCounter < aObjectIdArray.Count() )
   471         if( iAddCounter < aObjectIdArray.Count() )
   506             {
   472             {
   507             iAddCounter = 0;
   473             iAddCounter = 0;
   518             }
   484             }
   519         }
   485         }
   520     
   486     
   521     #ifdef _DEBUG
   487     #ifdef _DEBUG
   522     TN_DEBUG3( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Delete = %d", iAddCounter, iDelCounter );
   488     TN_DEBUG3( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Delete = %d", iAddCounter, iDelCounter );
   523     OstTraceExt2( TRACE_FATAL, DUP4_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::::IN-COUNTERS---------- Add, Delete;iAddCounter=%u;iDelCounter=%u", iAddCounter, iDelCounter );
       
   524     iDelCounter = 0;
   489     iDelCounter = 0;
   525 	iAddCounter = 0;
   490 	iAddCounter = 0;
   526     #endif
   491     #endif
   527     
   492     
   528     TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - end" );
   493     TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - end" );
   529     OstTrace0( TRACE_FATAL, DUP5_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - end" );
       
   530     }
   494     }
   531 
   495 
   532 // -----------------------------------------------------------------------------
   496 // -----------------------------------------------------------------------------
   533 // CThumbAGDaemon::ShutdownNotification
   497 // CThumbAGDaemon::ShutdownNotification
   534 // -----------------------------------------------------------------------------
   498 // -----------------------------------------------------------------------------
   535 //
   499 //
   536 void CThumbAGDaemon::ShutdownNotification()
   500 void CThumbAGDaemon::ShutdownNotification()
   537     {
   501     {
   538     TN_DEBUG1( "CThumbAGDaemon::ShutdownNotification()" );
   502     TN_DEBUG1( "CThumbAGDaemon::ShutdownNotification()" );
   539     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_SHUTDOWNNOTIFICATION, "CThumbAGDaemon::ShutdownNotification" );
       
   540     
   503     
   541     if (!iShutdown)
   504     if (!iShutdown)
   542         {
   505         {
   543         CActiveScheduler::Stop();
   506         CActiveScheduler::Stop();
   544         iShutdown = ETrue;
   507         iShutdown = ETrue;
   550 // ---------------------------------------------------------------------------
   513 // ---------------------------------------------------------------------------
   551 //
   514 //
   552 void CThumbAGDaemon::AddObserversL()
   515 void CThumbAGDaemon::AddObserversL()
   553     {
   516     {
   554     TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - begin" );
   517     TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - begin" );
   555     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_ADDOBSERVERSL, "CThumbAGDaemon::AddObserversL - begin" );
   518     
   556  
   519  
   557 #ifdef MDS_URI_OBSERVER
   520 #ifdef MDS_URI_OBSERVER
   558     // remove observer with uri
   521     // remove observer with uri
   559     iMdESession->AddObjectObserverWithUriL( *this, NULL, ENotifyRemove );
   522     iMdESession->AddObjectObserverWithUriL( *this, NULL, ENotifyRemove );
   560 #endif
   523 #endif
   561     
   524     
   562     // object present observer
   525     // object present observer
   563     iMdESession->AddObjectPresentObserverL( *this );
   526     iMdESession->AddObjectPresentObserverL( *this );
   564     
   527     
   565     TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - end" );
   528     TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - end" );
   566     OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_ADDOBSERVERSL, "CThumbAGDaemon::AddObserversL - end" );
       
   567     }
   529     }
   568 
   530 
   569 // ---------------------------------------------------------------------------
   531 // ---------------------------------------------------------------------------
   570 // CThumbAGDaemon::DaemonEnabledL
   532 // CThumbAGDaemon::DaemonEnabledL
   571 // ---------------------------------------------------------------------------
   533 // ---------------------------------------------------------------------------
   572 //
   534 //
   573 TBool CThumbAGDaemon::DaemonEnabledL()
   535 TBool CThumbAGDaemon::DaemonEnabledL()
   574     {
   536     {
   575     TN_DEBUG1( "CThumbAGDaemon::DaemonEnabledL() - begin" );
   537     TN_DEBUG1( "CThumbAGDaemon::DaemonEnabledL() - begin" );
   576     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_DAEMONENABLEDL, "CThumbAGDaemon::DaemonEnabledL - begin" );
       
   577     CRepository* rep = CRepository::NewL( TUid::Uid( THUMBNAIL_CENREP_UID ));
   538     CRepository* rep = CRepository::NewL( TUid::Uid( THUMBNAIL_CENREP_UID ));
   578     
   539     
   579     // get value
   540     // get value
   580     TBool val( EFalse );
   541     TBool val( EFalse );
   581     TInt ret = rep->Get( KEnableDaemon, val );
   542     TInt ret = rep->Get( KEnableDaemon, val );
   582     
   543     
   583     delete rep;
   544     delete rep;
   584     rep = NULL;
   545     rep = NULL;
   585     
   546     
   586     TN_DEBUG3( "CThumbAGDaemon::DaemonEnabledL() - val == %d, ret == %d", val, ret );
   547     TN_DEBUG3( "CThumbAGDaemon::DaemonEnabledL() - val == %d, ret == %d", val, ret );
   587     OstTraceExt2( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_DAEMONENABLEDL, "CThumbAGDaemon::DaemonEnabledL;val=%u;ret=%d", val, ret );
       
   588     return val;
   548     return val;
   589     }
   549     }
   590 
   550 
   591 // ---------------------------------------------------------------------------
   551 // ---------------------------------------------------------------------------
   592 // CThumbAGDaemon::ReconnectCallBack()
   552 // CThumbAGDaemon::ReconnectCallBack()
   593 // ---------------------------------------------------------------------------
   553 // ---------------------------------------------------------------------------
   594 //
   554 //
   595 TInt CThumbAGDaemon::ReconnectCallBack(TAny* aAny)
   555 TInt CThumbAGDaemon::ReconnectCallBack(TAny* aAny)
   596     {
   556     {
   597     TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - reinitialize");
   557     TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - reinitialize");
   598     OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_RECONNECTCALLBACK, "CThumbAGDaemon::ReconnectCallBack - reinitialize" );
       
   599     
   558     
   600     CThumbAGDaemon* self = static_cast<CThumbAGDaemon*>( aAny );
   559     CThumbAGDaemon* self = static_cast<CThumbAGDaemon*>( aAny );
   601     
   560     
   602     self->iReconnect->Cancel();
   561     self->iReconnect->Cancel();
   603     
   562     
   604     // reconnect to MDS
   563     // reconnect to MDS
   605     TRAP_IGNORE( self->InitializeL() );
   564     TRAP_IGNORE( self->InitializeL() );
   606     
   565     
   607     TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done");
   566     TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done");
   608     OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_RECONNECTCALLBACK, "CThumbAGDaemon::ReconnectCallBack - done" );
       
   609     
   567     
   610     return KErrNone;
   568     return KErrNone;
   611     }
   569     }
   612 
   570 
   613 // ---------------------------------------------------------------------------
   571 // ---------------------------------------------------------------------------
   615 // ---------------------------------------------------------------------------
   573 // ---------------------------------------------------------------------------
   616 //
   574 //
   617 TInt E32Main()
   575 TInt E32Main()
   618     {    
   576     {    
   619     TN_DEBUG1( "CThumbAGDaemon::E32Main() - begin" );
   577     TN_DEBUG1( "CThumbAGDaemon::E32Main() - begin" );
   620     OstTrace0( TRACE_FATAL, _E32MAIN, "::E32Main - begin" );
       
   621 
   578 
   622     __UHEAP_MARK;
   579     __UHEAP_MARK;
   623 
   580 
   624     CTrapCleanup* cleanup = CTrapCleanup::New();
   581     CTrapCleanup* cleanup = CTrapCleanup::New();
   625     TInt result = KErrNoMemory;
   582     TInt result = KErrNoMemory;
   632         }
   589         }
   633     
   590     
   634     if ( result != KErrNone )
   591     if ( result != KErrNone )
   635         {
   592         {
   636         TN_DEBUG1( "CThumbAGDaemon::E32Main() - error" );
   593         TN_DEBUG1( "CThumbAGDaemon::E32Main() - error" );
   637         OstTrace0( TRACE_FATAL, DUP1__E32MAIN, "::E32Main - error" );
       
   638         
   594         
   639         // Signal the client that server creation failed
   595         // Signal the client that server creation failed
   640         RProcess::Rendezvous( result );
   596         RProcess::Rendezvous( result );
   641         }    
   597         }    
   642     
   598     
   643     __UHEAP_MARKEND;
   599     __UHEAP_MARKEND;
   644 
   600 
   645     TN_DEBUG1( "CThumbAGDaemon::E32Main() - end" );
   601     TN_DEBUG1( "CThumbAGDaemon::E32Main() - end" );
   646     OstTrace0( TRACE_FATAL, DUP2__E32MAIN, "::E32Main - end" );
       
   647     
   602     
   648     return result;
   603     return result;
   649     }
   604     }
   650 
   605 
   651 // End of file
   606 // End of file