imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp
branchRCL_3
changeset 9 dea39715fc05
parent 7 2eb74cf6572e
child 11 85a88bc05e45
equal deleted inserted replaced
8:7403edfcf0fb 9:dea39715fc05
    48 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    49 //
    49 //
    50 CTMActivityManager::~CTMActivityManager()
    50 CTMActivityManager::~CTMActivityManager()
    51     {
    51     {
    52     TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
    52     TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
       
    53 #ifdef MONITOR_LIGHTS
    53     delete iLight;
    54     delete iLight;
    54     iLight = NULL;
    55     iLight = NULL;
       
    56 #endif
    55     Cancel();
    57     Cancel();
    56     iTimer.Close();
    58     iTimer.Close();
    57     }
    59     }
    58  
    60  
    59 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
    84 // ---------------------------------------------------------------------------
    83 //
    85 //
    84 void CTMActivityManager::Reset()
    86 void CTMActivityManager::Reset()
    85     {
    87     {
    86     TN_DEBUG1( "CTMActivityManager::Reset()");
    88     TN_DEBUG1( "CTMActivityManager::Reset()");
       
    89 #ifdef MONITOR_LIGHTS
    87     delete iLight;
    90     delete iLight;
    88     iLight = NULL;
    91     iLight = NULL;
       
    92 #endif
    89     Cancel();
    93     Cancel();
    90     Start();
    94     Start();
    91     }
    95     }
    92  
    96  
    93 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
   108     {
   112     {
   109     TN_DEBUG1( "CTMActivityManager::Start()");
   113     TN_DEBUG1( "CTMActivityManager::Start()");
   110     
   114     
   111     iFirstRound = ETrue;
   115     iFirstRound = ETrue;
   112     
   116     
       
   117 #ifdef MONITOR_LIGHTS
   113     if(!iLight)
   118     if(!iLight)
   114         {
   119         {
   115         TRAP_IGNORE(iLight = CHWRMLight::NewL(this));
   120         TRAP_IGNORE(iLight = CHWRMLight::NewL(this));
   116         }
   121         }
       
   122 #endif
   117     
   123     
   118     if( !IsActive() )
   124     if( !IsActive() )
   119         {
   125         {
   120         SetActive();
   126         SetActive();
   121         TRequestStatus* statusPtr = &iStatus;
   127         TRequestStatus* statusPtr = &iStatus;
   211 // IsInactive()
   217 // IsInactive()
   212 // -----------------------------------------------------------------------------
   218 // -----------------------------------------------------------------------------
   213 //
   219 //
   214 TBool CTMActivityManager::IsInactive()
   220 TBool CTMActivityManager::IsInactive()
   215     {
   221     {
       
   222 #ifdef MONITOR_LIGHTS
   216 #ifdef _DEBUG
   223 #ifdef _DEBUG
   217 TN_DEBUG3( "CTMActivityManager::IsInactive()= %d, iLights = %d", User::InactivityTime().Int(), iLights);
   224 TN_DEBUG3( "CTMActivityManager::IsInactive()= %d, iLights = %d", User::InactivityTime().Int(), iLights);
   218 #endif
   225 #endif
       
   226 #else
       
   227 TN_DEBUG2( "CTMActivityManager::IsInactive()= %d", User::InactivityTime().Int());
       
   228 #endif
   219 
   229 
   220     //if lights are off or inactivity timer is less that target the device is not idle
   230     //if lights are off or inactivity timer is less that target the device is not idle
   221     if( User::InactivityTime() >= TTimeIntervalSeconds(iTimeout) || !iLights )
   231     if( User::InactivityTime() >= TTimeIntervalSeconds(iTimeout)
       
   232 #ifdef MONITOR_LIGHTS
       
   233             || !iLights
       
   234 #endif
       
   235             )
   222       {
   236       {
   223       TN_DEBUG1( "CTMActivityManager::IsInactive() ETrue");
   237       TN_DEBUG1( "CTMActivityManager::IsInactive() ETrue");
   224       return ETrue;
   238       return ETrue;
   225       }
   239       }
   226     TN_DEBUG1( "CTMActivityManager::IsInactive() EFalse");
   240     TN_DEBUG1( "CTMActivityManager::IsInactive() EFalse");
   227     return EFalse;
   241     return EFalse;
   228     }
   242     }
   229 
   243 
       
   244 #ifdef MONITOR_LIGHTS
   230 // -----------------------------------------------------------------------------
   245 // -----------------------------------------------------------------------------
   231 // LightStatusChanged()
   246 // LightStatusChanged()
   232 // -----------------------------------------------------------------------------
   247 // -----------------------------------------------------------------------------
   233 //
   248 //
   234 void CTMActivityManager::LightStatusChanged(TInt /*aTarget*/, CHWRMLight::TLightStatus aStatus)
   249 void CTMActivityManager::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
   235     {
   250     {
   236     TN_DEBUG2( "CTMActivityManager::LightStatusChanged() aStatus == %d", aStatus);
   251     TN_DEBUG3( "CTMActivityManager::LightStatusChanged() aTarget = %d, aStatus == %d", aTarget, aStatus);
   237     
   252     
   238      if( aStatus == CHWRMLight::ELightOff)
   253     if(aTarget & CHWRMLight::EPrimaryDisplay)
   239         {
   254         {
   240         TN_DEBUG1( "CTMActivityManager::LightStatusChanged() -- OFF");
   255          if( aStatus == CHWRMLight::ELightOff )
   241         iLights = EFalse;
   256             {
   242         }
   257             TN_DEBUG1( "CTMActivityManager::LightStatusChanged() -- OFF");
   243     else
   258             iLights = EFalse;
   244         {
   259             }
   245         TN_DEBUG1( "CTMActivityManager::LightStatusChanged() -- ON");
   260         else
   246         iLights = ETrue;
   261             {
   247         }
   262             TN_DEBUG1( "CTMActivityManager::LightStatusChanged() -- ON");
       
   263             iLights = ETrue;
       
   264             }
   248      
   265      
   249         NotifyObserver();
   266         NotifyObserver();
   250     }
   267         }
       
   268     }
       
   269 #endif
   251 
   270 
   252 // -----------------------------------------------------------------------------
   271 // -----------------------------------------------------------------------------
   253 // NotifyObserver()
   272 // NotifyObserver()
   254 // -----------------------------------------------------------------------------
   273 // -----------------------------------------------------------------------------
   255 //
   274 //