imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmactivitymanager.h
changeset 54 48dd0f169f0d
parent 42 2e2a89493e2b
equal deleted inserted replaced
42:2e2a89493e2b 54:48dd0f169f0d
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Activity Manager
       
    15  *
       
    16 */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <hwrmlight.h>
       
    20 
       
    21 #ifndef TMACTIVITYMANAGER_H
       
    22 #define TMACTIVITYMANAGER_H
       
    23 
       
    24 //5.0 and 9.2 behaves totally different way, 
       
    25 //! uncomment on 5.0 !
       
    26 #define MONITOR_LIGHTS
       
    27 
       
    28 
       
    29 class MTMActivityManagerObserver
       
    30 
       
    31 {
       
    32 public :
       
    33     virtual void ActivityChanged(const TBool aActive) = 0;
       
    34 };
       
    35 
       
    36 
       
    37 class CTMActivityManager : public CActive
       
    38 #ifdef MONITOR_LIGHTS   
       
    39                            ,public MHWRMLightObserver
       
    40 #endif
       
    41 
       
    42 {
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      *
       
    48      * @since S60 v5.0
       
    49      * @return Instance of CThumbAGProcessor.
       
    50      */
       
    51     static CTMActivityManager* NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout = 60);
       
    52 
       
    53     /**
       
    54      * Destructor
       
    55      *
       
    56      * @since S60 v5.0
       
    57      */
       
    58     virtual ~CTMActivityManager();
       
    59     void SetTimeout(TInt aTimeout);
       
    60     void Start();
       
    61     void Reset();
       
    62     void Stop();
       
    63     TBool IsInactive();
       
    64 
       
    65 
       
    66 protected: // from CActive
       
    67     void DoCancel();
       
    68     void RunL();
       
    69     TInt RunError(TInt aError);
       
    70 
       
    71 protected:
       
    72     CTMActivityManager(MTMActivityManagerObserver* aObserver, TInt aTimeout);
       
    73     void ConstructL();
       
    74     void NotifyObserver();
       
    75     
       
    76 #ifdef MONITOR_LIGHTS
       
    77 private: //From MHWRMLightObserver
       
    78     void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
       
    79 #endif
       
    80     
       
    81 protected:
       
    82     enum TWatch { ENone = 0, EWaitingForInactivity, EWaitingForActivity };
       
    83 
       
    84 protected:
       
    85     RTimer iTimer;
       
    86     TWatch iWatch;
       
    87     MTMActivityManagerObserver* iObserver; ///The observer of activity status
       
    88     TInt iTimeout; ///Current inactivity period
       
    89     
       
    90 #ifdef MONITOR_LIGHTS
       
    91     //Backlight control 
       
    92     CHWRMLight* iLight;
       
    93     //backlight status
       
    94     TBool iLights;
       
    95 #endif
       
    96     //previous status
       
    97     TInt iPreviousStatus;
       
    98     TBool iFirstRound;
       
    99 };
       
   100 
       
   101 #endif // TMACTIVITYMANAGER_H