1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
29 * @param aSmsMessage refernce to sms message. |
23 * @param aSmsMessage refernce to sms message. |
30 * @param aNumSmss number of sms. |
24 * @param aNumSmss number of sms. |
31 */ |
25 */ |
32 void CReassemblyStoreUtility::PopulateEntry(TSmsReassemblyEntry& aEntry,const CSmsMessage& aSmsMessage,TInt aNumSmss) |
26 void CReassemblyStoreUtility::PopulateEntry(TSmsReassemblyEntry& aEntry,const CSmsMessage& aSmsMessage,TInt aNumSmss) |
33 { |
27 { |
34 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTOREUTILITY_POPULATEENTRY_1, "CReassemblyStoreUtility::PopulateEntry"); |
28 LOGSMSPROT1("CReassemblyStoreUtility::PopulateEntry"); |
35 aEntry.SetReference(0); |
29 aEntry.SetReference(0); |
36 aEntry.SetTotal(1); |
30 aEntry.SetTotal(1); |
37 aEntry.SetCount(1); |
31 aEntry.SetCount(1); |
38 |
32 |
39 if (aSmsMessage.TextPresent()) |
33 if (aSmsMessage.TextPresent()) |
91 * @param aFs File Server handle. |
85 * @param aFs File Server handle. |
92 * @param aPath (retrurns) private path of the component. |
86 * @param aPath (retrurns) private path of the component. |
93 */ |
87 */ |
94 void CReassemblyStoreUtility::PrivatePath(RFs& aFs, TDes& aPath) |
88 void CReassemblyStoreUtility::PrivatePath(RFs& aFs, TDes& aPath) |
95 { |
89 { |
96 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTOREUTILITY_PRIVATEPATH_1, "CReassemblyStoreUtility::PrivatePath()"); |
90 LOGSMSPROT1("CReassemblyStoreUtility::PrivatePath()"); |
97 |
91 |
98 TDriveUnit driveUnit(KStoreDrive); |
92 TDriveUnit driveUnit(KStoreDrive); |
99 TDriveName drive=driveUnit.Name(); |
93 TDriveName drive=driveUnit.Name(); |
100 aPath.Insert(0, drive); |
94 aPath.Insert(0, drive); |
101 //append private path |
95 //append private path |
128 |
122 |
129 @internalComponent |
123 @internalComponent |
130 */ |
124 */ |
131 void CReassemblyStore::InitializeL() |
125 void CReassemblyStore::InitializeL() |
132 { |
126 { |
133 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_INITIALIZEL_1, "CClass0SmsReassemblyStore::InitializeL()"); |
127 LOGSMSPROT1("CClass0SmsReassemblyStore::InitializeL()"); |
134 // Initialize Re-assembly store. |
128 // Initialize Re-assembly store. |
135 OpenStoreL(); |
129 OpenStoreL(); |
136 BeginTransactionLC(); |
130 BeginTransactionLC(); |
137 TInt count = iEntryArray.Count(); |
131 TInt count = iEntryArray.Count(); |
138 while (count--) |
132 while (count--) |
169 * @param aPurgeIncompleteOnly Purge complete messages flag |
163 * @param aPurgeIncompleteOnly Purge complete messages flag |
170 */ |
164 */ |
171 void CReassemblyStore::PurgeL(const TTimeIntervalMinutes& aTimeIntervalMinutes,TBool aPurgeIncompleteOnly) |
165 void CReassemblyStore::PurgeL(const TTimeIntervalMinutes& aTimeIntervalMinutes,TBool aPurgeIncompleteOnly) |
172 { |
166 { |
173 //Call purging function |
167 //Call purging function |
174 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_PURGEL_1, "CReassemblyStore::PurgeL(): aTimeIntervalMinutes=%d, aPurgeIncompleteOnly=%d",aTimeIntervalMinutes.Int(), aPurgeIncompleteOnly); |
168 LOGSMSPROT3("CReassemblyStore::PurgeL(): aTimeIntervalMinutes=%d, aPurgeIncompleteOnly=%d", |
|
169 aTimeIntervalMinutes.Int(), aPurgeIncompleteOnly); |
175 |
170 |
176 // TODO - flag |
171 // TODO - flag |
177 // we could also save the call of the method from the consruction of the smsprot |
172 // we could also save the call of the method from the consruction of the smsprot |
178 if( aPurgeIncompleteOnly ) |
173 if( aPurgeIncompleteOnly ) |
179 return; |
174 return; |
180 |
175 |
181 TInt count=iEntryArray.Count(); |
176 TInt count=iEntryArray.Count(); |
182 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_PURGEL_2, "CClass0SmsReassemblyStore::PurgeL(): count=%d", count); |
177 LOGSMSPROT2("CClass0SmsReassemblyStore::PurgeL(): count=%d", count); |
183 |
178 |
184 TTime time; |
179 TTime time; |
185 time.UniversalTime(); |
180 time.UniversalTime(); |
186 |
181 |
187 // we open the file outside the loop |
182 // we open the file outside the loop |
212 */ |
207 */ |
213 void CReassemblyStore::DeleteEnumeratedSIMEntries() |
208 void CReassemblyStore::DeleteEnumeratedSIMEntries() |
214 { |
209 { |
215 const TInt count = iEntryArray.Count(); |
210 const TInt count = iEntryArray.Count(); |
216 |
211 |
217 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_DELETEENUMERATEDSIMENTRIES_1, "CReassemblyStore::DeleteEnumeratedSIMEntries(): %d messages in RAS", count); |
212 LOGSMSPROT2("CReassemblyStore::DeleteEnumeratedSIMEntries(): %d messages in RAS", count); |
218 |
213 |
219 TInt index; |
214 TInt index; |
220 |
215 |
221 for (index = count-1; index >= 0; --index) |
216 for (index = count-1; index >= 0; --index) |
222 { |
217 { |
237 |
232 |
238 @internalComponent |
233 @internalComponent |
239 */ |
234 */ |
240 TInt CReassemblyStore::NumberOfCompleteMessages() |
235 TInt CReassemblyStore::NumberOfCompleteMessages() |
241 { |
236 { |
242 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_NUMBEROFCOMPLETEMESSAGES_1, "CReassemblyStore::NumberOfCompleteMessages(): iEntryArray.Count()=%d",iEntryArray.Count()); |
237 LOGSMSPROT2("CReassemblyStore::NumberOfCompleteMessages(): iEntryArray.Count()=%d", |
|
238 iEntryArray.Count()); |
243 |
239 |
244 //local variable for complete entries |
240 //local variable for complete entries |
245 TInt count( 0 ); |
241 TInt count( 0 ); |
246 // checks all entrys in the reassembly store |
242 // checks all entrys in the reassembly store |
247 for ( TInt i = iEntryArray.Count()-1; i >= 0; i-- ) |
243 for ( TInt i = iEntryArray.Count()-1; i >= 0; i-- ) |
292 |
288 |
293 @internalComponent |
289 @internalComponent |
294 */ |
290 */ |
295 void CReassemblyStore::AddSegmentToReassemblyStoreL(CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms, TInt& aIndex, TBool& aIsComplete, TBool aIsEnumeration, TInt& aCount, TInt& aTotal) |
291 void CReassemblyStore::AddSegmentToReassemblyStoreL(CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms, TInt& aIndex, TBool& aIsComplete, TBool aIsEnumeration, TInt& aCount, TInt& aTotal) |
296 { |
292 { |
297 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_ADDSEGMENTTOREASSEMBLYSTOREL_1, "CReassemblyStore::AddSegmentToReassemblyStoreL(): isComplete Message=%d",aSmsMessage.IsComplete()); |
293 LOGSMSPROT2("CReassemblyStore::AddSegmentToReassemblyStoreL(): isComplete Message=%d", |
|
294 aSmsMessage.IsComplete()); |
298 |
295 |
299 /* |
296 /* |
300 (1) If it is a single segment message create a new message |
297 (1) If it is a single segment message create a new message |
301 (2) If it is part of concatenated message find whether this is the first PDU |
298 (2) If it is part of concatenated message find whether this is the first PDU |
302 or it is the part of existing message. |
299 or it is the part of existing message. |
325 // Search the reassembly store for existing parts of the message. |
322 // Search the reassembly store for existing parts of the message. |
326 // |
323 // |
327 TInt segStoreIndex(KErrNotFound); |
324 TInt segStoreIndex(KErrNotFound); |
328 |
325 |
329 MatchPDUToExistingMessage(aSmsMessage, segStoreIndex); |
326 MatchPDUToExistingMessage(aSmsMessage, segStoreIndex); |
330 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_ADDSEGMENTTOREASSEMBLYSTOREL_2, "CSmsReassemblyStore::AddSegmentToReassemblyStoreL(): ""segStoreIndex=%d", segStoreIndex); |
327 LOGSMSPROT2("CSmsReassemblyStore::AddSegmentToReassemblyStoreL(): " |
|
328 "segStoreIndex=%d", segStoreIndex); |
331 |
329 |
332 // |
330 // |
333 // If not yet complete, then we must be part of a multiple PDU message. |
331 // If not yet complete, then we must be part of a multiple PDU message. |
334 // Search the reassembly store for existing parts of the message. This |
332 // Search the reassembly store for existing parts of the message. This |
335 // may set iIsComplete to true if all segments are then found. |
333 // may set iIsComplete to true if all segments are then found. |
344 // |
342 // |
345 aIndex = segStoreIndex; |
343 aIndex = segStoreIndex; |
346 UpdateExistingMessageL(aSmsMessage, aGsmSms, aIndex, |
344 UpdateExistingMessageL(aSmsMessage, aGsmSms, aIndex, |
347 aIsComplete, isDuplicateMsgRef, |
345 aIsComplete, isDuplicateMsgRef, |
348 isDuplicateSlot); |
346 isDuplicateSlot); |
349 OstTraceDefExt4(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_ADDSEGMENTTOREASSEMBLYSTOREL_3, "CSmsReassemblyStore::AddSegmentToReassemblyStoreL(): ""aIndex=%d, isComplete=%d, isDuplicateMsgRef=%d, isDuplicateSlot=%d",aIndex, aIsComplete, isDuplicateMsgRef, isDuplicateSlot); |
347 LOGSMSPROT5("CSmsReassemblyStore::AddSegmentToReassemblyStoreL(): " |
|
348 "aIndex=%d, isComplete=%d, isDuplicateMsgRef=%d, isDuplicateSlot=%d", |
|
349 aIndex, aIsComplete, isDuplicateMsgRef, isDuplicateSlot); |
350 |
350 |
351 if (isDuplicateMsgRef) |
351 if (isDuplicateMsgRef) |
352 { |
352 { |
353 // |
353 // |
354 // In most cases discard it, unless we are doing an enumeration??? |
354 // In most cases discard it, unless we are doing an enumeration??? |
411 |
411 |
412 @internalComponent |
412 @internalComponent |
413 */ |
413 */ |
414 void CReassemblyStore::DeleteMessageL(const CSmsMessage& aSmsMessage, TBool aPassed) |
414 void CReassemblyStore::DeleteMessageL(const CSmsMessage& aSmsMessage, TBool aPassed) |
415 { |
415 { |
416 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_DELETEMESSAGEL_1, "CReassemblyStore::DeleteMessageL()"); |
416 LOGSMSPROT1("CReassemblyStore::DeleteMessageL()"); |
417 TInt index(0); |
417 TInt index(0); |
418 BeginTransactionLC(); |
418 BeginTransactionLC(); |
419 if (FindMessageL(aSmsMessage, aPassed, index)) |
419 if (FindMessageL(aSmsMessage, aPassed, index)) |
420 { |
420 { |
421 const TReassemblyEntry& entry = iEntryArray[index]; |
421 const TReassemblyEntry& entry = iEntryArray[index]; |
433 |
433 |
434 @internalComponent |
434 @internalComponent |
435 */ |
435 */ |
436 void CReassemblyStore::UpdateLogServerIdOfMessageL(const CSmsMessage& aSmsMessage, TInt aIndex) |
436 void CReassemblyStore::UpdateLogServerIdOfMessageL(const CSmsMessage& aSmsMessage, TInt aIndex) |
437 { |
437 { |
438 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_UPDATELOGSERVERIDOFMESSAGEL_1, "CReassemblyStore::UpdateLogServerIdOfMessageL()"); |
438 LOGSMSPROT1("CReassemblyStore::UpdateLogServerIdOfMessageL()"); |
439 TInt foundIndex(KErrNotFound); |
439 TInt foundIndex(KErrNotFound); |
440 TBool found(EFalse); |
440 TBool found(EFalse); |
441 |
441 |
442 BeginTransactionLC(); |
442 BeginTransactionLC(); |
443 |
443 |
458 |
458 |
459 @internalComponent |
459 @internalComponent |
460 */ |
460 */ |
461 void CReassemblyStore::SetMessagePassedToClientL(const CSmsMessage& aSmsMessage, TBool aPassed) |
461 void CReassemblyStore::SetMessagePassedToClientL(const CSmsMessage& aSmsMessage, TBool aPassed) |
462 { |
462 { |
463 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_SETMESSAGEPASSEDTOCLIENTL_1, "CReassemblyStore::SetMessagePassedToClientL()"); |
463 LOGSMSPROT1("CReassemblyStore::SetMessagePassedToClientL()"); |
464 TInt index(0); |
464 TInt index(0); |
465 |
465 |
466 BeginTransactionLC(); |
466 BeginTransactionLC(); |
467 |
467 |
468 if (FindMessageL(aSmsMessage , !aPassed, index)) |
468 if (FindMessageL(aSmsMessage , !aPassed, index)) |
488 |
488 |
489 @internalComponent |
489 @internalComponent |
490 */ |
490 */ |
491 void CReassemblyStore::NewMessagePDUL(TInt& aIndex,CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms) |
491 void CReassemblyStore::NewMessagePDUL(TInt& aIndex,CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms) |
492 { |
492 { |
493 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_NEWMESSAGEPDUL_1, "CReassemblyStore::NewMessagePDUL"); |
493 LOGSMSPROT1("CReassemblyStore::NewMessagePDUL"); |
494 |
494 |
495 if (aSmsMessage.Time() >= iLastRealTime) |
495 if (aSmsMessage.Time() >= iLastRealTime) |
496 { |
496 { |
497 iLastRealTime=aSmsMessage.Time(); |
497 iLastRealTime=aSmsMessage.Time(); |
498 if(iLastReceivedTime >= aSmsMessage.Time()) |
498 if(iLastReceivedTime >= aSmsMessage.Time()) |
543 */ |
543 */ |
544 void CReassemblyStore::UpdateExistingMessageL(CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms, |
544 void CReassemblyStore::UpdateExistingMessageL(CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms, |
545 TInt aIndex, TBool& aIsComplete, |
545 TInt aIndex, TBool& aIsComplete, |
546 TBool& aDuplicateMsgRef, TBool& aDuplicateSlot) |
546 TBool& aDuplicateMsgRef, TBool& aDuplicateSlot) |
547 { |
547 { |
548 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_UPDATEEXISTINGMESSAGEL_1, "CReassemblyStore::UpdateExistingMessageL"); |
548 LOGSMSPROT1("CReassemblyStore::UpdateExistingMessageL"); |
549 aIsComplete = EFalse; |
549 aIsComplete = EFalse; |
550 BeginTransactionLC(); |
550 BeginTransactionLC(); |
551 UpdateExistingMessageL(aSmsMessage, aGsmSms, aDuplicateMsgRef, aDuplicateSlot); |
551 UpdateExistingMessageL(aSmsMessage, aGsmSms, aDuplicateMsgRef, aDuplicateSlot); |
552 CommitTransactionL(); |
552 CommitTransactionL(); |
553 if ((aDuplicateMsgRef == EFalse) && (aDuplicateSlot==EFalse)) |
553 if ((aDuplicateMsgRef == EFalse) && (aDuplicateSlot==EFalse)) |
572 @internalComponent |
572 @internalComponent |
573 */ |
573 */ |
574 void CReassemblyStore::MatchPDUToExistingMessage(const CSmsMessage& aSmsMessage, |
574 void CReassemblyStore::MatchPDUToExistingMessage(const CSmsMessage& aSmsMessage, |
575 TInt& aIndex) |
575 TInt& aIndex) |
576 { |
576 { |
577 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_MATCHPDUTOEXISTINGMESSAGE_1, "CReassemblyStore::MatchPDUToExistingMessage()"); |
577 LOGSMSPROT1("CReassemblyStore::MatchPDUToExistingMessage()"); |
578 |
578 |
579 aIndex = KErrNotFound; |
579 aIndex = KErrNotFound; |
580 |
580 |
581 TGsmSmsTelNumber parsedAddress; |
581 TGsmSmsTelNumber parsedAddress; |
582 aSmsMessage.ParsedToFromAddress(parsedAddress); |
582 aSmsMessage.ParsedToFromAddress(parsedAddress); |
609 break; |
609 break; |
610 } |
610 } |
611 } |
611 } |
612 } |
612 } |
613 |
613 |
614 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_MATCHPDUTOEXISTINGMESSAGE_2, "CReassemblyStore::MatchPDUToExistingMessage(): reassemblyCount=%d, aIndex=%d", reassemblyCount, aIndex); |
614 LOGSMSPROT3("CReassemblyStore::MatchPDUToExistingMessage(): reassemblyCount=%d, aIndex=%d", reassemblyCount, aIndex); |
615 } // CReassemblyStore::MatchPDUToExistingMessage |
615 } // CReassemblyStore::MatchPDUToExistingMessage |
616 |
616 |
617 /** |
617 /** |
618 It retrieves the message from re-assembly store. |
618 It retrieves the message from re-assembly store. |
619 |
619 |
625 |
625 |
626 @internalComponent |
626 @internalComponent |
627 */ |
627 */ |
628 void CReassemblyStore::GetMessageL(TInt aIndex, CSmsMessage& aSmsMessage) |
628 void CReassemblyStore::GetMessageL(TInt aIndex, CSmsMessage& aSmsMessage) |
629 { |
629 { |
630 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_GETMESSAGEL_1, "CReassemblyStore::GetMessageL()"); |
630 LOGSMSPROT1("CReassemblyStore::GetMessageL()"); |
631 const TReassemblyEntry& entry = iEntryArray[aIndex]; |
631 const TReassemblyEntry& entry = iEntryArray[aIndex]; |
632 RetrieveMessageL(entry, aSmsMessage); |
632 RetrieveMessageL(entry, aSmsMessage); |
633 } |
633 } |
634 |
634 |
635 /** |
635 /** |
645 */ |
645 */ |
646 TBool CReassemblyStore::FindMessageL(const CSmsMessage& aSmsMessage, |
646 TBool CReassemblyStore::FindMessageL(const CSmsMessage& aSmsMessage, |
647 TBool aPassed, |
647 TBool aPassed, |
648 TInt& aIndex) |
648 TInt& aIndex) |
649 { |
649 { |
650 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_FINDMESSAGEL_1, "CReassemblyStore::FindMessageL()"); |
650 LOGSMSPROT1("CReassemblyStore::FindMessageL()"); |
651 |
651 |
652 // |
652 // |
653 // Parse the GSM data from the SMS message... |
653 // Parse the GSM data from the SMS message... |
654 // |
654 // |
655 TGsmSmsTelNumber parsedAddress; |
655 TGsmSmsTelNumber parsedAddress; |
671 entry.Description2().Right(8) == parsedAddress.iTelNumber.Right(8)) |
671 entry.Description2().Right(8) == parsedAddress.iTelNumber.Right(8)) |
672 { |
672 { |
673 // |
673 // |
674 // Found! |
674 // Found! |
675 // |
675 // |
676 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_FINDMESSAGEL_2, "CReassemblyStore::FindMessage(): Found! index=%d", index); |
676 LOGSMSPROT2("CReassemblyStore::FindMessage(): Found! index=%d", index); |
677 |
677 |
678 aIndex = index; |
678 aIndex = index; |
679 |
679 |
680 return ETrue; |
680 return ETrue; |
681 } |
681 } |
682 } |
682 } |
683 |
683 |
684 // |
684 // |
685 // Not found... |
685 // Not found... |
686 // |
686 // |
687 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CREASSEMBLYSTORE_FINDMESSAGEL_3, "CReassemblyStore::FindMessage(): Not found!"); |
687 LOGSMSPROT1("CReassemblyStore::FindMessage(): Not found!"); |
688 |
688 |
689 return EFalse; |
689 return EFalse; |
690 } // CReassemblyStore::FindMessageL |
690 } // CReassemblyStore::FindMessageL |