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 |
|
28 #include <e32svr.h> |
22 #include <e32svr.h> |
29 #include <es_ini.h> |
23 #include <es_ini.h> |
30 #include "smspstor.h" |
24 #include "smspstor.h" |
31 #include "smspmain.h" |
25 #include "smspmain.h" |
32 #include "smsuaddr.H" |
26 #include "smsuaddr.H" |
33 #include "Gsmumsg.h" |
27 #include "Gsmumsg.h" |
34 #include "gsmubuf.h" |
28 #include "gsmubuf.h" |
|
29 #include <logwrap.h> |
35 #include <logwraplimits.h> |
30 #include <logwraplimits.h> |
36 #include "Gsmuelem.h" |
31 #include "Gsmuelem.h" |
37 #include "gsmuieoperations.h" |
32 #include "gsmuieoperations.h" |
38 #include "gsmunonieoperations.h" |
33 #include "gsmunonieoperations.h" |
39 |
34 |
40 LOCAL_C TPtrC TrimLeadingZeros(const TDesC& aString) |
35 LOCAL_C TPtrC TrimLeadingZeros(const TDesC& aString) |
41 { |
36 { |
42 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TRIMLEADINGZEROS_1, "CSARStore::ExternalizeEntryArrayL()"); |
37 LOGSMSPROT1("CSARStore::ExternalizeEntryArrayL()"); |
43 |
38 |
44 const TInt len = aString.Length(); |
39 const TInt len = aString.Length(); |
45 |
40 |
46 if (len == 0) |
41 if (len == 0) |
47 return aString; |
42 return aString; |
225 break; |
220 break; |
226 } |
221 } |
227 } |
222 } |
228 } |
223 } |
229 |
224 |
230 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_MATCHPDUTOEXISTINGMESSAGE_2, "CSmsReassemblyStore::MatchPDUToExistingMessage(): reassemblyCount=%d, aIndex=%d", reassemblyCount, aIndex); |
225 LOGSMSPROT3("CSmsReassemblyStore::MatchPDUToExistingMessage(): reassemblyCount=%d, aIndex=%d", reassemblyCount, aIndex); |
231 } // CSmsReassemblyStore::MatchPDUToExistingMessage |
226 } // CSmsReassemblyStore::MatchPDUToExistingMessage |
232 |
227 |
233 |
228 |
234 void CSmsReassemblyStore::UpdateExistingMessageL(const CSmsMessage& aSmsMessage, |
229 void CSmsReassemblyStore::UpdateExistingMessageL(const CSmsMessage& aSmsMessage, |
235 const TGsmSms& aGsmSms, TInt aIndex, |
230 const TGsmSms& aGsmSms, TInt aIndex, |
236 TBool& aComplete, |
231 TBool& aComplete, |
237 TBool& aDuplicateMsgRef, |
232 TBool& aDuplicateMsgRef, |
238 TBool& aDuplicateSlot) |
233 TBool& aDuplicateSlot) |
239 { |
234 { |
240 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_UPDATEEXISTINGMESSAGEL_1, "CSmsReassemblyStore::UpdateExistingMessageL()"); |
235 LOGSMSPROT1("CSmsReassemblyStore::UpdateExistingMessageL()"); |
241 |
236 |
242 aComplete = EFalse; |
237 aComplete = EFalse; |
243 aDuplicateMsgRef = EFalse; |
238 aDuplicateMsgRef = EFalse; |
244 aDuplicateSlot = EFalse; |
239 aDuplicateSlot = EFalse; |
245 |
240 |
363 } // CSmsReassemblyStore::UpdateExistingMessageL |
358 } // CSmsReassemblyStore::UpdateExistingMessageL |
364 |
359 |
365 |
360 |
366 void CSmsReassemblyStore::NewMessagePDUL(TInt& aIndex,CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms) |
361 void CSmsReassemblyStore::NewMessagePDUL(TInt& aIndex,CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms) |
367 { |
362 { |
368 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_NEWMESSAGEPDUL_1, "CSmsReassemblyStore::NewMessagePDUL"); |
363 LOGSMSPROT1("CSmsReassemblyStore::NewMessagePDUL"); |
369 |
364 |
370 CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8); |
365 CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8); |
371 CleanupStack::PushL(indexarray); |
366 CleanupStack::PushL(indexarray); |
372 CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8); |
367 CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8); |
373 CleanupStack::PushL(smsarray); |
368 CleanupStack::PushL(smsarray); |
380 } // CSmsReassemblyStore::NewMessagePDUL |
375 } // CSmsReassemblyStore::NewMessagePDUL |
381 |
376 |
382 |
377 |
383 void CSmsReassemblyStore::GetMessageL(TInt aIndex,CSmsMessage& aSmsMessage) |
378 void CSmsReassemblyStore::GetMessageL(TInt aIndex,CSmsMessage& aSmsMessage) |
384 { |
379 { |
385 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_GETMESSAGEL_1, "CSmsReassemblyStore::GetMessageL [aIndex=%d]", aIndex); |
380 LOGSMSPROT2("CSmsReassemblyStore::GetMessageL [aIndex=%d]", aIndex); |
386 |
381 |
387 CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8); |
382 CArrayFix<TInt>* indexarray=new(ELeave) CArrayFixFlat<TInt>(8); |
388 CleanupStack::PushL(indexarray); |
383 CleanupStack::PushL(indexarray); |
389 CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8); |
384 CArrayFixFlat<TGsmSms>* smsarray=new(ELeave) CArrayFixFlat<TGsmSms>(8); |
390 CleanupStack::PushL(smsarray); |
385 CleanupStack::PushL(smsarray); |
401 * |
396 * |
402 * NOTE! You have to call CSARStore::OpenFileLC() before calling this function |
397 * NOTE! You have to call CSARStore::OpenFileLC() before calling this function |
403 */ |
398 */ |
404 void CSmsReassemblyStore::InternalizeEntryL(const TStreamId& aStreamId,CSmsMessage& aSmsMessage,CArrayFix<TInt>& aIndexArray,CArrayFix<TGsmSms>& aSmsArray) |
399 void CSmsReassemblyStore::InternalizeEntryL(const TStreamId& aStreamId,CSmsMessage& aSmsMessage,CArrayFix<TInt>& aIndexArray,CArrayFix<TGsmSms>& aSmsArray) |
405 { |
400 { |
406 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_INTERNALIZEENTRYL_1, "CSmsReassemblyStore::InternalizeEntryL Start [sid=%d]", aStreamId.Value()); |
401 LOGSMSPROT2("CSmsReassemblyStore::InternalizeEntryL Start [sid=%d]", aStreamId.Value()); |
407 RStoreReadStream readstream; |
402 RStoreReadStream readstream; |
408 readstream.OpenLC(FileStore(),aStreamId); |
403 readstream.OpenLC(FileStore(),aStreamId); |
409 readstream >> aSmsMessage; |
404 readstream >> aSmsMessage; |
410 TInt count=readstream.ReadInt32L(); |
405 TInt count=readstream.ReadInt32L(); |
411 aIndexArray.Reset(); |
406 aIndexArray.Reset(); |
426 TGsmSms sms; |
421 TGsmSms sms; |
427 sms.SetPdu(pdu); |
422 sms.SetPdu(pdu); |
428 aSmsArray.AppendL(sms); |
423 aSmsArray.AppendL(sms); |
429 } |
424 } |
430 CleanupStack::PopAndDestroy(); |
425 CleanupStack::PopAndDestroy(); |
431 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_INTERNALIZEENTRYL_2, "CSmsReassemblyStore::InternalizeEntryL End [count=%d]", count); |
426 LOGSMSPROT2("CSmsReassemblyStore::InternalizeEntryL End [count=%d]", count); |
432 } // CSARStore::OpenFileLC |
427 } // CSARStore::OpenFileLC |
433 |
428 |
434 |
429 |
435 /** |
430 /** |
436 * externalizes all the entries from the internal memory to the permanent file store |
431 * externalizes all the entries from the internal memory to the permanent file store |
437 * |
432 * |
438 * NOTE! You have to call CSARStore::OpenFileLC() before calling this function |
433 * NOTE! You have to call CSARStore::OpenFileLC() before calling this function |
439 */ |
434 */ |
440 void CSmsReassemblyStore::ExternalizeEntryL(TStreamId& aStreamId,const CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray) |
435 void CSmsReassemblyStore::ExternalizeEntryL(TStreamId& aStreamId,const CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray) |
441 { |
436 { |
442 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_EXTERNALIZEENTRYL_1, "CSmsReassemblyStore::ExternalizeEntryL Start [sid=%d]", aStreamId.Value()); |
437 LOGSMSPROT2("CSmsReassemblyStore::ExternalizeEntryL Start [sid=%d]", aStreamId.Value()); |
443 |
438 |
444 RStoreWriteStream writestream; |
439 RStoreWriteStream writestream; |
445 if (aStreamId==KNullStreamId) |
440 if (aStreamId==KNullStreamId) |
446 aStreamId=writestream.CreateLC(FileStore()); |
441 aStreamId=writestream.CreateLC(FileStore()); |
447 else |
442 else |
462 writestream << pdu; |
457 writestream << pdu; |
463 } |
458 } |
464 writestream.CommitL(); |
459 writestream.CommitL(); |
465 CleanupStack::PopAndDestroy(); |
460 CleanupStack::PopAndDestroy(); |
466 |
461 |
467 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_EXTERNALIZEENTRYL_2, "CSmsReassemblyStore::ExternalizeEntryL End [count=%d]", count); |
462 LOGSMSPROT2("CSmsReassemblyStore::ExternalizeEntryL End [count=%d]", count); |
468 } // CSARStore::OpenFileLC |
463 } // CSARStore::OpenFileLC |
469 |
464 |
470 |
465 |
471 void CSmsReassemblyStore::PopulateEntry(TSmsReassemblyEntry& aEntry,const CSmsMessage& aSmsMessage,TInt aNumSmss) |
466 void CSmsReassemblyStore::PopulateEntry(TSmsReassemblyEntry& aEntry,const CSmsMessage& aSmsMessage,TInt aNumSmss) |
472 { |
467 { |
473 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_POPULATEENTRY_1, "CSmsReassemblyStore::PopulateEntry"); |
468 LOGSMSPROT1("CSmsReassemblyStore::PopulateEntry"); |
474 aEntry.SetReference(0); |
469 aEntry.SetReference(0); |
475 aEntry.SetTotal(1); |
470 aEntry.SetTotal(1); |
476 aEntry.SetCount(1); |
471 aEntry.SetCount(1); |
477 |
472 |
478 if (aSmsMessage.TextPresent()) |
473 if (aSmsMessage.TextPresent()) |
526 } // CSmsReassemblyStore::PopulateEntry |
521 } // CSmsReassemblyStore::PopulateEntry |
527 |
522 |
528 |
523 |
529 void CSmsReassemblyStore::CreateEntryL(CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray) |
524 void CSmsReassemblyStore::CreateEntryL(CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray) |
530 { |
525 { |
531 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_CREATEENTRYL_1, "CSmsReassemblyStore::CreateEntryL"); |
526 LOGSMSPROT1("CSmsReassemblyStore::CreateEntryL"); |
532 TStreamId streamid=KNullStreamId; |
527 TStreamId streamid=KNullStreamId; |
533 if (aSmsMessage.Time() >= iLastRealTime) |
528 if (aSmsMessage.Time() >= iLastRealTime) |
534 { |
529 { |
535 iLastRealTime=aSmsMessage.Time(); |
530 iLastRealTime=aSmsMessage.Time(); |
536 if(iLastReceivedTime >= aSmsMessage.Time()) |
531 if(iLastReceivedTime >= aSmsMessage.Time()) |
554 } // CSmsReassemblyStore::CreateEntryL |
549 } // CSmsReassemblyStore::CreateEntryL |
555 |
550 |
556 |
551 |
557 TBool CSmsReassemblyStore::PassedToClient( TInt aIndex ) const |
552 TBool CSmsReassemblyStore::PassedToClient( TInt aIndex ) const |
558 { |
553 { |
559 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_PASSEDTOCLIENT_1, "CSmsReassemblyStore::PassedToClient()"); |
554 LOGSMSPROT1("CSmsReassemblyStore::PassedToClient()"); |
560 |
555 |
561 const TSmsReassemblyEntry& entry = reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[ aIndex ]); |
556 const TSmsReassemblyEntry& entry = reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[ aIndex ]); |
562 return entry.PassedToClient(); |
557 return entry.PassedToClient(); |
563 } // CSmsReassemblyStore::PassedToClient |
558 } // CSmsReassemblyStore::PassedToClient |
564 |
559 |
565 |
560 |
566 void CSmsReassemblyStore::SetPassedToClientL(TInt aIndex, TBool aPassed) |
561 void CSmsReassemblyStore::SetPassedToClientL(TInt aIndex, TBool aPassed) |
567 { |
562 { |
568 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREASSEMBLYSTORE_SETPASSEDTOCLIENTL_1, "CSmsReassemblyStore::SetPassedToClientL()"); |
563 LOGSMSPROT1("CSmsReassemblyStore::SetPassedToClientL()"); |
569 |
564 |
570 TSmsReassemblyEntry entry(reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[aIndex])); |
565 TSmsReassemblyEntry entry(reinterpret_cast<const TSmsReassemblyEntry&>(Entries()[aIndex])); |
571 |
566 |
572 const TBool alreadyPassed = entry.PassedToClient(); |
567 const TBool alreadyPassed = entry.PassedToClient(); |
573 |
568 |
602 } // CSmsReassemblyStore::CSmsReassemblyStore |
597 } // CSmsReassemblyStore::CSmsReassemblyStore |
603 |
598 |
604 |
599 |
605 CSmsSegmentationStore* CSmsSegmentationStore::NewL(RFs& aFs) |
600 CSmsSegmentationStore* CSmsSegmentationStore::NewL(RFs& aFs) |
606 { |
601 { |
607 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEWL_1, "CSmsSegmentationStore::NewL()"); |
602 LOGSMSPROT1("CSmsSegmentationStore::NewL()"); |
608 |
603 |
609 CSmsSegmentationStore* segmentationStore = new(ELeave) CSmsSegmentationStore(aFs); |
604 CSmsSegmentationStore* segmentationStore = new(ELeave) CSmsSegmentationStore(aFs); |
610 CleanupStack::PushL( segmentationStore ); |
605 CleanupStack::PushL( segmentationStore ); |
611 segmentationStore->ConstructL(); |
606 segmentationStore->ConstructL(); |
612 CleanupStack::Pop( segmentationStore ); |
607 CleanupStack::Pop( segmentationStore ); |
672 TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
667 TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
673 if(ret != KErrNone) |
668 if(ret != KErrNone) |
674 { |
669 { |
675 // We have to leave on any error; otherwise a duplicate reference number will be generated |
670 // We have to leave on any error; otherwise a duplicate reference number will be generated |
676 // The transaction will revert |
671 // The transaction will revert |
677 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT8BITREFERENCEL_2, "WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret); |
672 LOGSMSPROT2("WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret); |
678 User::Leave(ret); // stream not corrupted |
673 User::Leave(ret); // stream not corrupted |
679 } |
674 } |
680 reference8bit=(reference8bit+1)%0x100; |
675 reference8bit=(reference8bit+1)%0x100; |
681 } |
676 } |
682 TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
677 TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
683 if(ret != KErrNone) |
678 if(ret != KErrNone) |
684 { |
679 { |
685 // We have to leave on any error; otherwise a duplicate reference number will be generated |
680 // We have to leave on any error; otherwise a duplicate reference number will be generated |
686 // The transaction will revert |
681 // The transaction will revert |
687 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT8BITREFERENCEL_3, "WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret); |
682 LOGSMSPROT2("WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret); |
688 User::Leave(ret); // stream not corrupted |
683 User::Leave(ret); // stream not corrupted |
689 } |
684 } |
690 SetExtraStreamIdL(streamid); |
685 SetExtraStreamIdL(streamid); |
691 CommitTransactionL(); |
686 CommitTransactionL(); |
692 return reference8bit; |
687 return reference8bit; |
693 } // CSmsSegmentationStore::Next8BitReferenceL |
688 } // CSmsSegmentationStore::Next8BitReferenceL |
694 |
689 |
695 |
690 |
696 TInt CSmsSegmentationStore::Next16BitReferenceL() |
691 TInt CSmsSegmentationStore::Next16BitReferenceL() |
697 { |
692 { |
698 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT16BITREFERENCEL_1, "CSmsSegmentationStore::Next16BitReferenceL"); |
693 LOGSMSPROT1("CSmsSegmentationStore::Next16BitReferenceL"); |
699 TInt reference8bit=0; |
694 TInt reference8bit=0; |
700 TInt reference16bit=0x100; |
695 TInt reference16bit=0x100; |
701 TStreamId streamid=ExtraStreamId(); |
696 TStreamId streamid=ExtraStreamId(); |
702 // |
697 // |
703 // access file store |
698 // access file store |
708 TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
703 TRAPD(ret,InternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
709 if(ret != KErrNone) |
704 if(ret != KErrNone) |
710 { |
705 { |
711 // We have to leave on any error; otherwise a duplicate reference number will be generated |
706 // We have to leave on any error; otherwise a duplicate reference number will be generated |
712 // The transaction will revert |
707 // The transaction will revert |
713 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT16BITREFERENCEL_2, "WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret); |
708 LOGSMSPROT2("WARNING! CSmsSegmentationStore::InternalizeConcatenationReferencesL left with %d", ret); |
714 User::Leave(ret); // stream not corrupted |
709 User::Leave(ret); // stream not corrupted |
715 } |
710 } |
716 reference16bit=((reference16bit+1)%0xFF00)+0x100; |
711 reference16bit=((reference16bit+1)%0xFF00)+0x100; |
717 } |
712 } |
718 TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
713 TRAPD(ret, ExternalizeConcatenationReferencesL(streamid,reference8bit,reference16bit)); |
719 if(ret != KErrNone) |
714 if(ret != KErrNone) |
720 { |
715 { |
721 // We have to leave on any error; otherwise a duplicate reference number will be generated |
716 // We have to leave on any error; otherwise a duplicate reference number will be generated |
722 // The transaction will revert |
717 // The transaction will revert |
723 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_NEXT16BITREFERENCEL_3, "WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret); |
718 LOGSMSPROT2("WARNING! CSmsSegmentationStore::ExternalizeConcatenationReferencesL left with %d", ret); |
724 User::Leave(ret); // stream not corrupted |
719 User::Leave(ret); // stream not corrupted |
725 } |
720 } |
726 SetExtraStreamIdL(streamid); |
721 SetExtraStreamIdL(streamid); |
727 CommitTransactionL(); |
722 CommitTransactionL(); |
728 return reference16bit; |
723 return reference16bit; |
738 * @pre aSubmit.Type() is ESmsSubmit |
733 * @pre aSubmit.Type() is ESmsSubmit |
739 * @pre aSubmit.EncodeMessagePdusL() has been called. This is so PopulateEntry sets the correct total on the TSAREntry |
734 * @pre aSubmit.EncodeMessagePdusL() has been called. This is so PopulateEntry sets the correct total on the TSAREntry |
740 */ |
735 */ |
741 void CSmsSegmentationStore::AddSubmitL(const TSmsAddr& aSmsAddr,CSmsMessage& aSubmit) |
736 void CSmsSegmentationStore::AddSubmitL(const TSmsAddr& aSmsAddr,CSmsMessage& aSubmit) |
742 { |
737 { |
743 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSUBMITL_1, "CSmsSegmentationStore::AddSubmitL"); |
738 LOGSMSPROT1("CSmsSegmentationStore::AddSubmitL"); |
744 |
739 |
745 __ASSERT_ALWAYS(aSubmit.Type()==CSmsPDU::ESmsSubmit,SmspPanic(KSmspPanicNotSubmit)); |
740 __ASSERT_ALWAYS(aSubmit.Type()==CSmsPDU::ESmsSubmit,SmspPanic(KSmspPanicNotSubmit)); |
746 |
741 |
747 BeginTransactionLC(); |
742 BeginTransactionLC(); |
748 |
743 |
769 } // CSmsSegmentationStore::AddSubmitL |
764 } // CSmsSegmentationStore::AddSubmitL |
770 |
765 |
771 |
766 |
772 TBool CSmsSegmentationStore::AddCommandL(const TSmsAddr& aSmsAddr,const CSmsMessage& aCommand, CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray& aRefStatus) |
767 TBool CSmsSegmentationStore::AddCommandL(const TSmsAddr& aSmsAddr,const CSmsMessage& aCommand, CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray& aRefStatus) |
773 { |
768 { |
774 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDCOMMANDL_1, "CSmsSegmentationStore::AddCommandL"); |
769 LOGSMSPROT1("CSmsSegmentationStore::AddCommandL"); |
775 __ASSERT_ALWAYS(aCommand.Type()==CSmsPDU::ESmsCommand,SmspPanic(KSmspPanicNotCommand)); |
770 __ASSERT_ALWAYS(aCommand.Type()==CSmsPDU::ESmsCommand,SmspPanic(KSmspPanicNotCommand)); |
776 const TInt count=Entries().Count(); |
771 const TInt count=Entries().Count(); |
777 const TLogId logid=(TLogId) aCommand.LogServerId(); |
772 const TLogId logid=(TLogId) aCommand.LogServerId(); |
778 |
773 |
779 BeginTransactionLC(); |
774 BeginTransactionLC(); |
845 |
840 |
846 |
841 |
847 TBool CSmsSegmentationStore::AddReferenceL(const CSmsMessage& aSmsMessage,TInt aReference) |
842 TBool CSmsSegmentationStore::AddReferenceL(const CSmsMessage& aSmsMessage,TInt aReference) |
848 { |
843 { |
849 const TInt count=Entries().Count(); |
844 const TInt count=Entries().Count(); |
850 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDREFERENCEL_1, "CSmsSegmentationStore::AddReferenceL [count=%d, ref=%d]", count, aReference); |
845 LOGSMSPROT3("CSmsSegmentationStore::AddReferenceL [count=%d, ref=%d]", count, aReference); |
851 TInt i=0; |
846 TInt i=0; |
852 TInt logserverid=aSmsMessage.LogServerId(); |
847 TInt logserverid=aSmsMessage.LogServerId(); |
853 if (logserverid!=KLogNullId) |
848 if (logserverid!=KLogNullId) |
854 { |
849 { |
855 for (i=0; i<count; i++) |
850 for (i=0; i<count; i++) |
925 * @param aReference The PDU reference. |
920 * @param aReference The PDU reference. |
926 */ |
921 */ |
927 TBool CSmsSegmentationStore::AddReferenceStatusPairL(const CSmsMessage& aSmsMessage,TInt aReference, TUint aSegmentSequenceNumber) |
922 TBool CSmsSegmentationStore::AddReferenceStatusPairL(const CSmsMessage& aSmsMessage,TInt aReference, TUint aSegmentSequenceNumber) |
928 { |
923 { |
929 const TInt count=Entries().Count(); |
924 const TInt count=Entries().Count(); |
930 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDREFERENCESTATUSPAIRL_1, "CSmsSegmentationStore::AddReferenceStatusPairL [count=%d, ref=%d]", count, aReference); |
925 LOGSMSPROT3("CSmsSegmentationStore::AddReferenceStatusPairL [count=%d, ref=%d]", count, aReference); |
931 TInt i=0; |
926 TInt i=0; |
932 TInt logserverid=aSmsMessage.LogServerId(); |
927 TInt logserverid=aSmsMessage.LogServerId(); |
933 if (logserverid!=KLogNullId) |
928 if (logserverid!=KLogNullId) |
934 { |
929 { |
935 for (i=0; i<count; i++) |
930 for (i=0; i<count; i++) |
1031 } // CSmsSegmentationStore::AddReferenceStatusPairL |
1026 } // CSmsSegmentationStore::AddReferenceStatusPairL |
1032 |
1027 |
1033 |
1028 |
1034 TBool CSmsSegmentationStore::AddStatusReportL(TInt& aIndex,TBool& aComplete,const CSmsMessage& aStatusReport) |
1029 TBool CSmsSegmentationStore::AddStatusReportL(TInt& aIndex,TBool& aComplete,const CSmsMessage& aStatusReport) |
1035 { |
1030 { |
1036 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_1, "CSmsSegmentationStore::AddStatusReportL"); |
1031 LOGSMSPROT1("CSmsSegmentationStore::AddStatusReportL"); |
1037 |
1032 |
1038 __ASSERT_DEBUG(aStatusReport.Type()==CSmsPDU::ESmsStatusReport,SmspPanic(KSmspPanicNotStatusReport)); |
1033 __ASSERT_DEBUG(aStatusReport.Type()==CSmsPDU::ESmsStatusReport,SmspPanic(KSmspPanicNotStatusReport)); |
1039 |
1034 |
1040 const CSmsStatusReport& statusreport=(CSmsStatusReport&) aStatusReport.SmsPDU(); |
1035 const CSmsStatusReport& statusreport=(CSmsStatusReport&) aStatusReport.SmsPDU(); |
1041 const TInt reference=statusreport.MessageReference(); |
1036 const TInt reference=statusreport.MessageReference(); |
1086 |
1081 |
1087 TBool sameTelNumbers = entry.Description2().Right(telLen) == parsedaddress.iTelNumber.Right(telLen); |
1082 TBool sameTelNumbers = entry.Description2().Right(telLen) == parsedaddress.iTelNumber.Right(telLen); |
1088 |
1083 |
1089 if (sameTelNumbers) |
1084 if (sameTelNumbers) |
1090 { |
1085 { |
1091 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_3, "CSmsSegmentationStore::AddStatusReportL telNumber from submit report matches that from SMS message"); |
1086 LOGSMSPROT1("CSmsSegmentationStore::AddStatusReportL telNumber from submit report matches that from SMS message"); |
1092 } |
1087 } |
1093 else |
1088 else |
1094 { |
1089 { |
1095 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_4, "CSmsSegmentationStore::AddStatusReportL telNumber from submit report does NOT match that from SMS message"); |
1090 LOGSMSPROT1("CSmsSegmentationStore::AddStatusReportL telNumber from submit report does NOT match that from SMS message"); |
1096 } |
1091 } |
1097 |
1092 |
1098 if (sameTelNumbers && |
1093 if (sameTelNumbers && |
1099 (((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfCommand) && (type==CSmsPDU::ESmsCommand)) || |
1094 (((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfCommand) && (type==CSmsPDU::ESmsCommand)) || |
1100 ((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfSubmit) && (type==CSmsPDU::ESmsSubmit))) && |
1095 ((qualifier==TSmsFirstOctet::ESmsStatusReportResultOfSubmit) && (type==CSmsPDU::ESmsSubmit))) && |
1117 { |
1112 { |
1118 found = ETrue; |
1113 found = ETrue; |
1119 } |
1114 } |
1120 else |
1115 else |
1121 { |
1116 { |
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); |
1117 LOGSMSPROT4("CSmsSegmentationStore::AddStatusReportL WARNING: Status already perm [status=%d refStatusPos=%d count=%d]", refStatusArray[refStatusPos].Status(), refStatusPos, refStatusArrayCount); |
1123 refStatusPos++; |
1118 refStatusPos++; |
1124 } |
1119 } |
1125 } |
1120 } |
1126 |
1121 |
1127 if (found) |
1122 if (found) |
1128 { |
1123 { |
1129 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_6, "CSmsSegmentationStore::AddStatusReportL Found [refStatusPos=%d]", refStatusPos); |
1124 LOGSMSPROT2("CSmsSegmentationStore::AddStatusReportL Found [refStatusPos=%d]", refStatusPos); |
1130 refStatusArray[refStatusPos].SetStatus(status); |
1125 refStatusArray[refStatusPos].SetStatus(status); |
1131 TStreamId streamid=entry.DataStreamId(); |
1126 TStreamId streamid=entry.DataStreamId(); |
1132 ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray); |
1127 ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray); |
1133 PopulateEntry(entry,*smsmessage, refStatusArray); |
1128 PopulateEntry(entry,*smsmessage, refStatusArray); |
1134 ChangeEntryL(aIndex,entry); |
1129 ChangeEntryL(aIndex,entry); |
1135 aComplete=StatusArrayComplete(refStatusArray, entry); |
1130 aComplete=StatusArrayComplete(refStatusArray, entry); |
1136 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_7, "CSmsSegmentationStore::AddStatusReportL StatusArrayComplete %d", aComplete); |
1131 LOGSMSPROT2("CSmsSegmentationStore::AddStatusReportL StatusArrayComplete %d", aComplete); |
1137 } |
1132 } |
1138 } |
1133 } |
1139 } |
1134 } |
1140 } |
1135 } |
1141 |
1136 |
1191 TStreamId streamid=entry.DataStreamId(); |
1186 TStreamId streamid=entry.DataStreamId(); |
1192 ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray2); |
1187 ExternalizeEntryL(streamid,smsaddr,*smsmessage, refStatusArray2); |
1193 PopulateEntry(entry,/*smsaddr,*/*smsmessage, refStatusArray2); |
1188 PopulateEntry(entry,/*smsaddr,*/*smsmessage, refStatusArray2); |
1194 ChangeEntryL(aIndex,entry); |
1189 ChangeEntryL(aIndex,entry); |
1195 aComplete=StatusArrayComplete(refStatusArray2, entry); |
1190 aComplete=StatusArrayComplete(refStatusArray2, entry); |
1196 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_8, "CSmsSegmentationStore::StatusArrayComplete [aStatus=%d, ret=%d]", status, aComplete); |
1191 LOGSMSPROT3("CSmsSegmentationStore::StatusArrayComplete [aStatus=%d, ret=%d]", status, aComplete); |
1197 break; |
1192 break; |
1198 } |
1193 } |
1199 } |
1194 } |
1200 |
1195 |
1201 CleanupStack::PopAndDestroy(&refStatusArray2); |
1196 CleanupStack::PopAndDestroy(&refStatusArray2); |
1202 } |
1197 } |
1203 |
1198 |
1204 CommitTransactionL(); |
1199 CommitTransactionL(); |
1205 CleanupStack::PopAndDestroy(2); // smsmessage, refStatusArray |
1200 CleanupStack::PopAndDestroy(2); // smsmessage, refStatusArray |
1206 |
1201 |
1207 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_ADDSTATUSREPORTL_9, "CSmsSegmentationStore::AddStatusReportL Exit [found=%d]", found); |
1202 LOGSMSPROT2("CSmsSegmentationStore::AddStatusReportL Exit [found=%d]", found); |
1208 return found; |
1203 return found; |
1209 } // CSmsSegmentationStore::AddStatusReportL |
1204 } // CSmsSegmentationStore::AddStatusReportL |
1210 |
1205 |
1211 |
1206 |
1212 void CSmsSegmentationStore::GetMessageL(TInt aIndex,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1207 void CSmsSegmentationStore::GetMessageL(TInt aIndex,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1213 { |
1208 { |
1214 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_GETMESSAGEL_1, "CSmsSegmentationStore::GetMessageL [aIndex=%d]", aIndex); |
1209 LOGSMSPROT2("CSmsSegmentationStore::GetMessageL [aIndex=%d]", aIndex); |
1215 |
1210 |
1216 InternalizeEntryL(Entries()[aIndex].DataStreamId(),aSmsAddr,aSmsMessage, aRefStatusArray); |
1211 InternalizeEntryL(Entries()[aIndex].DataStreamId(),aSmsAddr,aSmsMessage, aRefStatusArray); |
1217 } // CSmsSegmentationStore::GetMessageL |
1212 } // CSmsSegmentationStore::GetMessageL |
1218 |
1213 |
1219 |
1214 |
1223 * @note You have to call CSARStore::OpenFileLC() before calling this function |
1218 * @note You have to call CSARStore::OpenFileLC() before calling this function |
1224 * and CSARStore::CloseFile() after. |
1219 * and CSARStore::CloseFile() after. |
1225 */ |
1220 */ |
1226 void CSmsSegmentationStore::InternalizeConcatenationReferencesL(const TStreamId& aStreamId,TInt& aReference8bit,TInt& aReference16bit) |
1221 void CSmsSegmentationStore::InternalizeConcatenationReferencesL(const TStreamId& aStreamId,TInt& aReference8bit,TInt& aReference16bit) |
1227 { |
1222 { |
1228 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZECONCATENATIONREFERENCESL_1, "CSmsSegmentationStore::InternalizeConcatenationReferencesL Start"); |
1223 LOGSMSPROT1("CSmsSegmentationStore::InternalizeConcatenationReferencesL Start"); |
1229 RStoreReadStream readstream; |
1224 RStoreReadStream readstream; |
1230 readstream.OpenLC(FileStore(),aStreamId); |
1225 readstream.OpenLC(FileStore(),aStreamId); |
1231 aReference8bit=readstream.ReadInt32L(); |
1226 aReference8bit=readstream.ReadInt32L(); |
1232 aReference16bit=readstream.ReadInt32L(); |
1227 aReference16bit=readstream.ReadInt32L(); |
1233 CleanupStack::PopAndDestroy(); |
1228 CleanupStack::PopAndDestroy(); |
1234 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZECONCATENATIONREFERENCESL_2, "CSmsSegmentationStore::InternalizeConcatenationReferencesL End"); |
1229 LOGSMSPROT1("CSmsSegmentationStore::InternalizeConcatenationReferencesL End"); |
1235 } // CSmsSegmentationStore::InternalizeConcatenationReferencesL |
1230 } // CSmsSegmentationStore::InternalizeConcatenationReferencesL |
1236 |
1231 |
1237 |
1232 |
1238 /** |
1233 /** |
1239 * externalize the concat refs from the permanent file store to internal memory |
1234 * externalize the concat refs from the permanent file store to internal memory |
1241 * @note You have to call CSARStore::OpenFileLC() before calling this function |
1236 * @note You have to call CSARStore::OpenFileLC() before calling this function |
1242 * and CSARStore::CloseFile() after. |
1237 * and CSARStore::CloseFile() after. |
1243 */ |
1238 */ |
1244 void CSmsSegmentationStore::ExternalizeConcatenationReferencesL(TStreamId& aStreamId,TInt aReference8bit,TInt aReference16bit) |
1239 void CSmsSegmentationStore::ExternalizeConcatenationReferencesL(TStreamId& aStreamId,TInt aReference8bit,TInt aReference16bit) |
1245 { |
1240 { |
1246 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZECONCATENATIONREFERENCESL_1, "CSmsSegmentationStore::ExternalizeConcatenationReferencesL Start"); |
1241 LOGSMSPROT1("CSmsSegmentationStore::ExternalizeConcatenationReferencesL Start"); |
1247 RStoreWriteStream writestream; |
1242 RStoreWriteStream writestream; |
1248 if (aStreamId==KNullStreamId) |
1243 if (aStreamId==KNullStreamId) |
1249 aStreamId=writestream.CreateLC(FileStore()); |
1244 aStreamId=writestream.CreateLC(FileStore()); |
1250 else |
1245 else |
1251 writestream.ReplaceLC(FileStore(),aStreamId); |
1246 writestream.ReplaceLC(FileStore(),aStreamId); |
1252 writestream.WriteInt32L(aReference8bit); |
1247 writestream.WriteInt32L(aReference8bit); |
1253 writestream.WriteInt32L(aReference16bit); |
1248 writestream.WriteInt32L(aReference16bit); |
1254 writestream.CommitL(); |
1249 writestream.CommitL(); |
1255 CleanupStack::PopAndDestroy(); |
1250 CleanupStack::PopAndDestroy(); |
1256 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZECONCATENATIONREFERENCESL_2, "CSmsSegmentationStore::ExternalizeConcatenationReferencesL End"); |
1251 LOGSMSPROT1("CSmsSegmentationStore::ExternalizeConcatenationReferencesL End"); |
1257 } // CSmsSegmentationStore::ExternalizeConcatenationReferencesL |
1252 } // CSmsSegmentationStore::ExternalizeConcatenationReferencesL |
1258 |
1253 |
1259 |
1254 |
1260 /** |
1255 /** |
1261 * internalize all the entries from the permanent file store to internal memory |
1256 * internalize all the entries from the permanent file store to internal memory |
1263 * @note You have to call CSARStore::OpenFileLC() before calling this function |
1258 * @note You have to call CSARStore::OpenFileLC() before calling this function |
1264 * and CSARStore::CloseFile() after. |
1259 * and CSARStore::CloseFile() after. |
1265 */ |
1260 */ |
1266 void CSmsSegmentationStore::InternalizeEntryL(const TStreamId& aStreamId,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1261 void CSmsSegmentationStore::InternalizeEntryL(const TStreamId& aStreamId,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1267 { |
1262 { |
1268 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZEENTRYL_1, "CSmsSegmentationStore::InternalizeEntryL Start"); |
1263 LOGSMSPROT1("CSmsSegmentationStore::InternalizeEntryL Start"); |
1269 |
1264 |
1270 aRefStatusArray.Reset(); |
1265 aRefStatusArray.Reset(); |
1271 |
1266 |
1272 RStoreReadStream readstream; |
1267 RStoreReadStream readstream; |
1273 readstream.OpenLC(FileStore(),aStreamId); |
1268 readstream.OpenLC(FileStore(),aStreamId); |
1274 readstream >> aSmsAddr; |
1269 readstream >> aSmsAddr; |
1275 readstream >> aSmsMessage; |
1270 readstream >> aSmsMessage; |
1276 readstream >> aRefStatusArray; |
1271 readstream >> aRefStatusArray; |
1277 CleanupStack::PopAndDestroy(&readstream); |
1272 CleanupStack::PopAndDestroy(&readstream); |
1278 |
1273 |
1279 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_INTERNALIZEENTRYL_2, "CSmsSegmentationStore::InternalizeEntryL End [count=%d]", aRefStatusArray.Count()); |
1274 LOGSMSPROT2("CSmsSegmentationStore::InternalizeEntryL End [count=%d]", aRefStatusArray.Count()); |
1280 } // CSmsSegmentationStore::InternalizeEntryL |
1275 } // CSmsSegmentationStore::InternalizeEntryL |
1281 |
1276 |
1282 |
1277 |
1283 /** |
1278 /** |
1284 * externalizes all the entries from the internal memory to the permanent file store |
1279 * externalizes all the entries from the internal memory to the permanent file store |
1285 */ |
1280 */ |
1286 void CSmsSegmentationStore::ExternalizeEntryL(TStreamId& aStreamId,const TSmsAddr& aSmsAddr,const CSmsMessage& aSmsMessage, const RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1281 void CSmsSegmentationStore::ExternalizeEntryL(TStreamId& aStreamId,const TSmsAddr& aSmsAddr,const CSmsMessage& aSmsMessage, const RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1287 { |
1282 { |
1288 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZEENTRYL_1, "CSmsSegmentationStore::ExternalizeEntryL Start"); |
1283 LOGSMSPROT1("CSmsSegmentationStore::ExternalizeEntryL Start"); |
1289 |
1284 |
1290 RStoreWriteStream writestream; |
1285 RStoreWriteStream writestream; |
1291 |
1286 |
1292 if (aStreamId==KNullStreamId) |
1287 if (aStreamId==KNullStreamId) |
1293 aStreamId=writestream.CreateLC(FileStore()); |
1288 aStreamId=writestream.CreateLC(FileStore()); |
1298 writestream << aSmsMessage; |
1293 writestream << aSmsMessage; |
1299 writestream << aRefStatusArray; |
1294 writestream << aRefStatusArray; |
1300 writestream.CommitL(); |
1295 writestream.CommitL(); |
1301 CleanupStack::PopAndDestroy(&writestream); |
1296 CleanupStack::PopAndDestroy(&writestream); |
1302 |
1297 |
1303 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_EXTERNALIZEENTRYL_2, "CSmsSegmentationStore::ExternalizeEntryL End [count=%d]", aRefStatusArray.Count()); |
1298 LOGSMSPROT2("CSmsSegmentationStore::ExternalizeEntryL End [count=%d]", aRefStatusArray.Count()); |
1304 } // CSmsSegmentationStore::ExternalizeEntryL |
1299 } // CSmsSegmentationStore::ExternalizeEntryL |
1305 |
1300 |
1306 |
1301 |
1307 /** |
1302 /** |
1308 * Populates an SMS message into SAR store entry |
1303 * Populates an SMS message into SAR store entry |
1316 */ |
1311 */ |
1317 void CSmsSegmentationStore::PopulateEntry(TSmsSegmentationEntry& aEntry, |
1312 void CSmsSegmentationStore::PopulateEntry(TSmsSegmentationEntry& aEntry, |
1318 const CSmsMessage& aSmsMessage, |
1313 const CSmsMessage& aSmsMessage, |
1319 const RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1314 const RSmsSegmentationStoreRefStatusArray& aRefStatusArray) |
1320 { |
1315 { |
1321 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_POPULATEENTRY_1, "CSmsSegmentationStore::PopulateEntry"); |
1316 LOGSMSPROT1("CSmsSegmentationStore::PopulateEntry"); |
1322 TBool statusreportrequest=EFalse; |
1317 TBool statusreportrequest=EFalse; |
1323 if (aSmsMessage.Type()==CSmsPDU::ESmsSubmit) |
1318 if (aSmsMessage.Type()==CSmsPDU::ESmsSubmit) |
1324 { |
1319 { |
1325 aEntry.SetReference(0); |
1320 aEntry.SetReference(0); |
1326 aEntry.SetTotal(1); |
1321 aEntry.SetTotal(1); |
1424 TInt permanent=0; |
1419 TInt permanent=0; |
1425 const TInt count= aRefStatusArray.Count(); |
1420 const TInt count= aRefStatusArray.Count(); |
1426 for (TInt i=0; i<count; i++) |
1421 for (TInt i=0; i<count; i++) |
1427 { |
1422 { |
1428 const TBool ret = IsPermanentStatus(aRefStatusArray[i].Status()); |
1423 const TBool ret = IsPermanentStatus(aRefStatusArray[i].Status()); |
1429 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_STATUSARRAYCOMPLETE_1, "CSmsSegmentationStore::IsPermanentStatus [Status: %d, RetVal: %d, count=%d]", aRefStatusArray[i].Status(), ret, count); |
1424 LOGSMSPROT4("CSmsSegmentationStore::IsPermanentStatus [Status: %d, RetVal: %d, count=%d]", aRefStatusArray[i].Status(), ret, count); |
1430 if (ret) |
1425 if (ret) |
1431 permanent++; |
1426 permanent++; |
1432 } |
1427 } |
1433 return (permanent==count) && (permanent==aEntry.Total() ); |
1428 return (permanent==count) && (permanent==aEntry.Total() ); |
1434 } // CSmsSegmentationStore::StatusArrayComplete |
1429 } // CSmsSegmentationStore::StatusArrayComplete |
1438 * C'tor |
1433 * C'tor |
1439 */ |
1434 */ |
1440 CSmsSegmentationStore::CSmsSegmentationStore(RFs& aFs) |
1435 CSmsSegmentationStore::CSmsSegmentationStore(RFs& aFs) |
1441 :CSARStore(aFs) |
1436 :CSARStore(aFs) |
1442 { |
1437 { |
1443 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_CTOR_1, "CSmsSegmentationStore::CSmsSegmentationStore()"); |
1438 LOGSMSPROT1("CSmsSegmentationStore::CSmsSegmentationStore()"); |
1444 |
1439 |
1445 } // CSmsSegmentationStore::CSmsSegmentationStore |
1440 } // CSmsSegmentationStore::CSmsSegmentationStore |
1446 |
1441 |
1447 |
1442 |
1448 TInt CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare(const TSmsSegmentationStoreRefStatus& aLeft, const TSmsSegmentationStoreRefStatus& aRight) |
1443 TInt CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare(const TSmsSegmentationStoreRefStatus& aLeft, const TSmsSegmentationStoreRefStatus& aRight) |
1449 { |
1444 { |
1450 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_TSMSSEGMENTATIONSTOREREFSTATUS_COMPARE_1, "CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare()"); |
1445 LOGSMSPROT1("CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare()"); |
1451 |
1446 |
1452 return aLeft.iReference - aRight.iReference; |
1447 return aLeft.iReference - aRight.iReference; |
1453 } // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare |
1448 } // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::Compare |
1454 |
1449 |
1455 |
1450 |
1456 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL(RReadStream& aStream) |
1451 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL(RReadStream& aStream) |
1457 { |
1452 { |
1458 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_TSMSSEGMENTATIONSTOREREFSTATUS_INTERNALIZEL_1, "CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL()"); |
1453 LOGSMSPROT1("CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL()"); |
1459 |
1454 |
1460 iReference = aStream.ReadInt32L(); |
1455 iReference = aStream.ReadInt32L(); |
1461 iStatus = aStream.ReadInt32L(); |
1456 iStatus = aStream.ReadInt32L(); |
1462 } // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL |
1457 } // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::InternalizeL |
1463 |
1458 |
1464 |
1459 |
1465 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL(RWriteStream& aStream) const |
1460 void CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL(RWriteStream& aStream) const |
1466 { |
1461 { |
1467 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_TSMSSEGMENTATIONSTOREREFSTATUS_EXTERNALIZEL_1, "CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL()"); |
1462 LOGSMSPROT1("CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL()"); |
1468 |
1463 |
1469 aStream.WriteInt32L(iReference); |
1464 aStream.WriteInt32L(iReference); |
1470 aStream.WriteInt32L(iStatus); |
1465 aStream.WriteInt32L(iStatus); |
1471 } // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL |
1466 } // CSmsSegmentationStore::TSmsSegmentationStoreRefStatus::ExternalizeL |
1472 |
1467 |
1473 |
1468 |
1474 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL(const TSmsSegmentationStoreRefStatus& aRefStatus) |
1469 void CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL(const TSmsSegmentationStoreRefStatus& aRefStatus) |
1475 { |
1470 { |
1476 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAY_INSERTL_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL()"); |
1471 LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL()"); |
1477 |
1472 |
1478 TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare); |
1473 TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare); |
1479 User::LeaveIfError(InsertInOrderAllowRepeats(aRefStatus, order)); |
1474 User::LeaveIfError(InsertInOrderAllowRepeats(aRefStatus, order)); |
1480 } // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL |
1475 } // CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::InsertL |
1481 |
1476 |
1482 |
1477 |
1483 TInt CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find(const TSmsSegmentationStoreRefStatus& aRefStatus) const |
1478 TInt CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find(const TSmsSegmentationStoreRefStatus& aRefStatus) const |
1484 { |
1479 { |
1485 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSEGMENTATIONSTORE_RSMSSEGMENTATIONSTOREREFSTATUSARRAY_FIND_1, "CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find()"); |
1480 LOGSMSPROT1("CSmsSegmentationStore::RSmsSegmentationStoreRefStatusArray::Find()"); |
1486 |
1481 |
1487 TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare); |
1482 TLinearOrder<TSmsSegmentationStoreRefStatus> order(TSmsSegmentationStoreRefStatus::Compare); |
1488 TInt index = FindInOrder(aRefStatus, order); |
1483 TInt index = FindInOrder(aRefStatus, order); |
1489 if (index != KErrNotFound) |
1484 if (index != KErrNotFound) |
1490 { |
1485 { |