telephonyserverplugins/simtsy/src/CSimPhoneUSimApp.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-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".
    17 
    17 
    18 /**
    18 /**
    19  @file
    19  @file
    20 */
    20 */
    21 
    21 
    22 
       
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "CSimPhoneUSimAppTraces.h"
       
    27 #endif
       
    28 
       
    29 #include "CSimPhone.h"
    22 #include "CSimPhone.h"
       
    23 #include "Simlog.h"
    30 #include <testconfigfileparser.h>
    24 #include <testconfigfileparser.h>
    31 
    25 
    32 /**
    26 /**
    33 Standard factory method for two phase construction of a USim
    27 Standard factory method for two phase construction of a USim
    34 applications object.  The USim applications object simulates the
    28 applications object.  The USim applications object simulates the
    69 Second phase constructor for allocating memory to the USim applications
    63 Second phase constructor for allocating memory to the USim applications
    70 specified in the SimTsy configuration file.
    64 specified in the SimTsy configuration file.
    71 */
    65 */
    72 void CSimPhoneUSimApp::ConstructL()
    66 void CSimPhoneUSimApp::ConstructL()
    73 	{
    67 	{
    74 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CONSTRUCTL_1, "Starting to parse PhoneUSim applications additional config parameters...");
    68 	LOGPHONE1("Starting to parse PhoneUSim applications additional config parameters...");
    75 	
    69 	
    76 	const CTestConfigItem* item=NULL;
    70 	const CTestConfigItem* item=NULL;
    77 	TInt ret=KErrNone;
    71 	TInt ret=KErrNone;
    78 	TInt i;
    72 	TInt i;
    79 	TPtrC8 aid, label;
    73 	TPtrC8 aid, label;
    81 
    75 
    82 	TRAP_IGNORE(iTimer=CSimTimer::NewL(iPhone));
    76 	TRAP_IGNORE(iTimer=CSimTimer::NewL(iPhone));
    83 	iUSimAppInfo=new(ELeave) CArrayFixFlat<RMobilePhone::TUSimApplicationInfoV2>(KMaxUSimApps+1);
    77 	iUSimAppInfo=new(ELeave) CArrayFixFlat<RMobilePhone::TUSimApplicationInfoV2>(KMaxUSimApps+1);
    84 	TInt count=CfgFile()->ItemCount(KUSIMAppInfo);
    78 	TInt count=CfgFile()->ItemCount(KUSIMAppInfo);
    85 	
    79 	
    86 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CONSTRUCTL_2, "Starting to Load and Parse USim Application Info");
    80 	LOGPHONE1("Starting to Load and Parse USim Application Info");
    87 
    81 
    88 	for(i=0;i<count;i++)
    82 	for(i=0;i<count;i++)
    89 		{
    83 		{
    90 		item=CfgFile()->Item(KUSIMAppInfo,i);
    84 		item=CfgFile()->Item(KUSIMAppInfo,i);
    91 		if(!item)
    85 		if(!item)
    92 			break;
    86 			break;
    93 		
    87 		
    94 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0, aid);
    88 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0, aid);
    95 		if(ret!=KErrNone)
    89 		if(ret!=KErrNone)
    96 			{
    90 			{
    97 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CONSTRUCTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element AID returned %d (element no. %d) from tag %s.",ret,0,KUSIMAppInfo);
    91 			LOGPARSERR("aid",ret,0,&KUSIMAppInfo);
    98 			continue;
    92 			continue;
    99 			}
    93 			}
   100 		else
    94 		else
   101 			{
    95 			{
   102 			appInfo.iAID.Copy(aid);
    96 			appInfo.iAID.Copy(aid);
   104 				iActiveAID.Copy(aid);
    98 				iActiveAID.Copy(aid);
   105 			}
    99 			}
   106 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1, label);
   100 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1, label);
   107 		if(ret!=KErrNone)
   101 		if(ret!=KErrNone)
   108 			{
   102 			{
   109 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CONSTRUCTL_4, "WARNING - CONFIGURATION FILE PARSING - Reading element LABEL returned %d (element no. %d) from tag %s.",ret,1,KUSIMAppInfo);
   103 			LOGPARSERR("label",ret,1,&KUSIMAppInfo);
   110 			continue;
   104 			continue;
   111 			}
   105 			}
   112 		else 
   106 		else 
   113 			appInfo.iLabel.Copy(label);
   107 			appInfo.iLabel.Copy(label);
   114 
   108 
   120 	TUSimAppEvent appEvent;
   114 	TUSimAppEvent appEvent;
   121 	TInt duration;
   115 	TInt duration;
   122 
   116 
   123 	count=CfgFile()->ItemCount(KUSIMAppSwitching);
   117 	count=CfgFile()->ItemCount(KUSIMAppSwitching);
   124 	
   118 	
   125 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CONSTRUCTL_5, "Starting to Load and Parse USim Application Info");
   119 	LOGPHONE1("Starting to Load and Parse USim Application Info");
   126 
   120 
   127 	for(i=0;i<count;i++)
   121 	for(i=0;i<count;i++)
   128 		{
   122 		{
   129 		item=CfgFile()->Item(KUSIMAppSwitching,i);
   123 		item=CfgFile()->Item(KUSIMAppSwitching,i);
   130 		if(!item)
   124 		if(!item)
   131 			break;
   125 			break;
   132 
   126 
   133 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0, duration);
   127 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0, duration);
   134 		if(ret!=KErrNone)
   128 		if(ret!=KErrNone)
   135 			{
   129 			{
   136 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CONSTRUCTL_6, "WARNING - CONFIGURATION FILE PARSING - Reading element DURATION returned %d (element no. %d) from tag %s.",ret,0,KUSIMAppSwitching);
   130 			LOGPARSERR("duration",ret,0,&KUSIMAppSwitching);
   137 			continue;
   131 			continue;
   138 			}
   132 			}
   139 		else
   133 		else
   140 			appEvent.iDuration=duration;
   134 			appEvent.iDuration=duration;
   141 
   135 
   142 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1, aid);
   136 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1, aid);
   143 		if(ret!=KErrNone)
   137 		if(ret!=KErrNone)
   144 			{
   138 			{
   145 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CONSTRUCTL_7, "WARNING - CONFIGURATION FILE PARSING - Reading element AID returned %d (element no. %d) from tag %s.",ret,1,KUSIMAppSwitching);
   139 			LOGPARSERR("aid",ret,1,&KUSIMAppSwitching);
   146 			continue;
   140 			continue;
   147 			}
   141 			}
   148 		else 
   142 		else 
   149 			appEvent.iAid.Copy(aid);
   143 			appEvent.iAid.Copy(aid);
   150 
   144 
   310 	case EMobilePhoneNotifyUSimAppsSelectionModeChange:
   304 	case EMobilePhoneNotifyUSimAppsSelectionModeChange:
   311 	case EMobilePhoneNotifyUSimApplicationsInfoChange:
   305 	case EMobilePhoneNotifyUSimApplicationsInfoChange:
   312 		return KDefaultNumberOfSlots;
   306 		return KDefaultNumberOfSlots;
   313 
   307 
   314 	default:
   308 	default:
   315 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_NUMBEROFSLOTSL_1, "CSimPhoneUSimApp: Number of Slots error, unknown IPC");
   309 		LOGPHONE1("CSimPhoneUSimApp: Number of Slots error, unknown IPC");
   316 		User::Leave(KErrNotSupported);
   310 		User::Leave(KErrNotSupported);
   317 		break;
   311 		break;
   318 		}
   312 		}
   319 	return KDefaultNumberOfSlots;
   313 	return KDefaultNumberOfSlots;
   320 	}
   314 	}
   359 @return A CTestConfigSection pointer, which contains a section of the
   353 @return A CTestConfigSection pointer, which contains a section of the
   360         parsed information in the config file.
   354         parsed information in the config file.
   361 */
   355 */
   362 const CTestConfigSection* CSimPhoneUSimApp::CfgFile()
   356 const CTestConfigSection* CSimPhoneUSimApp::CfgFile()
   363 	{
   357 	{
   364 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONEUSIMAPP_CFGFILE_1, ">>CSimPhoneUSimApp::CfgFile");
   358 	LOGPHONE1(">>CSimPhoneUSimApp::CfgFile");
   365 	return iPhone->CfgFile();
   359 	return iPhone->CfgFile();
   366 	}
   360 	}
   367 
   361 
   368 /**
   362 /**
   369 Timer callback function.  When the timer's delay ends, it will call
   363 Timer callback function.  When the timer's delay ends, it will call