|
1 /* |
|
2 * Copyright (c) 2009-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 the License "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 * This class implements a system tick based timer service. |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 1 % |
|
21 */ |
|
22 |
|
23 #ifndef WLANTICKTIMER_H |
|
24 #define WLANTICKTIMER_H |
|
25 |
|
26 #include <e32base.h> |
|
27 |
|
28 /** |
|
29 * CWlanTickTimer class. |
|
30 * |
|
31 * Class providing timer services. The underlaying implementation relies |
|
32 * on RTimer. Therefore this module has the same limitations as RTimer. |
|
33 * |
|
34 * @lib wlmserversrv.dll |
|
35 * @since S60 v5.2 |
|
36 */ |
|
37 |
|
38 NONSHARABLE_CLASS( CWlanTickTimer ) : public CActive |
|
39 { |
|
40 |
|
41 public: // CWlanTickTimer public methods |
|
42 |
|
43 /** |
|
44 * Static constructor. |
|
45 * @param aTimerExpiredCB Callback for indicating timer expiry. |
|
46 * @param aTimerCancelledCB Callback for indicating timer cancellation. |
|
47 * @param aTimerErrorCB Callback for indicating timer error. |
|
48 */ |
|
49 static CWlanTickTimer* NewL( |
|
50 const TCallBack& aTimerExpiredCB, |
|
51 const TCallBack& aTimerCancelledCB, |
|
52 const TCallBack& aTimerErrorCB ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CWlanTickTimer(); |
|
58 |
|
59 /** |
|
60 * Requests an event after the specified interval. |
|
61 * @param The time interval in system ticks. |
|
62 */ |
|
63 void After( |
|
64 TUint aTicks ); |
|
65 |
|
66 private: // CWlanTickTimer private methods |
|
67 |
|
68 /** |
|
69 * C++ constructor. |
|
70 * @param aTimerExpiredCB Callback for indicating timer expiry. |
|
71 * @param aTimerCancelledCB Callback for indicating timer cancellation. |
|
72 * @param aTimerErrorCB Callback for indicating timer error. |
|
73 */ |
|
74 CWlanTickTimer( |
|
75 const TCallBack& aTimerExpiredCB, |
|
76 const TCallBack& aTimerCancelledCB, |
|
77 const TCallBack& aTimerErrorCB ); |
|
78 |
|
79 /** |
|
80 * Symbian 2nd phase constructor. |
|
81 */ |
|
82 void ConstructL(); |
|
83 |
|
84 private: // From CActive |
|
85 |
|
86 /** |
|
87 * From CActive. |
|
88 * Called by the active object framework when the request has been completed. |
|
89 */ |
|
90 void RunL(); |
|
91 |
|
92 /** |
|
93 * From CActive. |
|
94 * Called by the framework if RunL leaves. |
|
95 * |
|
96 * @param aError The error code RunL leaved with. |
|
97 * @return KErrNone if leave was handled, one of the system-wide error codes otherwise. |
|
98 */ |
|
99 TInt RunError( |
|
100 TInt aError ); |
|
101 |
|
102 /** |
|
103 * From CActive. |
|
104 * Called by the framework when Cancel() has been called. |
|
105 */ |
|
106 void DoCancel(); |
|
107 |
|
108 private: // CWlanTickTimer private data |
|
109 |
|
110 /** |
|
111 * Handle to RTimer. |
|
112 */ |
|
113 RTimer iTimer; |
|
114 |
|
115 /** |
|
116 * TimerExpiredCB. |
|
117 * Registered callback method that is called, when the timer |
|
118 * expires. This is set when CWlanTickTimer instance is created. |
|
119 */ |
|
120 TCallBack iTimerExpiredCB; |
|
121 |
|
122 /** |
|
123 * TimerCancelledCB. |
|
124 * Registered callback method that is called, when the timer |
|
125 * is cancelled by an external event (i.e. cancellation is |
|
126 * not requested by the client). This is set when CWlanTickTimer |
|
127 * instance is created. |
|
128 */ |
|
129 TCallBack iTimerCancelledCB; |
|
130 |
|
131 /** |
|
132 * TimerErrorCB. |
|
133 * Registered callback method that is called, when there is |
|
134 * a timer error. This is set when CWlanTickTimer instance is created. |
|
135 */ |
|
136 TCallBack iTimerErrorCB; |
|
137 }; |
|
138 |
|
139 #endif // WLANTICKTIMER_H |