emailservices/emailservermonitor/inc/emailservermonitor.h
branchRCL_3
changeset 12 f5907b1a1053
parent 0 8466d47a6819
equal deleted inserted replaced
8:e1b6206813b4 12:f5907b1a1053
    25 #include <e32cmn.h>						// TUid
    25 #include <e32cmn.h>						// TUid
    26 #include <apgcli.h>                     // RApaLsSession
    26 #include <apgcli.h>                     // RApaLsSession
    27 
    27 
    28 #include "emailservermonitorconst.h"
    28 #include "emailservermonitorconst.h"
    29 
    29 
       
    30 /////////////////////////////////////////////////////////////////////////////
       
    31 //  FORWARD DECLARATIONS
       
    32 class CEmailShutter;
       
    33 
    30 /**
    34 /**
    31 *  Class CEmailServerMonitor implements functionality that starts up
    35 *  Class CEmailServerMonitor implements functionality that starts up
    32 *  EmailServer and monitors it. If EmailServer crashes, then
    36 *  EmailServer and monitors it. If EmailServer crashes, then
    33 *  CEmailServerMonitor restarts it. CEmailServerMonitor also starts up needed
    37 *  CEmailServerMonitor restarts it. CEmailServerMonitor also starts up needed
    34 *  email related 3rd party services after IAD update.
    38 *  email related 3rd party services after IAD update.
    35 */
    39 */
    36 NONSHARABLE_CLASS( CEmailServerMonitor ) : public CActive
    40 NONSHARABLE_CLASS( CEmailServerMonitor ) : public CActive, public MEmailServerMonitorTimerCallback
    37     {
    41     {
    38     
    42     
    39 public: // Public construcor and destructor
    43 public: // Public construcor and destructor
    40     /**
    44     /**
    41      * Two-phased class constructor.
    45      * Two-phased class constructor.
    56     
    60     
    57     /**
    61     /**
    58      * Start email server monitoring.
    62      * Start email server monitoring.
    59      */
    63      */
    60     void Start();
    64     void Start();
       
    65     
       
    66     /**
       
    67      * Set pointer to Shutter object
       
    68      */
       
    69     void SetShutter( CEmailShutter* aShutter );
       
    70     
       
    71     /**
       
    72      * If Restart External Services flag is set to true, then external
       
    73      * services will be restarted after Email Server is up and running
       
    74      */
       
    75     void SetRestartExternalServicesFlag( TBool aRestartFlag = ETrue );
       
    76     
       
    77 public: // From base class MEmailServerMonitorTimerCallback
       
    78     
       
    79     void TimerEventL( CEmailServerMonitorTimer* aTriggeredTimer );
    61 
    80 
    62 private: // Private constructors
    81 private: // Private constructors
    63     /**
    82     /**
    64      * Default class constructor.
    83      * Default class constructor.
    65      * Only NewL can be called
    84      * Only NewL can be called
   121         EEsmStateInitializing,
   140         EEsmStateInitializing,
   122         EEsmStateMonitoring,
   141         EEsmStateMonitoring,
   123         EEsmStateRestarting
   142         EEsmStateRestarting
   124         };
   143         };
   125 
   144 
       
   145     enum TExternalServiceRestartState
       
   146         {
       
   147         EEsmEsrStateRestartNotNeeded,
       
   148         EEsmEsrStateRestartNeeded,
       
   149         EEsmEsrStateRestartInitiated,
       
   150         EEsmEsrStateFirstServiceRestarted,
       
   151         };
       
   152     
   126 private: // Member variables
   153 private: // Member variables
   127 
   154 
   128     // A session with the application architecture server
   155     // A session with the application architecture server
   129     RApaLsSession iApaLsSession;
   156     RApaLsSession iApaLsSession;
   130     
   157     
   142     
   169     
   143     // Time of the previous restart, used to reset restart counter if
   170     // Time of the previous restart, used to reset restart counter if
   144     // server has been running succesfully long enough
   171     // server has been running succesfully long enough
   145     TTime iLastRestartTime;
   172     TTime iLastRestartTime;
   146 
   173 
       
   174     /**
       
   175      * Pointer to Shutter
       
   176      * Not owned
       
   177      */
       
   178     CEmailShutter* iShutter;
       
   179 
       
   180     /**
       
   181      * Should we restart external services after Email Server is up and running
       
   182      */
       
   183     TExternalServiceRestartState iExternalServicesRestartState;
       
   184     
       
   185     /**
       
   186      * Generic timer used to make delayed restart of the external services
       
   187      * Owned
       
   188      */
       
   189     CEmailServerMonitorTimer* iExternalServiceRestartTimer;
       
   190 
   147     };
   191     };
   148 
   192 
   149 
   193 
   150 #endif  // EMAILSERVERMONITOR_H
   194 #endif  // EMAILSERVERMONITOR_H