harvester/harvesterserver/inc/cgaurdtimer.h
changeset 23 d4d56f5e7c55
equal deleted inserted replaced
20:556534771396 23:d4d56f5e7c55
       
     1 /*
       
     2 * Copyright (c) 2010 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:  This component is to start gaurd timer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CGAURDTIMER_H
       
    20 #define CGAURDTIMER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class MGaurdTimerHandler
       
    25     {
       
    26 public :
       
    27     /*
       
    28     * HandleGaurdTimerL signal when the gaurd timer expires 
       
    29     */
       
    30     virtual void HandleGaurdTimerL() = 0;
       
    31     };
       
    32 
       
    33 class CGaurdTimer : public CActive
       
    34     {
       
    35 public:
       
    36     /*
       
    37      * Construction
       
    38      * @return instance of CGaurdTimer
       
    39      */
       
    40     static CGaurdTimer* NewL( MGaurdTimerHandler* aGaurdTimerHandler ); //For callback
       
    41     /*
       
    42      * Construction
       
    43      * @return instance of CGaurdTimer
       
    44      */
       
    45     static CGaurdTimer* NewLC( MGaurdTimerHandler* aGaurdTimerHandler );
       
    46     /*
       
    47      * Destructor
       
    48      */
       
    49     virtual ~CGaurdTimer();
       
    50 public:
       
    51     /*
       
    52      * Srats the gaurd timer to find the idle time
       
    53      */
       
    54     void StartgaurdTimer();
       
    55     
       
    56     //From CActive
       
    57     void RunL();
       
    58     void DoCancel();
       
    59     TInt RunError( TInt aError );
       
    60 private:    
       
    61     /*
       
    62      * Constructor
       
    63      */
       
    64     CGaurdTimer();
       
    65     /*
       
    66      * Second phase constructor
       
    67      */
       
    68     void ConstructL( MGaurdTimerHandler* aGaurdTimerHandler );
       
    69 
       
    70 private:
       
    71     
       
    72     //Timer for self activation of AO
       
    73     RTimer iTimer; 
       
    74    
       
    75     MGaurdTimerHandler* iGaurdTimerHandler;
       
    76     };
       
    77 
       
    78 #endif /* CGAURDTIMER_H */