1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2003-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". |
60 * 2 phase constructor |
66 * 2 phase constructor |
61 * |
67 * |
62 */ |
68 */ |
63 CSmsProtocolFamily * CSmsProtocolFamily::NewL() |
69 CSmsProtocolFamily * CSmsProtocolFamily::NewL() |
64 { |
70 { |
65 LOGSMSPROT4("CSmsProtocolFamily::NewL [version %d.%d.%d]", |
71 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOLFAMILY_NEWL_1, "CSmsProtocolFamily::NewL [version %u.%u.%u]",KSmsPrtMajorVersionNumber,KSmsPrtMinorVersionNumber,KSmsPrtBuildVersionNumber ); |
66 KSmsPrtMajorVersionNumber, |
|
67 KSmsPrtMinorVersionNumber, |
|
68 KSmsPrtBuildVersionNumber |
|
69 ); |
|
70 return new (ELeave)CSmsProtocolFamily; |
72 return new (ELeave)CSmsProtocolFamily; |
71 } // CSmsProtocolFamily::NewL |
73 } // CSmsProtocolFamily::NewL |
72 |
74 |
73 |
75 |
74 /** |
76 /** |
107 * @return a new instance of the CSmsProtocol class. |
109 * @return a new instance of the CSmsProtocol class. |
108 * |
110 * |
109 */ |
111 */ |
110 CProtocolBase * CSmsProtocolFamily::NewProtocolL(TUint /*aSockType*/,TUint /*aProtocol*/) |
112 CProtocolBase * CSmsProtocolFamily::NewProtocolL(TUint /*aSockType*/,TUint /*aProtocol*/) |
111 { |
113 { |
112 LOGSMSPROT1("CSmsProtocolFamily::NewProtocolL"); |
114 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOLFAMILY_NEWPROTOCOLL_1 , "CSmsProtocolFamily::NewProtocolL"); |
113 return CSmsProtocol::NewL(); |
115 return CSmsProtocol::NewL(); |
114 } // CProtocolFamilyBase::NewProtocolL |
116 } // CProtocolFamilyBase::NewProtocolL |
115 |
117 |
116 |
118 |
117 /** |
119 /** |
125 * @return the number of protocols supported (1). |
127 * @return the number of protocols supported (1). |
126 * |
128 * |
127 */ |
129 */ |
128 TUint CSmsProtocolFamily::ProtocolList(TServerProtocolDesc *& aProtocolList) |
130 TUint CSmsProtocolFamily::ProtocolList(TServerProtocolDesc *& aProtocolList) |
129 { |
131 { |
130 LOGSMSPROT1("CSmsProtocolFamily::ProtocolList"); |
132 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOLFAMILY_PROTOCOLLIST_1, "CSmsProtocolFamily::ProtocolList"); |
131 |
133 |
132 TRAPD(ret, (aProtocolList=new(ELeave) TServerProtocolDesc[1])); |
134 TRAPD(ret, (aProtocolList=new(ELeave) TServerProtocolDesc[1])); |
133 if(ret!=KErrNone) |
135 if(ret!=KErrNone) |
134 { |
136 { |
135 LOGSMSPROT2("WARNING! new TServerProtocolDesc left with %d", ret); |
137 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOLFAMILY_PROTOCOLLIST_2, "WARNING! new TServerProtocolDesc left with %d", ret); |
136 return 0; |
138 return 0; |
137 } |
139 } |
138 |
140 |
139 // Datagram protocol |
141 // Datagram protocol |
140 aProtocolList[0].iName=KSmsDatagram; |
142 aProtocolList[0].iName=KSmsDatagram; |
167 * an instance of our CProtocolFamilyBase derived class. |
169 * an instance of our CProtocolFamilyBase derived class. |
168 * |
170 * |
169 */ |
171 */ |
170 EXPORT_C CProtocolFamilyBase* InstallSMS() |
172 EXPORT_C CProtocolFamilyBase* InstallSMS() |
171 { |
173 { |
172 LOGSMSPROT1("CSmsProtocolFamily::CSmsProtocolFamily()"); |
174 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, INSTALLSMS_1, "CSmsProtocolFamily::CSmsProtocolFamily()"); |
173 |
175 |
174 CSmsProtocolFamily* smsProtocolFamily(NULL); |
176 CSmsProtocolFamily* smsProtocolFamily(NULL); |
175 |
177 |
176 TRAP_IGNORE(smsProtocolFamily = CSmsProtocolFamily::NewL()); |
178 TRAP_IGNORE(smsProtocolFamily = CSmsProtocolFamily::NewL()); |
177 |
179 |
250 * @return a new CSmsProvider object. |
252 * @return a new CSmsProvider object. |
251 * |
253 * |
252 */ |
254 */ |
253 CServProviderBase *CSmsProtocol::NewSAPL(TUint aSocketType) |
255 CServProviderBase *CSmsProtocol::NewSAPL(TUint aSocketType) |
254 { |
256 { |
255 LOGSMSPROT2("*CSmsProtocol::NewSAPL [sockettype=%d]", aSocketType); |
257 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_NEWSAPL_1, "*CSmsProtocol::NewSAPL [sockettype=%d]", aSocketType); |
256 if (aSocketType!=KSockDatagram) |
258 if (aSocketType!=KSockDatagram) |
257 User::Leave(KErrNotSupported); |
259 User::Leave(KErrNotSupported); |
258 return CSmsProvider::NewL(*this); |
260 return CSmsProvider::NewL(*this); |
259 } // CProtocolBase::NewSAPL |
261 } // CProtocolBase::NewSAPL |
260 |
262 |
272 * state machines started (otherwise wait until we receive notification of connection). |
274 * state machines started (otherwise wait until we receive notification of connection). |
273 * |
275 * |
274 */ |
276 */ |
275 void CSmsProtocol::InitL(TDesC& /*aTag*/) |
277 void CSmsProtocol::InitL(TDesC& /*aTag*/) |
276 { |
278 { |
277 LOGSMSPROT1("CSmsProtocol::InitL"); |
279 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_INITL_1, "CSmsProtocol::InitL"); |
278 |
280 |
279 User::LeaveIfError(iFs.Connect()); |
281 User::LeaveIfError(iFs.Connect()); |
280 |
282 |
281 iReassemblyStore=CFacadeSmsReassemblyStore::NewL(iFs, *this); |
283 iReassemblyStore=CFacadeSmsReassemblyStore::NewL(iFs, *this); |
282 iReassemblyStore->InitL(); |
284 iReassemblyStore->InitL(); |
283 |
285 |
284 LOGSMSPROT1("CSmsProtocol::InitL Constructing members"); |
286 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_INITL_2, "CSmsProtocol::InitL Constructing members"); |
285 |
287 |
286 ReadConfigurableSettingsL(); |
288 ReadConfigurableSettingsL(); |
287 |
289 |
288 iBootTimer = CSmsProtocolBootTimer::NewL(*this); |
290 iBootTimer = CSmsProtocolBootTimer::NewL(*this); |
289 iBootTimer->Start(iSmsSettings.BootTimerTimeout().Int()); |
291 iBootTimer->Start(iSmsSettings.BootTimerTimeout().Int()); |
342 iGsmTsyName = *tsyField; |
344 iGsmTsyName = *tsyField; |
343 CleanupStack::PopAndDestroy(tsyField); |
345 CleanupStack::PopAndDestroy(tsyField); |
344 |
346 |
345 CleanupStack::PopAndDestroy(sess); |
347 CleanupStack::PopAndDestroy(sess); |
346 |
348 |
347 #ifdef _SMS_LOGGING_ENABLED |
349 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_INITL_4, "CSmsProtocol::InitL [modemId=%d tsy=%S]",(TInt)modemId, iGsmTsyName ); |
348 TBuf8<KCommsDbSvrMaxFieldLength> buf8; |
|
349 buf8.Copy(iGsmTsyName); |
|
350 LOGSMSPROT3("CSmsProtocol::InitL [modemId=%d tsy=%S]", |
|
351 modemId, &buf8); |
|
352 #endif |
|
353 |
350 |
354 // Start event notification state machines |
351 // Start event notification state machines |
355 iSmsModemNotification->Start(); |
352 iSmsModemNotification->Start(); |
356 |
353 |
357 // Intialise the SmsStack to the state that the phone has been found in |
354 // Intialise the SmsStack to the state that the phone has been found in |
394 * Binding is not supported so this indication is not important to us. |
391 * Binding is not supported so this indication is not important to us. |
395 * |
392 * |
396 */ |
393 */ |
397 void CSmsProtocol::StartL(void) |
394 void CSmsProtocol::StartL(void) |
398 { |
395 { |
399 LOGSMSPROT1("CSmsProtocol::StartL"); |
396 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_STARTL_1, "CSmsProtocol::StartL"); |
400 } // CSmsProtocol::StartL |
397 } // CSmsProtocol::StartL |
401 |
398 |
402 |
399 |
403 /** |
400 /** |
404 * Override of CProtocolBase::Identify(). |
401 * Override of CProtocolBase::Identify(). |
405 * Called by the socket server to obtain a description of the SMS protocol. |
402 * Called by the socket server to obtain a description of the SMS protocol. |
406 * |
403 * |
407 */ |
404 */ |
408 void CSmsProtocol::Identify(TServerProtocolDesc *aDesc)const |
405 void CSmsProtocol::Identify(TServerProtocolDesc *aDesc)const |
409 { |
406 { |
410 LOGSMSPROT1("CSmsProtocol::Identify"); |
407 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_IDENTIFY_1, "CSmsProtocol::Identify"); |
411 |
408 |
412 aDesc->iName=KSmsDatagram; |
409 aDesc->iName=KSmsDatagram; |
413 aDesc->iAddrFamily=KSMSAddrFamily; |
410 aDesc->iAddrFamily=KSMSAddrFamily; |
414 aDesc->iSockType=KSockDatagram; |
411 aDesc->iSockType=KSockDatagram; |
415 aDesc->iProtocol=KSMSDatagramProtocol; |
412 aDesc->iProtocol=KSMSDatagramProtocol; |
523 { |
520 { |
524 CESockIniData* ini = NULL; |
521 CESockIniData* ini = NULL; |
525 TRAPD(ret, ini=CESockIniData::NewL(_L("smswap.sms.esk"))); |
522 TRAPD(ret, ini=CESockIniData::NewL(_L("smswap.sms.esk"))); |
526 if(ret!=KErrNone) |
523 if(ret!=KErrNone) |
527 { |
524 { |
528 LOGSMSPROT2("esk read failed, error code = [%d]", ret); |
525 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_READCONFIGURABLESETTINGSL_1, "esk read failed, error code = [%d]", ret); |
529 User::Leave(ret); |
526 User::Leave(ret); |
530 } |
527 } |
531 |
528 |
532 CleanupStack::PushL(ini); |
529 CleanupStack::PushL(ini); |
533 |
530 |
534 TInt var(0); |
531 TInt var(0); |
535 if(ini->FindVar(_L("customTimeoutSettings"),_L("sendTryTimeout"),var)) |
532 if(ini->FindVar(_L("customTimeoutSettings"),_L("sendTryTimeout"),var)) |
536 { |
533 { |
537 if (var > 0) |
534 if (var > 0) |
538 { |
535 { |
539 LOGSMSPROT2("sendTryTimeout [%d]", var); |
536 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_READCONFIGURABLESETTINGSL_2, "sendTryTimeout [%d]", var); |
540 iSmsSettings.SetSendTryTimeout(var); |
537 iSmsSettings.SetSendTryTimeout(var); |
541 } |
538 } |
542 else |
539 else |
543 { |
540 { |
544 User::Leave(KErrArgument); |
541 User::Leave(KErrArgument); |
547 |
544 |
548 if(ini->FindVar(_L("customTimeoutSettings"),_L("bootTimerTimeout"),var)) |
545 if(ini->FindVar(_L("customTimeoutSettings"),_L("bootTimerTimeout"),var)) |
549 { |
546 { |
550 if (var > 0) |
547 if (var > 0) |
551 { |
548 { |
552 LOGSMSPROT2("bootTimerTimeout [%d]", var); |
549 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_READCONFIGURABLESETTINGSL_3, "bootTimerTimeout [%d]", var); |
553 iSmsSettings.SetBootTimerTimeout(var); |
550 iSmsSettings.SetBootTimerTimeout(var); |
554 } |
551 } |
555 else |
552 else |
556 { |
553 { |
557 User::Leave(KErrArgument); |
554 User::Leave(KErrArgument); |
572 */ |
569 */ |
573 TInt CSmsProtocol::Send(TDes8& /*aDes*/,TSockAddr* /*aTo*/,TSockAddr* /*aFrom*/,CProtocolBase* /*aSourceProtocol*/) |
570 TInt CSmsProtocol::Send(TDes8& /*aDes*/,TSockAddr* /*aTo*/,TSockAddr* /*aFrom*/,CProtocolBase* /*aSourceProtocol*/) |
574 { |
571 { |
575 // Ignore in code coverage - not intended to be used |
572 // Ignore in code coverage - not intended to be used |
576 BULLSEYE_OFF |
573 BULLSEYE_OFF |
577 LOGSMSPROT1("CSmsProtocol::Send"); |
574 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_SEND_1, "CSmsProtocol::Send"); |
578 SmspPanic(ESmspCantSend); |
575 SmspPanic(ESmspCantSend); |
579 return KErrNotSupported; |
576 return KErrNotSupported; |
580 BULLSEYE_RESTORE |
577 BULLSEYE_RESTORE |
581 } |
578 } |
582 |
579 |
590 */ |
587 */ |
591 void CSmsProtocol::Process(TDes8& /*aDes*/,TSockAddr* /*aFrom*/,TSockAddr* /*aTo*/,CProtocolBase* /*aSourceProtocol*/) |
588 void CSmsProtocol::Process(TDes8& /*aDes*/,TSockAddr* /*aFrom*/,TSockAddr* /*aTo*/,CProtocolBase* /*aSourceProtocol*/) |
592 { |
589 { |
593 // Ignore in code coverage - not intended to be used |
590 // Ignore in code coverage - not intended to be used |
594 BULLSEYE_OFF |
591 BULLSEYE_OFF |
595 LOGSMSPROT1("CSmsProtocol::Process"); |
592 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_PROCESS_1, "CSmsProtocol::Process"); |
596 SmspPanic(ESmspCantProcess); |
593 SmspPanic(ESmspCantProcess); |
597 BULLSEYE_RESTORE |
594 BULLSEYE_RESTORE |
598 } |
595 } |
599 |
596 |
600 /** |
597 /** |
607 */ |
604 */ |
608 TInt CSmsProtocol::GetOption(TUint /*aLevel*/,TUint /*aName*/,TDes8 & /*aOption*/,CProtocolBase* /*aSourceProtocol*/) |
605 TInt CSmsProtocol::GetOption(TUint /*aLevel*/,TUint /*aName*/,TDes8 & /*aOption*/,CProtocolBase* /*aSourceProtocol*/) |
609 { |
606 { |
610 // Ignore in code coverage - not intended to be used |
607 // Ignore in code coverage - not intended to be used |
611 BULLSEYE_OFF |
608 BULLSEYE_OFF |
612 LOGSMSPROT1("CSmsProtocol::GetOption"); |
609 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_GETOPTION_1, "CSmsProtocol::GetOption"); |
613 // SmspPanic(ESmspCantGetOption); |
610 // SmspPanic(ESmspCantGetOption); |
614 return KErrNotSupported; |
611 return KErrNotSupported; |
615 BULLSEYE_RESTORE |
612 BULLSEYE_RESTORE |
616 } |
613 } |
617 |
614 |
625 */ |
622 */ |
626 TInt CSmsProtocol::SetOption(TUint /*aLevel*/,TUint /*aName*/,const TDesC8& /*option*/,CProtocolBase* /*aSourceProtocol*/) |
623 TInt CSmsProtocol::SetOption(TUint /*aLevel*/,TUint /*aName*/,const TDesC8& /*option*/,CProtocolBase* /*aSourceProtocol*/) |
627 { |
624 { |
628 // Ignore in code coverage - not intended to be used |
625 // Ignore in code coverage - not intended to be used |
629 BULLSEYE_OFF |
626 BULLSEYE_OFF |
630 LOGSMSPROT1("CSmsProtocol::SetOption"); |
627 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_SETOPTION_1, "CSmsProtocol::SetOption"); |
631 //SmspPanic(ESmspCantSetOption); |
628 //SmspPanic(ESmspCantSetOption); |
632 return KErrNotSupported; |
629 return KErrNotSupported; |
633 BULLSEYE_RESTORE |
630 BULLSEYE_RESTORE |
634 } |
631 } |
635 |
632 |
657 * @leave Leaves if not enough memory is available. |
654 * @leave Leaves if not enough memory is available. |
658 * |
655 * |
659 */ |
656 */ |
660 void CSmsProtocol::AddSmsMessageObserverL(MSmsMessageObserver& aObserver) |
657 void CSmsProtocol::AddSmsMessageObserverL(MSmsMessageObserver& aObserver) |
661 { |
658 { |
662 LOGSMSPROT2("CSmsProtocol::AddSmsMessageObserverL [aObserver=0x%08x]", &aObserver); |
659 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_ADDSMSMESSAGEOBSERVERL_1, "CSmsProtocol::AddSmsMessageObserverL [aObserver=0x%08x]", &aObserver); |
663 iSmsMessageObserverList.AppendL(&aObserver); |
660 iSmsMessageObserverList.AppendL(&aObserver); |
664 SetClosingDown(EFalse); |
661 SetClosingDown(EFalse); |
665 } |
662 } |
666 |
663 |
667 /** |
664 /** |
674 * @return KErrNone on success, or KErrAlreadyExists if a duplicate exists. |
671 * @return KErrNone on success, or KErrAlreadyExists if a duplicate exists. |
675 * |
672 * |
676 */ |
673 */ |
677 TInt CSmsProtocol::BindSmsMessageObserver(MSmsMessageObserver& aObserver,const TSmsAddr& aSmsAddr) |
674 TInt CSmsProtocol::BindSmsMessageObserver(MSmsMessageObserver& aObserver,const TSmsAddr& aSmsAddr) |
678 { |
675 { |
679 LOGSMSPROT2("CSmsProtocol::BindSmsMessageObserver 0x%08x", &aObserver); |
676 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_BINDSMSMESSAGEOBSERVER_1, "CSmsProtocol::BindSmsMessageObserver 0x%08x", &aObserver); |
680 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
677 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
681 TInt ret=KErrNone; |
678 TInt ret=KErrNone; |
682 |
679 |
683 if (!SmsAddrIsAlreadyUsed(&aObserver,aSmsAddr)) |
680 if (!SmsAddrIsAlreadyUsed(&aObserver,aSmsAddr)) |
684 { |
681 { |
713 * Observers should at least call this method in their destructors. |
710 * Observers should at least call this method in their destructors. |
714 * |
711 * |
715 */ |
712 */ |
716 void CSmsProtocol::RemoveSmsMessageObserver(const MSmsMessageObserver& aObserver) |
713 void CSmsProtocol::RemoveSmsMessageObserver(const MSmsMessageObserver& aObserver) |
717 { |
714 { |
718 LOGSMSPROT2("CSmsProtocol::RemoveSmsMessageObserver 0x%08x", &aObserver); |
715 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_REMOVESMSMESSAGEOBSERVER_1, "CSmsProtocol::RemoveSmsMessageObserver 0x%08x", &aObserver); |
719 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
716 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
720 TInt index=ObserverIndex(aObserver); |
717 TInt index=ObserverIndex(aObserver); |
721 iSmsMessageObserverList.Delete(index); |
718 iSmsMessageObserverList.Delete(index); |
722 } |
719 } |
723 |
720 |
726 * Ensures there is a current connection to the modem and queues the message. |
723 * Ensures there is a current connection to the modem and queues the message. |
727 * Completes with an error immediately if CheckPoweredUp() returns an error code |
724 * Completes with an error immediately if CheckPoweredUp() returns an error code |
728 */ |
725 */ |
729 void CSmsProtocol::SendSmsMessage(CSmsMessage* aSmsMessage,MSmsMessageObserver& aObserver,TUint aOptions) |
726 void CSmsProtocol::SendSmsMessage(CSmsMessage* aSmsMessage,MSmsMessageObserver& aObserver,TUint aOptions) |
730 { |
727 { |
731 LOGSMSPROT2("CSmsProtocol::SendSmsMessage [aObserver=0x%X]", &aObserver); |
728 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_SENDSMSMESSAGE_1, "CSmsProtocol::SendSmsMessage [aObserver=0x%08X]", (TUint) &aObserver); |
732 __ASSERT_DEBUG(ObserverIsPresent(aObserver), SmspPanic(ESmspMessageObserverNotFound)); |
729 __ASSERT_DEBUG(ObserverIsPresent(aObserver), SmspPanic(ESmspMessageObserverNotFound)); |
733 |
730 |
734 // Ensure the modem is connected and initialized |
731 // Ensure the modem is connected and initialized |
735 const TInt err = CheckPoweredUp(); |
732 const TInt err = CheckPoweredUp(); |
736 |
733 |
762 { |
759 { |
763 err = iSmsPhoneInitialization->Initialized(); |
760 err = iSmsPhoneInitialization->Initialized(); |
764 } |
761 } |
765 if( err != KErrNone ) |
762 if( err != KErrNone ) |
766 { |
763 { |
767 LOGSMSPROT4("CSmsProtocol::CheckPoweredUp [err=%d, iModemDetection=%d, IsBackupOrRestoreInProgress=%d]", err, iModemDetection, iBackupRestoreSession->IsBackupOrRestoreInProgress()); |
764 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CHECKPOWEREDUP_1, "CSmsProtocol::CheckPoweredUp [err=%d, iModemDetection=%d, IsBackupOrRestoreInProgress=%d]", err, iModemDetection, iBackupRestoreSession->IsBackupOrRestoreInProgress()); |
768 } |
765 } |
769 return err; |
766 return err; |
770 } |
767 } |
771 |
768 |
772 /** |
769 /** |
780 * @leave Panics in DEBUG if the message is not found in the queue. |
777 * @leave Panics in DEBUG if the message is not found in the queue. |
781 * |
778 * |
782 */ |
779 */ |
783 void CSmsProtocol::CancelSendSmsMessage(MSmsMessageObserver& aObserver,TBool) |
780 void CSmsProtocol::CancelSendSmsMessage(MSmsMessageObserver& aObserver,TBool) |
784 { |
781 { |
785 LOGSMSPROT2("CSmsProtocol::CancelSendSmsMessage 0x%08x", &aObserver); |
782 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CANCELSENDSMSMESSAGE_1, "CSmsProtocol::CancelSendSmsMessage 0x%08x", &aObserver); |
786 |
783 |
787 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
784 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
788 |
785 |
789 iSendQueue->CancelObserver(aObserver); |
786 iSendQueue->CancelObserver(aObserver); |
790 } // CSmsProtocol::CancelSendSmsMessage |
787 } // CSmsProtocol::CancelSendSmsMessage |
793 /** |
790 /** |
794 * Handles a request from a SAP to enumerate the SMS messages stored on the phone. |
791 * Handles a request from a SAP to enumerate the SMS messages stored on the phone. |
795 */ |
792 */ |
796 void CSmsProtocol::EnumeratePhone(MSmsMessageObserver& aObserver) |
793 void CSmsProtocol::EnumeratePhone(MSmsMessageObserver& aObserver) |
797 { |
794 { |
798 LOGSMSPROT1("CSmsProtocol::EnumeratePhone"); |
795 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_ENUMERATEPHONE_1, "CSmsProtocol::EnumeratePhone"); |
799 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
796 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
800 |
797 |
801 // Ensure the modem is connected and initialized |
798 // Ensure the modem is connected and initialized |
802 const TInt err = CheckPoweredUp(); |
799 const TInt err = CheckPoweredUp(); |
803 |
800 |
824 * @leave Panics in DEBUG if the SAP is invalid. |
821 * @leave Panics in DEBUG if the SAP is invalid. |
825 * |
822 * |
826 */ |
823 */ |
827 void CSmsProtocol::CancelEnumeratePhone(MSmsMessageObserver& aObserver) |
824 void CSmsProtocol::CancelEnumeratePhone(MSmsMessageObserver& aObserver) |
828 { |
825 { |
829 LOGSMSPROT1("CSmsProtocol::CancelEnumeratePhone"); |
826 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CANCELENUMERATEPHONE_1, "CSmsProtocol::CancelEnumeratePhone"); |
830 |
827 |
831 __ASSERT_DEBUG(ObserverIsPresent(aObserver), SmspPanic(ESmspMessageObserverNotFound)); |
828 __ASSERT_DEBUG(ObserverIsPresent(aObserver), SmspPanic(ESmspMessageObserverNotFound)); |
832 __ASSERT_DEBUG(iPhoneEnumerationObserver==NULL || &aObserver==iPhoneEnumerationObserver, SmspPanic(ESmspMessageWrongObserver)); |
829 __ASSERT_DEBUG(iPhoneEnumerationObserver==NULL || &aObserver==iPhoneEnumerationObserver, SmspPanic(ESmspMessageWrongObserver)); |
833 |
830 |
834 if (iSmsPhoneEnumeration != NULL) |
831 if (iSmsPhoneEnumeration != NULL) |
853 * Completes with an error immediately if CheckPoweredUp() returns an error code |
850 * Completes with an error immediately if CheckPoweredUp() returns an error code |
854 * Otherwise the message is added to the tail of the write queue. |
851 * Otherwise the message is added to the tail of the write queue. |
855 */ |
852 */ |
856 void CSmsProtocol::WriteSmsMessage(CSmsMessage* aSmsMessage,MSmsMessageObserver& aObserver) |
853 void CSmsProtocol::WriteSmsMessage(CSmsMessage* aSmsMessage,MSmsMessageObserver& aObserver) |
857 { |
854 { |
858 LOGSMSPROT1("CSmsProtocol::WriteSmsMessage"); |
855 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_WRITESMSMESSAGE_1, "CSmsProtocol::WriteSmsMessage"); |
859 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
856 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
860 |
857 |
861 const TInt err = CheckPoweredUp(); |
858 const TInt err = CheckPoweredUp(); |
862 |
859 |
863 if (err != KErrNone) |
860 if (err != KErrNone) |
872 } // CSmsProtocol::WriteSmsMessage |
869 } // CSmsProtocol::WriteSmsMessage |
873 |
870 |
874 |
871 |
875 void CSmsProtocol::CancelWriteSmsMessage(MSmsMessageObserver& aObserver) |
872 void CSmsProtocol::CancelWriteSmsMessage(MSmsMessageObserver& aObserver) |
876 { |
873 { |
877 LOGSMSPROT1("CSmsProtocol::CancelWriteSmsMessage()"); |
874 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CANCELWRITESMSMESSAGE_1, "CSmsProtocol::CancelWriteSmsMessage()"); |
878 |
875 |
879 if (iWriteQueue != NULL) |
876 if (iWriteQueue != NULL) |
880 iWriteQueue->CancelObserver(aObserver); |
877 iWriteQueue->CancelObserver(aObserver); |
881 } // CSmsProtocol::CancelWriteSmsMessage |
878 } // CSmsProtocol::CancelWriteSmsMessage |
882 |
879 |
891 * @note aSmsMessage is destroyed from memory on completion. |
888 * @note aSmsMessage is destroyed from memory on completion. |
892 * |
889 * |
893 */ |
890 */ |
894 void CSmsProtocol::DeleteSmsMessage(CSmsMessage* aSmsMessage,MSmsMessageObserver& aObserver) |
891 void CSmsProtocol::DeleteSmsMessage(CSmsMessage* aSmsMessage,MSmsMessageObserver& aObserver) |
895 { |
892 { |
896 LOGSMSPROT1("CSmsProtocol::DeleteSmsMessage"); |
893 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DELETESMSMESSAGE_1, "CSmsProtocol::DeleteSmsMessage"); |
897 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
894 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
898 |
895 |
899 // Ensure the modem is connected and initialized |
896 // Ensure the modem is connected and initialized |
900 const TInt err = CheckPoweredUp(); |
897 const TInt err = CheckPoweredUp(); |
901 |
898 |
919 * @leave Panics in DEBUG if the SAP is invalid. |
916 * @leave Panics in DEBUG if the SAP is invalid. |
920 * |
917 * |
921 */ |
918 */ |
922 void CSmsProtocol::CancelDeleteSmsMessage(MSmsMessageObserver& aObserver) |
919 void CSmsProtocol::CancelDeleteSmsMessage(MSmsMessageObserver& aObserver) |
923 { |
920 { |
924 LOGSMSPROT1("CSmsProtocol::CancelDeleteSmsMessage"); |
921 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CANCELDELETESMSMESSAGE_1, "CSmsProtocol::CancelDeleteSmsMessage"); |
925 |
922 |
926 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
923 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
927 |
924 |
928 iDeleteQueue->CancelObserver(aObserver); |
925 iDeleteQueue->CancelObserver(aObserver); |
929 } // CSmsProtocol::CancelDeleteSmsMessage |
926 } // CSmsProtocol::CancelDeleteSmsMessage |
940 * Otherwise, the reading process is started. |
937 * Otherwise, the reading process is started. |
941 * |
938 * |
942 */ |
939 */ |
943 void CSmsProtocol::ReadSmsParameters(MSmsMessageObserver& aObserver) |
940 void CSmsProtocol::ReadSmsParameters(MSmsMessageObserver& aObserver) |
944 { |
941 { |
945 LOGSMSPROT1("CSmsProtocol::ReadSmsParameters"); |
942 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_READSMSPARAMETERS_1, "CSmsProtocol::ReadSmsParameters"); |
946 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
943 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
947 TInt ret = CheckPoweredUp(); |
944 TInt ret = CheckPoweredUp(); |
948 |
945 |
949 if (ret == KErrNone) |
946 if (ret == KErrNone) |
950 { |
947 { |
974 * Cancels a previous request to read SMS parameters. |
971 * Cancels a previous request to read SMS parameters. |
975 * |
972 * |
976 */ |
973 */ |
977 void CSmsProtocol::CancelReadSmsParams() |
974 void CSmsProtocol::CancelReadSmsParams() |
978 { |
975 { |
979 LOGSMSPROT1("CSmsProtocol::CancelReadSmsParams"); |
976 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CANCELREADSMSPARAMS_1, "CSmsProtocol::CancelReadSmsParams"); |
980 |
977 |
981 if(iSmsReadParams != NULL) |
978 if(iSmsReadParams != NULL) |
982 iSmsReadParams->Cancel(); |
979 iSmsReadParams->Cancel(); |
983 } // CSmsProtocol::CancelReadSmsParams |
980 } // CSmsProtocol::CancelReadSmsParams |
984 |
981 |
994 * Otherwise, the writing process is started. |
991 * Otherwise, the writing process is started. |
995 * |
992 * |
996 */ |
993 */ |
997 void CSmsProtocol::WriteSmsParameters(CMobilePhoneSmspList* aMobilePhoneSmspList,MSmsMessageObserver& aObserver) |
994 void CSmsProtocol::WriteSmsParameters(CMobilePhoneSmspList* aMobilePhoneSmspList,MSmsMessageObserver& aObserver) |
998 { |
995 { |
999 LOGSMSPROT1("CSmsProtocol::WriteSmsParameters"); |
996 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_WRITESMSPARAMETERS_1, "CSmsProtocol::WriteSmsParameters"); |
1000 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
997 __ASSERT_DEBUG(ObserverIsPresent(aObserver),SmspPanic(ESmspMessageObserverNotFound)); |
1001 |
998 |
1002 TInt ret = CheckPoweredUp(); |
999 TInt ret = CheckPoweredUp(); |
1003 |
1000 |
1004 if (ret == KErrNone) |
1001 if (ret == KErrNone) |
1040 * Cancels a previous request to write SMS parameters. |
1037 * Cancels a previous request to write SMS parameters. |
1041 * |
1038 * |
1042 */ |
1039 */ |
1043 void CSmsProtocol::CancelWriteSmsParams() |
1040 void CSmsProtocol::CancelWriteSmsParams() |
1044 { |
1041 { |
1045 LOGSMSPROT1("CSmsProtocol::CancelWriteSmsParams"); |
1042 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CANCELWRITESMSPARAMS_1, "CSmsProtocol::CancelWriteSmsParams"); |
1046 |
1043 |
1047 if(iSmsWriteParams != NULL) |
1044 if(iSmsWriteParams != NULL) |
1048 iSmsWriteParams->Cancel(); |
1045 iSmsWriteParams->Cancel(); |
1049 } // CSmsProtocol::CancelWriteSmsParams |
1046 } // CSmsProtocol::CancelWriteSmsParams |
1050 |
1047 |
1071 * |
1068 * |
1072 */ |
1069 */ |
1073 TInt CSmsProtocol::ProcessMessageL(const CSmsMessage& aSmsMessage,const TSmsAddr* aOriginalSmsAddr, |
1070 TInt CSmsProtocol::ProcessMessageL(const CSmsMessage& aSmsMessage,const TSmsAddr* aOriginalSmsAddr, |
1074 const CSmsMessage* /*aOriginalSmsMessage*/,TDes& aDes) |
1071 const CSmsMessage* /*aOriginalSmsMessage*/,TDes& aDes) |
1075 { |
1072 { |
1076 LOGSMSPROT1("CSmsProtocol::ProcessMessage"); |
1073 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_PROCESSMESSAGEL_1, "CSmsProtocol::ProcessMessage"); |
1077 |
1074 |
1078 MSmsMessageObserver* observer=NULL; |
1075 MSmsMessageObserver* observer=NULL; |
1079 if (aOriginalSmsAddr!=NULL) |
1076 if (aOriginalSmsAddr!=NULL) |
1080 { |
1077 { |
1081 // Status report and original message matched - send to original sender as priority |
1078 // Status report and original message matched - send to original sender as priority |
1140 * |
1137 * |
1141 * @param aSlotArray |
1138 * @param aSlotArray |
1142 */ |
1139 */ |
1143 void CSmsProtocol::DeletePDUs(const CArrayFix<TGsmSmsSlotEntry>& aSlotArray, MSmsMessageObserver* aObserver) |
1140 void CSmsProtocol::DeletePDUs(const CArrayFix<TGsmSmsSlotEntry>& aSlotArray, MSmsMessageObserver* aObserver) |
1144 { |
1141 { |
1145 LOGSMSPROT3("CSmsProtocol::DeletePDUs [count=%d aObserver=0x%08X", aSlotArray.Count(), aObserver); |
1142 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DELETEPDUS_1, "CSmsProtocol::DeletePDUs [count=%d aObserver=0x%08X", aSlotArray.Count(), (TUint)aObserver); |
1146 __ASSERT_DEBUG(aSlotArray.Count() != 0, SmspPanic(KSmspSlotArrayEmpty)); |
1143 __ASSERT_DEBUG(aSlotArray.Count() != 0, SmspPanic(KSmspSlotArrayEmpty)); |
1147 |
1144 |
1148 for(TInt i=0; i< aSlotArray.Count() ;i++) |
1145 for(TInt i=0; i< aSlotArray.Count() ;i++) |
1149 { |
1146 { |
1150 LOGSMSPROT3("CSmsProtocol::DeletePDUs index: %d store %S", aSlotArray[i].iIndex, &aSlotArray[i].iStore); |
1147 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DELETEPDUS_2, "CSmsProtocol::DeletePDUs index: %d store %S", aSlotArray[i].iIndex, aSlotArray[i].iStore); |
1151 } |
1148 } |
1152 |
1149 |
1153 if (iDeleteQueue != NULL && aSlotArray.Count() != 0) |
1150 if (iDeleteQueue != NULL && aSlotArray.Count() != 0) |
1154 { |
1151 { |
1155 iDeleteQueue->Queue(aSlotArray, aObserver); |
1152 iDeleteQueue->Queue(aSlotArray, aObserver); |
1156 } |
1153 } |
1164 * |
1161 * |
1165 */ |
1162 */ |
1166 void CSmsProtocol::ModemNotificationCompleted(TInt aStatus, |
1163 void CSmsProtocol::ModemNotificationCompleted(TInt aStatus, |
1167 RPhone::TModemDetection aNewState) |
1164 RPhone::TModemDetection aNewState) |
1168 { |
1165 { |
1169 LOGSMSPROT3("CSmsProtocol::ModemNotificationCompleted(): aStatus=%d, aNewState=%d", |
1166 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MODEMNOTIFICATIONCOMPLETED_1, "CSmsProtocol::ModemNotificationCompleted(): aStatus=%d, aNewState=%d",aStatus, aNewState); |
1170 aStatus, aNewState); |
|
1171 |
1167 |
1172 TBool stateChanged = EFalse; |
1168 TBool stateChanged = EFalse; |
1173 |
1169 |
1174 if (aStatus==KErrNone) |
1170 if (aStatus==KErrNone) |
1175 { |
1171 { |
1179 // it goes from OFF to ON |
1175 // it goes from OFF to ON |
1180 // |
1176 // |
1181 case RPhone::EDetectedNotPresent: |
1177 case RPhone::EDetectedNotPresent: |
1182 case RPhone::EDetectedUnknown: |
1178 case RPhone::EDetectedUnknown: |
1183 { |
1179 { |
1184 LOGSMSPROT1("RPhone::EDetectedNotPresent: [OFF -> ON]"); |
1180 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MODEMNOTIFICATIONCOMPLETED_2, "RPhone::EDetectedNotPresent: [OFF -> ON]"); |
1185 if (aNewState==RPhone::EDetectedPresent) |
1181 if (aNewState==RPhone::EDetectedPresent) |
1186 { |
1182 { |
1187 // There is a new modem connection |
1183 // There is a new modem connection |
1188 iModemDetection=aNewState; |
1184 iModemDetection=aNewState; |
1189 stateChanged = ETrue; |
1185 stateChanged = ETrue; |
1193 // |
1189 // |
1194 // it goes from ON to OFF |
1190 // it goes from ON to OFF |
1195 // |
1191 // |
1196 case RPhone::EDetectedPresent: |
1192 case RPhone::EDetectedPresent: |
1197 { |
1193 { |
1198 LOGSMSPROT1("RPhone::EDetectedPresent: [ON -> OFF]"); |
1194 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MODEMNOTIFICATIONCOMPLETED_3, "RPhone::EDetectedPresent: [ON -> OFF]"); |
1199 if (aNewState!=RPhone::EDetectedPresent) |
1195 if (aNewState!=RPhone::EDetectedPresent) |
1200 { |
1196 { |
1201 // Ah, lost our modem - cancel outstanding operations |
1197 // Ah, lost our modem - cancel outstanding operations |
1202 iModemDetection=aNewState; |
1198 iModemDetection=aNewState; |
1203 stateChanged = ETrue; |
1199 stateChanged = ETrue; |
1228 void CSmsProtocol::DiskSpaceMonitorStateChange(TSmsDiskSpaceMonitorStatus aStatus) |
1224 void CSmsProtocol::DiskSpaceMonitorStateChange(TSmsDiskSpaceMonitorStatus aStatus) |
1229 /** |
1225 /** |
1230 * Called when the Disk Space Monitor state has changed. |
1226 * Called when the Disk Space Monitor state has changed. |
1231 */ |
1227 */ |
1232 { |
1228 { |
1233 LOGSMSPROT2("CSmsProtocol::DiskSpaceMonitorStateChange(): aStatus=%d", aStatus); |
1229 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DISKSPACEMONITORSTATECHANGE_1, "CSmsProtocol::DiskSpaceMonitorStateChange(): aStatus=%d", aStatus); |
1234 |
1230 |
1235 RProperty::Set(KUidPSSMSStackCategory, KUidPSSMSStackDiskSpaceMonitorKey, aStatus); |
1231 RProperty::Set(KUidPSSMSStackCategory, KUidPSSMSStackDiskSpaceMonitorKey, aStatus); |
1236 } // CSmsProtocol::DiskSpaceMonitorStateChange |
1232 } // CSmsProtocol::DiskSpaceMonitorStateChange |
1237 |
1233 |
1238 |
1234 |
1241 * Increments the number of segmentation store accesses and purges the store |
1237 * Increments the number of segmentation store accesses and purges the store |
1242 * if it exceeds CSmsProtocol::KNumSARStoreAccessesBeforePurging. |
1238 * if it exceeds CSmsProtocol::KNumSARStoreAccessesBeforePurging. |
1243 */ |
1239 */ |
1244 void CSmsProtocol::MessageSendCompleted(TInt aStatus) |
1240 void CSmsProtocol::MessageSendCompleted(TInt aStatus) |
1245 { |
1241 { |
1246 LOGSMSPROT3("*** CSmsProtocol::MessageSendCompleted [aStatus=%d iNumSegmentationStoreAccesses=%d]", aStatus, iNumSegmentationStoreAccesses); |
1242 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MESSAGESENDCOMPLETED_1, "*** CSmsProtocol::MessageSendCompleted [aStatus=%d iNumSegmentationStoreAccesses=%d]", aStatus, iNumSegmentationStoreAccesses); |
1247 (void) aStatus; |
1243 (void) aStatus; |
1248 iNumSegmentationStoreAccesses++; |
1244 iNumSegmentationStoreAccesses++; |
1249 if (iNumSegmentationStoreAccesses>=KNumSARStoreAccessesBeforePurging) |
1245 if (iNumSegmentationStoreAccesses>=KNumSARStoreAccessesBeforePurging) |
1250 { |
1246 { |
1251 LOGSMSPROT1("iSegmentationStore->PurgeL Start"); |
1247 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MESSAGESENDCOMPLETED_2, "iSegmentationStore->PurgeL Start"); |
1252 TRAPD(ret, iSegmentationStore->PurgeL(iSmsSettings.KSegmentationLifetimeMultiplier(),EFalse)); |
1248 TRAPD(ret, iSegmentationStore->PurgeL(iSmsSettings.KSegmentationLifetimeMultiplier(),EFalse)); |
1253 if(ret!=KErrNone) |
1249 if(ret!=KErrNone) |
1254 { |
1250 { |
1255 // we need to close the file because the function |
1251 // we need to close the file because the function |
1256 // left with the file opened |
1252 // left with the file opened |
1257 // iSegmentationStore->CloseFile(); |
1253 // iSegmentationStore->CloseFile(); |
1258 LOGSMSPROT2("WARNING! iSegmentationStore->PurgeL left with %d", ret); |
1254 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MESSAGESENDCOMPLETED_3, "WARNING! iSegmentationStore->PurgeL left with %d", ret); |
1259 } |
1255 } |
1260 iNumSegmentationStoreAccesses=0; |
1256 iNumSegmentationStoreAccesses=0; |
1261 LOGSMSPROT2("iSegmentationStore->PurgeL End [ret=%d]", ret); |
1257 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MESSAGESENDCOMPLETED_4, "iSegmentationStore->PurgeL End [ret=%d]", ret); |
1262 } |
1258 } |
1263 } // CSmsProtocol::KNumSARStoreAccessesBeforePurging |
1259 } // CSmsProtocol::KNumSARStoreAccessesBeforePurging |
1264 |
1260 |
1265 |
1261 |
1266 /** |
1262 /** |
1268 * phone has completed. Notifies the SAP that made the request. |
1264 * phone has completed. Notifies the SAP that made the request. |
1269 * |
1265 * |
1270 */ |
1266 */ |
1271 void CSmsProtocol::PhoneEnumerationCompleted(TInt aStatus) |
1267 void CSmsProtocol::PhoneEnumerationCompleted(TInt aStatus) |
1272 { |
1268 { |
1273 LOGSMSPROT1("CSmsProtocol::PhoneEnumerationCompleted"); |
1269 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_PHONEENUMERATIONCOMPLETED_1, "CSmsProtocol::PhoneEnumerationCompleted"); |
1274 iPhoneEnumerationObserver->EnumeratePhoneCompleted(aStatus); |
1270 iPhoneEnumerationObserver->EnumeratePhoneCompleted(aStatus); |
1275 } // CSmsProtocol::PhoneEnumerationCompleted |
1271 } // CSmsProtocol::PhoneEnumerationCompleted |
1276 |
1272 |
1277 |
1273 |
1278 /** |
1274 /** |
1281 * is set, otherwise CProtocolBase::CanClose() is called to finish closing. |
1277 * is set, otherwise CProtocolBase::CanClose() is called to finish closing. |
1282 * |
1278 * |
1283 */ |
1279 */ |
1284 void CSmsProtocol::CloseNow() |
1280 void CSmsProtocol::CloseNow() |
1285 { |
1281 { |
1286 LOGSMSPROT1("CSmsProtocol::CloseNow"); |
1282 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CLOSENOW_1, "CSmsProtocol::CloseNow"); |
1287 if (iDeleteQueue != NULL && iDeleteQueue->IsActive()) |
1283 if (iDeleteQueue != NULL && iDeleteQueue->IsActive()) |
1288 SetClosingDown(ETrue); |
1284 SetClosingDown(ETrue); |
1289 else |
1285 else |
1290 CanClose(); |
1286 CanClose(); |
1291 } // CSmsProtocol::CloseNow |
1287 } // CSmsProtocol::CloseNow |
1311 * Returns the index of an observer in the observer list. |
1307 * Returns the index of an observer in the observer list. |
1312 * |
1308 * |
1313 */ |
1309 */ |
1314 TInt CSmsProtocol::ObserverIndex(const MSmsMessageObserver& aObserver) const |
1310 TInt CSmsProtocol::ObserverIndex(const MSmsMessageObserver& aObserver) const |
1315 { |
1311 { |
1316 LOGSMSPROT1("CSmsProtocol::ObserverIndex()"); |
1312 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_OBSERVERINDEX_1, "CSmsProtocol::ObserverIndex()"); |
1317 |
1313 |
1318 TInt count=iSmsMessageObserverList.Count(); |
1314 TInt count=iSmsMessageObserverList.Count(); |
1319 TInt index=0; |
1315 TInt index=0; |
1320 for (; index<count; index++) |
1316 for (; index<count; index++) |
1321 if (iSmsMessageObserverList[index]==&aObserver) |
1317 if (iSmsMessageObserverList[index]==&aObserver) |
1328 * Checks if an SMS address type is a duplicate of an existing SAP / observer. |
1324 * Checks if an SMS address type is a duplicate of an existing SAP / observer. |
1329 * |
1325 * |
1330 */ |
1326 */ |
1331 TBool CSmsProtocol::SmsAddrIsAlreadyUsed(const MSmsMessageObserver* aObserver,const TSmsAddr& aSmsAddr)const |
1327 TBool CSmsProtocol::SmsAddrIsAlreadyUsed(const MSmsMessageObserver* aObserver,const TSmsAddr& aSmsAddr)const |
1332 { |
1328 { |
1333 LOGSMSPROT1("CSmsProtocol::SmsAddrIsAlreadyUsed()"); |
1329 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_SMSADDRISALREADYUSED_1, "CSmsProtocol::SmsAddrIsAlreadyUsed()"); |
1334 |
1330 |
1335 TBool isduplicate=EFalse; |
1331 TBool isduplicate=EFalse; |
1336 TInt count=iSmsMessageObserverList.Count(); |
1332 TInt count=iSmsMessageObserverList.Count(); |
1337 for (TInt i=0; (i<count) && (!isduplicate); i++) |
1333 for (TInt i=0; (i<count) && (!isduplicate); i++) |
1338 isduplicate=(iSmsMessageObserverList[i]->SmsAddrIsDuplicate(aObserver,aSmsAddr)); |
1334 isduplicate=(iSmsMessageObserverList[i]->SmsAddrIsDuplicate(aObserver,aSmsAddr)); |
1413 * the observer list based on their address types. |
1409 * the observer list based on their address types. |
1414 * |
1410 * |
1415 */ |
1411 */ |
1416 TInt TKeySmsObserver::Compare(TInt aLeft, TInt aRight) const |
1412 TInt TKeySmsObserver::Compare(TInt aLeft, TInt aRight) const |
1417 { |
1413 { |
1418 LOGSMSPROT3("TKeySmsObserver::Compare [left=%d, right=%d]", aLeft, aRight); |
1414 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TKEYSMSOBSERVER_COMPARE_1, "TKeySmsObserver::Compare [left=%d, right=%d]", aLeft, aRight); |
1419 |
1415 |
1420 const TInt lhptr = -1; // Left higher priority than right |
1416 const TInt lhptr = -1; // Left higher priority than right |
1421 const TInt rhptl = 1; // Right higher priority than left |
1417 const TInt rhptl = 1; // Right higher priority than left |
1422 |
1418 |
1423 MSmsMessageObserver* left = *(MSmsMessageObserver**)At(aLeft); |
1419 MSmsMessageObserver* left = *(MSmsMessageObserver**)At(aLeft); |
1456 * Re-orders the observer list using TKeySmsObserver to determine priorities. |
1452 * Re-orders the observer list using TKeySmsObserver to determine priorities. |
1457 * |
1453 * |
1458 */ |
1454 */ |
1459 void CSmsProtocol::OrderSmsMessageObserver(const MSmsMessageObserver& /*aObserver*/) |
1455 void CSmsProtocol::OrderSmsMessageObserver(const MSmsMessageObserver& /*aObserver*/) |
1460 { |
1456 { |
1461 LOGSMSPROT1("CSmsProtocol::OrderSmsMessageObserver()"); |
1457 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_ORDERSMSMESSAGEOBSERVER_1, "CSmsProtocol::OrderSmsMessageObserver()"); |
1462 |
1458 |
1463 TKeySmsObserver smsObsKey; |
1459 TKeySmsObserver smsObsKey; |
1464 #ifdef _DEBUG |
1460 #ifdef _DEBUG |
1465 TInt ret=iSmsMessageObserverList.Sort(smsObsKey); |
1461 TInt ret=iSmsMessageObserverList.Sort(smsObsKey); |
1466 __ASSERT_DEBUG(ret==KErrNone,SmspPanic(ESmspCorruptObserverList)); |
1462 __ASSERT_DEBUG(ret==KErrNone,SmspPanic(ESmspCorruptObserverList)); |
1475 * highest priority observer. |
1471 * highest priority observer. |
1476 * |
1472 * |
1477 */ |
1473 */ |
1478 MSmsMessageObserver* CSmsProtocol::MatchSmsMessageToObserver(const CSmsMessage& aSmsMessage) |
1474 MSmsMessageObserver* CSmsProtocol::MatchSmsMessageToObserver(const CSmsMessage& aSmsMessage) |
1479 { |
1475 { |
1480 LOGSMSPROT1("CSmsProtocol::MatchSmsMessageToObserver()"); |
1476 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MATCHSMSMESSAGETOOBSERVER_1, "CSmsProtocol::MatchSmsMessageToObserver()"); |
1481 |
1477 |
1482 TInt count=iSmsMessageObserverList.Count(); |
1478 TInt count=iSmsMessageObserverList.Count(); |
1483 for (TInt i=0;i<count;i++) |
1479 for (TInt i=0;i<count;i++) |
1484 { |
1480 { |
1485 MSmsMessageObserver* obs = iSmsMessageObserverList[i]; |
1481 MSmsMessageObserver* obs = iSmsMessageObserverList[i]; |
1495 * priority observer. |
1491 * priority observer. |
1496 * |
1492 * |
1497 */ |
1493 */ |
1498 MSmsMessageObserver* CSmsProtocol::MatchSmsAddressToObserver(const TSmsAddr& aAddr) |
1494 MSmsMessageObserver* CSmsProtocol::MatchSmsAddressToObserver(const TSmsAddr& aAddr) |
1499 { |
1495 { |
1500 LOGSMSPROT1("CSmsProtocol::MatchSmsAddressToObserver()"); |
1496 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MATCHSMSADDRESSTOOBSERVER_1, "CSmsProtocol::MatchSmsAddressToObserver()"); |
1501 |
1497 |
1502 TInt count=iSmsMessageObserverList.Count(); |
1498 TInt count=iSmsMessageObserverList.Count(); |
1503 for (TInt i=0;i<count;i++) |
1499 for (TInt i=0;i<count;i++) |
1504 { |
1500 { |
1505 MSmsMessageObserver* obs = iSmsMessageObserverList[i]; |
1501 MSmsMessageObserver* obs = iSmsMessageObserverList[i]; |
1614 * to determine if an SMS address type matches an application port. |
1610 * to determine if an SMS address type matches an application port. |
1615 * |
1611 * |
1616 */ |
1612 */ |
1617 TBool CSmsProtocol::MatchApplicationPort(const CSmsMessage& aSmsMessage,TUint aPort,TBool a16Bit) |
1613 TBool CSmsProtocol::MatchApplicationPort(const CSmsMessage& aSmsMessage,TUint aPort,TBool a16Bit) |
1618 { |
1614 { |
1619 LOGSMSPROT1("CSmsProtocol::MatchApplicationPort"); |
1615 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MATCHAPPLICATIONPORT_1, "CSmsProtocol::MatchApplicationPort"); |
1620 |
1616 |
1621 if (!aSmsMessage.SmsPDU().UserDataPresent()) |
1617 if (!aSmsMessage.SmsPDU().UserDataPresent()) |
1622 return EFalse; |
1618 return EFalse; |
1623 |
1619 |
1624 const CSmsPDU& Pdu = aSmsMessage.SmsPDU(); |
1620 const CSmsPDU& Pdu = aSmsMessage.SmsPDU(); |
1638 * to determine if an SMS address type matches a message. |
1634 * to determine if an SMS address type matches a message. |
1639 * |
1635 * |
1640 */ |
1636 */ |
1641 TBool CSmsProtocol::MatchInformationElement(const CSmsMessage& aSmsMessage, CSmsInformationElement::TSmsInformationElementIdentifier aIeVal) |
1637 TBool CSmsProtocol::MatchInformationElement(const CSmsMessage& aSmsMessage, CSmsInformationElement::TSmsInformationElementIdentifier aIeVal) |
1642 { |
1638 { |
1643 LOGSMSPROT1("CSmsProtocol::MatchInformationElement"); |
1639 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MATCHINFORMATIONELEMENT_1, "CSmsProtocol::MatchInformationElement"); |
1644 |
1640 |
1645 if (!aSmsMessage.SmsPDU().UserDataPresent()) |
1641 if (!aSmsMessage.SmsPDU().UserDataPresent()) |
1646 return EFalse; |
1642 return EFalse; |
1647 |
1643 |
1648 TInt count=aSmsMessage.SmsPDU().UserData().NumInformationElements(); |
1644 TInt count=aSmsMessage.SmsPDU().UserData().NumInformationElements(); |
1664 * successfully processed. |
1660 * successfully processed. |
1665 * |
1661 * |
1666 */ |
1662 */ |
1667 void CSmsProtocol::ProcessCompleteSmsMessagesL() |
1663 void CSmsProtocol::ProcessCompleteSmsMessagesL() |
1668 { |
1664 { |
1669 LOGSMSPROT1("CSmsProtocol::ProcessCompleteSmsMessagesL"); |
1665 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_PROCESSCOMPLETESMSMESSAGESL_1, "CSmsProtocol::ProcessCompleteSmsMessagesL"); |
1670 |
1666 |
1671 if(iPhoneEnumerationObserver) return; |
1667 if(iPhoneEnumerationObserver) return; |
1672 |
1668 |
1673 iReassemblyStore->ProcessCompleteSmsMessagesL(*this, iSmsPDURead->CurrentMessage()); |
1669 iReassemblyStore->ProcessCompleteSmsMessagesL(*this, iSmsPDURead->CurrentMessage()); |
1674 } // CSmsProtocol::ProcessCompleteSmsMessagesL |
1670 } // CSmsProtocol::ProcessCompleteSmsMessagesL |
1682 * not empty, and the processing state machinery is started for the next entry. |
1678 * not empty, and the processing state machinery is started for the next entry. |
1683 * |
1679 * |
1684 */ |
1680 */ |
1685 void CSmsProtocol::MessageReadedSuccessfully() |
1681 void CSmsProtocol::MessageReadedSuccessfully() |
1686 { |
1682 { |
1687 LOGSMSPROT1("CSmsProtocol::MessageReadedSuccessfully"); |
1683 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MESSAGEREADEDSUCCESSFULLY_1, "CSmsProtocol::MessageReadedSuccessfully"); |
1688 TRAPD(ret,ProcessCompleteSmsMessagesL()); |
1684 TRAPD(ret,ProcessCompleteSmsMessagesL()); |
1689 if(ret!=KErrNone) |
1685 if(ret!=KErrNone) |
1690 { |
1686 { |
1691 LOGSMSPROT2("WARNING! CSmsProtocol::ProcessCompleteSmsMessagesL left with %d", ret); |
1687 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MESSAGEREADEDSUCCESSFULLY_2, "WARNING! CSmsProtocol::ProcessCompleteSmsMessagesL left with %d", ret); |
1692 } |
1688 } |
1693 |
1689 |
1694 iNumReassemblyStoreAccesses++; |
1690 iNumReassemblyStoreAccesses++; |
1695 if(iNumReassemblyStoreAccesses>=KNumSARStoreAccessesBeforePurging) |
1691 if(iNumReassemblyStoreAccesses>=KNumSARStoreAccessesBeforePurging) |
1696 { |
1692 { |
1697 TRAP(ret, iReassemblyStore->PurgeL(iSmsSettings.ReassemblyLifetime(),EFalse)); |
1693 TRAP(ret, iReassemblyStore->PurgeL(iSmsSettings.ReassemblyLifetime(),EFalse)); |
1698 |
1694 |
1699 if(ret!=KErrNone) |
1695 if(ret!=KErrNone) |
1700 { |
1696 { |
1701 LOGSMSPROT2("WARNING! iReassemblyStore->PurgeL left with %d", ret); |
1697 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_MESSAGEREADEDSUCCESSFULLY_3, "WARNING! iReassemblyStore->PurgeL left with %d", ret); |
1702 } |
1698 } |
1703 |
1699 |
1704 iNumReassemblyStoreAccesses=0; |
1700 iNumReassemblyStoreAccesses=0; |
1705 } |
1701 } |
1706 if(CheckPoweredUp() == KErrNone ) |
1702 if(CheckPoweredUp() == KErrNone ) |
1711 /** |
1707 /** |
1712 * method to delete sms from the reastore |
1708 * method to delete sms from the reastore |
1713 */ |
1709 */ |
1714 void CSmsProtocol::DeleteSMSFromReaStoreL(const CSmsMessage& aSmsMessage) |
1710 void CSmsProtocol::DeleteSMSFromReaStoreL(const CSmsMessage& aSmsMessage) |
1715 { |
1711 { |
1716 LOGSMSPROT1("CSmsProtocol::DeleteSMSFromReaStoreL entry"); |
1712 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DELETESMSFROMREASTOREL_1, "CSmsProtocol::DeleteSMSFromReaStoreL entry"); |
1717 if (aSmsMessage.Type() == CSmsPDU::ESmsStatusReport) |
1713 if (aSmsMessage.Type() == CSmsPDU::ESmsStatusReport) |
1718 { |
1714 { |
1719 LOGSMSPROT1("CSmsProtocol::DeleteSMSFromReaStoreL it's SR"); |
1715 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DELETESMSFROMREASTOREL_2, "CSmsProtocol::DeleteSMSFromReaStoreL it's SR"); |
1720 return; |
1716 return; |
1721 } |
1717 } |
1722 |
1718 |
1723 TSmsDataCodingScheme::TSmsClass msgClass; |
1719 TSmsDataCodingScheme::TSmsClass msgClass; |
1724 |
1720 |
1737 { |
1733 { |
1738 /* |
1734 /* |
1739 Only in this condition set incomplete message as forwarded |
1735 Only in this condition set incomplete message as forwarded |
1740 which internally will remove the PDUs from pre-allocated file. |
1736 which internally will remove the PDUs from pre-allocated file. |
1741 */ |
1737 */ |
1742 LOGSMSPROT1("CSmsProtocol::DeleteSMSFromReaStoreL Incomplete Message Not last segment"); |
1738 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DELETESMSFROMREASTOREL_3, "CSmsProtocol::DeleteSMSFromReaStoreL Incomplete Message Not last segment"); |
1743 iReassemblyStore->SetIncompleteMessageForwardedToClientL(aSmsMessage); |
1739 iReassemblyStore->SetIncompleteMessageForwardedToClientL(aSmsMessage); |
1744 return; |
1740 return; |
1745 } |
1741 } |
1746 } |
1742 } |
1747 } |
1743 } |
1748 } |
1744 } |
1749 iReassemblyStore->DeleteMessageL(aSmsMessage, ETrue); |
1745 iReassemblyStore->DeleteMessageL(aSmsMessage, ETrue); |
1750 |
1746 |
1751 LOGSMSPROT1("CSmsProtocol::DeleteSMSFromReaStoreL exit"); |
1747 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DELETESMSFROMREASTOREL_4, "CSmsProtocol::DeleteSMSFromReaStoreL exit"); |
1752 } // CSmsProtocol::DeleteSMSFromReaStoreL |
1748 } // CSmsProtocol::DeleteSMSFromReaStoreL |
1753 |
1749 |
1754 |
1750 |
1755 /** |
1751 /** |
1756 * Used to notify observer of the change in state of the modem connection. |
1752 * Used to notify observer of the change in state of the modem connection. |
1757 * Send only observers are not notified (why?). |
1753 * Send only observers are not notified (why?). |
1758 */ |
1754 */ |
1759 void CSmsProtocol::NotifyMessageObservers(TInt aStatus) |
1755 void CSmsProtocol::NotifyMessageObservers(TInt aStatus) |
1760 { |
1756 { |
1761 LOGSMSPROT1("CSmsProtocol::NotifyMessageObservers"); |
1757 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_NOTIFYMESSAGEOBSERVERS_1, "CSmsProtocol::NotifyMessageObservers"); |
1762 |
1758 |
1763 TInt count=iSmsMessageObserverList.Count(); |
1759 TInt count=iSmsMessageObserverList.Count(); |
1764 LOGSMSPROT3("CSmsProtocol::NotifyMessageObservers [count=%d, aStatus=%d]",count, aStatus); |
1760 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_NOTIFYMESSAGEOBSERVERS_2, "CSmsProtocol::NotifyMessageObservers [count=%d, aStatus=%d]",count, aStatus); |
1765 for (TInt index=0; index<count; index++) |
1761 for (TInt index=0; index<count; index++) |
1766 { |
1762 { |
1767 MSmsMessageObserver* observer=iSmsMessageObserverList[index]; |
1763 MSmsMessageObserver* observer=iSmsMessageObserverList[index]; |
1768 TSmsAddrFamily fam = observer->GetLocalAddress().SmsAddrFamily(); |
1764 TSmsAddrFamily fam = observer->GetLocalAddress().SmsAddrFamily(); |
1769 LOGSMSPROT2("CSmsProtocol::NotifyMessageObservers [family=%d]", fam); |
1765 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_NOTIFYMESSAGEOBSERVERS_3, "CSmsProtocol::NotifyMessageObservers [family=%d]", fam); |
1770 switch (fam) |
1766 switch (fam) |
1771 { |
1767 { |
1772 case ESmsAddrMessageIndication: |
1768 case ESmsAddrMessageIndication: |
1773 case ESmsAddrStatusReport: |
1769 case ESmsAddrStatusReport: |
1774 case ESmsAddrMatchIEI: |
1770 case ESmsAddrMatchIEI: |
1792 } // CSmsProtocol::NotifyMessageObservers |
1788 } // CSmsProtocol::NotifyMessageObservers |
1793 |
1789 |
1794 |
1790 |
1795 void CSmsProtocol::PowerUp() |
1791 void CSmsProtocol::PowerUp() |
1796 { |
1792 { |
1797 LOGSMSPROT2("CSmsProtocol::PowerUp [iState=%d]", iState); |
1793 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_POWERUP_1, "CSmsProtocol::PowerUp [iState=%d]", iState); |
1798 __ASSERT_DEBUG(iState == EPoweredDown, SmspPanic(KSmspPanicUnexpectedState)); |
1794 __ASSERT_DEBUG(iState == EPoweredDown, SmspPanic(KSmspPanicUnexpectedState)); |
1799 |
1795 |
1800 if (iState == EPoweredDown) |
1796 if (iState == EPoweredDown) |
1801 { |
1797 { |
1802 TRAPD(err, DoPowerUpL()); |
1798 TRAPD(err, DoPowerUpL()); |
1803 |
1799 |
1804 if (err != KErrNone) |
1800 if (err != KErrNone) |
1805 { |
1801 { |
1806 LOGSMSPROT3("WARNING: CSmsProtocol::DoPowerUpL left [err=%d iState=%d]", err, iState); |
1802 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_POWERUP_2, "WARNING: CSmsProtocol::DoPowerUpL left [err=%d iState=%d]", err, iState); |
1807 __ASSERT_DEBUG(iState == EPoweredDown, SmspPanic(KSmspPanicUnexpectedState)); |
1803 __ASSERT_DEBUG(iState == EPoweredDown, SmspPanic(KSmspPanicUnexpectedState)); |
1808 PowerDown(); |
1804 PowerDown(); |
1809 } |
1805 } |
1810 } |
1806 } |
1811 } // CSmsProtocol::PowerUp |
1807 } // CSmsProtocol::PowerUp |
1820 * - A number of state machines started |
1816 * - A number of state machines started |
1821 * |
1817 * |
1822 */ |
1818 */ |
1823 void CSmsProtocol::DoPowerUpL() |
1819 void CSmsProtocol::DoPowerUpL() |
1824 { |
1820 { |
1825 LOGSMSPROT1("CSmsProtocol::DoPowerUpL"); |
1821 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_1, "CSmsProtocol::DoPowerUpL"); |
1826 __ASSERT_DEBUG(iModemDetection==RPhone::EDetectedPresent,SmspPanic(KSmspPhoneHasNotTurnedOn)); |
1822 __ASSERT_DEBUG(iModemDetection==RPhone::EDetectedPresent,SmspPanic(KSmspPhoneHasNotTurnedOn)); |
1827 |
1823 |
1828 //Open the segmentation and reassembly stores |
1824 //Open the segmentation and reassembly stores |
1829 |
1825 |
1830 iReassemblyStore->OpenStoreL(); |
1826 iReassemblyStore->OpenStoreL(); |
1831 iSegmentationStore->OpenStoreL(); |
1827 iSegmentationStore->OpenStoreL(); |
1832 LOGSMSPROT1("CSmsProtocol::DoPowerUpL->PurgeL Start"); |
1828 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_2, "CSmsProtocol::DoPowerUpL->PurgeL Start"); |
1833 iReassemblyStore->PurgeL(iSmsSettings.ReassemblyLifetime(), ETrue); |
1829 iReassemblyStore->PurgeL(iSmsSettings.ReassemblyLifetime(), ETrue); |
1834 LOGSMSPROT1("CSmsProtocol::DoPowerUpL->PurgeL End"); |
1830 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_3, "CSmsProtocol::DoPowerUpL->PurgeL End"); |
1835 LOGSMSPROT1("CSmsProtocol::DoPowerUpL->PurgeL Start"); |
1831 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_4, "CSmsProtocol::DoPowerUpL->PurgeL Start"); |
1836 iSegmentationStore->PurgeL(iSmsSettings.KSegmentationLifetimeMultiplier(),EFalse); |
1832 iSegmentationStore->PurgeL(iSmsSettings.KSegmentationLifetimeMultiplier(),EFalse); |
1837 LOGSMSPROT1("CSmsProtocol::DoPowerUpL->PurgeL End"); |
1833 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_5, "CSmsProtocol::DoPowerUpL->PurgeL End"); |
1838 |
1834 |
1839 // Connect to ETEL and load the TSY |
1835 // Connect to ETEL and load the TSY |
1840 User::LeaveIfError(iTelServer.Connect()); |
1836 User::LeaveIfError(iTelServer.Connect()); |
1841 User::LeaveIfError(iTelServer.LoadPhoneModule(iGsmTsyName)); |
1837 User::LeaveIfError(iTelServer.LoadPhoneModule(iGsmTsyName)); |
1842 LOGSMSPROT1("CSmsProtocol::DoPowerUpL Connected to Etel"); |
1838 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_6, "CSmsProtocol::DoPowerUpL Connected to Etel"); |
1843 |
1839 |
1844 // Find the phone corresponding to this TSY and open a number of handles on it |
1840 // Find the phone corresponding to this TSY and open a number of handles on it |
1845 TInt numPhones; |
1841 TInt numPhones; |
1846 User::LeaveIfError(iTelServer.EnumeratePhones(numPhones)); |
1842 User::LeaveIfError(iTelServer.EnumeratePhones(numPhones)); |
1847 TInt i=0; |
1843 TInt i=0; |
1862 __ASSERT_DEBUG(i<numPhones,SmspPanic(ESmspPhoneNotFound)); |
1858 __ASSERT_DEBUG(i<numPhones,SmspPanic(ESmspPhoneNotFound)); |
1863 if (iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)!=KErrNone) |
1859 if (iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)!=KErrNone) |
1864 User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorBasic)); |
1860 User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorBasic)); |
1865 User::LeaveIfError(iSmsMessaging.Open(iGsmPhone)); |
1861 User::LeaveIfError(iSmsMessaging.Open(iGsmPhone)); |
1866 |
1862 |
1867 LOGSMSPROT1("CSmsProtocol::DoPowerUpL Opened TSY handles"); |
1863 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_7, "CSmsProtocol::DoPowerUpL Opened TSY handles"); |
1868 |
1864 |
1869 if (iSmsPhoneEnumeration == NULL) |
1865 if (iSmsPhoneEnumeration == NULL) |
1870 iSmsPhoneEnumeration=CSmsPhoneEnumeration::NewL(*this, iSmsSettings, *iReassemblyStore, *iSegmentationStore, iEnumerationPhone, KSmsSessionPriority, *iSmsMonitorDiskSpace); |
1866 iSmsPhoneEnumeration=CSmsPhoneEnumeration::NewL(*this, iSmsSettings, *iReassemblyStore, *iSegmentationStore, iEnumerationPhone, KSmsSessionPriority, *iSmsMonitorDiskSpace); |
1871 |
1867 |
1872 if (iWriteQueue == NULL) |
1868 if (iWriteQueue == NULL) |
1876 iDeleteQueue = CSmspDeleteQueue::NewL(*this,iSmsSettings,iSmsMessaging, KSmsSessionPriority); |
1872 iDeleteQueue = CSmspDeleteQueue::NewL(*this,iSmsSettings,iSmsMessaging, KSmsSessionPriority); |
1877 |
1873 |
1878 // Start state machines |
1874 // Start state machines |
1879 iSmsPhoneInitialization->Start(); |
1875 iSmsPhoneInitialization->Start(); |
1880 |
1876 |
1881 LOGSMSPROT1("CSmsProtocol::DoPowerUpL Started state machines"); |
1877 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_8, "CSmsProtocol::DoPowerUpL Started state machines"); |
1882 |
1878 |
1883 NotifyMessageObservers(KIoctlSelectModemPresent); |
1879 NotifyMessageObservers(KIoctlSelectModemPresent); |
1884 LOGSMSPROT1("CSmsProtocol::DoPowerUpL Notified message observers"); |
1880 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_DOPOWERUPL_9, "CSmsProtocol::DoPowerUpL Notified message observers"); |
1885 |
1881 |
1886 |
1882 |
1887 // Process any waiting messages |
1883 // Process any waiting messages |
1888 ProcessCompleteSmsMessagesL(); |
1884 ProcessCompleteSmsMessagesL(); |
1889 |
1885 |
1900 * |
1896 * |
1901 * This function will also be called if PowerUpL() leaves |
1897 * This function will also be called if PowerUpL() leaves |
1902 */ |
1898 */ |
1903 void CSmsProtocol::PowerDown() |
1899 void CSmsProtocol::PowerDown() |
1904 { |
1900 { |
1905 LOGSMSPROT1("CSmsProtocol::PowerDown"); |
1901 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_POWERDOWN_1, "CSmsProtocol::PowerDown"); |
1906 |
1902 |
1907 iSetBearer->Cancel(); |
1903 iSetBearer->Cancel(); |
1908 iReceiveMode->Cancel(); |
1904 iReceiveMode->Cancel(); |
1909 |
1905 |
1910 iSendQueue->Cancel(); |
1906 iSendQueue->Cancel(); |
1931 iWriteQueue = NULL; |
1927 iWriteQueue = NULL; |
1932 |
1928 |
1933 delete iDeleteQueue; //must be deleted because uses iSmsMessaging which is soon closed |
1929 delete iDeleteQueue; //must be deleted because uses iSmsMessaging which is soon closed |
1934 iDeleteQueue = NULL; |
1930 iDeleteQueue = NULL; |
1935 |
1931 |
1936 LOGSMSPROT1("CSmsProtocol::PowerDown Cancelled state machines"); |
1932 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_POWERDOWN_2, "CSmsProtocol::PowerDown Cancelled state machines"); |
1937 |
1933 |
1938 NotifyMessageObservers(KIoctlSelectModemNotPresent); |
1934 NotifyMessageObservers(KIoctlSelectModemNotPresent); |
1939 LOGSMSPROT1("CSmsProtocol::PowerDown Notified message observers"); |
1935 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_POWERDOWN_3, "CSmsProtocol::PowerDown Notified message observers"); |
1940 |
1936 |
1941 // Close TSY handles |
1937 // Close TSY handles |
1942 iSmsMessaging.Close(); |
1938 iSmsMessaging.Close(); |
1943 iGsmPhone.Close(); |
1939 iGsmPhone.Close(); |
1944 iEnumerationPhone.Close(); |
1940 iEnumerationPhone.Close(); |
1945 iWritePhone.Close(); |
1941 iWritePhone.Close(); |
1946 LOGSMSPROT1("CSmsProtocol::PowerDown Closed TSY handles"); |
1942 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_POWERDOWN_4, "CSmsProtocol::PowerDown Closed TSY handles"); |
1947 |
1943 |
1948 // Disconnect from Etel |
1944 // Disconnect from Etel |
1949 iTelServer.Close(); |
1945 iTelServer.Close(); |
1950 LOGSMSPROT1("CSmsProtocol::PowerDown Disconnected from Etel"); |
1946 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_POWERDOWN_5, "CSmsProtocol::PowerDown Disconnected from Etel"); |
1951 |
1947 |
1952 iReassemblyStore->Close(); |
1948 iReassemblyStore->Close(); |
1953 iSegmentationStore->Close(); |
1949 iSegmentationStore->Close(); |
1954 |
1950 |
1955 iState = EPoweredDown; |
1951 iState = EPoweredDown; |
1961 // empty and SMS stack is closing down - can only get this situation |
1957 // empty and SMS stack is closing down - can only get this situation |
1962 // when the PDU delete has been initiated by the SMS stack itself |
1958 // when the PDU delete has been initiated by the SMS stack itself |
1963 // (rather than the client) and the PDUs are still being deleted |
1959 // (rather than the client) and the PDUs are still being deleted |
1964 // when last client disconnects. |
1960 // when last client disconnects. |
1965 BULLSEYE_OFF |
1961 BULLSEYE_OFF |
1966 LOGSMSPROT1("CSmsProtocol::CloseNowWrap()"); |
1962 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_CLOSENOWWRAP_1, "CSmsProtocol::CloseNowWrap()"); |
1967 |
1963 |
1968 if( iDeleteQueue == NULL || !iDeleteQueue->IsActive() ) |
1964 if( iDeleteQueue == NULL || !iDeleteQueue->IsActive() ) |
1969 { |
1965 { |
1970 CloseNow(); |
1966 CloseNow(); |
1971 } |
1967 } |
1972 BULLSEYE_RESTORE |
1968 BULLSEYE_RESTORE |
1973 } |
1969 } |
1974 |
1970 |
1975 void CSmsProtocol::HandleBackupOrRestoreStartingL() |
1971 void CSmsProtocol::HandleBackupOrRestoreStartingL() |
1976 { |
1972 { |
1977 LOGSMSPROT2("CSmsProtocol::HandleBackupOrRestoreStartingL [ModemState=%d]", iSmsModemNotification->ModemState()); |
1973 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_HANDLEBACKUPORRESTORESTARTINGL_1, "CSmsProtocol::HandleBackupOrRestoreStartingL [ModemState=%d]", iSmsModemNotification->ModemState()); |
1978 PowerDown(); |
1974 PowerDown(); |
1979 } |
1975 } |
1980 |
1976 |
1981 void CSmsProtocol::HandleBackupOrRestoreCompleteL() |
1977 void CSmsProtocol::HandleBackupOrRestoreCompleteL() |
1982 { |
1978 { |
1983 LOGSMSPROT2("CSmsProtocol::HandleBackupOrRestoreCompleteL [ModemState=%d]", iSmsModemNotification->ModemState()); |
1979 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_HANDLEBACKUPORRESTORECOMPLETEL_1, "CSmsProtocol::HandleBackupOrRestoreCompleteL [ModemState=%d]", iSmsModemNotification->ModemState()); |
1984 |
1980 |
1985 if (iModemDetection == RPhone::EDetectedPresent) |
1981 if (iModemDetection == RPhone::EDetectedPresent) |
1986 { |
1982 { |
1987 PowerUp(); |
1983 PowerUp(); |
1988 } |
1984 } |
1991 /** |
1987 /** |
1992 * Set the sap port number |
1988 * Set the sap port number |
1993 */ |
1989 */ |
1994 TBool CSmsProtocol::AllocateLocalAddress(TSmsAddr& aAddr) |
1990 TBool CSmsProtocol::AllocateLocalAddress(TSmsAddr& aAddr) |
1995 { |
1991 { |
1996 LOGSMSPROT1("CSmsProtocol::AllocateLocalAddressL"); |
1992 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_ALLOCATELOCALADDRESS_1, "CSmsProtocol::AllocateLocalAddressL"); |
1997 |
1993 |
1998 TBool found=EFalse; |
1994 TBool found=EFalse; |
1999 TUint count=0,attempts=0; |
1995 TUint count=0,attempts=0; |
2000 TSmsAddr locAddr=aAddr; |
1996 TSmsAddr locAddr=aAddr; |
2001 |
1997 |
2039 * @param aSmsMessage reference to CSmsMessage object. |
2035 * @param aSmsMessage reference to CSmsMessage object. |
2040 * |
2036 * |
2041 */ |
2037 */ |
2042 TBool CSmsProtocol::IsAppPortSMS(const CSmsMessage& aSmsMessage) |
2038 TBool CSmsProtocol::IsAppPortSMS(const CSmsMessage& aSmsMessage) |
2043 { |
2039 { |
2044 LOGSMSPROT1("CSmsProtocol::IsAppPortSMS()"); |
2040 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_ISAPPPORTSMS_1, "CSmsProtocol::IsAppPortSMS()"); |
2045 |
2041 |
2046 TSmsAddr addr; |
2042 TSmsAddr addr; |
2047 addr.SetSmsAddrFamily(ESmsAddrMatchIEI); |
2043 addr.SetSmsAddrFamily(ESmsAddrMatchIEI); |
2048 addr.SetIdentifierMatch(CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit); |
2044 addr.SetIdentifierMatch(CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit); |
2049 if (IsMatch(addr,aSmsMessage)) |
2045 if (IsMatch(addr,aSmsMessage)) |
2069 } // CSmsProtocol::IsAppPortSMS |
2065 } // CSmsProtocol::IsAppPortSMS |
2070 |
2066 |
2071 |
2067 |
2072 const RMobilePhone::TMobilePhoneNetworkInfoV1& CSmsProtocol::NetworkInfo() const |
2068 const RMobilePhone::TMobilePhoneNetworkInfoV1& CSmsProtocol::NetworkInfo() const |
2073 { |
2069 { |
2074 LOGSMSPROT1("CSmsProtocol::NetworkInfo()"); |
2070 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_NETWORKINFO_1, "CSmsProtocol::NetworkInfo()"); |
2075 |
2071 |
2076 return iSmsPhoneInitialization->NetworkInfo(); |
2072 return iSmsPhoneInitialization->NetworkInfo(); |
2077 } // CSmsProtocol::NetworkInfo |
2073 } // CSmsProtocol::NetworkInfo |
2078 |
2074 |
2079 |
2075 |
2080 TBool CSmsProtocol::NetworkInfoAvailable() const |
2076 TBool CSmsProtocol::NetworkInfoAvailable() const |
2081 { |
2077 { |
2082 LOGSMSPROT1("CSmsProtocol::NetworkInfoAvailable()"); |
2078 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOL_NETWORKINFOAVAILABLE_1, "CSmsProtocol::NetworkInfoAvailable()"); |
2083 |
2079 |
2084 return iSmsPhoneInitialization->NetworkInfoAvailable(); |
2080 return iSmsPhoneInitialization->NetworkInfoAvailable(); |
2085 } // CSmsProtocol::NetworkInfoAvailable |
2081 } // CSmsProtocol::NetworkInfoAvailable |
2086 |
2082 |
2087 |
2083 |
2093 * |
2089 * |
2094 * @param aActive Reference to an CSmsProtocol object |
2090 * @param aActive Reference to an CSmsProtocol object |
2095 */ |
2091 */ |
2096 CSmsProtocolBootTimer* CSmsProtocolBootTimer::NewL(CSmsProtocol& aSmsProtocol) |
2092 CSmsProtocolBootTimer* CSmsProtocolBootTimer::NewL(CSmsProtocol& aSmsProtocol) |
2097 { |
2093 { |
2098 LOGSMSPROT1("CSmsProtocolBootTimer::NewL"); |
2094 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROTOCOLBOOTTIMER_NEWL_1, "CSmsProtocolBootTimer::NewL"); |
2099 |
2095 |
2100 CSmsProtocolBootTimer* self = new(ELeave) CSmsProtocolBootTimer(aSmsProtocol); |
2096 CSmsProtocolBootTimer* self = new(ELeave) CSmsProtocolBootTimer(aSmsProtocol); |
2101 CleanupStack::PushL(self); |
2097 CleanupStack::PushL(self); |
2102 self->ConstructL(); |
2098 self->ConstructL(); |
2103 CleanupStack::Pop(self); |
2099 CleanupStack::Pop(self); |