smsprotocols/smsstack/smsprot/Src/smspstor.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 14 7ef16719d8cb
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-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 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "smspstorTraces.h"
       
    26 #endif
       
    27 
    22 #include <e32svr.h>
    28 #include <e32svr.h>
    23 #include <es_ini.h>
    29 #include <es_ini.h>
    24 #include "smspstor.h"
    30 #include "smspstor.h"
    25 #include "smspmain.h"
    31 #include "smspmain.h"
    26 #include "smsuaddr.H"
    32 #include "smsuaddr.H"
    27 #include "Gsmumsg.h"
    33 #include "Gsmumsg.h"
    28 #include "gsmubuf.h"
    34 #include "gsmubuf.h"
    29 #include <logwrap.h>
       
    30 #include <logwraplimits.h>
    35 #include <logwraplimits.h>
    31 #include "Gsmuelem.h"
    36 #include "Gsmuelem.h"
    32 #include "gsmuieoperations.h"
    37 #include "gsmuieoperations.h"
    33 #include "gsmunonieoperations.h"
    38 #include "gsmunonieoperations.h"
    34 
    39 
    35 LOCAL_C TPtrC TrimLeadingZeros(const TDesC& aString)
    40 LOCAL_C TPtrC TrimLeadingZeros(const TDesC& aString)
    36 	{
    41 	{
    37 	LOGSMSPROT1("CSARStore::ExternalizeEntryArrayL()");
    42 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TRIMLEADINGZEROS_1, "CSARStore::ExternalizeEntryArrayL()");
    38 
    43 
    39 	const TInt len = aString.Length();
    44 	const TInt len = aString.Length();
    40 
    45 
    41 	if (len == 0)
    46 	if (len == 0)
    42 		return aString;
    47 		return aString;
    57  *  
    62  *  
    58  *  @param aFs  File Server handle.
    63  *  @param aFs  File Server handle.
    59  */
    64  */
    60 CSmsReassemblyStore* CSmsReassemblyStore::NewL(RFs& aFs)
    65 CSmsReassemblyStore* CSmsReassemblyStore::NewL(RFs& aFs)
    61 	{
    66 	{
    62 	LOGSMSPROT1("CSmsReassemblyStore::NewL()");
    67 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_NEWL_1, "CSmsReassemblyStore::NewL()");
    63 
    68 
    64 	CSmsReassemblyStore*  self = new (ELeave) CSmsReassemblyStore(aFs);
    69 	CSmsReassemblyStore*  self = new (ELeave) CSmsReassemblyStore(aFs);
    65 	CleanupStack::PushL(self);
    70 	CleanupStack::PushL(self);
    66 	self->ConstructL();
    71 	self->ConstructL();
    67 	CleanupStack::Pop(self);
    72 	CleanupStack::Pop(self);
    73 /**
    78 /**
    74  *  Creates and starts timer
    79  *  Creates and starts timer
    75  */
    80  */
    76 void CSmsReassemblyStore::ConstructL()
    81 void CSmsReassemblyStore::ConstructL()
    77 	{
    82 	{
    78 	LOGSMSPROT1("CSmsReassemblyStore::ConstructL()");
    83 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_CONSTRUCTL_1, "CSmsReassemblyStore::ConstructL()");
    79 
    84 
    80 	//
    85 	//
    81 	// Generate the full path to the reassembly store.
    86 	// Generate the full path to the reassembly store.
    82 	//
    87 	//
    83 	PrivatePath(iFullPathBuf);
    88 	PrivatePath(iFullPathBuf);
    97 	} // CSmsReassemblyStore::~CSmsReassemblyStore
   102 	} // CSmsReassemblyStore::~CSmsReassemblyStore
    98 
   103 
    99 
   104 
   100 void CSmsReassemblyStore::UpdateLogServerIdL(TInt aIndex, TLogId aLogServerId)
   105 void CSmsReassemblyStore::UpdateLogServerIdL(TInt aIndex, TLogId aLogServerId)
   101 	{
   106 	{
   102 	LOGSMSPROT1("CSmsReassemblyStore::UpdateLogServerIdL()");
   107 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_UPDATELOGSERVERIDL_1, "CSmsReassemblyStore::UpdateLogServerIdL()");
   103 
   108 
   104 	TSmsReassemblyEntry entry(reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[aIndex]));
   109 	TSmsReassemblyEntry entry(reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[aIndex]));
   105 
   110 
   106 	if (entry.LogServerId() != aLogServerId)
   111 	if (entry.LogServerId() != aLogServerId)
   107 		{
   112 		{
   125  */
   130  */
   126 TBool CSmsReassemblyStore::FindMessageL(const CSmsMessage& aSmsMessage,
   131 TBool CSmsReassemblyStore::FindMessageL(const CSmsMessage& aSmsMessage,
   127 										TBool aPassed,
   132 										TBool aPassed,
   128 										TInt& aIndex)
   133 										TInt& aIndex)
   129  	{
   134  	{
   130  	LOGSMSPROT1("CSmsReassemblyStore::FindMessageL()");
   135  	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_FINDMESSAGEL_1, "CSmsReassemblyStore::FindMessageL()");
   131 
   136 
   132 	//
   137 	//
   133 	// Parse the GSM data from the SMS message...
   138 	// Parse the GSM data from the SMS message...
   134 	//
   139 	//
   135 	TGsmSmsTelNumber  parsedAddress;
   140 	TGsmSmsTelNumber  parsedAddress;
   151 			entry.Description2().Right(8) == parsedAddress.iTelNumber.Right(8))
   156 			entry.Description2().Right(8) == parsedAddress.iTelNumber.Right(8))
   152  			{
   157  			{
   153 			//
   158 			//
   154 			// Found!
   159 			// Found!
   155 			//
   160 			//
   156 			LOGSMSPROT2("CSmsReassemblyStore::FindMessage(): Found! index=%d", index);
   161 			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_FINDMESSAGEL_2, "CSmsReassemblyStore::FindMessage(): Found! index=%d", index);
   157 
   162 
   158 			aIndex = index;
   163 			aIndex = index;
   159 
   164 
   160 			return ETrue;
   165 			return ETrue;
   161 			}
   166 			}
   162  		}
   167  		}
   163 
   168 
   164 	//
   169 	//
   165 	// Not found...
   170 	// Not found...
   166 	//
   171 	//
   167 	LOGSMSPROT1("CSmsReassemblyStore::FindMessage(): Not found!");
   172 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_FINDMESSAGEL_3, "CSmsReassemblyStore::FindMessage(): Not found!");
   168 
   173 
   169  	return EFalse;
   174  	return EFalse;
   170  	} // CSmsReassemblyStore::FindMessageL
   175  	} // CSmsReassemblyStore::FindMessageL
   171 
   176 
   172 
   177 
   180  *  @param aServiceCenterAddressPresent Used to
   185  *  @param aServiceCenterAddressPresent Used to
   181  */
   186  */
   182 void CSmsReassemblyStore::MatchPDUToExistingMessage(const CSmsMessage& aSmsMessage,
   187 void CSmsReassemblyStore::MatchPDUToExistingMessage(const CSmsMessage& aSmsMessage,
   183 													TInt& aIndex)
   188 													TInt& aIndex)
   184 	{
   189 	{
   185 	LOGSMSPROT1("CSmsReassemblyStore::MatchPDUToExistingMessage()");
   190 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_MATCHPDUTOEXISTINGMESSAGE_1, "CSmsReassemblyStore::MatchPDUToExistingMessage()");
   186 
   191 
   187 	__ASSERT_ALWAYS(!aSmsMessage.IsDecoded(), SmspPanic(KSmspPanicMessageConcatenated));
   192 	__ASSERT_ALWAYS(!aSmsMessage.IsDecoded(), SmspPanic(KSmspPanicMessageConcatenated));
   188 
   193 
   189 	aIndex = KErrNotFound;
   194 	aIndex = KErrNotFound;
   190 
   195 
   220 				break;
   225 				break;
   221 				}
   226 				}
   222 			}
   227 			}
   223 		}
   228 		}
   224 
   229 
   225 	LOGSMSPROT3("CSmsReassemblyStore::MatchPDUToExistingMessage(): reassemblyCount=%d, aIndex=%d", reassemblyCount, aIndex);
   230 	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_MATCHPDUTOEXISTINGMESSAGE_2, "CSmsReassemblyStore::MatchPDUToExistingMessage(): reassemblyCount=%d, aIndex=%d", reassemblyCount, aIndex);
   226 	} // CSmsReassemblyStore::MatchPDUToExistingMessage
   231 	} // CSmsReassemblyStore::MatchPDUToExistingMessage
   227 
   232 
   228 
   233 
   229 void CSmsReassemblyStore::UpdateExistingMessageL(const CSmsMessage& aSmsMessage,
   234 void CSmsReassemblyStore::UpdateExistingMessageL(const CSmsMessage& aSmsMessage,
   230 												 const TGsmSms& aGsmSms, TInt aIndex,
   235 												 const TGsmSms& aGsmSms, TInt aIndex,
   231 												 TBool& aComplete,
   236 												 TBool& aComplete,
   232 												 TBool& aDuplicateMsgRef,
   237 												 TBool& aDuplicateMsgRef,
   233 												 TBool& aDuplicateSlot)
   238 												 TBool& aDuplicateSlot)
   234 	{
   239 	{
   235 	LOGSMSPROT1("CSmsReassemblyStore::UpdateExistingMessageL()");
   240 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_UPDATEEXISTINGMESSAGEL_1, "CSmsReassemblyStore::UpdateExistingMessageL()");
   236 
   241 
   237 	aComplete        = EFalse;
   242 	aComplete        = EFalse;
   238 	aDuplicateMsgRef = EFalse;
   243 	aDuplicateMsgRef = EFalse;
   239 	aDuplicateSlot   = EFalse;
   244 	aDuplicateSlot   = EFalse;
   240 
   245 
   274 			{
   279 			{
   275 			const TGsmSmsSlotEntry&  slot = smsMessage->iSlotArray[slotNum];
   280 			const TGsmSmsSlotEntry&  slot = smsMessage->iSlotArray[slotNum];
   276 
   281 
   277 			if (slot.iIndex == newSlot.iIndex  && slot.iStore == newSlot.iStore)
   282 			if (slot.iIndex == newSlot.iIndex  && slot.iStore == newSlot.iStore)
   278 				{
   283 				{
   279 				LOGSMSPROT1("CSmsReassemblyStore::UpdateExistingMessageL(): Duplicate enumerated PDU.");
   284 				OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_UPDATEEXISTINGMESSAGEL_2, "CSmsReassemblyStore::UpdateExistingMessageL(): Duplicate enumerated PDU.");
   280 
   285 
   281 				// It is a duplicate that was already stored on the SIM...
   286 				// It is a duplicate that was already stored on the SIM...
   282 				aDuplicateSlot = ETrue;
   287 				aDuplicateSlot = ETrue;
   283 				break;
   288 				break;
   284 				}
   289 				}
   289 
   294 
   290 	for (TInt index = 0;  index < indexArrayCount;  index++ )
   295 	for (TInt index = 0;  index < indexArrayCount;  index++ )
   291 		{
   296 		{
   292 		if (indexArray->At(index) == concatPDUIndex)
   297 		if (indexArray->At(index) == concatPDUIndex)
   293 			{
   298 			{
   294 			LOGSMSPROT1("CSmsReassemblyStore::UpdateExistingMessageL(): Duplicate concatenated PDU.");
   299 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_UPDATEEXISTINGMESSAGEL_3, "CSmsReassemblyStore::UpdateExistingMessageL(): Duplicate concatenated PDU.");
   295 
   300 
   296 			// The PDU is already stored in the reassembly store.
   301 			// The PDU is already stored in the reassembly store.
   297 			aDuplicateMsgRef = ETrue;
   302 			aDuplicateMsgRef = ETrue;
   298 			break;
   303 			break;
   299 			}
   304 			}
   358 	} // CSmsReassemblyStore::UpdateExistingMessageL
   363 	} // CSmsReassemblyStore::UpdateExistingMessageL
   359 
   364 
   360 
   365 
   361 void CSmsReassemblyStore::NewMessagePDUL(TInt& aIndex,CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms)
   366 void CSmsReassemblyStore::NewMessagePDUL(TInt& aIndex,CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms)
   362 	{
   367 	{
   363 	LOGSMSPROT1("CSmsReassemblyStore::NewMessagePDUL");
   368 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_NEWMESSAGEPDUL_1, "CSmsReassemblyStore::NewMessagePDUL");
   364 
   369 
   365 	CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8);
   370 	CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8);
   366 	CleanupStack::PushL(indexarray);
   371 	CleanupStack::PushL(indexarray);
   367 	CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8);
   372 	CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8);
   368 	CleanupStack::PushL(smsarray);
   373 	CleanupStack::PushL(smsarray);
   375 	} // CSmsReassemblyStore::NewMessagePDUL
   380 	} // CSmsReassemblyStore::NewMessagePDUL
   376 
   381 
   377 
   382 
   378 void CSmsReassemblyStore::GetMessageL(TInt aIndex,CSmsMessage& aSmsMessage)
   383 void CSmsReassemblyStore::GetMessageL(TInt aIndex,CSmsMessage& aSmsMessage)
   379 	{
   384 	{
   380 	LOGSMSPROT2("CSmsReassemblyStore::GetMessageL [aIndex=%d]", aIndex);
   385 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_GETMESSAGEL_1, "CSmsReassemblyStore::GetMessageL [aIndex=%d]", aIndex);
   381 
   386 
   382 	CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8);
   387 	CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8);
   383 	CleanupStack::PushL(indexarray);
   388 	CleanupStack::PushL(indexarray);
   384 	CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8);
   389 	CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8);
   385 	CleanupStack::PushL(smsarray);
   390 	CleanupStack::PushL(smsarray);
   396  *  
   401  *  
   397  *  NOTE! You have to call CSARStore::OpenFileLC() before calling this function
   402  *  NOTE! You have to call CSARStore::OpenFileLC() before calling this function
   398  */
   403  */
   399 void CSmsReassemblyStore::InternalizeEntryL(const TStreamId& aStreamId,CSmsMessage& aSmsMessage,CArrayFix<TInt>& aIndexArray,CArrayFix<TGsmSms>& aSmsArray)
   404 void CSmsReassemblyStore::InternalizeEntryL(const TStreamId& aStreamId,CSmsMessage& aSmsMessage,CArrayFix<TInt>& aIndexArray,CArrayFix<TGsmSms>& aSmsArray)
   400 	{
   405 	{
   401 	LOGSMSPROT2("CSmsReassemblyStore::InternalizeEntryL Start [sid=%d]", aStreamId.Value());
   406 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_INTERNALIZEENTRYL_1, "CSmsReassemblyStore::InternalizeEntryL Start [sid=%d]", aStreamId.Value());
   402 	RStoreReadStream readstream;
   407 	RStoreReadStream readstream;
   403 	readstream.OpenLC(FileStore(),aStreamId);
   408 	readstream.OpenLC(FileStore(),aStreamId);
   404 	readstream >> aSmsMessage;
   409 	readstream >> aSmsMessage;
   405 	TInt count=readstream.ReadInt32L();
   410 	TInt count=readstream.ReadInt32L();
   406 	aIndexArray.Reset();
   411 	aIndexArray.Reset();
   421 		TGsmSms sms;
   426 		TGsmSms sms;
   422 		sms.SetPdu(pdu);
   427 		sms.SetPdu(pdu);
   423 		aSmsArray.AppendL(sms);
   428 		aSmsArray.AppendL(sms);
   424 		}
   429 		}
   425 	CleanupStack::PopAndDestroy();
   430 	CleanupStack::PopAndDestroy();
   426 	LOGSMSPROT2("CSmsReassemblyStore::InternalizeEntryL End [count=%d]", count);
   431 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_INTERNALIZEENTRYL_2, "CSmsReassemblyStore::InternalizeEntryL End [count=%d]", count);
   427 	} // CSARStore::OpenFileLC
   432 	} // CSARStore::OpenFileLC
   428 
   433 
   429 
   434 
   430 /**
   435 /**
   431  *  externalizes all the entries from the internal memory to the permanent file store
   436  *  externalizes all the entries from the internal memory to the permanent file store
   432  *  
   437  *  
   433  *  NOTE! You have to call CSARStore::OpenFileLC() before calling this function
   438  *  NOTE! You have to call CSARStore::OpenFileLC() before calling this function
   434  */
   439  */
   435 void CSmsReassemblyStore::ExternalizeEntryL(TStreamId& aStreamId,const CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray)
   440 void CSmsReassemblyStore::ExternalizeEntryL(TStreamId& aStreamId,const CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray)
   436 	{
   441 	{
   437 	LOGSMSPROT2("CSmsReassemblyStore::ExternalizeEntryL Start [sid=%d]", aStreamId.Value());
   442 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_EXTERNALIZEENTRYL_1, "CSmsReassemblyStore::ExternalizeEntryL Start [sid=%d]", aStreamId.Value());
   438 
   443 
   439 	RStoreWriteStream writestream;
   444 	RStoreWriteStream writestream;
   440 	if (aStreamId==KNullStreamId)
   445 	if (aStreamId==KNullStreamId)
   441 		aStreamId=writestream.CreateLC(FileStore());
   446 		aStreamId=writestream.CreateLC(FileStore());
   442 	else
   447 	else
   457 		writestream << pdu;
   462 		writestream << pdu;
   458 		}
   463 		}
   459 	writestream.CommitL();
   464 	writestream.CommitL();
   460 	CleanupStack::PopAndDestroy();
   465 	CleanupStack::PopAndDestroy();
   461 
   466 
   462 	LOGSMSPROT2("CSmsReassemblyStore::ExternalizeEntryL End [count=%d]", count);
   467 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_EXTERNALIZEENTRYL_2, "CSmsReassemblyStore::ExternalizeEntryL End [count=%d]", count);
   463 	} // CSARStore::OpenFileLC
   468 	} // CSARStore::OpenFileLC
   464 
   469 
   465 
   470 
   466 void CSmsReassemblyStore::PopulateEntry(TSmsReassemblyEntry& aEntry,const CSmsMessage& aSmsMessage,TInt aNumSmss)
   471 void CSmsReassemblyStore::PopulateEntry(TSmsReassemblyEntry& aEntry,const CSmsMessage& aSmsMessage,TInt aNumSmss)
   467 	{
   472 	{
   468 	LOGSMSPROT1("CSmsReassemblyStore::PopulateEntry");
   473 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_POPULATEENTRY_1, "CSmsReassemblyStore::PopulateEntry");
   469 	aEntry.SetReference(0);
   474 	aEntry.SetReference(0);
   470 	aEntry.SetTotal(1);
   475 	aEntry.SetTotal(1);
   471 	aEntry.SetCount(1);
   476 	aEntry.SetCount(1);
   472 
   477 
   473 	if (aSmsMessage.TextPresent())
   478 	if (aSmsMessage.TextPresent())
   521 	} // CSmsReassemblyStore::PopulateEntry
   526 	} // CSmsReassemblyStore::PopulateEntry
   522 
   527 
   523 
   528 
   524 void CSmsReassemblyStore::CreateEntryL(CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray)
   529 void CSmsReassemblyStore::CreateEntryL(CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray)
   525 	{
   530 	{
   526 	LOGSMSPROT1("CSmsReassemblyStore::CreateEntryL");
   531 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_CREATEENTRYL_1, "CSmsReassemblyStore::CreateEntryL");
   527  	TStreamId streamid=KNullStreamId;
   532  	TStreamId streamid=KNullStreamId;
   528  	if (aSmsMessage.Time() >= iLastRealTime)
   533  	if (aSmsMessage.Time() >= iLastRealTime)
   529  		{
   534  		{
   530  		iLastRealTime=aSmsMessage.Time();
   535  		iLastRealTime=aSmsMessage.Time();
   531  		if(iLastReceivedTime >= aSmsMessage.Time())
   536  		if(iLastReceivedTime >= aSmsMessage.Time())
   549 	} // CSmsReassemblyStore::CreateEntryL
   554 	} // CSmsReassemblyStore::CreateEntryL
   550 
   555 
   551 
   556 
   552 TBool CSmsReassemblyStore::PassedToClient( TInt aIndex ) const
   557 TBool CSmsReassemblyStore::PassedToClient( TInt aIndex ) const
   553 	{
   558 	{
   554 	LOGSMSPROT1("CSmsReassemblyStore::PassedToClient()");
   559 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_PASSEDTOCLIENT_1, "CSmsReassemblyStore::PassedToClient()");
   555 
   560 
   556 	const TSmsReassemblyEntry& entry = reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[ aIndex ]);
   561 	const TSmsReassemblyEntry& entry = reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[ aIndex ]);
   557 	return entry.PassedToClient();
   562 	return entry.PassedToClient();
   558 	} // CSmsReassemblyStore::PassedToClient
   563 	} // CSmsReassemblyStore::PassedToClient
   559 
   564 
   560 
   565 
   561 void CSmsReassemblyStore::SetPassedToClientL(TInt aIndex, TBool aPassed)
   566 void CSmsReassemblyStore::SetPassedToClientL(TInt aIndex, TBool aPassed)
   562 	{
   567 	{
   563 	LOGSMSPROT1("CSmsReassemblyStore::SetPassedToClientL()");
   568 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_SETPASSEDTOCLIENTL_1, "CSmsReassemblyStore::SetPassedToClientL()");
   564 
   569 
   565 	TSmsReassemblyEntry entry(reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[aIndex]));
   570 	TSmsReassemblyEntry entry(reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[aIndex]));
   566 
   571 
   567 	const TBool alreadyPassed = entry.PassedToClient();
   572 	const TBool alreadyPassed = entry.PassedToClient();
   568 
   573 
   577 /**
   582 /**
   578  *  Open the sms reassembly store.
   583  *  Open the sms reassembly store.
   579  */
   584  */
   580 void CSmsReassemblyStore::OpenStoreL()
   585 void CSmsReassemblyStore::OpenStoreL()
   581 	{
   586 	{
   582 	LOGSMSPROT1("CSmsReassemblyStore::OpenStoreL()");
   587 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_OPENSTOREL_1, "CSmsReassemblyStore::OpenStoreL()");
   583 
   588 
   584 	this->OpenL(iFullPathBuf,KReassemblyStoreUid);
   589 	this->OpenL(iFullPathBuf,KReassemblyStoreUid);
   585 	} // CSmsReassemblyStore::OpenStoreL
   590 	} // CSmsReassemblyStore::OpenStoreL
   586 
   591 
   587 
   592 
   597 	} // CSmsReassemblyStore::CSmsReassemblyStore
   602 	} // CSmsReassemblyStore::CSmsReassemblyStore
   598 
   603 
   599 
   604 
   600 CSmsSegmentationStore* CSmsSegmentationStore::NewL(RFs& aFs)
   605 CSmsSegmentationStore* CSmsSegmentationStore::NewL(RFs& aFs)
   601 	{
   606 	{
   602 	LOGSMSPROT1("CSmsSegmentationStore::NewL()");
   607 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEWL_1, "CSmsSegmentationStore::NewL()");
   603 
   608 
   604 	CSmsSegmentationStore* segmentationStore = new(ELeave) CSmsSegmentationStore(aFs);
   609 	CSmsSegmentationStore* segmentationStore = new(ELeave) CSmsSegmentationStore(aFs);
   605 	CleanupStack::PushL( segmentationStore );
   610 	CleanupStack::PushL( segmentationStore );
   606 	segmentationStore->ConstructL();
   611 	segmentationStore->ConstructL();
   607 	CleanupStack::Pop( segmentationStore );
   612 	CleanupStack::Pop( segmentationStore );
   609 	} // CSmsSegmentationStore::NewL
   614 	} // CSmsSegmentationStore::NewL
   610 
   615 
   611 
   616 
   612 void CSmsSegmentationStore::ConstructL()
   617 void CSmsSegmentationStore::ConstructL()
   613 	{
   618 	{
   614 	LOGSMSPROT1("CSmsSegmentationStore::ConstructL()");
   619 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_CONSTRUCTL_1, "CSmsSegmentationStore::ConstructL()");
   615 
   620 
   616 	//generate fullpath of segmentation store.
   621 	//generate fullpath of segmentation store.
   617 	PrivatePath(iFullPathBuf);
   622 	PrivatePath(iFullPathBuf);
   618 	//append store name
   623 	//append store name
   619 	iFullPathBuf.Append(KSegmentationStoreName);
   624 	iFullPathBuf.Append(KSegmentationStoreName);
   650     } // CSmsSegmentationStore::~CSmsSegmentationStore
   655     } // CSmsSegmentationStore::~CSmsSegmentationStore
   651 
   656 
   652 
   657 
   653 TInt CSmsSegmentationStore::Next8BitReferenceL()
   658 TInt CSmsSegmentationStore::Next8BitReferenceL()
   654 	{
   659 	{
   655 	LOGSMSPROT1("CSmsSegmentationStore::Next8BitReferenceL");
   660 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT8BITREFERENCEL_1, "CSmsSegmentationStore::Next8BitReferenceL");
   656 
   661 
   657 	TInt reference8bit=0;
   662 	TInt reference8bit=0;
   658 	TInt reference16bit=0;
   663 	TInt reference16bit=0;
   659 	TStreamId streamid=ExtraStreamId();
   664 	TStreamId streamid=ExtraStreamId();
   660 
   665 
   667 		TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   672 		TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   668 		if(ret != KErrNone)
   673 		if(ret != KErrNone)
   669 			{
   674 			{
   670 			// We have to leave on any error; otherwise a duplicate reference number will be generated
   675 			// We have to leave on any error; otherwise a duplicate reference number will be generated
   671 			// The transaction will revert
   676 			// The transaction will revert
   672 			LOGSMSPROT2("WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret);
   677 			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT8BITREFERENCEL_2, "WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret);
   673 			User::Leave(ret);  //  stream not corrupted
   678 			User::Leave(ret);  //  stream not corrupted
   674 			}
   679 			}
   675 		reference8bit=(reference8bit+1)%0x100;
   680 		reference8bit=(reference8bit+1)%0x100;
   676 		}
   681 		}
   677 	TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   682 	TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   678 	if(ret != KErrNone)
   683 	if(ret != KErrNone)
   679 		{
   684 		{
   680 		// We have to leave on any error; otherwise a duplicate reference number will be generated
   685 		// We have to leave on any error; otherwise a duplicate reference number will be generated
   681 		// The transaction will revert
   686 		// The transaction will revert
   682 		LOGSMSPROT2("WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret);
   687 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT8BITREFERENCEL_3, "WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret);
   683 		User::Leave(ret);  //  stream not corrupted
   688 		User::Leave(ret);  //  stream not corrupted
   684 		}
   689 		}
   685 	SetExtraStreamIdL(streamid);
   690 	SetExtraStreamIdL(streamid);
   686 	CommitTransactionL();
   691 	CommitTransactionL();
   687 	return reference8bit;
   692 	return reference8bit;
   688 	} // CSmsSegmentationStore::Next8BitReferenceL
   693 	} // CSmsSegmentationStore::Next8BitReferenceL
   689 
   694 
   690 
   695 
   691 TInt CSmsSegmentationStore::Next16BitReferenceL()
   696 TInt CSmsSegmentationStore::Next16BitReferenceL()
   692 	{
   697 	{
   693 	LOGSMSPROT1("CSmsSegmentationStore::Next16BitReferenceL");
   698 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT16BITREFERENCEL_1, "CSmsSegmentationStore::Next16BitReferenceL");
   694 	TInt reference8bit=0;
   699 	TInt reference8bit=0;
   695 	TInt reference16bit=0x100;
   700 	TInt reference16bit=0x100;
   696 	TStreamId streamid=ExtraStreamId();
   701 	TStreamId streamid=ExtraStreamId();
   697 	//
   702 	//
   698 	// access file store
   703 	// access file store
   703 		TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   708 		TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   704 		if(ret != KErrNone)
   709 		if(ret != KErrNone)
   705 			{
   710 			{
   706 			// We have to leave on any error; otherwise a duplicate reference number will be generated
   711 			// We have to leave on any error; otherwise a duplicate reference number will be generated
   707 			// The transaction will revert
   712 			// The transaction will revert
   708 			LOGSMSPROT2("WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret);
   713 			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT16BITREFERENCEL_2, "WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret);
   709 			User::Leave(ret);  //  stream not corrupted
   714 			User::Leave(ret);  //  stream not corrupted
   710 			}
   715 			}
   711 		reference16bit=((reference16bit+1)%0xFF00)+0x100;
   716 		reference16bit=((reference16bit+1)%0xFF00)+0x100;
   712 		}
   717 		}
   713 	TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   718 	TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit));
   714 	if(ret != KErrNone)
   719 	if(ret != KErrNone)
   715 		{
   720 		{
   716 		// We have to leave on any error; otherwise a duplicate reference number will be generated
   721 		// We have to leave on any error; otherwise a duplicate reference number will be generated
   717 		// The transaction will revert
   722 		// The transaction will revert
   718 		LOGSMSPROT2("WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret);
   723 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT16BITREFERENCEL_3, "WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret);
   719 		User::Leave(ret);  //  stream not corrupted
   724 		User::Leave(ret);  //  stream not corrupted
   720 		}
   725 		}
   721 	SetExtraStreamIdL(streamid);
   726 	SetExtraStreamIdL(streamid);
   722 	CommitTransactionL();
   727 	CommitTransactionL();
   723 	return reference16bit;
   728 	return reference16bit;
   733  *  @pre aSubmit.Type() is ESmsSubmit
   738  *  @pre aSubmit.Type() is ESmsSubmit
   734  *  @pre aSubmit.EncodeMessagePdusL() has been called. This is so PopulateEntry sets the correct total on the TSAREntry
   739  *  @pre aSubmit.EncodeMessagePdusL() has been called. This is so PopulateEntry sets the correct total on the TSAREntry
   735  */
   740  */
   736 void CSmsSegmentationStore::AddSubmitL(const TSmsAddr& aSmsAddr,CSmsMessage& aSubmit)
   741 void CSmsSegmentationStore::AddSubmitL(const TSmsAddr& aSmsAddr,CSmsMessage& aSubmit)
   737 	{
   742 	{
   738 	LOGSMSPROT1("CSmsSegmentationStore::AddSubmitL");
   743 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSUBMITL_1, "CSmsSegmentationStore::AddSubmitL");
   739 
   744 
   740 	__ASSERT_ALWAYS(aSubmit.Type()==CSmsPDU::ESmsSubmit,SmspPanic(KSmspPanicNotSubmit));
   745 	__ASSERT_ALWAYS(aSubmit.Type()==CSmsPDU::ESmsSubmit,SmspPanic(KSmspPanicNotSubmit));
   741 
   746 
   742 	BeginTransactionLC();
   747 	BeginTransactionLC();
   743 
   748 
   764 	} // CSmsSegmentationStore::AddSubmitL
   769 	} // CSmsSegmentationStore::AddSubmitL
   765 
   770 
   766 
   771 
   767 TBool CSmsSegmentationStore::AddCommandL(const TSmsAddr& aSmsAddr,const CSmsMessage& aCommand, CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray& aRefStatus)
   772 TBool CSmsSegmentationStore::AddCommandL(const TSmsAddr& aSmsAddr,const CSmsMessage& aCommand, CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray& aRefStatus)
   768 	{
   773 	{
   769 	LOGSMSPROT1("CSmsSegmentationStore::AddCommandL");
   774 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDCOMMANDL_1, "CSmsSegmentationStore::AddCommandL");
   770 	__ASSERT_ALWAYS(aCommand.Type()==CSmsPDU::ESmsCommand,SmspPanic(KSmspPanicNotCommand));
   775 	__ASSERT_ALWAYS(aCommand.Type()==CSmsPDU::ESmsCommand,SmspPanic(KSmspPanicNotCommand));
   771 	const TInt count=Entries().Count();
   776 	const TInt count=Entries().Count();
   772 	const TLogId logid=(TLogId) aCommand.LogServerId();
   777 	const TLogId logid=(TLogId) aCommand.LogServerId();
   773 
   778 
   774 	BeginTransactionLC();
   779 	BeginTransactionLC();
   840 
   845 
   841 
   846 
   842 TBool CSmsSegmentationStore::AddReferenceL(const CSmsMessage& aSmsMessage,TInt aReference)
   847 TBool CSmsSegmentationStore::AddReferenceL(const CSmsMessage& aSmsMessage,TInt aReference)
   843 	{
   848 	{
   844 	const TInt count=Entries().Count();
   849 	const TInt count=Entries().Count();
   845 	LOGSMSPROT3("CSmsSegmentationStore::AddReferenceL [count=%d, ref=%d]", count, aReference);
   850 	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDREFERENCEL_1, "CSmsSegmentationStore::AddReferenceL [count=%d, ref=%d]", count, aReference);
   846 	TInt i=0;
   851 	TInt i=0;
   847 	TInt logserverid=aSmsMessage.LogServerId();
   852 	TInt logserverid=aSmsMessage.LogServerId();
   848 	if (logserverid!=KLogNullId)
   853 	if (logserverid!=KLogNullId)
   849 		{
   854 		{
   850 		for (i=0; i<count; i++)
   855 		for (i=0; i<count; i++)
   868                     break;
   873                     break;
   869                 }
   874                 }
   870             }
   875             }
   871 	if(i>=count)
   876 	if(i>=count)
   872 		{
   877 		{
   873 		LOGSMSPROT3("WARNING! KSmspPanicEntryWithLogServerIdNotFound [i=%d, count=%d]", i, count);
   878 		OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDREFERENCEL_2, "WARNING! KSmspPanicEntryWithLogServerIdNotFound [i=%d, count=%d]", i, count);
   874 		return EFalse;
   879 		return EFalse;
   875 		}
   880 		}
   876 
   881 
   877 	RSmsSegmentationStoreRefStatusArray refStatusArray;
   882 	RSmsSegmentationStoreRefStatusArray refStatusArray;
   878 	CleanupClosePushL(refStatusArray);
   883 	CleanupClosePushL(refStatusArray);
   920  *  @param aReference  The PDU reference.
   925  *  @param aReference  The PDU reference.
   921  */
   926  */
   922 TBool CSmsSegmentationStore::AddReferenceStatusPairL(const CSmsMessage& aSmsMessage,TInt aReference, TUint aSegmentSequenceNumber)
   927 TBool CSmsSegmentationStore::AddReferenceStatusPairL(const CSmsMessage& aSmsMessage,TInt aReference, TUint aSegmentSequenceNumber)
   923  	{
   928  	{
   924 	const TInt count=Entries().Count();
   929 	const TInt count=Entries().Count();
   925 	LOGSMSPROT3("CSmsSegmentationStore::AddReferenceStatusPairL [count=%d, ref=%d]", count, aReference);
   930 	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDREFERENCESTATUSPAIRL_1, "CSmsSegmentationStore::AddReferenceStatusPairL [count=%d, ref=%d]", count, aReference);
   926 	TInt i=0;
   931 	TInt i=0;
   927 	TInt logserverid=aSmsMessage.LogServerId();
   932 	TInt logserverid=aSmsMessage.LogServerId();
   928 	if (logserverid!=KLogNullId)
   933 	if (logserverid!=KLogNullId)
   929 		{
   934 		{
   930 		for (i=0; i<count; i++)
   935 		for (i=0; i<count; i++)
   948 				break;
   953 				break;
   949 			}
   954 			}
   950 		}
   955 		}
   951 	if(i>=count)
   956 	if(i>=count)
   952 		{
   957 		{
   953 		LOGSMSPROT3("WARNING! KSmspPanicEntryWithLogServerIdNotFound [i=%d, count=%d]", i, count);
   958 		OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDREFERENCESTATUSPAIRL_2, "WARNING! KSmspPanicEntryWithLogServerIdNotFound [i=%d, count=%d]", i, count);
   954 		return EFalse;
   959 		return EFalse;
   955 		}
   960 		}
   956 
   961 
   957 	RSmsSegmentationStoreRefStatusArray refStatusArray;
   962 	RSmsSegmentationStoreRefStatusArray refStatusArray;
   958 	CleanupClosePushL(refStatusArray);
   963 	CleanupClosePushL(refStatusArray);
  1026 	} // CSmsSegmentationStore::AddReferenceStatusPairL
  1031 	} // CSmsSegmentationStore::AddReferenceStatusPairL
  1027 
  1032 
  1028 
  1033 
  1029 TBool CSmsSegmentationStore::AddStatusReportL(TInt& aIndex,TBool& aComplete,const CSmsMessage& aStatusReport)
  1034 TBool CSmsSegmentationStore::AddStatusReportL(TInt& aIndex,TBool& aComplete,const CSmsMessage& aStatusReport)
  1030 	{
  1035 	{
  1031 	LOGSMSPROT1("CSmsSegmentationStore::AddStatusReportL");
  1036 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_1, "CSmsSegmentationStore::AddStatusReportL");
  1032 
  1037 
  1033 	__ASSERT_DEBUG(aStatusReport.Type()==CSmsPDU::ESmsStatusReport,SmspPanic(KSmspPanicNotStatusReport));
  1038 	__ASSERT_DEBUG(aStatusReport.Type()==CSmsPDU::ESmsStatusReport,SmspPanic(KSmspPanicNotStatusReport));
  1034 
  1039 
  1035 	const CSmsStatusReport& statusreport=(CSmsStatusReport&) aStatusReport.SmsPDU();
  1040 	const CSmsStatusReport& statusreport=(CSmsStatusReport&) aStatusReport.SmsPDU();
  1036 	const TInt reference=statusreport.MessageReference();
  1041 	const TInt reference=statusreport.MessageReference();
  1038 	const TInt isPerm = IsPermanentStatus(status);
  1043 	const TInt isPerm = IsPermanentStatus(status);
  1039 	const TSmsFirstOctet::TSmsStatusReportQualifier qualifier=statusreport.StatusReportQualifier();
  1044 	const TSmsFirstOctet::TSmsStatusReportQualifier qualifier=statusreport.StatusReportQualifier();
  1040 	TBool found=EFalse;
  1045 	TBool found=EFalse;
  1041 	aComplete=EFalse;
  1046 	aComplete=EFalse;
  1042 
  1047 
  1043 	LOGSMSPROT4("CSmsSegmentationStore::AddStatusReportL [ref=%d status=%d IsPerm=%d]", reference, status, isPerm);
  1048 	OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_2, "CSmsSegmentationStore::AddStatusReportL [ref=%d status=%d IsPerm=%d]", reference, status, isPerm);
  1044 
  1049 
  1045 	if(!isPerm)
  1050 	if(!isPerm)
  1046 		{
  1051 		{
  1047 		return EFalse;
  1052 		return EFalse;
  1048 		}
  1053 		}
  1081 
  1086 
  1082 		TBool sameTelNumbers = entry.Description2().Right(telLen) == parsedaddress.iTelNumber.Right(telLen);
  1087 		TBool sameTelNumbers = entry.Description2().Right(telLen) == parsedaddress.iTelNumber.Right(telLen);
  1083 		
  1088 		
  1084 		if (sameTelNumbers)
  1089 		if (sameTelNumbers)
  1085 			{
  1090 			{
  1086 			LOGSMSPROT1("CSmsSegmentationStore::AddStatusReportL telNumber from submit report matches that from SMS message");
  1091 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_3, "CSmsSegmentationStore::AddStatusReportL telNumber from submit report matches that from SMS message");
  1087 			}
  1092 			}
  1088 		else
  1093 		else
  1089 			{
  1094 			{
  1090 			LOGSMSPROT1("CSmsSegmentationStore::AddStatusReportL telNumber from submit report does NOT match that from SMS message");
  1095 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_4, "CSmsSegmentationStore::AddStatusReportL telNumber from submit report does NOT match that from SMS message");
  1091 			}
  1096 			}
  1092 
  1097 
  1093 		if (sameTelNumbers &&
  1098 		if (sameTelNumbers &&
  1094 		  (((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfCommand) && (type==CSmsPDU::ESmsCommand)) ||
  1099 		  (((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfCommand) && (type==CSmsPDU::ESmsCommand)) ||
  1095 		   ((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfSubmit) &&  (type==CSmsPDU::ESmsSubmit))) &&
  1100 		   ((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfSubmit) &&  (type==CSmsPDU::ESmsSubmit))) &&
  1112 						{
  1117 						{
  1113 						found = ETrue;
  1118 						found = ETrue;
  1114 						}
  1119 						}
  1115 					else
  1120 					else
  1116 						{
  1121 						{
  1117 						LOGSMSPROT4("CSmsSegmentationStore::AddStatusReportL WARNING: Status already perm [status=%d refStatusPos=%d count=%d]", refStatusArray[refStatusPos].Status(), refStatusPos, refStatusArrayCount);
  1122 						OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_5, "CSmsSegmentationStore::AddStatusReportL WARNING: Status already perm [status=%d refStatusPos=%d count=%d]", refStatusArray[refStatusPos].Status(), refStatusPos, refStatusArrayCount);
  1118 						refStatusPos++;
  1123 						refStatusPos++;
  1119 						}
  1124 						}
  1120 					}
  1125 					}
  1121 
  1126 
  1122 				if (found)
  1127 				if (found)
  1123 					{
  1128 					{
  1124 					LOGSMSPROT2("CSmsSegmentationStore::AddStatusReportL Found [refStatusPos=%d]", refStatusPos);
  1129 					OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_6, "CSmsSegmentationStore::AddStatusReportL Found [refStatusPos=%d]", refStatusPos);
  1125 					refStatusArray[refStatusPos].SetStatus(status);
  1130 					refStatusArray[refStatusPos].SetStatus(status);
  1126 					TStreamId streamid=entry.DataStreamId();
  1131 					TStreamId streamid=entry.DataStreamId();
  1127 					ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray);
  1132 					ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray);
  1128 					PopulateEntry(entry,*smsmessage, refStatusArray);
  1133 					PopulateEntry(entry,*smsmessage, refStatusArray);
  1129 					ChangeEntryL(aIndex,entry);
  1134 					ChangeEntryL(aIndex,entry);
  1130 					aComplete=StatusArrayComplete(refStatusArray, entry);
  1135 					aComplete=StatusArrayComplete(refStatusArray, entry);
  1131 				    LOGSMSPROT2("CSmsSegmentationStore::AddStatusReportL StatusArrayComplete %d", aComplete);
  1136 				    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_7, "CSmsSegmentationStore::AddStatusReportL StatusArrayComplete %d", aComplete);
  1132 					}
  1137 					}
  1133 				}
  1138 				}
  1134 			}
  1139 			}
  1135 		}
  1140 		}
  1136 
  1141 
  1186 				TStreamId streamid=entry.DataStreamId();
  1191 				TStreamId streamid=entry.DataStreamId();
  1187 				ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray2);
  1192 				ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray2);
  1188 				PopulateEntry(entry,/*smsaddr,*/*smsmessage, refStatusArray2);
  1193 				PopulateEntry(entry,/*smsaddr,*/*smsmessage, refStatusArray2);
  1189 				ChangeEntryL(aIndex,entry);
  1194 				ChangeEntryL(aIndex,entry);
  1190 				aComplete=StatusArrayComplete(refStatusArray2, entry);
  1195 				aComplete=StatusArrayComplete(refStatusArray2, entry);
  1191 			    LOGSMSPROT3("CSmsSegmentationStore::StatusArrayComplete [aStatus=%d, ret=%d]", status, aComplete);
  1196 			    OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_8, "CSmsSegmentationStore::StatusArrayComplete [aStatus=%d, ret=%d]", status, aComplete);
  1192 				break;
  1197 				break;
  1193 				}
  1198 				}
  1194 			}
  1199 			}
  1195 
  1200 
  1196 		CleanupStack::PopAndDestroy(&refStatusArray2);
  1201 		CleanupStack::PopAndDestroy(&refStatusArray2);
  1197 		}
  1202 		}
  1198 
  1203 
  1199 	CommitTransactionL();
  1204 	CommitTransactionL();
  1200 	CleanupStack::PopAndDestroy(2); // smsmessage, refStatusArray
  1205 	CleanupStack::PopAndDestroy(2); // smsmessage, refStatusArray
  1201 
  1206 
  1202 	LOGSMSPROT2("CSmsSegmentationStore::AddStatusReportL Exit [found=%d]", found);
  1207 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_9, "CSmsSegmentationStore::AddStatusReportL Exit [found=%d]", found);
  1203 	return found;
  1208 	return found;
  1204 	} // CSmsSegmentationStore::AddStatusReportL
  1209 	} // CSmsSegmentationStore::AddStatusReportL
  1205 
  1210 
  1206 
  1211 
  1207 void CSmsSegmentationStore::GetMessageL(TInt aIndex,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1212 void CSmsSegmentationStore::GetMessageL(TInt aIndex,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1208 	{
  1213 	{
  1209 	LOGSMSPROT2("CSmsSegmentationStore::GetMessageL [aIndex=%d]", aIndex);
  1214 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_GETMESSAGEL_1, "CSmsSegmentationStore::GetMessageL [aIndex=%d]", aIndex);
  1210 
  1215 
  1211 	InternalizeEntryL(Entries()[aIndex].DataStreamId(),aSmsAddr,aSmsMessage, aRefStatusArray);
  1216 	InternalizeEntryL(Entries()[aIndex].DataStreamId(),aSmsAddr,aSmsMessage, aRefStatusArray);
  1212 	} // CSmsSegmentationStore::GetMessageL
  1217 	} // CSmsSegmentationStore::GetMessageL
  1213 
  1218 
  1214 
  1219 
  1218  *  @note You have to call CSARStore::OpenFileLC() before calling this function
  1223  *  @note You have to call CSARStore::OpenFileLC() before calling this function
  1219  *  and CSARStore::CloseFile() after.
  1224  *  and CSARStore::CloseFile() after.
  1220  */
  1225  */
  1221 void CSmsSegmentationStore::InternalizeConcatenationReferencesL(const TStreamId& aStreamId,TInt& aReference8bit,TInt& aReference16bit)
  1226 void CSmsSegmentationStore::InternalizeConcatenationReferencesL(const TStreamId& aStreamId,TInt& aReference8bit,TInt& aReference16bit)
  1222 	{
  1227 	{
  1223 	LOGSMSPROT1("CSmsSegmentationStore::InternalizeConcatenationReferencesL Start");
  1228 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZECONCATENATIONREFERENCESL_1, "CSmsSegmentationStore::InternalizeConcatenationReferencesL Start");
  1224 	RStoreReadStream readstream;
  1229 	RStoreReadStream readstream;
  1225 	readstream.OpenLC(FileStore(),aStreamId);
  1230 	readstream.OpenLC(FileStore(),aStreamId);
  1226 	aReference8bit=readstream.ReadInt32L();
  1231 	aReference8bit=readstream.ReadInt32L();
  1227 	aReference16bit=readstream.ReadInt32L();
  1232 	aReference16bit=readstream.ReadInt32L();
  1228 	CleanupStack::PopAndDestroy();
  1233 	CleanupStack::PopAndDestroy();
  1229 	LOGSMSPROT1("CSmsSegmentationStore::InternalizeConcatenationReferencesL End");
  1234 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZECONCATENATIONREFERENCESL_2, "CSmsSegmentationStore::InternalizeConcatenationReferencesL End");
  1230 	} // CSmsSegmentationStore::InternalizeConcatenationReferencesL
  1235 	} // CSmsSegmentationStore::InternalizeConcatenationReferencesL
  1231 
  1236 
  1232 
  1237 
  1233 /**
  1238 /**
  1234  *  externalize the concat refs from the permanent file store to internal memory
  1239  *  externalize the concat refs from the permanent file store to internal memory
  1236  *  @note You have to call CSARStore::OpenFileLC() before calling this function
  1241  *  @note You have to call CSARStore::OpenFileLC() before calling this function
  1237  *  and CSARStore::CloseFile() after.
  1242  *  and CSARStore::CloseFile() after.
  1238  */
  1243  */
  1239 void CSmsSegmentationStore::ExternalizeConcatenationReferencesL(TStreamId& aStreamId,TInt aReference8bit,TInt aReference16bit)
  1244 void CSmsSegmentationStore::ExternalizeConcatenationReferencesL(TStreamId& aStreamId,TInt aReference8bit,TInt aReference16bit)
  1240 	{
  1245 	{
  1241 	LOGSMSPROT1("CSmsSegmentationStore::ExternalizeConcatenationReferencesL Start");
  1246 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZECONCATENATIONREFERENCESL_1, "CSmsSegmentationStore::ExternalizeConcatenationReferencesL Start");
  1242 	RStoreWriteStream writestream;
  1247 	RStoreWriteStream writestream;
  1243 	if (aStreamId==KNullStreamId)
  1248 	if (aStreamId==KNullStreamId)
  1244 		aStreamId=writestream.CreateLC(FileStore());
  1249 		aStreamId=writestream.CreateLC(FileStore());
  1245 	else
  1250 	else
  1246 		writestream.ReplaceLC(FileStore(),aStreamId);
  1251 		writestream.ReplaceLC(FileStore(),aStreamId);
  1247 	writestream.WriteInt32L(aReference8bit);
  1252 	writestream.WriteInt32L(aReference8bit);
  1248 	writestream.WriteInt32L(aReference16bit);
  1253 	writestream.WriteInt32L(aReference16bit);
  1249 	writestream.CommitL();
  1254 	writestream.CommitL();
  1250 	CleanupStack::PopAndDestroy();
  1255 	CleanupStack::PopAndDestroy();
  1251 	LOGSMSPROT1("CSmsSegmentationStore::ExternalizeConcatenationReferencesL End");
  1256 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZECONCATENATIONREFERENCESL_2, "CSmsSegmentationStore::ExternalizeConcatenationReferencesL End");
  1252 	} // CSmsSegmentationStore::ExternalizeConcatenationReferencesL
  1257 	} // CSmsSegmentationStore::ExternalizeConcatenationReferencesL
  1253 
  1258 
  1254 
  1259 
  1255 /**
  1260 /**
  1256  *  internalize all the entries from the permanent file store to internal memory
  1261  *  internalize all the entries from the permanent file store to internal memory
  1258  *  @note You have to call CSARStore::OpenFileLC() before calling this function
  1263  *  @note You have to call CSARStore::OpenFileLC() before calling this function
  1259  *  and CSARStore::CloseFile() after.
  1264  *  and CSARStore::CloseFile() after.
  1260  */
  1265  */
  1261 void CSmsSegmentationStore::InternalizeEntryL(const TStreamId& aStreamId,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1266 void CSmsSegmentationStore::InternalizeEntryL(const TStreamId& aStreamId,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1262 	{
  1267 	{
  1263 	LOGSMSPROT1("CSmsSegmentationStore::InternalizeEntryL Start");
  1268 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZEENTRYL_1, "CSmsSegmentationStore::InternalizeEntryL Start");
  1264 
  1269 
  1265 	aRefStatusArray.Reset();
  1270 	aRefStatusArray.Reset();
  1266 
  1271 
  1267 	RStoreReadStream readstream;
  1272 	RStoreReadStream readstream;
  1268 	readstream.OpenLC(FileStore(),aStreamId);
  1273 	readstream.OpenLC(FileStore(),aStreamId);
  1269 	readstream >> aSmsAddr;
  1274 	readstream >> aSmsAddr;
  1270 	readstream >> aSmsMessage;
  1275 	readstream >> aSmsMessage;
  1271 	readstream >> aRefStatusArray;
  1276 	readstream >> aRefStatusArray;
  1272 	CleanupStack::PopAndDestroy(&readstream);
  1277 	CleanupStack::PopAndDestroy(&readstream);
  1273 
  1278 
  1274 	LOGSMSPROT2("CSmsSegmentationStore::InternalizeEntryL End [count=%d]", aRefStatusArray.Count());
  1279 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZEENTRYL_2, "CSmsSegmentationStore::InternalizeEntryL End [count=%d]", aRefStatusArray.Count());
  1275 	} // CSmsSegmentationStore::InternalizeEntryL
  1280 	} // CSmsSegmentationStore::InternalizeEntryL
  1276 
  1281 
  1277 
  1282 
  1278 /**
  1283 /**
  1279  *  externalizes all the entries from the internal memory to the permanent file store
  1284  *  externalizes all the entries from the internal memory to the permanent file store
  1280  */
  1285  */
  1281 void CSmsSegmentationStore::ExternalizeEntryL(TStreamId& aStreamId,const TSmsAddr& aSmsAddr,const CSmsMessage& aSmsMessage, const RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1286 void CSmsSegmentationStore::ExternalizeEntryL(TStreamId& aStreamId,const TSmsAddr& aSmsAddr,const CSmsMessage& aSmsMessage, const RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1282 	{
  1287 	{
  1283 	LOGSMSPROT1("CSmsSegmentationStore::ExternalizeEntryL Start");
  1288 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZEENTRYL_1, "CSmsSegmentationStore::ExternalizeEntryL Start");
  1284 
  1289 
  1285 	RStoreWriteStream writestream;
  1290 	RStoreWriteStream writestream;
  1286 
  1291 
  1287 	if (aStreamId==KNullStreamId)
  1292 	if (aStreamId==KNullStreamId)
  1288 		aStreamId=writestream.CreateLC(FileStore());
  1293 		aStreamId=writestream.CreateLC(FileStore());
  1293 	writestream << aSmsMessage;
  1298 	writestream << aSmsMessage;
  1294 	writestream << aRefStatusArray;
  1299 	writestream << aRefStatusArray;
  1295 	writestream.CommitL();
  1300 	writestream.CommitL();
  1296 	CleanupStack::PopAndDestroy(&writestream);
  1301 	CleanupStack::PopAndDestroy(&writestream);
  1297 
  1302 
  1298 	LOGSMSPROT2("CSmsSegmentationStore::ExternalizeEntryL End [count=%d]", aRefStatusArray.Count());
  1303 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZEENTRYL_2, "CSmsSegmentationStore::ExternalizeEntryL End [count=%d]", aRefStatusArray.Count());
  1299 	} // CSmsSegmentationStore::ExternalizeEntryL
  1304 	} // CSmsSegmentationStore::ExternalizeEntryL
  1300 
  1305 
  1301 
  1306 
  1302 /**
  1307 /**
  1303  *  Populates an SMS message into SAR store entry
  1308  *  Populates an SMS message into SAR store entry
  1311  */
  1316  */
  1312 void CSmsSegmentationStore::PopulateEntry(TSmsSegmentationEntry& aEntry,
  1317 void CSmsSegmentationStore::PopulateEntry(TSmsSegmentationEntry& aEntry,
  1313 					  const CSmsMessage& aSmsMessage,
  1318 					  const CSmsMessage& aSmsMessage,
  1314 					  const RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1319 					  const RSmsSegmentationStoreRefStatusArray& aRefStatusArray)
  1315 	{
  1320 	{
  1316 	LOGSMSPROT1("CSmsSegmentationStore::PopulateEntry");
  1321 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_POPULATEENTRY_1, "CSmsSegmentationStore::PopulateEntry");
  1317 	TBool statusreportrequest=EFalse;
  1322 	TBool statusreportrequest=EFalse;
  1318 	if (aSmsMessage.Type()==CSmsPDU::ESmsSubmit)
  1323 	if (aSmsMessage.Type()==CSmsPDU::ESmsSubmit)
  1319 		{
  1324 		{
  1320 		aEntry.SetReference(0);
  1325 		aEntry.SetReference(0);
  1321 		aEntry.SetTotal(1);
  1326 		aEntry.SetTotal(1);
  1419 	TInt permanent=0;
  1424 	TInt permanent=0;
  1420 	const TInt count= aRefStatusArray.Count();
  1425 	const TInt count= aRefStatusArray.Count();
  1421 	for (TInt i=0; i<count; i++)
  1426 	for (TInt i=0; i<count; i++)
  1422 		{
  1427 		{
  1423 		const TBool ret = IsPermanentStatus(aRefStatusArray[i].Status());
  1428 		const TBool ret = IsPermanentStatus(aRefStatusArray[i].Status());
  1424 		LOGSMSPROT4("CSmsSegmentationStore::IsPermanentStatus [Status: %d, RetVal: %d, count=%d]", aRefStatusArray[i].Status(), ret, count);
  1429 		OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_STATUSARRAYCOMPLETE_1, "CSmsSegmentationStore::IsPermanentStatus [Status: %d, RetVal: %d, count=%d]", aRefStatusArray[i].Status(), ret, count);
  1425 		if (ret)
  1430 		if (ret)
  1426 			permanent++;
  1431 			permanent++;
  1427 		}
  1432 		}
  1428 	return (permanent==count) && (permanent==aEntry.Total() );
  1433 	return (permanent==count) && (permanent==aEntry.Total() );
  1429 	} // CSmsSegmentationStore::StatusArrayComplete
  1434 	} // CSmsSegmentationStore::StatusArrayComplete
  1433    *  C'tor
  1438    *  C'tor
  1434    */
  1439    */
  1435 CSmsSegmentationStore::CSmsSegmentationStore(RFs& aFs)
  1440 CSmsSegmentationStore::CSmsSegmentationStore(RFs& aFs)
  1436     :CSARStore(aFs)
  1441     :CSARStore(aFs)
  1437     {
  1442     {
  1438     LOGSMSPROT1("CSmsSegmentationStore::CSmsSegmentationStore()");
  1443     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_CTOR_1, "CSmsSegmentationStore::CSmsSegmentationStore()");
  1439 
  1444 
  1440     } // CSmsSegmentationStore::CSmsSegmentationStore
  1445     } // CSmsSegmentationStore::CSmsSegmentationStore
  1441 
  1446 
  1442 
  1447 
  1443 TInt CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare(const TSmsSegmentationStoreRefStatus& aLeft, const TSmsSegmentationStoreRefStatus& aRight)
  1448 TInt CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare(const TSmsSegmentationStoreRefStatus& aLeft, const TSmsSegmentationStoreRefStatus& aRight)
  1444 	{
  1449 	{
  1445 	LOGSMSPROT1("CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare()");
  1450 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_TSMSSEGMENTATIONSTOREREFSTATUS_COMPARE_1, "CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare()");
  1446 
  1451 
  1447 	return aLeft.iReference - aRight.iReference;
  1452 	return aLeft.iReference - aRight.iReference;
  1448 	} // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare
  1453 	} // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare
  1449 
  1454 
  1450 
  1455 
  1451 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL(RReadStream& aStream)
  1456 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL(RReadStream& aStream)
  1452 	{
  1457 	{
  1453 	LOGSMSPROT1("CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL()");
  1458 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_TSMSSEGMENTATIONSTOREREFSTATUS_INTERNALIZEL_1, "CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL()");
  1454 
  1459 
  1455 	iReference = aStream.ReadInt32L();
  1460 	iReference = aStream.ReadInt32L();
  1456 	iStatus = aStream.ReadInt32L();
  1461 	iStatus = aStream.ReadInt32L();
  1457 	} // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL
  1462 	} // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL
  1458 
  1463 
  1459 
  1464 
  1460 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL(RWriteStream& aStream) const
  1465 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL(RWriteStream& aStream) const
  1461 	{
  1466 	{
  1462 	LOGSMSPROT1("CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL()");
  1467 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_TSMSSEGMENTATIONSTOREREFSTATUS_EXTERNALIZEL_1, "CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL()");
  1463 
  1468 
  1464 	aStream.WriteInt32L(iReference);
  1469 	aStream.WriteInt32L(iReference);
  1465 	aStream.WriteInt32L(iStatus);
  1470 	aStream.WriteInt32L(iStatus);
  1466 	} // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL
  1471 	} // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL
  1467 
  1472 
  1468 
  1473 
  1469 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL(const TSmsSegmentationStoreRefStatus& aRefStatus)
  1474 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL(const TSmsSegmentationStoreRefStatus& aRefStatus)
  1470 	{
  1475 	{
  1471 	LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL()");
  1476 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAY_INSERTL_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL()");
  1472 
  1477 
  1473 	TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare);
  1478 	TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare);
  1474 	User::LeaveIfError(InsertInOrderAllowRepeats(aRefStatus, order));
  1479 	User::LeaveIfError(InsertInOrderAllowRepeats(aRefStatus, order));
  1475 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL
  1480 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL
  1476 
  1481 
  1477 
  1482 
  1478 TInt CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find(const TSmsSegmentationStoreRefStatus& aRefStatus) const
  1483 TInt CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find(const TSmsSegmentationStoreRefStatus& aRefStatus) const
  1479 	{
  1484 	{
  1480 	LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find()");
  1485 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAY_FIND_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find()");
  1481 
  1486 
  1482 	TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare);
  1487 	TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare);
  1483 	TInt index = FindInOrder(aRefStatus, order);
  1488 	TInt index = FindInOrder(aRefStatus, order);
  1484 	if (index != KErrNotFound)
  1489 	if (index != KErrNotFound)
  1485 		{
  1490 		{
  1495 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find
  1500 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find
  1496 
  1501 
  1497 
  1502 
  1498 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::CopyL(const RSmsSegmentationStoreRefStatusArray& aOther)
  1503 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::CopyL(const RSmsSegmentationStoreRefStatusArray& aOther)
  1499 	{
  1504 	{
  1500 	LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::CopyL()");
  1505 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAY_COPYL_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::CopyL()");
  1501 
  1506 
  1502 	Reset();
  1507 	Reset();
  1503 
  1508 
  1504 	TInt count = aOther.Count();
  1509 	TInt count = aOther.Count();
  1505 	while (count--)
  1510 	while (count--)
  1509 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::CopyL
  1514 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::CopyL
  1510 
  1515 
  1511 
  1516 
  1512 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ResetAllStatus(TInt aStatus)
  1517 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ResetAllStatus(TInt aStatus)
  1513 	{
  1518 	{
  1514 	LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ResetAllStatus()");
  1519 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAY_RESETALLSTATUS_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ResetAllStatus()");
  1515 
  1520 
  1516 	TInt count = Count();
  1521 	TInt count = Count();
  1517 	while (count--)
  1522 	while (count--)
  1518 		{
  1523 		{
  1519 		(*this)[count].SetStatus(aStatus);
  1524 		(*this)[count].SetStatus(aStatus);
  1521 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ResetAllStatus
  1526 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ResetAllStatus
  1522 
  1527 
  1523 
  1528 
  1524 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InternalizeL(RReadStream& aStream)
  1529 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InternalizeL(RReadStream& aStream)
  1525 	{
  1530 	{
  1526 	LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InternalizeL()");
  1531 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAY_INTERNALIZEL_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InternalizeL()");
  1527 
  1532 
  1528 	TInt count = aStream.ReadInt32L();
  1533 	TInt count = aStream.ReadInt32L();
  1529 	while (count--)
  1534 	while (count--)
  1530 		{
  1535 		{
  1531 		TSmsSegmentationStoreRefStatus refStatus;
  1536 		TSmsSegmentationStoreRefStatus refStatus;
  1535 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InternalizeL
  1540 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InternalizeL
  1536 
  1541 
  1537 
  1542 
  1538 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ExternalizeL(RWriteStream& aStream) const
  1543 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ExternalizeL(RWriteStream& aStream) const
  1539 	{
  1544 	{
  1540 	LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ExternalizeL()");
  1545 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAYEXTERNALIZEL_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ExternalizeL()");
  1541 
  1546 
  1542 	const TInt count = Count();
  1547 	const TInt count = Count();
  1543 	aStream.WriteInt32L(count);
  1548 	aStream.WriteInt32L(count);
  1544 
  1549 
  1545 	for (TInt i = 0; i < count; i++)
  1550 	for (TInt i = 0; i < count; i++)
  1549 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ExternalizeL
  1554 	} // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::ExternalizeL
  1550 
  1555 
  1551 
  1556 
  1552 TBool CSmsSegmentationStore::HasEntryWithLogIdL(TLogId aLogID,TInt& aRefNo,TInt& aSent)
  1557 TBool CSmsSegmentationStore::HasEntryWithLogIdL(TLogId aLogID,TInt& aRefNo,TInt& aSent)
  1553 	{
  1558 	{
  1554 	LOGSMSPROT1("CSmsSegmentationStore::HasEntryWithLogIdL()");
  1559 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_HASENTRYWITHLOGIDL_1, "CSmsSegmentationStore::HasEntryWithLogIdL()");
  1555 
  1560 
  1556 	TInt count=Entries().Count();
  1561 	TInt count=Entries().Count();
  1557 	TBool found=EFalse;
  1562 	TBool found=EFalse;
  1558 	if(aLogID != KLogNullId)
  1563 	if(aLogID != KLogNullId)
  1559 		{
  1564 		{
  1574 					found=ETrue;
  1579 					found=ETrue;
  1575 					}
  1580 					}
  1576 				else
  1581 				else
  1577 					{
  1582 					{
  1578 					DeleteEntryL(i);
  1583 					DeleteEntryL(i);
  1579 					LOGSMSPROT3("CSmsSegmentationStore::HasEntryWithLogIdL [Entry: %d LogId %d - deleted]", i, aLogID );
  1584 					OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_HASENTRYWITHLOGIDL_2, "CSmsSegmentationStore::HasEntryWithLogIdL [Entry: %d LogId %d - deleted]", i, (TInt)aLogID );
  1580 					}
  1585 					}
  1581 				break;
  1586 				break;
  1582 				}
  1587 				}
  1583 			}
  1588 			}
  1584 		CommitTransactionL();
  1589 		CommitTransactionL();
  1590 /**
  1595 /**
  1591  *  Open the sms segmentation store.
  1596  *  Open the sms segmentation store.
  1592  */
  1597  */
  1593 void CSmsSegmentationStore::OpenStoreL()
  1598 void CSmsSegmentationStore::OpenStoreL()
  1594 	{
  1599 	{
  1595 	LOGSMSPROT1("CSmsSegmentationStore::OpenStoreL()");
  1600 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_OPENSTOREL_1, "CSmsSegmentationStore::OpenStoreL()");
  1596 
  1601 
  1597 	this->OpenL(iFullPathBuf,KSegmentationStoreUid);
  1602 	this->OpenL(iFullPathBuf,KSegmentationStoreUid);
  1598 	} // CSmsSegmentationStore::OpenStoreL
  1603 	} // CSmsSegmentationStore::OpenStoreL