1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
51 const RMobileSmsMessaging::TMobileSmsCapsV1& aMobileSmsCaps, |
57 const RMobileSmsMessaging::TMobileSmsCapsV1& aMobileSmsCaps, |
52 TInt aPriority, |
58 TInt aPriority, |
53 CSmspReceiveMode& aSmspReceiveMode, |
59 CSmspReceiveMode& aSmspReceiveMode, |
54 CSmsMonitorDiskSpace& aSmsMonitorDiskSpace) |
60 CSmsMonitorDiskSpace& aSmsMonitorDiskSpace) |
55 { |
61 { |
56 LOGSMSPROT1("CSmsPDURead::NewL()"); |
62 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_NEWL_1, "CSmsPDURead::NewL()"); |
57 |
63 |
58 CSmsPDURead* smsPduRead = new (ELeave) CSmsPDURead(aSmsComm, |
64 CSmsPDURead* smsPduRead = new (ELeave) CSmsPDURead(aSmsComm, |
59 aSmsSettings, |
65 aSmsSettings, |
60 aSmsMessaging, |
66 aSmsMessaging, |
61 aReassemblyStore, |
67 aReassemblyStore, |
73 } // CSmsPDURead::NewL |
79 } // CSmsPDURead::NewL |
74 |
80 |
75 |
81 |
76 void CSmsPDURead::ConstructL() |
82 void CSmsPDURead::ConstructL() |
77 { |
83 { |
78 LOGSMSPROT1("CSmsPDURead::ConstructL()"); |
84 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_CONSTRUCTL_1, "CSmsPDURead::ConstructL()"); |
79 |
85 |
80 ConstructTimeoutL(); |
86 ConstructTimeoutL(); |
81 User::LeaveIfError(iOOMTimer.CreateLocal()); |
87 User::LeaveIfError(iOOMTimer.CreateLocal()); |
82 |
88 |
83 iLogger = CSmsPDUReadLogger::NewL(iReassemblyStore.FileSession(), Priority()); |
89 iLogger = CSmsPDUReadLogger::NewL(iReassemblyStore.FileSession(), Priority()); |
126 * Called by CSmsProtocol to start CSmsStoreRead active object |
132 * Called by CSmsProtocol to start CSmsStoreRead active object |
127 * Issues a Receive to the TSY |
133 * Issues a Receive to the TSY |
128 */ |
134 */ |
129 void CSmsPDURead::Start() |
135 void CSmsPDURead::Start() |
130 { |
136 { |
131 LOGSMSPROT3("CSmsPDURead::Start(): iStatus=%d, iState=%d", iStatus.Int(), iState ); |
137 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_START_1, "CSmsPDURead::Start(): iStatus=%d, iState=%d", iStatus.Int(), iState ); |
132 |
138 |
133 if (IsSupported() && IsActive() == EFalse && iReassemblyStore.IsFull() == EFalse) |
139 if (IsSupported() && IsActive() == EFalse && iReassemblyStore.IsFull() == EFalse) |
134 { |
140 { |
135 iState = ESmsPDUReadSetReceiveMode; |
141 iState = ESmsPDUReadSetReceiveMode; |
136 |
142 |
140 } // CSmsPDURead::Start |
146 } // CSmsPDURead::Start |
141 |
147 |
142 |
148 |
143 void CSmsPDURead::ProcessPDUL() |
149 void CSmsPDURead::ProcessPDUL() |
144 { |
150 { |
145 LOGSMSPROT1("CSmsPDURead::ProcessPDUL()"); |
151 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_PROCESSPDUL_1, "CSmsPDURead::ProcessPDUL()"); |
146 |
152 |
147 // |
153 // |
148 // Initilse the Slot location data... |
154 // Initilse the Slot location data... |
149 // |
155 // |
150 iSlot.iIndex = iMsgReceiveAttributes.iStoreIndex; |
156 iSlot.iIndex = iMsgReceiveAttributes.iStoreIndex; |
167 iPduProcessor->SetDiscardType0Class0(iConfigDiscardingType0Class0); |
173 iPduProcessor->SetDiscardType0Class0(iConfigDiscardingType0Class0); |
168 iPduProcessor->SetDiscardType0Class2(iConfigDiscardingType0Class2); |
174 iPduProcessor->SetDiscardType0Class2(iConfigDiscardingType0Class2); |
169 |
175 |
170 TRAPD(decodeError, iPduProcessor->DecodeAndProcessPDUL(iSlot, EFalse)); |
176 TRAPD(decodeError, iPduProcessor->DecodeAndProcessPDUL(iSlot, EFalse)); |
171 iStatus = decodeError; |
177 iStatus = decodeError; |
172 LOGSMSPROT2("CSmsPDURead::ProcessPDUL(): DecodeAndProcessPDUL() returned %d", iStatus.Int()); |
178 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_PROCESSPDUL_2, "CSmsPDURead::ProcessPDUL(): DecodeAndProcessPDUL() returned %d", iStatus.Int()); |
173 |
179 |
174 // |
180 // |
175 // If the PDU cannot be decoded, and this was not due to memory or disk |
181 // If the PDU cannot be decoded, and this was not due to memory or disk |
176 // space problems, then get rid of it... |
182 // space problems, then get rid of it... |
177 // |
183 // |
198 * @leave Leaves if there was an error |
204 * @leave Leaves if there was an error |
199 * @leave Panic if complete is called while state is ESmsStoreReadIdle |
205 * @leave Panic if complete is called while state is ESmsStoreReadIdle |
200 */ |
206 */ |
201 void CSmsPDURead::DoRunL() |
207 void CSmsPDURead::DoRunL() |
202 { |
208 { |
203 LOGSMSPROT3("CSmsPDURead::DoRunL [iStatus=%d, iState=%d]", iStatus.Int(), iState); |
209 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DORUNL_1, "CSmsPDURead::DoRunL [iStatus=%d, iState=%d]", iStatus.Int(), iState); |
204 |
210 |
205 // |
211 // |
206 // Handle state changes only for successful operations. Any errors will be |
212 // Handle state changes only for successful operations. Any errors will be |
207 // handled when Complete() is called following this DoRunL() call. |
213 // handled when Complete() is called following this DoRunL() call. |
208 // Complete() is not called if the object becomes active. |
214 // Complete() is not called if the object becomes active. |
229 |
235 |
230 case ESmsPDUReadWaitingForPDU: |
236 case ESmsPDUReadWaitingForPDU: |
231 { |
237 { |
232 if (iStatus.Int() == KErrNone) |
238 if (iStatus.Int() == KErrNone) |
233 { |
239 { |
234 LOGSMSIFPDU(_L8("ETEL RX PDU: "), iMsgData, EFalse); |
240 #if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG) |
235 LOGSMSIFTIMESTAMP(); |
241 LogSmsIfPDU(_L8("ETEL RX PDU: "), iMsgData, EFalse); |
|
242 TBuf<40> timestamp; |
|
243 SmsTimeStampL(timestamp); |
|
244 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS,CSMSPDUREAD_DORUNL_2, "%S",timestamp); |
|
245 #endif |
236 ProcessPDUL(); |
246 ProcessPDUL(); |
237 } |
247 } |
238 } |
248 } |
239 break; |
249 break; |
240 |
250 |
264 |
274 |
265 case ESmsPDUReadSystemOutOfMemorySendNegativeAck: |
275 case ESmsPDUReadSystemOutOfMemorySendNegativeAck: |
266 { |
276 { |
267 if (iStatus.Int() == KErrNone) |
277 if (iStatus.Int() == KErrNone) |
268 { |
278 { |
269 LOGSMSPROT1("CSmsPDURead::DoRunL in ESmsPDUReadSystemOutOfMemorySendNack2"); |
279 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DORUNL_3, "CSmsPDURead::DoRunL in ESmsPDUReadSystemOutOfMemorySendNack2"); |
270 LOGSMSPROT1("CSmsPDURead::DoRunL activate post OOM timer"); |
280 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DORUNL_4, "CSmsPDURead::DoRunL activate post OOM timer"); |
271 iState = ESmsPDUWaitTimerAfterOOM; |
281 iState = ESmsPDUWaitTimerAfterOOM; |
272 iOOMTimer.After(iStatus,KWaitReadPduTime); |
282 iOOMTimer.After(iStatus,KWaitReadPduTime); |
273 SetActive(); |
283 SetActive(); |
274 } |
284 } |
275 } |
285 } |
309 /** |
319 /** |
310 * public method for starting receive message |
320 * public method for starting receive message |
311 */ |
321 */ |
312 void CSmsPDURead::ResumeSmsReception() |
322 void CSmsPDURead::ResumeSmsReception() |
313 { |
323 { |
314 LOGSMSPROT3("CSmsPDURead::ResumeSmsReception [iStatus=%d, iState=%d]", iStatus.Int(), iState ); |
324 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_RESUMESMSRECEPTION_1, "CSmsPDURead::ResumeSmsReception [iStatus=%d, iState=%d]", iStatus.Int(), iState ); |
315 |
325 |
316 if (!IsActive()) |
326 if (!IsActive()) |
317 { |
327 { |
318 iDelayedResumeSmsReceptionRequired = EFalse; |
328 iDelayedResumeSmsReceptionRequired = EFalse; |
319 iSmsReceptionSupended = EFalse; |
329 iSmsReceptionSupended = EFalse; |
334 /** |
344 /** |
335 * private method for starting receive message |
345 * private method for starting receive message |
336 */ |
346 */ |
337 void CSmsPDURead::Receive() |
347 void CSmsPDURead::Receive() |
338 { |
348 { |
339 LOGSMSPROT3("CSmsPDURead::Receive [iStatus=%d, iState=%d]", iStatus.Int(), iState ); |
349 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_RECEIVE_1, "CSmsPDURead::Receive [iStatus=%d, iState=%d]", iStatus.Int(), iState ); |
340 |
350 |
341 // |
351 // |
342 // Check if we need to resume reception first. This may be required if a |
352 // Check if we need to resume reception first. This may be required if a |
343 // previous attempt to resume could not be actioned. |
353 // previous attempt to resume could not be actioned. |
344 // |
354 // |
372 * Cancels reveive message |
382 * Cancels reveive message |
373 * Completes CSmsPDURead object |
383 * Completes CSmsPDURead object |
374 */ |
384 */ |
375 void CSmsPDURead::DoCancel() |
385 void CSmsPDURead::DoCancel() |
376 { |
386 { |
377 LOGSMSPROT3("CSmsPDURead::DoCancel [iStatus=%d iState=%d]", iStatus.Int(), iState ); |
387 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DOCANCEL_1, "CSmsPDURead::DoCancel [iStatus=%d iState=%d]", iStatus.Int(), iState ); |
378 |
388 |
379 TimedSetActiveCancel(); |
389 TimedSetActiveCancel(); |
380 |
390 |
381 switch (iState) |
391 switch (iState) |
382 { |
392 { |
453 } // CSmsPDURead::DoCancel |
463 } // CSmsPDURead::DoCancel |
454 |
464 |
455 |
465 |
456 void CSmsPDURead::AddLogEvent() |
466 void CSmsPDURead::AddLogEvent() |
457 { |
467 { |
458 LOGSMSPROT1("CSmsPDURead::AddLogEvent()"); |
468 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_ADDLOGEVENT_1, "CSmsPDURead::AddLogEvent()"); |
459 |
469 |
460 iState = ESmsPDUReadLogging; |
470 iState = ESmsPDUReadLogging; |
461 |
471 |
462 if (iPduProcessor->OriginalSmsMessage() == NULL) |
472 if (iPduProcessor->OriginalSmsMessage() == NULL) |
463 { |
473 { |
484 } // CSmsPDURead::AddLogEvent |
494 } // CSmsPDURead::AddLogEvent |
485 |
495 |
486 |
496 |
487 void CSmsPDURead::DoEncodeDeliverReportL() |
497 void CSmsPDURead::DoEncodeDeliverReportL() |
488 { |
498 { |
489 LOGSMSPROT2("CSmsPDUReadProcess::DoEncodeDeliverReport [iStatus=%d]", iStatus.Int()); |
499 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DOENCODEDELIVERREPORTL_1, "CSmsPDUReadProcess::DoEncodeDeliverReport [iStatus=%d]", iStatus.Int()); |
490 |
500 |
491 iDeliverReport.SetPdu(KNullDesC8); |
501 iDeliverReport.SetPdu(KNullDesC8); |
492 |
502 |
493 const TPtrC des(iPduProcessor->DeliverReportBuffer()); |
503 const TPtrC des(iPduProcessor->DeliverReportBuffer()); |
494 CSmsBuffer* buffer = CSmsBuffer::NewL(); |
504 CSmsBuffer* buffer = CSmsBuffer::NewL(); |
500 switch(iState) |
510 switch(iState) |
501 { |
511 { |
502 case ESmsPDUReadInvalidPDUSendNegativeAck: |
512 case ESmsPDUReadInvalidPDUSendNegativeAck: |
503 case ESmsPDUReadSystemOutOfMemorySendNegativeAck: |
513 case ESmsPDUReadSystemOutOfMemorySendNegativeAck: |
504 { |
514 { |
505 LOGSMSPROT4("CSmsPDURead::DoEncodeDeliverReport SendNegativeAck [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]", |
515 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DOENCODEDELIVERREPORTL_2, "CSmsPDURead::DoEncodeDeliverReport SendNegativeAck [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]",iStatus.Int(), iState, iRpErrorCodesSupported); |
506 iStatus.Int(), iState, iRpErrorCodesSupported); |
|
507 |
516 |
508 deliverReport.SetIsRPError(ETrue); |
517 deliverReport.SetIsRPError(ETrue); |
509 const TInt failureCause = ErrorToTPError(iStatus.Int()); |
518 const TInt failureCause = ErrorToTPError(iStatus.Int()); |
510 deliverReport.SetFailureCause((TSmsFailureCause::TSmsFailureCauseError) failureCause); |
519 deliverReport.SetFailureCause((TSmsFailureCause::TSmsFailureCauseError) failureCause); |
511 break; |
520 break; |
512 } |
521 } |
513 case ESmsPDUReadAcceptValidPduSendPositiveAck: |
522 case ESmsPDUReadAcceptValidPduSendPositiveAck: |
514 case ESmsPDUReadAbsorbInvalidPduSendPositiveAck: |
523 case ESmsPDUReadAbsorbInvalidPduSendPositiveAck: |
515 case ESmsPDUReadAbsorbValidPduSendPositiveAck: |
524 case ESmsPDUReadAbsorbValidPduSendPositiveAck: |
516 { |
525 { |
517 LOGSMSPROT4("CSmsPDURead::DoEncodeDeliverReport SendPositiveAck [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]", |
526 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DOENCODEDELIVERREPORTL_3, "CSmsPDURead::DoEncodeDeliverReport SendPositiveAck [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]",iStatus.Int(), iState, iRpErrorCodesSupported); |
518 iStatus.Int(), iState, iRpErrorCodesSupported); |
|
519 deliverReport.SetIsRPError(EFalse); |
527 deliverReport.SetIsRPError(EFalse); |
520 break; |
528 break; |
521 } |
529 } |
522 default: |
530 default: |
523 { |
531 { |
524 LOGSMSPROT4("CSmsPDURead::DoEncodeDeliverReport [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]", |
532 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_DOENCODEDELIVERREPORTL_4, "CSmsPDURead::DoEncodeDeliverReport [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]",iStatus.Int(), iState, iRpErrorCodesSupported); |
525 iStatus.Int(), iState, iRpErrorCodesSupported); |
|
526 SmspPanic( KSmspPanicUnexpectedStateEncountered ); |
533 SmspPanic( KSmspPanicUnexpectedStateEncountered ); |
527 break; |
534 break; |
528 } |
535 } |
529 } |
536 } |
530 |
537 |
566 * @note Basic interface for sending sms deliver report to the SC. |
573 * @note Basic interface for sending sms deliver report to the SC. |
567 */ |
574 */ |
568 void CSmsPDURead::SendDeliverReport() |
575 void CSmsPDURead::SendDeliverReport() |
569 { |
576 { |
570 // Method behaviour based on DEF047323 |
577 // Method behaviour based on DEF047323 |
571 LOGSMSPROT2("CSmsPDUReadProcess::SendDeliverReport(): iStatus=%d ",iStatus.Int()); |
578 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_SENDDELIVERREPORT_1, "CSmsPDUReadProcess::SendDeliverReport(): iStatus=%d ",iStatus.Int()); |
572 |
579 |
573 MakeStateTransitionBasedOnErrorCode(); |
580 MakeStateTransitionBasedOnErrorCode(); |
574 |
581 |
575 if ((iMsgReceiveAttributes.iStatus == RMobileSmsMessaging::EMtMessageUnstoredClientAck) || |
582 if ((iMsgReceiveAttributes.iStatus == RMobileSmsMessaging::EMtMessageUnstoredClientAck) || |
576 (iMsgReceiveAttributes.iStatus == RMobileSmsMessaging::EMtMessageUnknownStatus)) |
583 (iMsgReceiveAttributes.iStatus == RMobileSmsMessaging::EMtMessageUnknownStatus)) |
578 iDeliverReport = TGsmSms(); |
585 iDeliverReport = TGsmSms(); |
579 |
586 |
580 TRAPD(err, DoEncodeDeliverReportL()); |
587 TRAPD(err, DoEncodeDeliverReportL()); |
581 if(err != KErrNone) |
588 if(err != KErrNone) |
582 { |
589 { |
583 LOGSMSPROT2("CSmsPDURead::DoEncodeDeliverReport [err=%d]", err); |
590 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_SENDDELIVERREPORT_2, "CSmsPDURead::DoEncodeDeliverReport [err=%d]", err); |
584 } |
591 } |
585 } |
592 } |
586 else |
593 else |
587 { |
594 { |
588 iDeliverReport.SetPdu(iMsgData); //create quasi deliver report |
595 iDeliverReport.SetPdu(iMsgData); //create quasi deliver report |
609 } |
616 } |
610 break; |
617 break; |
611 |
618 |
612 default: |
619 default: |
613 { |
620 { |
614 LOGSMSPROT4("CSmsPDURead::DoEncodeDeliverReport [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]", |
621 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_SENDDELIVERREPORT_3, "CSmsPDURead::DoEncodeDeliverReport [iStatus=%d, iState=%d, iRpErrorCodesSupported= %d]",iStatus.Int(), iState, iRpErrorCodesSupported); |
615 iStatus.Int(), iState, iRpErrorCodesSupported); |
|
616 SmspPanic( KSmspPanicUnexpectedStateEncountered ); |
622 SmspPanic( KSmspPanicUnexpectedStateEncountered ); |
617 } |
623 } |
618 break; |
624 break; |
619 } |
625 } |
620 |
626 |
626 * Sets state to ESmsPDUReadIdle |
632 * Sets state to ESmsPDUReadIdle |
627 * Completes message receive request to the CSmsProtocol |
633 * Completes message receive request to the CSmsProtocol |
628 */ |
634 */ |
629 void CSmsPDURead::Complete(TInt aError) |
635 void CSmsPDURead::Complete(TInt aError) |
630 { |
636 { |
631 LOGSMSPROT3("CSmsPDURead::Complete [aError=%d, iState=%d]", aError, iState ); |
637 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_COMPLETE_1, "CSmsPDURead::Complete [aError=%d, iState=%d]", aError, iState ); |
632 |
638 |
633 switch (iState) |
639 switch (iState) |
634 { |
640 { |
635 case ESmsPDUReadAcceptValidPduSendPositiveAck: |
641 case ESmsPDUReadAcceptValidPduSendPositiveAck: |
636 { |
642 { |
726 * @param aIndex identifies the bit that represents the error condition in the bit mask |
732 * @param aIndex identifies the bit that represents the error condition in the bit mask |
727 * @param aValue specifies whether the error condition is supported. |
733 * @param aValue specifies whether the error condition is supported. |
728 */ |
734 */ |
729 void CSmsPDURead::SetErrorCodeStatus(enum TRpErrorCodeIndex aIndex, TBool aValue) |
735 void CSmsPDURead::SetErrorCodeStatus(enum TRpErrorCodeIndex aIndex, TBool aValue) |
730 { |
736 { |
731 LOGSMSPROT1("CSmsPDURead::SetErrorCodeStatus()"); |
737 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_SETERRORCODESTATUS_1, "CSmsPDURead::SetErrorCodeStatus()"); |
732 |
738 |
733 if (aValue) |
739 if (aValue) |
734 { |
740 { |
735 iRpErrorCodesSupported |= (((TUint8) 0x01) << aIndex); |
741 iRpErrorCodesSupported |= (((TUint8) 0x01) << aIndex); |
736 } |
742 } |
750 * @return whether the error condition is to be reported in a delivery report, if the |
756 * @return whether the error condition is to be reported in a delivery report, if the |
751 * condition is detected. |
757 * condition is detected. |
752 */ |
758 */ |
753 TBool CSmsPDURead::GetErrorCodeStatus(enum TRpErrorCodeIndex aIndex) |
759 TBool CSmsPDURead::GetErrorCodeStatus(enum TRpErrorCodeIndex aIndex) |
754 { |
760 { |
755 LOGSMSPROT1("CSmsPDURead::GetErrorCodeStatus()"); |
761 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_GETERRORCODESTATUS_1, "CSmsPDURead::GetErrorCodeStatus()"); |
756 |
762 |
757 TBool rc; |
763 TBool rc; |
758 iRpErrorCodesSupported & (((TUint8) 0x01) << aIndex) ? rc = ETrue : rc = EFalse; |
764 iRpErrorCodesSupported & (((TUint8) 0x01) << aIndex) ? rc = ETrue : rc = EFalse; |
759 return rc; |
765 return rc; |
760 } // CSmsPDURead::GetErrorCodeStatus |
766 } // CSmsPDURead::GetErrorCodeStatus |
768 * @param aIndex represents the index to the error status in a bit mask. |
774 * @param aIndex represents the index to the error status in a bit mask. |
769 * @return True if the error can be mapped to a bit mask index, otherwise False |
775 * @return True if the error can be mapped to a bit mask index, otherwise False |
770 */ |
776 */ |
771 TBool CSmsPDURead::MapRpErrorToIndex(TInt aRpErrorCode, TRpErrorCodeIndex& aIndex) |
777 TBool CSmsPDURead::MapRpErrorToIndex(TInt aRpErrorCode, TRpErrorCodeIndex& aIndex) |
772 { |
778 { |
773 LOGSMSPROT1("CSmsPDURead::MapRpErrorToIndex()"); |
779 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_MAPRPERRORTOINDEX_1, "CSmsPDURead::MapRpErrorToIndex()"); |
774 |
780 |
775 switch( aRpErrorCode ) |
781 switch( aRpErrorCode ) |
776 { |
782 { |
777 case KErrGsmSMSInvalidShortMessageTransferReferenceValue: |
783 case KErrGsmSMSInvalidShortMessageTransferReferenceValue: |
778 { |
784 { |
901 { |
907 { |
902 CESockIniData* ini = NULL; |
908 CESockIniData* ini = NULL; |
903 TRAPD(ret, ini=CESockIniData::NewL(_L("smswap.sms.esk"))); |
909 TRAPD(ret, ini=CESockIniData::NewL(_L("smswap.sms.esk"))); |
904 if(ret!=KErrNone) |
910 if(ret!=KErrNone) |
905 { |
911 { |
906 LOGSMSPROT2("esk read failed, error code = [%d]", ret); |
912 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_READCONFIGURABLESMSSETTINGSL_1, "esk read failed, error code = [%d]", ret); |
907 User::Leave(ret); |
913 User::Leave(ret); |
908 } |
914 } |
909 |
915 |
910 CleanupStack::PushL(ini); |
916 CleanupStack::PushL(ini); |
911 |
917 |
978 /** |
984 /** |
979 * Checks that receiving message is supported by Tsy. |
985 * Checks that receiving message is supported by Tsy. |
980 */ |
986 */ |
981 TBool CSmsPDURead::IsSupported() const |
987 TBool CSmsPDURead::IsSupported() const |
982 { |
988 { |
983 LOGSMSPROT1("CSmsPDURead::IsSupported()"); |
989 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_ISSUPPORTED_1, "CSmsPDURead::IsSupported()"); |
984 |
990 |
985 if (( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveUnstoredClientAck ) || |
991 if (( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveUnstoredClientAck ) || |
986 ( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveUnstoredPhoneAck ) || |
992 ( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveUnstoredPhoneAck ) || |
987 ( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveStored ) || |
993 ( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveStored ) || |
988 ( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveEither )) |
994 ( iMobileSmsCaps.iSmsControl & RMobileSmsMessaging::KCapsReceiveEither )) |
1005 * Note that this function also handles the absorption of |
1011 * Note that this function also handles the absorption of |
1006 * valid PDUs when needed. |
1012 * valid PDUs when needed. |
1007 */ |
1013 */ |
1008 void CSmsPDURead::MakeStateTransitionBasedOnErrorCode() |
1014 void CSmsPDURead::MakeStateTransitionBasedOnErrorCode() |
1009 { |
1015 { |
1010 LOGSMSPROT1("CSmsPDURead::MakeStateTransitionBasedOnErrorCode()"); |
1016 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_MAKESTATETRANSITIONBASEDONERRORCODE_1, "CSmsPDURead::MakeStateTransitionBasedOnErrorCode()"); |
1011 |
1017 |
1012 if (iState != ESmsPDUReadWaitingForPDU) |
1018 if (iState != ESmsPDUReadWaitingForPDU) |
1013 SmspPanic( KSmspPanicUnexpectedStateEncountered ); |
1019 SmspPanic( KSmspPanicUnexpectedStateEncountered ); |
1014 |
1020 |
1015 if (iStatus == KErrNoMemory || iStatus == KErrDiskFull) |
1021 if (iStatus == KErrNoMemory || iStatus == KErrDiskFull) |
1038 if (iPduProcessor->IsPIDType0() && |
1044 if (iPduProcessor->IsPIDType0() && |
1039 ( (iPduProcessor->IsClass0Message() && iPduProcessor->IsDiscardType0Class0() ) || |
1045 ( (iPduProcessor->IsClass0Message() && iPduProcessor->IsDiscardType0Class0() ) || |
1040 (iPduProcessor->IsClass2Message() && iPduProcessor->IsDiscardType0Class2() ) || |
1046 (iPduProcessor->IsClass2Message() && iPduProcessor->IsDiscardType0Class2() ) || |
1041 (iPduProcessor->IsClass0Message() == EFalse && iPduProcessor->IsClass2Message() == EFalse)) ) |
1047 (iPduProcessor->IsClass0Message() == EFalse && iPduProcessor->IsClass2Message() == EFalse)) ) |
1042 { |
1048 { |
1043 LOGSMSPROT1("CSmsPDURead::MakeStateTransitionBasedOnErrorCode Absorb Valid PDU"); |
1049 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREAD_MAKESTATETRANSITIONBASEDONERRORCODE_2, "CSmsPDURead::MakeStateTransitionBasedOnErrorCode Absorb Valid PDU"); |
1044 iState = ESmsPDUReadAbsorbValidPduSendPositiveAck; |
1050 iState = ESmsPDUReadAbsorbValidPduSendPositiveAck; |
1045 } |
1051 } |
1046 else |
1052 else |
1047 { |
1053 { |
1048 iState = ESmsPDUReadAcceptValidPduSendPositiveAck; |
1054 iState = ESmsPDUReadAcceptValidPduSendPositiveAck; |
1059 * @param aPriority ActiveScheduler priority of this active object |
1065 * @param aPriority ActiveScheduler priority of this active object |
1060 * @return Newly constructed CSmsPDUReadLogger |
1066 * @return Newly constructed CSmsPDUReadLogger |
1061 */ |
1067 */ |
1062 CSmsPDUReadLogger* CSmsPDUReadLogger::NewL(RFs& aFs, TInt aPriority) |
1068 CSmsPDUReadLogger* CSmsPDUReadLogger::NewL(RFs& aFs, TInt aPriority) |
1063 { |
1069 { |
1064 LOGSMSPROT1("CSmsPDUReadLogger::NewL()"); |
1070 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_NEWL_1, "CSmsPDUReadLogger::NewL()"); |
1065 |
1071 |
1066 CSmsPDUReadLogger* self = new (ELeave) CSmsPDUReadLogger(aPriority); |
1072 CSmsPDUReadLogger* self = new (ELeave) CSmsPDUReadLogger(aPriority); |
1067 CleanupStack::PushL(self); |
1073 CleanupStack::PushL(self); |
1068 self->ConstructL(aFs); |
1074 self->ConstructL(aFs); |
1069 CleanupStack::Pop(self); |
1075 CleanupStack::Pop(self); |
1089 * @param aFs File Server session |
1095 * @param aFs File Server session |
1090 * @leave Leaves (usually with KErrNoMemory) if unable to construct the CSmsEventLogger |
1096 * @leave Leaves (usually with KErrNoMemory) if unable to construct the CSmsEventLogger |
1091 */ |
1097 */ |
1092 void CSmsPDUReadLogger::ConstructL(RFs& aFs) |
1098 void CSmsPDUReadLogger::ConstructL(RFs& aFs) |
1093 { |
1099 { |
1094 LOGSMSPROT1("CSmsPDUReadLogger::ConstructL()"); |
1100 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_CONSTRUCTL_1, "CSmsPDUReadLogger::ConstructL()"); |
1095 |
1101 |
1096 iLogger = CSmsEventLogger::NewL(aFs, Priority()); |
1102 iLogger = CSmsEventLogger::NewL(aFs, Priority()); |
1097 } // CSmsPDUReadLogger::ConstructL |
1103 } // CSmsPDUReadLogger::ConstructL |
1098 |
1104 |
1099 |
1105 |
1115 * @param aTime Sms delivery time |
1121 * @param aTime Sms delivery time |
1116 * @leave Completes aStatus with KErrNone if there is no logging client available |
1122 * @leave Completes aStatus with KErrNone if there is no logging client available |
1117 */ |
1123 */ |
1118 void CSmsPDUReadLogger::ChangeOrAddLogEvent(CSmsMessage& aSmsMessage, const TLogSmsPduData& aSmsPDUData, const TTime* aTime, TRequestStatus& aStatus) |
1124 void CSmsPDUReadLogger::ChangeOrAddLogEvent(CSmsMessage& aSmsMessage, const TLogSmsPduData& aSmsPDUData, const TTime* aTime, TRequestStatus& aStatus) |
1119 { |
1125 { |
1120 LOGSMSPROT1("CSmsPDUReadLogger::ChangeOrAddLogEvent()"); |
1126 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_CHANGEORADDLOGEVENT_1, "CSmsPDUReadLogger::ChangeOrAddLogEvent()"); |
1121 |
1127 |
1122 __ASSERT_DEBUG(iState == ESmsPDUReadLoggerIdle, SmspPanic(KSmspPanicUnexpectedState)); |
1128 __ASSERT_DEBUG(iState == ESmsPDUReadLoggerIdle, SmspPanic(KSmspPanicUnexpectedState)); |
1123 |
1129 |
1124 Queue(aStatus); |
1130 Queue(aStatus); |
1125 |
1131 |
1151 /** |
1157 /** |
1152 * Adds iSmsMessage to the log |
1158 * Adds iSmsMessage to the log |
1153 */ |
1159 */ |
1154 void CSmsPDUReadLogger::AddLogEvent() |
1160 void CSmsPDUReadLogger::AddLogEvent() |
1155 { |
1161 { |
1156 LOGSMSPROT1("CSmsPDUReadLogger::AddLogEvent()"); |
1162 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_ADDLOGEVENT_1, "CSmsPDUReadLogger::AddLogEvent()"); |
1157 |
1163 |
1158 iState = ESmsPDUReadLoggerAdd; |
1164 iState = ESmsPDUReadLoggerAdd; |
1159 |
1165 |
1160 iLogger->AddEvent(iStatus, *iSmsMessage, *iSmsPDUData); |
1166 iLogger->AddEvent(iStatus, *iSmsMessage, *iSmsPDUData); |
1161 SetActive(); |
1167 SetActive(); |
1165 /** |
1171 /** |
1166 * Gets the log event with Id iSmsMessage->LogServerId() |
1172 * Gets the log event with Id iSmsMessage->LogServerId() |
1167 */ |
1173 */ |
1168 void CSmsPDUReadLogger::GetLogEvent() |
1174 void CSmsPDUReadLogger::GetLogEvent() |
1169 { |
1175 { |
1170 LOGSMSPROT1("CSmsPDUReadLogger::GetLogEvent()"); |
1176 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_GETLOGEVENT_1, "CSmsPDUReadLogger::GetLogEvent()"); |
1171 |
1177 |
1172 __ASSERT_DEBUG(iSmsMessage->LogServerId() != KLogNullId, SmspPanic(KSmspPanicLogIdNull)); |
1178 __ASSERT_DEBUG(iSmsMessage->LogServerId() != KLogNullId, SmspPanic(KSmspPanicLogIdNull)); |
1173 |
1179 |
1174 iState = ESmsPDUReadLoggerGet; |
1180 iState = ESmsPDUReadLoggerGet; |
1175 |
1181 |
1181 /** |
1187 /** |
1182 * Changes the log event with iSmsMessage and iSmsPDUData |
1188 * Changes the log event with iSmsMessage and iSmsPDUData |
1183 */ |
1189 */ |
1184 void CSmsPDUReadLogger::ChangeLogEvent() |
1190 void CSmsPDUReadLogger::ChangeLogEvent() |
1185 { |
1191 { |
1186 LOGSMSPROT1("CSmsPDUReadLogger::ChangeLogEvent()"); |
1192 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_CHANGELOGEVENT_1, "CSmsPDUReadLogger::ChangeLogEvent()"); |
1187 |
1193 |
1188 iState = ESmsPDUReadLoggerChange; |
1194 iState = ESmsPDUReadLoggerChange; |
1189 iLogger->ChangeEvent(iStatus, *iSmsMessage, iTimePtr, *iSmsPDUData); |
1195 iLogger->ChangeEvent(iStatus, *iSmsMessage, iTimePtr, *iSmsPDUData); |
1190 SetActive(); |
1196 SetActive(); |
1191 } // CSmsPDUReadLogger::ChangeLogEvent |
1197 } // CSmsPDUReadLogger::ChangeLogEvent |
1192 |
1198 |
1193 |
1199 |
1194 void CSmsPDUReadLogger::DoRunL() |
1200 void CSmsPDUReadLogger::DoRunL() |
1195 { |
1201 { |
1196 LOGSMSPROT1("CSmsPDUReadLogger::DoRunL()"); |
1202 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_DORUNL_1, "CSmsPDUReadLogger::DoRunL()"); |
1197 |
1203 |
1198 switch (iState) |
1204 switch (iState) |
1199 { |
1205 { |
1200 case ESmsPDUReadLoggerGet: |
1206 case ESmsPDUReadLoggerGet: |
1201 { |
1207 { |
1241 // only if CSmsPDURead is itself cancelled during logging state. |
1247 // only if CSmsPDURead is itself cancelled during logging state. |
1242 // CSmsPDURead is only cancelled when SMS stack shuts down. These |
1248 // CSmsPDURead is only cancelled when SMS stack shuts down. These |
1243 // conditions are very difficult to create in a deterministic way. |
1249 // conditions are very difficult to create in a deterministic way. |
1244 BULLSEYE_OFF |
1250 BULLSEYE_OFF |
1245 |
1251 |
1246 LOGSMSPROT1("CSmsPDUReadLogger::DoCancel()"); |
1252 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_DOCANCEL_1, "CSmsPDUReadLogger::DoCancel()"); |
1247 |
1253 |
1248 iLogger->Cancel(); |
1254 iLogger->Cancel(); |
1249 |
1255 |
1250 // |
1256 // |
1251 // Handle completion of this Active Object. Note that the object |
1257 // Handle completion of this Active Object. Note that the object |
1262 BULLSEYE_RESTORE |
1268 BULLSEYE_RESTORE |
1263 } |
1269 } |
1264 |
1270 |
1265 void CSmsPDUReadLogger::Complete(TInt aStatus) |
1271 void CSmsPDUReadLogger::Complete(TInt aStatus) |
1266 { |
1272 { |
1267 LOGSMSPROT1("CSmsPDUReadLogger::Complete()"); |
1273 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUREADLOGGER_COMPLETE_1, "CSmsPDUReadLogger::Complete()"); |
1268 |
1274 |
1269 // Call the base function to perform the actual complete... |
1275 // Call the base function to perform the actual complete... |
1270 CSmsuActiveBase::Complete(aStatus); |
1276 CSmsuActiveBase::Complete(aStatus); |
1271 |
1277 |
1272 iState = ESmsPDUReadLoggerIdle; |
1278 iState = ESmsPDUReadLoggerIdle; |