telephonyserverplugins/simtsy/src/CSimONStore.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2001-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 "CSimONStoreTraces.h"
       
    27 #endif
       
    28 
    22 #include "CSimONStore.h"
    29 #include "CSimONStore.h"
    23 #include "CSimPhone.h"
    30 #include "CSimPhone.h"
    24 #include "Simlog.h"
       
    25 #include <testconfigfileparser.h>
    31 #include <testconfigfileparser.h>
    26 
    32 
    27 //
    33 //
    28 // CSimONStore
    34 // CSimONStore
    29 //
    35 //
    68  * 
    74  * 
    69  * @param aMaxNumLen	The maximum length of a telephone number.
    75  * @param aMaxNumLen	The maximum length of a telephone number.
    70  * @param aMaxTextLen	The maximum length of an alpha tag.
    76  * @param aMaxTextLen	The maximum length of an alpha tag.
    71  */
    77  */
    72 	{
    78 	{
    73 	LOGPHBK1("Starting to parse Own Number store additional config parameters...");
    79 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMONSTORE_CONSTRUCTL_1, "Starting to parse Own Number store additional config parameters...");
    74 	__ASSERT_ALWAYS(aMaxNumLen<=KONMaxTelNumSize,SimPanic(EOwnNumberNameOrNumberTooLarge));
    80 	__ASSERT_ALWAYS(aMaxNumLen<=KONMaxTelNumSize,SimPanic(EOwnNumberNameOrNumberTooLarge));
    75 	__ASSERT_ALWAYS(aMaxTextLen<=KONMaxTextSize,SimPanic(EOwnNumberNameOrNumberTooLarge));
    81 	__ASSERT_ALWAYS(aMaxTextLen<=KONMaxTextSize,SimPanic(EOwnNumberNameOrNumberTooLarge));
    76 
    82 
    77 	iONStoreEntries=new(ELeave) TONStoreEntry[aMaxNumSlots+1]; //slot 0 is unused
    83 	iONStoreEntries=new(ELeave) TONStoreEntry[aMaxNumSlots+1]; //slot 0 is unused
    78 	iONMaxNumSlots=aMaxNumSlots;
    84 	iONMaxNumSlots=aMaxNumSlots;
    89 		TPtrC8 value;
    95 		TPtrC8 value;
    90 		TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,value);
    96 		TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,value);
    91 		if(ret!=KErrNone)
    97 		if(ret!=KErrNone)
    92 			{
    98 			{
    93 			iONStoreCaps=KDefaultONPhoneStoreCaps;
    99 			iONStoreCaps=KDefaultONPhoneStoreCaps;
    94 			LOGPARSERR("value",ret,0,&KONPhoneStoreCaps);
   100 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMONSTORE_CONSTRUCTL_2, "WARNING - CONFIGURATION FILE PARSING - Reading element VALUE returned %d (element no. %d) from tag %s.",ret,0,KONPhoneStoreCaps);
    95 			}	
   101 			}	
    96 		else
   102 		else
    97 			{
   103 			{
    98 			TUint32 intValue;
   104 			TUint32 intValue;
    99 			TInt ret = AsciiToNum(value, intValue);
   105 			TInt ret = AsciiToNum(value, intValue);
   105 		}
   111 		}
   106 	else
   112 	else
   107 		iONStoreCaps=KDefaultONPhoneStoreCaps;
   113 		iONStoreCaps=KDefaultONPhoneStoreCaps;
   108 
   114 
   109 
   115 
   110 	LOGPHBK1("...Finished parsing Own Number store additional config parameters...");
   116 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMONSTORE_CONSTRUCTL_3, "...Finished parsing Own Number store additional config parameters...");
   111 	}
   117 	}
   112 
   118 
   113 void CSimONStore::PopulateStoreFromConfigFileL()
   119 void CSimONStore::PopulateStoreFromConfigFileL()
   114 /**
   120 /**
   115  * Populate the Own Number store from information in the configuration file.  This is performed
   121  * Populate the Own Number store from information in the configuration file.  This is performed
   118  *
   124  *
   119  * The store entries comply to the following format:
   125  * The store entries comply to the following format:
   120  * "PhBkStoreEntry = <store name>, <slot number>, <telephone number>, <alphatag>"
   126  * "PhBkStoreEntry = <store name>, <slot number>, <telephone number>, <alphatag>"
   121  */
   127  */
   122 	{
   128 	{
   123 	LOGPHBK1("Starting to read Own Number store entries...");
   129 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMONSTORE_POPULATESTOREFROMCONFIGFILEL_1, "Starting to read Own Number store entries...");
   124 	iONIndividualPause=CfgFile()->ItemValue(KONStoreIndividualReqPause,KDefaultONStoreIndividualReqPause);
   130 	iONIndividualPause=CfgFile()->ItemValue(KONStoreIndividualReqPause,KDefaultONStoreIndividualReqPause);
   125 
   131 
   126 	TInt count=CfgFile()->ItemCount(KONStoreEntry);
   132 	TInt count=CfgFile()->ItemCount(KONStoreEntry);
   127 	const CTestConfigItem* item=NULL;
   133 	const CTestConfigItem* item=NULL;
   128 	TInt ret=KErrNone;
   134 	TInt ret=KErrNone;
   141 		RMobilePhone::TMobilePhoneNetworkMode mode;
   147 		RMobilePhone::TMobilePhoneNetworkMode mode;
   142 		RMobilePhone::TMobileNPI numberPlan;
   148 		RMobilePhone::TMobileNPI numberPlan;
   143 		ret=GetONEntry(item,0,index,telNum,name,typeOfNumber,service,mode,numberPlan);
   149 		ret=GetONEntry(item,0,index,telNum,name,typeOfNumber,service,mode,numberPlan);
   144 		if(ret!=KErrNone)
   150 		if(ret!=KErrNone)
   145 			{
   151 			{
   146 			LOGPARSERR("Own Number Entry",ret,index,&KONStoreEntry);
   152 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMONSTORE_POPULATESTOREFROMCONFIGFILEL_2, "WARNING - CONFIGURATION FILE PARSING - Reading element OWN NUMBER ENTRY returned %d (element no. %d) from tag %s.",ret,index,KONStoreEntry);
   147 			continue;
   153 			continue;
   148 			}
   154 			}
   149 
   155 
   150 		iONStoreEntries[index].iMode=mode;
   156 		iONStoreEntries[index].iMode=mode;
   151 		iONStoreEntries[index].iService=service;
   157 		iONStoreEntries[index].iService=service;
   153 		iONStoreEntries[index].iText.Copy(name);
   159 		iONStoreEntries[index].iText.Copy(name);
   154 		iONStoreEntries[index].iTypeOfNumber=typeOfNumber;	
   160 		iONStoreEntries[index].iTypeOfNumber=typeOfNumber;	
   155 		iONStoreEntries[index].iNumberPlan=numberPlan;
   161 		iONStoreEntries[index].iNumberPlan=numberPlan;
   156 		}
   162 		}
   157 
   163 
   158 	LOGPHBK1("...Finished reading Own Number store entries...");
   164 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMONSTORE_POPULATESTOREFROMCONFIGFILEL_3, "...Finished reading Own Number store entries...");
   159 
   165 
   160 	}
   166 	}
   161 
   167 
   162 TInt CSimONStore::GetONEntry(const CTestConfigItem* aItem, TInt aItemIndex, TInt& aIndex,
   168 TInt CSimONStore::GetONEntry(const CTestConfigItem* aItem, TInt aItemIndex, TInt& aIndex,
   163 								 TPtrC8& aTelNum, TPtrC8& aText,
   169 								 TPtrC8& aTelNum, TPtrC8& aText,
   542 * Returns a pointer to the config file section
   548 * Returns a pointer to the config file section
   543 *
   549 *
   544 * @return CTestConfigSection a pointer to the configuration file data section
   550 * @return CTestConfigSection a pointer to the configuration file data section
   545 */
   551 */
   546 	{
   552 	{
   547 	LOGPHBK1(">>CSimONStore::CfgFile");
   553 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMONSTORE_CFGFILE_1, ">>CSimONStore::CfgFile");
   548 	return iPhone->CfgFile();
   554 	return iPhone->CfgFile();
   549 	}
   555 	}