telephonyserverplugins/simtsy/src/CSimSmsStore.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2003-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 "CSimSmsStoreTraces.h"
       
    27 #endif
       
    28 
       
    29 #include <mmlist.h>
    22 #include <mmlist.h>
    30 #include <mmretrieve.h>
    23 #include <mmretrieve.h>
    31 #include <testconfigfileparser.h>
    24 #include <testconfigfileparser.h>
    32 #include "CSimSmsStore.h"
    25 #include "CSimSmsStore.h"
    33 #include "csimsmsmess.h"
    26 #include "csimsmsmess.h"
       
    27 #include "Simlog.h"
    34 #include "CSimTsyMode.h"
    28 #include "CSimTsyMode.h"
    35 
    29 
    36 const TInt KSmsStoreGranularity=2;
    30 const TInt KSmsStoreGranularity=2;
    37 const TInt KCorruptPDU=9999;
    31 const TInt KCorruptPDU=9999;
    38 _LIT(KNullTelephoneNumber,"0");
    32 _LIT(KNullTelephoneNumber,"0");
   130 	{
   124 	{
   131 	iGsmSmsStoreEntries=new(ELeave) RMobileSmsStore::TMobileGsmSmsEntryV1[aMaxNumSlots+1];//index 0 is not used
   125 	iGsmSmsStoreEntries=new(ELeave) RMobileSmsStore::TMobileGsmSmsEntryV1[aMaxNumSlots+1];//index 0 is not used
   132 	iSmsMaxNumSlots=aMaxNumSlots;
   126 	iSmsMaxNumSlots=aMaxNumSlots;
   133 	iSmsStoreName.Copy(aName);
   127 	iSmsStoreName.Copy(aName);
   134 	iSmsReadAll=new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(KSmsStoreGranularity);
   128 	iSmsReadAll=new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(KSmsStoreGranularity);
   135 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_CONSTRUCTL_1, "Starting to parse SMS Store config parameters...");
   129 	LOGSMS1("Starting to parse SMS Store config parameters...");
   136 	iSmsIndividualPause=CfgFileSection()->ItemValue(KSmsStoreIndividualReqPause,KDefaultSmsStoreIndividualReqPause);
   130 	iSmsIndividualPause=CfgFileSection()->ItemValue(KSmsStoreIndividualReqPause,KDefaultSmsStoreIndividualReqPause);
   137 	iSmsBatchPause=CfgFileSection()->ItemValue(KSmsStoreBatchReqPause,KDefaultSmsStoreBatchReqPause);
   131 	iSmsBatchPause=CfgFileSection()->ItemValue(KSmsStoreBatchReqPause,KDefaultSmsStoreBatchReqPause);
   138 	
   132 	
   139 	const CTestConfigItem* item0=NULL;
   133 	const CTestConfigItem* item0=NULL;
   140 	item0=CfgFileSection()->Item(KSmsPhoneStoreCaps,0);
   134 	item0=CfgFileSection()->Item(KSmsPhoneStoreCaps,0);
   142 		{
   136 		{
   143 		TPtrC8 value0;
   137 		TPtrC8 value0;
   144 		TInt ret0=CTestConfig::GetElement(item0->Value(),KStdDelimiter,0,value0);
   138 		TInt ret0=CTestConfig::GetElement(item0->Value(),KStdDelimiter,0,value0);
   145 		if(ret0!=KErrNone)
   139 		if(ret0!=KErrNone)
   146 			{
   140 			{
   147 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_CONSTRUCTL_2, "WARNING - CONFIGURATION FILE PARSING - Reading element VALUE0 returned %d (element no. %d) from tag %s.",ret0,0,KSmsPhoneStoreCaps);
   141 			LOGPARSERR("value0",ret0,0,&KSmsPhoneStoreCaps);
   148 			iSmsStoreCaps=KDefaultSmsPhoneStoreCaps+KDefaultSmsOnlySmsCaps;
   142 			iSmsStoreCaps=KDefaultSmsPhoneStoreCaps+KDefaultSmsOnlySmsCaps;
   149 			}
   143 			}
   150 		else
   144 		else
   151 			{
   145 			{
   152 			TUint32 intValue;
   146 			TUint32 intValue;
   159 		}
   153 		}
   160 	else
   154 	else
   161 		iSmsStoreCaps=KDefaultSmsPhoneStoreCaps+KDefaultSmsOnlySmsCaps;
   155 		iSmsStoreCaps=KDefaultSmsPhoneStoreCaps+KDefaultSmsOnlySmsCaps;
   162 
   156 
   163 
   157 
   164 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_CONSTRUCTL_3, "...Finished parsing SMS Store config parameters");
   158 	LOGSMS1("...Finished parsing SMS Store config parameters");
   165 	iTimer=CSimTimer::NewL(iSmsMessaging->iPhone);
   159 	iTimer=CSimTimer::NewL(iSmsMessaging->iPhone);
   166 	iIncomingTimer=CSimTimer::NewL(iSmsMessaging->iPhone);
   160 	iIncomingTimer=CSimTimer::NewL(iSmsMessaging->iPhone);
   167 	}
   161 	}
   168 
   162 
   169 void CSimSmsStore::PopulateStoreFromConfigFile()
   163 void CSimSmsStore::PopulateStoreFromConfigFile()
   174  *
   168  *
   175  * The store entries comply to the following format:
   169  * The store entries comply to the following format:
   176  * "SmsStoreEntry = <store name>, <slot number>, <entry status>, <pdu>"
   170  * "SmsStoreEntry = <store name>, <slot number>, <entry status>, <pdu>"
   177  */
   171  */
   178 	{
   172 	{
   179 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_POPULATESTOREFROMCONFIGFILE_1, "Starting reading SMS Store entries...");
   173 	LOGSMS1("Starting reading SMS Store entries...");
   180 	TInt count=CfgFileSection()->ItemCount(KSmsStoreEntry);
   174 	TInt count=CfgFileSection()->ItemCount(KSmsStoreEntry);
   181 	const CTestConfigItem* item=NULL;
   175 	const CTestConfigItem* item=NULL;
   182 	TInt ret=KErrNone;
   176 	TInt ret=KErrNone;
   183 
   177 
   184 	for(TInt i=0;i<count;i++)
   178 	for(TInt i=0;i<count;i++)
   189 
   183 
   190 		TPtrC8 storeName;
   184 		TPtrC8 storeName;
   191 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,storeName);
   185 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,storeName);
   192 		if(ret!=KErrNone)
   186 		if(ret!=KErrNone)
   193 			{
   187 			{
   194 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_POPULATESTOREFROMCONFIGFILE_2, "WARNING - CONFIGURATION FILE PARSING - Reading element STORENAME returned %d (element no. %d) from tag %s.",ret,0,KSmsStoreEntry);
   188 			LOGPARSERR("storeName",ret,0,&KSmsStoreEntry);
   195 			continue;
   189 			continue;
   196 			}
   190 			}
   197 		if(storeName.MatchF(iSmsStoreName)!=0)
   191 		if(storeName.MatchF(iSmsStoreName)!=0)
   198 			continue;						// Not this store
   192 			continue;						// Not this store
   199 
   193 
   200 		TInt index,stat;
   194 		TInt index,stat;
   201 		TPtrC8 pdu;
   195 		TPtrC8 pdu;
   202 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,index);
   196 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,index);
   203 		if((ret!=KErrNone)||(index>=iSmsMaxNumSlots))
   197 		if((ret!=KErrNone)||(index>=iSmsMaxNumSlots))
   204 			{
   198 			{
   205 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_POPULATESTOREFROMCONFIGFILE_3, "WARNING - CONFIGURATION FILE PARSING - Reading element INDEX returned %d (element no. %d) from tag %s.",ret,1,KSmsStoreEntry);
   199 			LOGPARSERR("index",ret,1,&KSmsStoreEntry);
   206 			continue;
   200 			continue;
   207 			}
   201 			}
   208 	
   202 	
   209 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,stat);
   203 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,stat);
   210 		if(ret!=KErrNone)
   204 		if(ret!=KErrNone)
   211 			{
   205 			{
   212 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_POPULATESTOREFROMCONFIGFILE_4, "WARNING - CONFIGURATION FILE PARSING - Reading element STAT returned %d (element no. %d) from tag %s",ret,2,KSmsStoreEntry);
   206 			LOGPARSERR("stat",ret,2,&KSmsStoreEntry);
   213 			continue;
   207 			continue;
   214 			}
   208 			}
   215 
   209 
   216 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,pdu);
   210 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,pdu);
   217 		if(ret!=KErrNone)
   211 		if(ret!=KErrNone)
   218 			{
   212 			{
   219 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_POPULATESTOREFROMCONFIGFILE_5, "WARNING - CONFIGURATION FILE PARSING - Reading element PDU returned %d (element no. %d) from tag %s.",ret,3,KSmsStoreEntry);
   213 			LOGPARSERR("pdu",ret,3,&KSmsStoreEntry);
   220 			continue;
   214 			continue;
   221 			}
   215 			}
   222 
   216 
   223 		TPtrC8 sca;
   217 		TPtrC8 sca;
   224 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,sca);
   218 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,sca);
   225 		if(ret!=KErrNone)
   219 		if(ret!=KErrNone)
   226 			{
   220 			{
   227 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_POPULATESTOREFROMCONFIGFILE_6, "WARNING - CONFIGURATION FILE PARSING - Reading element SCA returned %d (element no. %d) from tag %s.",ret,4,KSmsStoreEntry);
   221 			LOGPARSERR("sca",ret,4,&KSmsStoreEntry);
   228 			continue;
   222 			continue;
   229 			}
   223 			}
   230 		iGsmSmsStoreEntries[index].iIndex=index;
   224 		iGsmSmsStoreEntries[index].iIndex=index;
   231 		iGsmSmsStoreEntries[index].iMsgStatus=(RMobileSmsStore::TMobileSmsStoreStatus)stat;
   225 		iGsmSmsStoreEntries[index].iMsgStatus=(RMobileSmsStore::TMobileSmsStoreStatus)stat;
   232 		ConvertAsciiSms(pdu,iGsmSmsStoreEntries[index].iMsgData);
   226 		ConvertAsciiSms(pdu,iGsmSmsStoreEntries[index].iMsgData);
   233 		RecordSca(sca, index);
   227 		RecordSca(sca, index);
   234 		}
   228 		}
   235 
   229 
   236 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_POPULATESTOREFROMCONFIGFILE_7, "...Finished reading SMS Store entries");
   230 	LOGSMS1("...Finished reading SMS Store entries");
   237 	}
   231 	}
   238 
   232 
   239 
   233 
   240 
   234 
   241 void CSimSmsStore::RecordSca(const TDesC8& aAsciiAddr, TInt aIndex)
   235 void CSimSmsStore::RecordSca(const TDesC8& aAsciiAddr, TInt aIndex)
   272 
   266 
   273 	delete iTimer;
   267 	delete iTimer;
   274 	delete iIncomingTimer;
   268 	delete iIncomingTimer;
   275 	}
   269 	}
   276 
   270 
   277 #ifdef OST_TRACE_COMPILER_IN_USE
   271 #ifdef _DEBUG
   278 void CSimSmsStore::LogRequest(TBool aEntering, TInt aIpc, TInt aError)
   272 void CSimSmsStore::LogRequest(TBool aEntering, TInt aIpc, TInt aError)
   279 #else
   273 #else
   280 void CSimSmsStore::LogRequest(TBool aEntering, TInt aIpc, TInt /*aError*/)
   274 void CSimSmsStore::LogRequest(TBool aEntering, TInt aIpc, TInt /*aError*/)
   281 #endif
   275 #endif
   282 /**
   276 /**
   328 			break;
   322 			break;
   329 		}
   323 		}
   330 
   324 
   331 	if (aEntering!=EFalse)
   325 	if (aEntering!=EFalse)
   332 		{
   326 		{
   333 		OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_LOGREQUEST_1, ">>%d,CSimSmsStore::%s",aIpc, ipcBuf );
   327 		LOGSMS3(">>%d,CSimSmsStore::%S",aIpc, &ipcBuf );
   334 		}
   328 		}
   335 	else
   329 	else
   336 		{	
   330 		{
   337 		OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_LOGREQUEST_2, "<<%d,CSimSmsStore::%s with error %d",aIpc, ipcBuf, aError);	
   331 		LOGSMS4("<<%d,CSimSmsStore::%S with error %d",aIpc, &ipcBuf, aError);
   338 		}
   332 		}
   339 	}
   333 	}
   340 
   334 
   341 
   335 
   342 
   336 
  1181 * Returns a pointer to the config file section
  1175 * Returns a pointer to the config file section
  1182 *
  1176 *
  1183 * @return CTestConfigSection a pointer to the configuration file data section
  1177 * @return CTestConfigSection a pointer to the configuration file data section
  1184 */
  1178 */
  1185 	{
  1179 	{
  1186 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMSSTORE_CFGFILESECTION_1, ">>CSimSmsStore::CfgFileSection");
  1180 	LOGSMS1(">>CSimSmsStore::CfgFileSection");
  1187 	return iSmsMessaging->CfgFileSection();
  1181 	return iSmsMessaging->CfgFileSection();
  1188 	}
  1182 	}
  1189 
  1183