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