64
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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:
|
|
15 |
* Declaration of common functions of Email Server Monitor
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
// Include Files
|
|
19 |
|
|
20 |
#ifndef EMAILSERVERMONITORUTILITIES_H
|
|
21 |
#define EMAILSERVERMONITORUTILITIES_H
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <e32cmn.h> // TSecureId
|
|
25 |
|
|
26 |
// Forward declarations
|
|
27 |
class CEmailServerMonitorTimer;
|
|
28 |
|
|
29 |
const TInt KDefaultTimeToWaitInSeconds = 3;
|
|
30 |
|
|
31 |
/////////////////////////////////////////////////////////////////////////////
|
|
32 |
// LOCAL FUNCTION DECLARATIONS
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Wait some time to give other applications and servers some time to shut
|
|
36 |
* down themselves gracefully or to start themselves
|
|
37 |
*
|
|
38 |
* @param aWaitTimeInSeconds Time to wait in seconds
|
|
39 |
*/
|
|
40 |
void Wait( TInt aWaitTimeInSeconds = KDefaultTimeToWaitInSeconds );
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Check is specified process running. If we are checking other UID than
|
|
44 |
* ourselves, we just check is there specified process running. If we are
|
|
45 |
* checking our own UID, then we check is there another instance already
|
|
46 |
* running.
|
|
47 |
*
|
|
48 |
* @param aUid Process UID (=Secure ID) to be searched
|
|
49 |
* @param aProcess If process handle is given, it will updated to have a
|
|
50 |
* a handle to the found process
|
|
51 |
* @param aProcessUpdated On return ETrue, if aProcess handle was given and
|
|
52 |
* it was updated succesfully
|
|
53 |
* @return ETrue if the specified process is running, otherwise EFalse.
|
|
54 |
*/
|
|
55 |
TBool IsProcessRunning( TSecureId aUid, RProcess* aProcess = NULL );
|
|
56 |
|
|
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 |
|
|
147 |
#endif // EMAILSERVERMONITORUTILITIES_H
|