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