emailservices/emailservermonitor/inc/emailservermonitorutilities.h
branchRCL_3
changeset 31 72d484772ca6
parent 0 8466d47a6819
equal deleted inserted replaced
8:e1b6206813b4 31:72d484772ca6
    20 #ifndef EMAILSERVERMONITORUTILITIES_H
    20 #ifndef EMAILSERVERMONITORUTILITIES_H
    21 #define EMAILSERVERMONITORUTILITIES_H
    21 #define EMAILSERVERMONITORUTILITIES_H
    22 
    22 
    23 #include <e32base.h>
    23 #include <e32base.h>
    24 #include <e32cmn.h>     // TSecureId
    24 #include <e32cmn.h>     // TSecureId
       
    25 
       
    26 // Forward declarations
       
    27 class CEmailServerMonitorTimer;
    25 
    28 
    26 const TInt KDefaultTimeToWaitInSeconds = 3;
    29 const TInt KDefaultTimeToWaitInSeconds = 3;
    27 
    30 
    28 /////////////////////////////////////////////////////////////////////////////
    31 /////////////////////////////////////////////////////////////////////////////
    29 // LOCAL FUNCTION DECLARATIONS
    32 // LOCAL FUNCTION DECLARATIONS
    50  * @return ETrue if the specified process is running, otherwise EFalse.
    53  * @return ETrue if the specified process is running, otherwise EFalse.
    51  */
    54  */
    52 TBool IsProcessRunning( TSecureId aUid, RProcess* aProcess = NULL );
    55 TBool IsProcessRunning( TSecureId aUid, RProcess* aProcess = NULL );
    53 
    56 
    54 
    57 
       
    58 /**
       
    59 *  Generic timer's callback
       
    60 *
       
    61 *  Classes inherited from this one can be used as a callback for the generic
       
    62 *  timer. TimerEvent() is called when the timer elapses.
       
    63 *
       
    64 */
       
    65 class MEmailServerMonitorTimerCallback
       
    66     {
       
    67 public:
       
    68     /**
       
    69      * @param   aTriggeredTimer The timer which launched this event.
       
    70      */
       
    71     virtual void TimerEventL( CEmailServerMonitorTimer* aTriggeredTimer ) = 0;
       
    72     };
       
    73 
       
    74 /**
       
    75 *  Generic timer
       
    76 *
       
    77 *  Caller gives MEmailServerMonitorTimerCallback inherited pointer as a
       
    78 *  parameter, and that pointer is used as a callback when the timer elapses.
       
    79 *  Timer interval is given as a parameter for the Start function.
       
    80 *
       
    81 */
       
    82 class CEmailServerMonitorTimer : public CTimer
       
    83     {
       
    84 public:
       
    85     
       
    86     /**
       
    87     * Symbian two-pahse constructor.
       
    88     *
       
    89     * @param aCallback Callback class
       
    90     * @param aPriority Timers priority, EPriorityStandard by default
       
    91     */
       
    92     static CEmailServerMonitorTimer* NewL(
       
    93         MEmailServerMonitorTimerCallback* aCallback,
       
    94         const TInt aPriority = CActive::EPriorityStandard );
       
    95 
       
    96     /**
       
    97     * Symbian two-pahse constructor.
       
    98     *
       
    99     * @param aCallback Callback class
       
   100     * @param aPriority Timers priority, EPriorityStandard by default
       
   101     */
       
   102     static CEmailServerMonitorTimer* NewLC(
       
   103         MEmailServerMonitorTimerCallback* aCallback,
       
   104         const TInt aPriority = CActive::EPriorityStandard );
       
   105         
       
   106     /**
       
   107     * Destructor.
       
   108     */
       
   109     ~CEmailServerMonitorTimer();
       
   110         
       
   111     /**
       
   112     * Starts the timer with specified interval, or with the default value.
       
   113     *
       
   114     * @param aInterval Timer interval as microseconds
       
   115     */
       
   116     void Start( TInt aInterval );
       
   117 
       
   118     /**
       
   119     * Stops the timer.
       
   120     */
       
   121     void Stop();
       
   122 
       
   123     /**
       
   124     * CActive object's RunL
       
   125     */
       
   126     void RunL();
       
   127         
       
   128 protected:
       
   129     /**
       
   130     * Constructor.
       
   131     */
       
   132     CEmailServerMonitorTimer( MEmailServerMonitorTimerCallback* aCallback,
       
   133                               const TInt aPriority );
       
   134         
       
   135 private:
       
   136     /**
       
   137     * 2nd phase constructor.
       
   138     */
       
   139     void ConstructL();
       
   140 
       
   141 private:
       
   142     /* Pointer to callback class */
       
   143     MEmailServerMonitorTimerCallback* iCallback;
       
   144     };
       
   145 
       
   146 
    55 #endif // EMAILSERVERMONITORUTILITIES_H
   147 #endif // EMAILSERVERMONITORUTILITIES_H