telephonyserverplugins/simtsy/src/CSimIndicator.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2001-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".
    18 
    18 
    19 /**
    19 /**
    20  @file
    20  @file
    21 */
    21 */
    22 
    22 
    23 
       
    24 
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "CSimIndicatorTraces.h"
       
    28 #endif
       
    29 
       
    30 #include <testconfigfileparser.h>
    23 #include <testconfigfileparser.h>
    31 #include "CSimIndicator.h"
    24 #include "CSimIndicator.h"
    32 #include "CSimPhone.h"
    25 #include "CSimPhone.h"
       
    26 #include "Simlog.h"
    33 
    27 
    34 
    28 
    35 const TInt KIndicatorsGranularity=5;		// < Granularity for indicators list array
    29 const TInt KIndicatorsGranularity=5;		// < Granularity for indicators list array
    36 
    30 
    37 CSimIndicator* CSimIndicator::NewL(CSimPhone* aPhone)
    31 CSimIndicator* CSimIndicator::NewL(CSimPhone* aPhone)
    71  * for the duration of the test.
    65  * for the duration of the test.
    72  */
    66  */
    73 	{
    67 	{
    74 	iIndicatorsInfo=new(ELeave) CArrayFixFlat<TPhoneIndicatorsInfo>(KIndicatorsGranularity);
    68 	iIndicatorsInfo=new(ELeave) CArrayFixFlat<TPhoneIndicatorsInfo>(KIndicatorsGranularity);
    75 
    69 
    76 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_1, "Starting to parse Indicators config parameters...");
    70 	LOGPHONE1("Starting to parse Indicators config parameters...");
    77 	TInt count=CfgFile()->ItemCount(KIndicators);
    71 	TInt count=CfgFile()->ItemCount(KIndicators);
    78 	const CTestConfigItem* item=NULL;
    72 	const CTestConfigItem* item=NULL;
    79 	TInt ret=KErrNone;
    73 	TInt ret=KErrNone;
    80 
    74 
    81 	TInt i;
    75 	TInt i;
    88 		TInt number;
    82 		TInt number;
    89 		TInt error;
    83 		TInt error;
    90 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,number);
    84 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,number);
    91 		if(ret!=KErrNone)
    85 		if(ret!=KErrNone)
    92 			{
    86 			{
    93 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_2, "WARNING - CONFIGURATION FILE PARSING - Reading element NUMBER returned %d (element no. %d) from tag %s.",ret,0,KIndicators);
    87 			LOGPARSERR("number",ret,0,&KIndicators);
    94 			continue;
    88 			continue;
    95 			}
    89 			}
    96 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,error);
    90 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,error);
    97 		if(ret!=KErrNone)
    91 		if(ret!=KErrNone)
    98 			{
    92 			{
    99 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element ERROR returned %d (element no. %d) from tag %s.",ret,1,KIndicators);
    93 			LOGPARSERR("error",ret,1,&KIndicators);
   100 			continue;
    94 			continue;
   101 			}
    95 			}
   102 		TPhoneIndicatorsInfo indicInfo;
    96 		TPhoneIndicatorsInfo indicInfo;
   103 		indicInfo.iNotificationNumber=number;
    97 		indicInfo.iNotificationNumber=number;
   104 		indicInfo.iError=error;
    98 		indicInfo.iError=error;
   105 		iIndicatorsInfo->AppendL(indicInfo);
    99 		iIndicatorsInfo->AppendL(indicInfo);
   106 		}
   100 		}
   107 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_4, "Finished parsing Indicators config parameters...%d items found", count);
   101 	LOGPHONE2("Finished parsing Indicators config parameters...%d items found", count);
   108 
   102 
   109 	iIndicatorCheckPeriod = 1;
   103 	iIndicatorCheckPeriod = 1;
   110 	count = CfgFile()->ItemCount(KIndicatorCheckPeriod);
   104 	count = CfgFile()->ItemCount(KIndicatorCheckPeriod);
   111 	if (count > 1)
   105 	if (count > 1)
   112 		{
   106 		{
   113 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_5, "Warning: Error parsing IndicatorCheckPeriod in config file.");
   107 		LOGPHONE1("Warning: Error parsing IndicatorCheckPeriod in config file.");
   114 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_6, "         More than one value found, using default value.");
   108 		LOGPHONE1("         More than one value found, using default value.");
   115 		}
   109 		}
   116 	else
   110 	else
   117 		{
   111 		{
   118 		item=CfgFile()->Item(KIndicatorCheckPeriod);
   112 		item=CfgFile()->Item(KIndicatorCheckPeriod);
   119 
   113 
   121 			{
   115 			{
   122 			TInt period;
   116 			TInt period;
   123 			ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,period);
   117 			ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,period);
   124 			if(ret!=KErrNone)
   118 			if(ret!=KErrNone)
   125 				{
   119 				{
   126 				OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_7, "Warning: Error parsing IndicatorCheckPeriod in config file.");
   120 				LOGPHONE1("Warning: Error parsing IndicatorCheckPeriod in config file.");
   127 				OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_8, "         No value for IndicatorCheckPeriod found.");
   121 				LOGPHONE1("         No value for IndicatorCheckPeriod found.");
   128 				}
   122 				}
   129 			else
   123 			else
   130 				{
   124 				{
   131 				iIndicatorCheckPeriod = period;
   125 				iIndicatorCheckPeriod = period;
   132 				}
   126 				}
   189  * @param aReqHandle	The request handle associated with this request.
   183  * @param aReqHandle	The request handle associated with this request.
   190  * @param aPckg1		This is populated with the Indicators flags.
   184  * @param aPckg1		This is populated with the Indicators flags.
   191  * @return TInt			Standard error value.
   185  * @return TInt			Standard error value.
   192  */
   186  */
   193 	{
   187 	{
   194 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_GETINDICATOR_1, "CSimIndicator::GetIndicator request made: returning %d",iCurrentIndicator);
   188 	LOGPHONE2("CSimIndicator::GetIndicator request made: returning %d",iCurrentIndicator);
   195 	TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1;
   189 	TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1;
   196 	TUint32& indic=(*indicPckg)();
   190 	TUint32& indic=(*indicPckg)();
   197 	
   191 	
   198 	indic=iCurrentIndicator;
   192 	indic=iCurrentIndicator;
   199 	iPhone->ReqCompleted(aReqHandle,KErrNone);
   193 	iPhone->ReqCompleted(aReqHandle,KErrNone);
   208  *
   202  *
   209  * @param aPckg1		The first parameter package.  This is populated with the Indicators flags.
   203  * @param aPckg1		The first parameter package.  This is populated with the Indicators flags.
   210  * @return TInt			Standard error value.
   204  * @return TInt			Standard error value.
   211  */
   205  */
   212 	{
   206 	{
   213 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_NOTIFYINDICATORCHANGE_1, "CSimIndicator::NotifyIndicatorChange notification posted");
   207 	LOGPHONE1("CSimIndicator::NotifyIndicatorChange notification posted");
   214 	TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1;
   208 	TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1;
   215 	TUint32& indic=(*indicPckg)();
   209 	TUint32& indic=(*indicPckg)();
   216 
   210 
   217 	__ASSERT_ALWAYS(!iIndicatorsChangeNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding));
   211 	__ASSERT_ALWAYS(!iIndicatorsChangeNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding));
   218 	iIndicatorsChangeNotificationPending=ETrue;
   212 	iIndicatorsChangeNotificationPending=ETrue;
   228  * Cancel a previous request to be notified of a change in indicators.
   222  * Cancel a previous request to be notified of a change in indicators.
   229  */
   223  */
   230 	{
   224 	{
   231 	if(iIndicatorsChangeNotificationPending)
   225 	if(iIndicatorsChangeNotificationPending)
   232 		{
   226 		{
   233 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_NOTIFYINDICATORCHANGECANCEL_1, "CSimIndicator::NotifyIndicatorChange notification cancelled");
   227 		LOGPHONE1("CSimIndicator::NotifyIndicatorChange notification cancelled");
   234 		iIndicatorsChangeNotificationPending=EFalse;
   228 		iIndicatorsChangeNotificationPending=EFalse;
   235 		iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,KErrCancel);
   229 		iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,KErrCancel);
   236 		}
   230 		}
   237 	}
   231 	}
   238 
   232 
   266 				}
   260 				}
   267 
   261 
   268 // Trigger notification with appropriate data and result codes
   262 // Trigger notification with appropriate data and result codes
   269 			iIndicatorsChangeNotificationPending=EFalse;
   263 			iIndicatorsChangeNotificationPending=EFalse;
   270 			*iIndicatorsChangeNofificationValue=iCurrentIndicator;
   264 			*iIndicatorsChangeNofificationValue=iCurrentIndicator;
   271 			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CHECKNOTIFICATION_1, "CSimIndicator::NotifyIndicatorChange triggered: returned %d",iCurrentIndicator);
   265 			LOGPHONE2("CSimIndicator::NotifyIndicatorChange triggered: returned %d",iCurrentIndicator);
   272 			iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,ret);
   266 			iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,ret);
   273 			}
   267 			}
   274 		}
   268 		}
   275 	}
   269 	}
   276 
   270