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; |
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 |
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 |
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 ); |
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++) |
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++) |
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(); |
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 { |