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