equal
deleted
inserted
replaced
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 // User includes |
16 // User includes |
17 #include "watcherlog.h" |
17 |
|
18 |
|
19 #include "OstTraceDefinitions.h" |
|
20 #ifdef OST_TRACE_COMPILER_IN_USE |
|
21 #include "indicatorwatcherTraces.h" |
|
22 #endif |
|
23 |
18 #include "indicatorwatcher.h" |
24 #include "indicatorwatcher.h" |
19 |
25 |
20 // System includes |
26 // System includes |
21 #include <sacls.h> |
27 #include <sacls.h> |
22 |
28 |
73 { |
79 { |
74 switch(IndicatorState()) |
80 switch(IndicatorState()) |
75 { |
81 { |
76 case EIndicatorNotYetInitialised: |
82 case EIndicatorNotYetInitialised: |
77 case EIndicatorRequestInitialIndicator: |
83 case EIndicatorRequestInitialIndicator: |
78 LOGINDICATOR1("IndicatorWatcher : Requesting initial indicator values"); |
84 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CINDICATORWATCHER_HANDLEPHONESTATEEVENTL_1, "IndicatorWatcher : Requesting initial indicator values"); |
79 Phone().GetIndicator(iStatus, iIndicatorInfo); |
85 Phone().GetIndicator(iStatus, iIndicatorInfo); |
80 IndicatorState() = EIndicatorWaitingForInitialIndicator; |
86 IndicatorState() = EIndicatorWaitingForInitialIndicator; |
81 SetActive(); |
87 SetActive(); |
82 break; |
88 break; |
83 |
89 |
128 // |
134 // |
129 // |
135 // |
130 |
136 |
131 void CIndicatorWatcher::HandleIndicatorUpdateL(TInt aCompletionCode) |
137 void CIndicatorWatcher::HandleIndicatorUpdateL(TInt aCompletionCode) |
132 { |
138 { |
133 #ifdef _DEBUG |
139 #ifdef OST_TRACE_COMPILER_IN_USE |
134 LOGINDICATOR2("IndicatorWatcher : Handling phone state change with request result (%d)", aCompletionCode); |
140 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CINDICATORWATCHER_HANDLEINDICATORUPDATEL_1, "IndicatorWatcher : Handling phone state change with request result (%d)", aCompletionCode); |
135 #else |
141 #else |
136 (void) aCompletionCode; |
142 (void) aCompletionCode; |
137 #endif |
143 #endif |
138 |
144 |
139 #ifdef WATCHER_TESTING |
145 #ifdef WATCHER_TESTING |
208 else |
214 else |
209 SuspendFor(KErrorRetryPausePeriod); |
215 SuspendFor(KErrorRetryPausePeriod); |
210 } |
216 } |
211 else |
217 else |
212 { |
218 { |
213 LOGINDICATOR1("IndicatorWatcher : Processing successful indicator event"); |
219 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CINDICATORWATCHER_HANDLEINDICATORUPDATEL_2, "IndicatorWatcher : Processing successful indicator event"); |
214 |
220 |
215 // Update charger status if there has been a change |
221 // Update charger status if there has been a change |
216 { |
222 { |
217 TInt chargerState; |
223 TInt chargerState; |
218 User::LeaveIfError(iChargerStatusProperty.Get(chargerState)); |
224 User::LeaveIfError(iChargerStatusProperty.Get(chargerState)); |
224 else |
230 else |
225 newChargerState=ESAChargerDisconnected; |
231 newChargerState=ESAChargerDisconnected; |
226 |
232 |
227 if (newChargerState!=chargerState) |
233 if (newChargerState!=chargerState) |
228 { |
234 { |
229 LOGINDICATOR2("IndicatorWatcher : New Charger State %d", newChargerState); |
235 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CINDICATORWATCHER_HANDLEINDICATORUPDATEL_3, "IndicatorWatcher : New Charger State %d", newChargerState); |
230 User::LeaveIfError(iChargerStatusProperty.Set(newChargerState)); |
236 User::LeaveIfError(iChargerStatusProperty.Set(newChargerState)); |
231 } |
237 } |
232 } |
238 } |
233 |
239 |
234 // Update network available status if there has been a change |
240 // Update network available status if there has been a change |
242 else |
248 else |
243 newNetworkState=ESANetworkUnAvailable; |
249 newNetworkState=ESANetworkUnAvailable; |
244 |
250 |
245 if (newNetworkState!=networkState) |
251 if (newNetworkState!=networkState) |
246 { |
252 { |
247 LOGINDICATOR2("IndicatorWatcher : New Network State %d", newNetworkState); |
253 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CINDICATORWATCHER_HANDLEINDICATORUPDATEL_4, "IndicatorWatcher : New Network State %d", newNetworkState); |
248 User::LeaveIfError(iNetworkStatusProperty.Set(newNetworkState)); |
254 User::LeaveIfError(iNetworkStatusProperty.Set(newNetworkState)); |
249 } |
255 } |
250 } |
256 } |
251 |
257 |
252 // Update call-in-progress status if there has been a change |
258 // Update call-in-progress status if there has been a change |
266 newCallState=ESACallNone; |
272 newCallState=ESACallNone; |
267 } |
273 } |
268 |
274 |
269 if (newCallState!=callState) |
275 if (newCallState!=callState) |
270 { |
276 { |
271 LOGINDICATOR2("IndicatorWatcher : New Call State %d", newCallState); |
277 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CINDICATORWATCHER_HANDLEINDICATORUPDATEL_5, "IndicatorWatcher : New Call State %d", newCallState); |
272 User::LeaveIfError(iCurrentCallProperty.Set(newCallState)); |
278 User::LeaveIfError(iCurrentCallProperty.Set(newCallState)); |
273 } |
279 } |
274 } |
280 } |
275 |
281 |
276 // Issue another request |
282 // Issue another request |