|
1 /* |
|
2 * Copyright (c) 2004,2006 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: Implementation of CAOTimer class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CAOTIMER_H |
|
20 #define C_CAOTIMER_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32base.h> |
|
24 #include "maotimer.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CPeriodic; |
|
28 class MAOTimerObserver; |
|
29 class MAOSettings; |
|
30 |
|
31 /** |
|
32 * Timer provides possibility to start and stop retry |
|
33 * and connection timers. |
|
34 * |
|
35 * @lib PDPContextManager2.lib |
|
36 * @since S60 v3.1 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CAOTimer ): |
|
39 public CBase, |
|
40 public MAOTimer |
|
41 { |
|
42 public: // Constructors & destructors |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @since S60 v3.1 |
|
48 * @param aObserver observer for timer events |
|
49 * @param aSettings settings for the timer |
|
50 * @return pointer to the created CAOTimer object |
|
51 */ |
|
52 static CAOTimer* NewL( MAOTimerObserver& aObserver, |
|
53 MAOSettings& aSettings ); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 * |
|
58 * @since S60 v3.1 |
|
59 */ |
|
60 virtual ~CAOTimer(); |
|
61 |
|
62 public: // New methods |
|
63 |
|
64 /** |
|
65 * Handles settings changes. |
|
66 * |
|
67 * @since S60 v3.1 |
|
68 */ |
|
69 void HandleSettingsChangedL(); |
|
70 |
|
71 public: // From base class MAOTimer |
|
72 // Allow Always-On Server access |
|
73 |
|
74 /** |
|
75 * From MAOTimer |
|
76 * Starts retry timer. |
|
77 * |
|
78 * @since S60 v3.1 |
|
79 */ |
|
80 void StartRetryTimer(); |
|
81 |
|
82 /** |
|
83 * From MAOTimer |
|
84 * Starts connection timer. |
|
85 * |
|
86 * @since S60 v3.1 |
|
87 */ |
|
88 void StartConnectionTimer(); |
|
89 |
|
90 /** |
|
91 * From MAOTimer |
|
92 * Stops retry timer. |
|
93 * |
|
94 * @since S60 v3.1 |
|
95 */ |
|
96 void StopRetryTimer(); |
|
97 |
|
98 /** |
|
99 * From MAOTimer |
|
100 * Stops connection timer. |
|
101 * |
|
102 * @since S60 v3.1 |
|
103 */ |
|
104 void StopConnectionTimer(); |
|
105 |
|
106 /** |
|
107 * Starts unconnect timer. |
|
108 * |
|
109 * @since 3.0 |
|
110 */ |
|
111 void StartUnconnectTimer(); |
|
112 |
|
113 /** |
|
114 * Stops unconnect timer. |
|
115 * |
|
116 * @since 3.0 |
|
117 */ |
|
118 void StopUnconnectTimer(); |
|
119 |
|
120 /** |
|
121 * From MAOTimer |
|
122 * Checks if retry timer is set to infinite (disabled). |
|
123 * |
|
124 * @since S60 v3.1 |
|
125 */ |
|
126 TBool RetryTimerDisabled() const; |
|
127 |
|
128 /** |
|
129 * Checks if unconnect timer is set to zero (disabled). |
|
130 * |
|
131 * @since 3.0 |
|
132 * @return ETrue if set to infinite |
|
133 */ |
|
134 TBool UnconnectTimerDisabled() const; |
|
135 |
|
136 private: // New methods |
|
137 |
|
138 /** |
|
139 * Constructor. |
|
140 * |
|
141 * @since S60 v3.1 |
|
142 * @param aObserver observer for timer events |
|
143 * @param aSettings settings for the timer |
|
144 */ |
|
145 CAOTimer( MAOTimerObserver& aObserver, |
|
146 MAOSettings& aSettings ); |
|
147 |
|
148 /** |
|
149 * Default Symbian 2nd-phase constructor |
|
150 * |
|
151 * @since S60 v3.1 |
|
152 */ |
|
153 void ConstructL(); |
|
154 |
|
155 private: // New metohds |
|
156 |
|
157 /** |
|
158 * Retry timer callback |
|
159 * |
|
160 * @since S60 v3.1 |
|
161 * @param aSelf the caller |
|
162 * @return error code in case of error else KErrNone |
|
163 */ |
|
164 static TInt RetryTimerCallBack( TAny* aSelf ); |
|
165 |
|
166 /** |
|
167 * Connection timer callback |
|
168 * |
|
169 * @since S60 v3.1 |
|
170 * @param aSelf the caller |
|
171 * @return error code in case of error else KErrNone |
|
172 */ |
|
173 static TInt ConnectionTimerCallBack( TAny* aSelf ); |
|
174 |
|
175 /** |
|
176 * Handles retry timer callback |
|
177 * |
|
178 * @since S60 v3.1 |
|
179 */ |
|
180 void HandleRetryTimerCallBackL(); |
|
181 |
|
182 /** |
|
183 * unconnected timer call back |
|
184 * |
|
185 * @since S60 v3.1 |
|
186 * @param aSelf ? |
|
187 */ |
|
188 static TInt UnconnectTimerCallBack( TAny* aSelf ); |
|
189 |
|
190 /** |
|
191 * Configures interval for timer |
|
192 * Return value is internal in micro seconds |
|
193 * |
|
194 * @since S60 v3.1 |
|
195 * @param aInternalInSec ? |
|
196 */ |
|
197 TInt ConfigureInterval( const TInt& aIntervalInSec ); |
|
198 |
|
199 private: // Data |
|
200 |
|
201 /** |
|
202 * Timer observer |
|
203 */ |
|
204 MAOTimerObserver& iObserver; |
|
205 |
|
206 /** |
|
207 * Settings |
|
208 */ |
|
209 MAOSettings& iSettings; |
|
210 |
|
211 /** |
|
212 * Own: Retry timer |
|
213 */ |
|
214 CPeriodic* iRetryTimer; |
|
215 |
|
216 /** |
|
217 * Retry timer value |
|
218 */ |
|
219 TInt iRetryTimerCount; |
|
220 |
|
221 /** |
|
222 * Currently used retry timer interval |
|
223 */ |
|
224 TInt iCurrentRetryTimerInterval; |
|
225 |
|
226 /** |
|
227 * Own: Connection timer |
|
228 */ |
|
229 CPeriodic* iConnectionTimer; |
|
230 |
|
231 /** |
|
232 * Own: Unconnect timer |
|
233 */ |
|
234 CPeriodic* iUnconnectTimer; |
|
235 }; |
|
236 |
|
237 #endif // C_CAOTIMER_H |