|
1 /* |
|
2 * Copyright (c) 2001-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 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: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // This is enumeration of EAPOL source code. |
|
20 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
21 #undef EAP_FILE_NUMBER_ENUM |
|
22 #define EAP_FILE_NUMBER_ENUM 164 |
|
23 #undef EAP_FILE_NUMBER_DATE |
|
24 #define EAP_FILE_NUMBER_DATE 1127594498 |
|
25 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
26 |
|
27 |
|
28 // INCLUDE FILES |
|
29 #include "eap_am_memory.h" |
|
30 #include "EapolTimer.h" |
|
31 #include "eap_tools.h" |
|
32 #include "eap_am_tools.h" |
|
33 #include "abs_eap_am_tools.h" |
|
34 #include "abs_eap_am_mutex.h" |
|
35 #include "eap_am_tools_symbian.h" |
|
36 |
|
37 // ================= MEMBER FUNCTIONS ======================= |
|
38 |
|
39 CEapolTimer::CEapolTimer(abs_eap_am_tools_c * const aTools) |
|
40 : CTimer(CTimer::EPriorityStandard) |
|
41 , iTools(aTools) |
|
42 { |
|
43 // Set a flag in EAPOL that specifies that timer queue can be used. |
|
44 reinterpret_cast<eap_am_tools_symbian_c *>(iTools)->set_use_timer_queue(); |
|
45 } |
|
46 |
|
47 |
|
48 //-------------------------------------------------- |
|
49 |
|
50 void CEapolTimer::ConstructL() |
|
51 { |
|
52 CTimer::ConstructL(); |
|
53 } |
|
54 |
|
55 //-------------------------------------------------- |
|
56 |
|
57 CEapolTimer* CEapolTimer::NewL(abs_eap_am_tools_c * const aTools) |
|
58 { |
|
59 CEapolTimer* self = new (ELeave) CEapolTimer(aTools); |
|
60 CleanupStack::PushL(self); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop(self); |
|
63 return self; |
|
64 } |
|
65 |
|
66 //-------------------------------------------------- |
|
67 |
|
68 CEapolTimer::~CEapolTimer() |
|
69 { |
|
70 Cancel(); |
|
71 } |
|
72 |
|
73 //-------------------------------------------------- |
|
74 |
|
75 void CEapolTimer::StartTimer(const TUint aInterval) |
|
76 { |
|
77 EAP_TRACE_DEBUG( |
|
78 iTools, |
|
79 TRACE_FLAGS_TIMER_QUEUE, |
|
80 (EAPL("CEapolTimer::StartTimer().\n"))); |
|
81 |
|
82 iInterval = aInterval; |
|
83 iStartTime = iTools->get_clock_ticks(); |
|
84 |
|
85 iLastTime = iStartTime; |
|
86 |
|
87 // Start the timer |
|
88 After(iInterval*1000); |
|
89 } |
|
90 |
|
91 //-------------------------------------------------- |
|
92 void CEapolTimer::StopTimer() |
|
93 { |
|
94 EAP_TRACE_DEBUG( |
|
95 iTools, |
|
96 TRACE_FLAGS_TIMER_QUEUE, |
|
97 (EAPL("CEapolTimer::StopTimer().\n"))); |
|
98 |
|
99 Cancel(); |
|
100 } |
|
101 //-------------------------------------------------- |
|
102 |
|
103 TBool CEapolTimer::TimerRunning() |
|
104 { |
|
105 if (!IsActive()) |
|
106 { |
|
107 EAP_TRACE_DEBUG( |
|
108 iTools, |
|
109 TRACE_FLAGS_TIMER_QUEUE, |
|
110 (EAPL("CEapolTimer::TimerRunning(): EFalse.\n"))); |
|
111 |
|
112 return EFalse; |
|
113 } |
|
114 else |
|
115 { |
|
116 EAP_TRACE_DEBUG( |
|
117 iTools, |
|
118 TRACE_FLAGS_TIMER_QUEUE, |
|
119 (EAPL("CEapolTimer::TimerRunning(): ETrue.\n"))); |
|
120 |
|
121 return ETrue; |
|
122 } |
|
123 } |
|
124 |
|
125 void CEapolTimer::RunL() |
|
126 { |
|
127 EAP_TRACE_DEBUG( |
|
128 iTools, |
|
129 TRACE_FLAGS_TIMER_QUEUE, |
|
130 (EAPL("CEapolTimer::RunL().\n"))); |
|
131 |
|
132 u64_t currentTime = iTools->get_clock_ticks(); |
|
133 |
|
134 iLastTime = currentTime; |
|
135 |
|
136 u32_t next_sleep_time = iInterval; |
|
137 |
|
138 iTools->enter_global_mutex(); |
|
139 if (iTools->get_is_timer_thread_active()) |
|
140 { |
|
141 EAP_TRACE_DEBUG( |
|
142 iTools, |
|
143 TRACE_FLAGS_TIMER_QUEUE, |
|
144 (EAPL("CEapolTimer::RunL(): pulse_timer().\n"))); |
|
145 |
|
146 next_sleep_time = iTools->pulse_timer(next_sleep_time); |
|
147 } |
|
148 iTools->leave_global_mutex(); |
|
149 |
|
150 // Setup timer again (if somebody inside pulse_timer has not already done it...) |
|
151 if (!IsActive()) |
|
152 { |
|
153 EAP_TRACE_DEBUG( |
|
154 iTools, |
|
155 TRACE_FLAGS_TIMER_QUEUE, |
|
156 (EAPL("CEapolTimer::RunL(): After().\n"))); |
|
157 |
|
158 After(next_sleep_time*1000); |
|
159 } |
|
160 else |
|
161 { |
|
162 EAP_TRACE_DEBUG( |
|
163 iTools, |
|
164 TRACE_FLAGS_TIMER_QUEUE, |
|
165 (EAPL("CEapolTimer::RunL(): is active.\n"))); |
|
166 } |
|
167 } |
|
168 //-------------------------------------------------- |
|
169 |
|
170 void CEapolTimer::DoCancel() |
|
171 { |
|
172 EAP_TRACE_DEBUG( |
|
173 iTools, |
|
174 TRACE_FLAGS_TIMER_QUEUE, |
|
175 (EAPL("CEapolTimer::DoCancel().\n"))); |
|
176 |
|
177 // Base class |
|
178 CTimer::DoCancel(); |
|
179 } |
|
180 |
|
181 // End of file |