1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2001-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". |
30 #include "Gsmumsg.h" |
36 #include "Gsmumsg.h" |
31 |
37 |
32 #include "smsustrm.h" |
38 #include "smsustrm.h" |
33 #include "smspmain.h" |
39 #include "smspmain.h" |
34 #include "smspfacadestor.h" |
40 #include "smspfacadestor.h" |
|
41 |
|
42 #include "smsstacklog.h" |
35 |
43 |
36 // CSmsProvider policies |
44 // CSmsProvider policies |
37 // |
45 // |
38 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlDeleteSmsMessagePolicy,ECapabilityWriteUserData); |
46 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlDeleteSmsMessagePolicy,ECapabilityWriteUserData); |
39 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlEnumerateSmsMessagesPolicy,ECapabilityReadUserData ); |
47 static _LIT_SECURITY_POLICY_C1(smsProviderIoctlEnumerateSmsMessagesPolicy,ECapabilityReadUserData ); |
59 * @return a new CSmsProvider object. |
67 * @return a new CSmsProvider object. |
60 * |
68 * |
61 */ |
69 */ |
62 CSmsProvider* CSmsProvider::NewL(CSmsProtocol& aProtocol) |
70 CSmsProvider* CSmsProvider::NewL(CSmsProtocol& aProtocol) |
63 { |
71 { |
64 LOGSMSPROT1("CSmsProvider::NewL"); |
72 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_NEWL_1, "CSmsProvider::NewL"); |
65 |
73 |
66 CSmsProvider* self =new(ELeave) CSmsProvider(aProtocol); |
74 CSmsProvider* self =new(ELeave) CSmsProvider(aProtocol); |
67 CleanupStack::PushL(self); |
75 CleanupStack::PushL(self); |
68 self->ConstructL(); |
76 self->ConstructL(); |
69 CleanupStack::Pop(self); |
77 CleanupStack::Pop(self); |
70 |
78 |
71 LOGSMSPROT1("-> CSmsProvider::NewL - done"); |
79 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_NEWL_2, "-> CSmsProvider::NewL - done"); |
72 |
80 |
73 return self; |
81 return self; |
74 } |
82 } |
75 |
83 |
76 /** |
84 /** |
89 * receive buffers. |
97 * receive buffers. |
90 * |
98 * |
91 */ |
99 */ |
92 void CSmsProvider::ConstructL() |
100 void CSmsProvider::ConstructL() |
93 { |
101 { |
94 LOGSMSPROT1("CSmsProvider::ConstructL"); |
102 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CONSTRUCTL_1, "CSmsProvider::ConstructL"); |
95 |
103 |
96 iProtocol.AddSmsMessageObserverL(*this); |
104 iProtocol.AddSmsMessageObserverL(*this); |
97 SetObserverAddedToProtocol(ETrue); |
105 SetObserverAddedToProtocol(ETrue); |
98 iRecvBufSegArray=new(ELeave) CArrayPtrFlat<CBufSeg>(8); |
106 iRecvBufSegArray=new(ELeave) CArrayPtrFlat<CBufSeg>(8); |
99 iSendBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength); |
107 iSendBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength); |
100 |
108 |
101 LOGSMSPROT1("-> CSmsProvider::ConstructL - done"); |
109 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CONSTRUCTL_2, "-> CSmsProvider::ConstructL - done"); |
102 } |
110 } |
103 |
111 |
104 /** |
112 /** |
105 * D'tor |
113 * D'tor |
106 * |
114 * |
126 * Does nothing. Implementation of pure virtual CServProviderBase::Start(). |
134 * Does nothing. Implementation of pure virtual CServProviderBase::Start(). |
127 * |
135 * |
128 */ |
136 */ |
129 void CSmsProvider::Start() |
137 void CSmsProvider::Start() |
130 { |
138 { |
131 LOGSMSPROT1("CSmsProvider::Start"); |
139 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_START_1, "CSmsProvider::Start"); |
132 } |
140 } |
133 |
141 |
134 /** |
142 /** |
135 * Returns the local address of this SAP. Implementation of |
143 * Returns the local address of this SAP. Implementation of |
136 * pure virtual CServProviderBase::LocalName(). |
144 * pure virtual CServProviderBase::LocalName(). |
137 * |
145 * |
138 */ |
146 */ |
139 void CSmsProvider::LocalName(TSockAddr& aAddr) const |
147 void CSmsProvider::LocalName(TSockAddr& aAddr) const |
140 { |
148 { |
141 LOGSMSPROT1("CSmsProvider::LocalName"); |
149 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_LOCALNAME_1, "CSmsProvider::LocalName"); |
142 aAddr = iLocalAddress; |
150 aAddr = iLocalAddress; |
143 } |
151 } |
144 |
152 |
145 /** |
153 /** |
146 * Sets the local address of this SAP by binding it to the protocol. |
154 * Sets the local address of this SAP by binding it to the protocol. |
152 * |
160 * |
153 * @capability NetworkServices |
161 * @capability NetworkServices |
154 */ |
162 */ |
155 TInt CSmsProvider::SetLocalName(TSockAddr& aAddr) |
163 TInt CSmsProvider::SetLocalName(TSockAddr& aAddr) |
156 { |
164 { |
157 LOGSMSPROT1("CSmsProvider::SetLocalName"); |
165 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SETLOCALNAME_1, "CSmsProvider::SetLocalName"); |
158 |
166 |
159 if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderSetLocalNamePolicy,"CSmsProvider SetLocal Name policy check") != KErrNone) ) |
167 if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderSetLocalNamePolicy,"CSmsProvider SetLocal Name policy check") != KErrNone) ) |
160 { |
168 { |
161 return KErrPermissionDenied; |
169 return KErrPermissionDenied; |
162 } |
170 } |
180 */ |
188 */ |
181 void CSmsProvider::RemName(TSockAddr& /*aAddr*/) const |
189 void CSmsProvider::RemName(TSockAddr& /*aAddr*/) const |
182 { |
190 { |
183 // Ignore in code coverage - not intended to be used |
191 // Ignore in code coverage - not intended to be used |
184 BULLSEYE_OFF |
192 BULLSEYE_OFF |
185 LOGSMSPROT1("CSmsProvider::RemName"); |
193 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_REMNAME_1, "CSmsProvider::RemName"); |
186 BULLSEYE_RESTORE |
194 BULLSEYE_RESTORE |
187 } |
195 } |
188 |
196 |
189 /** |
197 /** |
190 * Called by the protocol to set the remote name of the connection. |
198 * Called by the protocol to set the remote name of the connection. |
210 */ |
218 */ |
211 TInt CSmsProvider::GetOption(TUint /*aLevel*/,TUint /*aName*/,TDes8& /*aOption*/) const |
219 TInt CSmsProvider::GetOption(TUint /*aLevel*/,TUint /*aName*/,TDes8& /*aOption*/) const |
212 { |
220 { |
213 // Ignore in code coverage - not intended to be used |
221 // Ignore in code coverage - not intended to be used |
214 BULLSEYE_OFF |
222 BULLSEYE_OFF |
215 LOGSMSPROT1("CSmsProvider::GetOption"); |
223 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_GETOPTION_1, "CSmsProvider::GetOption"); |
216 return 0; |
224 return 0; |
217 BULLSEYE_RESTORE |
225 BULLSEYE_RESTORE |
218 } |
226 } |
219 |
227 |
220 /** |
228 /** |
234 * @param aOption the IOCTL option. |
242 * @param aOption the IOCTL option. |
235 * |
243 * |
236 */ |
244 */ |
237 void CSmsProvider::Ioctl(TUint aLevel,TUint aName,TDes8* aOption) |
245 void CSmsProvider::Ioctl(TUint aLevel,TUint aName,TDes8* aOption) |
238 { |
246 { |
239 LOGSMSPROT3("CSmsProvider::Ioctl [aLevel=%d, aName=%d]", aLevel, aName); |
247 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_1, "CSmsProvider::Ioctl [aLevel=%u, aName=%u provider=0x%08x]", aLevel, aName, (TUint)this); |
240 LOGSMSPROT2("CSmsProvider::Ioctl [provider=0x%08x]",this); |
|
241 |
248 |
242 // Panic in debug mode if this call is invalid in this SAPs current state |
249 // Panic in debug mode if this call is invalid in this SAPs current state |
243 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
250 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
244 __ASSERT_DEBUG(!IoctlOutstanding(),SmspPanic(KSmspPanicIoctlAlreadyOutstanding)); |
251 __ASSERT_DEBUG(!IoctlOutstanding(),SmspPanic(KSmspPanicIoctlAlreadyOutstanding)); |
245 // Gracefully handle invalid calls in release build |
252 // Gracefully handle invalid calls in release build |
373 // Read message from the socket |
380 // Read message from the socket |
374 CSmsMessage*smsmessage=NULL; |
381 CSmsMessage*smsmessage=NULL; |
375 TRAPD(ret,(smsmessage=InternalizeMessageL())); |
382 TRAPD(ret,(smsmessage=InternalizeMessageL())); |
376 if( ret!=KErrNone ) |
383 if( ret!=KErrNone ) |
377 { |
384 { |
378 LOGSMSPROT2("-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret); |
385 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_3, "-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret); |
379 iSendBufSeg->Reset(); |
386 iSendBufSeg->Reset(); |
380 iSocket->Error(ret, MSocketNotify::EErrorIoctl); |
387 iSocket->Error(ret, MSocketNotify::EErrorIoctl); |
381 } |
388 } |
382 else |
389 else |
383 { |
390 { |
399 CSmsMessage*smsmessage=NULL; |
406 CSmsMessage*smsmessage=NULL; |
400 TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(0)))); |
407 TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(0)))); |
401 if( ret==KErrNone ) |
408 if( ret==KErrNone ) |
402 { |
409 { |
403 TRAP(ret,(iProtocol.DeleteSMSFromReaStoreL( *smsmessage ))); |
410 TRAP(ret,(iProtocol.DeleteSMSFromReaStoreL( *smsmessage ))); |
404 LOGSMSPROT2("-> CSmsProvider::Ioctl - CSmsProvider::DeleteSMSFromReaStoreL [ret=%d]", ret); |
411 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_4, "-> CSmsProvider::Ioctl - CSmsProvider::DeleteSMSFromReaStoreL [ret=%d]", ret); |
405 } |
412 } |
406 else |
413 else |
407 { |
414 { |
408 LOGSMSPROT2("-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret); |
415 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_5, "-> CSmsProvider::Ioctl - CSmsProvider::InternalizeMessageL [ret=%d]", ret); |
409 } |
416 } |
410 delete smsmessage; |
417 delete smsmessage; |
411 // Looking for more sms left in the store |
418 // Looking for more sms left in the store |
412 // This is now done after finishing the readprocess |
419 // This is now done after finishing the readprocess |
413 iProtocol.MessageReadedSuccessfully(); |
420 iProtocol.MessageReadedSuccessfully(); |
414 if( iEnumSocket ) |
421 if( iEnumSocket ) |
415 { |
422 { |
416 --iNumOfEnumeratedMessages; |
423 --iNumOfEnumeratedMessages; |
417 LOGSMSPROT2("-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=%d]", iNumOfEnumeratedMessages); |
424 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_6, "-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=%d]", iNumOfEnumeratedMessages); |
418 if( iNumOfEnumeratedMessages <= 0 ) |
425 if( iNumOfEnumeratedMessages <= 0 ) |
419 { |
426 { |
420 iProtocol.iPhoneEnumerationObserver=NULL; |
427 iProtocol.iPhoneEnumerationObserver=NULL; |
421 iEnumSocket=EFalse; |
428 iEnumSocket=EFalse; |
422 iProtocol.MessageReadedSuccessfully(); |
429 iProtocol.MessageReadedSuccessfully(); |
423 LOGSMSPROT1("-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=NULL]"); |
430 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_7, "-> CSmsProvider::Ioctl - [iNumOfEnumeratedMessages=NULL]"); |
424 } |
431 } |
425 } |
432 } |
426 // Remove the message from the receive buffer & complete |
433 // Remove the message from the receive buffer & complete |
427 delete iRecvBufSegArray->At(0); |
434 delete iRecvBufSegArray->At(0); |
428 iRecvBufSegArray->At(0) = NULL; |
435 iRecvBufSegArray->At(0) = NULL; |
447 { |
454 { |
448 --iNumOfEnumeratedMessages; |
455 --iNumOfEnumeratedMessages; |
449 if( iNumOfEnumeratedMessages <= 0 ) |
456 if( iNumOfEnumeratedMessages <= 0 ) |
450 { |
457 { |
451 iProtocol.iPhoneEnumerationObserver=NULL; |
458 iProtocol.iPhoneEnumerationObserver=NULL; |
452 LOGSMSPROT1("-> CSmsProvider::Ioctl - fail [iNumOfEnumeratedMessages=NULL]"); |
459 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_IOCTL_8, "-> CSmsProvider::Ioctl - fail [iNumOfEnumeratedMessages=NULL]"); |
453 iEnumSocket=EFalse; |
460 iEnumSocket=EFalse; |
454 iProtocol.MessageReadedSuccessfully(); |
461 iProtocol.MessageReadedSuccessfully(); |
455 } |
462 } |
456 } |
463 } |
457 iSocket->Error(KErrNotSupported,MSocketNotify::EErrorIoctl); |
464 iSocket->Error(KErrNotSupported,MSocketNotify::EErrorIoctl); |
555 * @param aName the name of the ioctl request to cancel. |
562 * @param aName the name of the ioctl request to cancel. |
556 * |
563 * |
557 */ |
564 */ |
558 void CSmsProvider::CancelIoctl(TUint aLevel, TUint aName) |
565 void CSmsProvider::CancelIoctl(TUint aLevel, TUint aName) |
559 { |
566 { |
560 LOGSMSPROT3("CSmsProvider::CancelIoctl [aLevel=%d, aName=%d]", aLevel, aName); |
567 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CANCELIOCTL_1, "CSmsProvider::CancelIoctl [aLevel=%u, aName=%u]", aLevel, aName); |
561 |
568 |
562 // Panic in debug mode if this call is invalid in this SAPs current state |
569 // Panic in debug mode if this call is invalid in this SAPs current state |
563 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
570 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
564 __ASSERT_DEBUG(iName==aName,SmspPanic(ESmspBadIoctlName)); |
571 __ASSERT_DEBUG(iName==aName,SmspPanic(ESmspBadIoctlName)); |
565 if( iName != aName ) |
572 if( iName != aName ) |
581 { |
588 { |
582 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
589 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
583 iProtocol.CancelEnumeratePhone(*this); |
590 iProtocol.CancelEnumeratePhone(*this); |
584 iEnumSocket=EFalse; |
591 iEnumSocket=EFalse; |
585 iProtocol.iPhoneEnumerationObserver=NULL; |
592 iProtocol.iPhoneEnumerationObserver=NULL; |
586 LOGSMSPROT1("-> CSmsProvider::CancelIoctl - [iNumOfEnumeratedMessages=NULL]"); |
593 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CANCELIOCTL_2, "-> CSmsProvider::CancelIoctl - [iNumOfEnumeratedMessages=NULL]"); |
587 } break; |
594 } break; |
588 case KIoctlWriteSmsMessage: |
595 case KIoctlWriteSmsMessage: |
589 { |
596 { |
590 iProtocol.CancelWriteSmsMessage(*this); |
597 iProtocol.CancelWriteSmsMessage(*this); |
591 } break; |
598 } break; |
628 */ |
635 */ |
629 TInt CSmsProvider::SetOption(TUint /*aLevel*/,TUint /*aName*/,const TDesC8& /*aOption*/) |
636 TInt CSmsProvider::SetOption(TUint /*aLevel*/,TUint /*aName*/,const TDesC8& /*aOption*/) |
630 { |
637 { |
631 // Ignore in code coverage - not intended to be used |
638 // Ignore in code coverage - not intended to be used |
632 BULLSEYE_OFF |
639 BULLSEYE_OFF |
633 LOGSMSPROT1("CSmsProvider::SetOption()"); |
640 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SETOPTION_1, "CSmsProvider::SetOption()"); |
634 return 0; |
641 return 0; |
635 BULLSEYE_RESTORE |
642 BULLSEYE_RESTORE |
636 } |
643 } |
637 |
644 |
638 /** |
645 /** |
652 * |
659 * |
653 * @capability None |
660 * @capability None |
654 */ |
661 */ |
655 TInt CSmsProvider::Write(RMBufChain& aBufChain, TUint /*aOptions*/, TSockAddr* /*aAddr*/) |
662 TInt CSmsProvider::Write(RMBufChain& aBufChain, TUint /*aOptions*/, TSockAddr* /*aAddr*/) |
656 { |
663 { |
657 LOGSMSPROT1("CSmsProvider::Write"); |
664 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_WRITE_1, "CSmsProvider::Write"); |
658 |
665 |
659 if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderWritePolicy,"CSmsProvider Write policy check") != KErrNone) ) |
666 if( !iSecurityChecker || (iSecurityChecker->CheckPolicy(smsProviderWritePolicy,"CSmsProvider Write policy check") != KErrNone) ) |
660 { |
667 { |
661 return KErrPermissionDenied; |
668 return KErrPermissionDenied; |
662 } |
669 } |
663 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
670 __ASSERT_DEBUG(iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound,SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
664 |
671 |
665 /// @note: LOGIFH2A2 macro for logging esock write |
672 /// @note: LOGIFH2A2 macro for logging esock write |
666 LOGSMSPROT2("-> CSmsProvider::Write [%d bytes]", aBufChain.Length()); |
673 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_WRITE_2, "-> CSmsProvider::Write [%d bytes]", aBufChain.Length()); |
667 #ifdef SMSLOGGERIF |
674 #ifdef SMSLOGGERIF |
668 HBufC8* debugBuf = HBufC8::New(aBufChain.Length()); |
675 HBufC8* debugBuf = HBufC8::New(aBufChain.Length()); |
669 if(debugBuf) |
676 if(debugBuf) |
670 { |
677 { |
671 TPtr8 debugData = debugBuf->Des(); |
678 TPtr8 debugData = debugBuf->Des(); |
721 */ |
728 */ |
722 TInt CSmsProvider::GetData(RMBufChain& aBufChain, TUint /*aLength*/, TUint /*aOptions*/, TSockAddr* /*aAddr*/) |
729 TInt CSmsProvider::GetData(RMBufChain& aBufChain, TUint /*aLength*/, TUint /*aOptions*/, TSockAddr* /*aAddr*/) |
723 { |
730 { |
724 __ASSERT_DEBUG((iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound) && (iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly),SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
731 __ASSERT_DEBUG((iLocalAddress.SmsAddrFamily()!=ESmsAddrUnbound) && (iLocalAddress.SmsAddrFamily()!=ESmsAddrSendOnly),SmspPanic(KSmspPanicWrongSmsAddressFamily)); |
725 |
732 |
726 LOGSMSPROT2("CSmsProvider::GetData [provider=0x%08x]", this); |
733 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_GETDATA_1, "CSmsProvider::GetData [provider=0x%08x]", (TUint)this); |
727 |
734 |
728 // Get the segmented buffer of first message |
735 // Get the segmented buffer of first message |
729 CBufSeg* recvbufseg=iRecvBufSegArray->At(0); |
736 CBufSeg* recvbufseg=iRecvBufSegArray->At(0); |
730 TInt size=recvbufseg->Size(); |
737 TInt size=recvbufseg->Size(); |
731 __ASSERT_DEBUG(iSegmentIndex<NumSegments(size),SmspPanic(KSmspPanicBadClientMessageRead)); |
738 __ASSERT_DEBUG(iSegmentIndex<NumSegments(size),SmspPanic(KSmspPanicBadClientMessageRead)); |
772 */ |
779 */ |
773 void CSmsProvider::ActiveOpen() |
780 void CSmsProvider::ActiveOpen() |
774 { |
781 { |
775 // Ignore in code coverage - not intended to be used |
782 // Ignore in code coverage - not intended to be used |
776 BULLSEYE_OFF |
783 BULLSEYE_OFF |
777 LOGSMSPROT1("CSmsProvider::ActiveOpen [does nothing]"); |
784 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_ACTIVEOPEN_1, "CSmsProvider::ActiveOpen [does nothing]"); |
778 BULLSEYE_RESTORE |
785 BULLSEYE_RESTORE |
779 } |
786 } |
780 |
787 |
781 /** |
788 /** |
782 * Called by the socket server to indicate the provider should connect to |
789 * Called by the socket server to indicate the provider should connect to |
787 */ |
794 */ |
788 void CSmsProvider::ActiveOpen(const TDesC8& /*aConnectionData*/) |
795 void CSmsProvider::ActiveOpen(const TDesC8& /*aConnectionData*/) |
789 { |
796 { |
790 // Ignore in code coverage - not intended to be used |
797 // Ignore in code coverage - not intended to be used |
791 BULLSEYE_OFF |
798 BULLSEYE_OFF |
792 LOGSMSPROT1("CSmsProvider::ActiveOpen [does nothing]"); |
799 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_ACTIVEOPEN1_1, "CSmsProvider::ActiveOpen [does nothing]"); |
793 BULLSEYE_RESTORE |
800 BULLSEYE_RESTORE |
794 } |
801 } |
795 |
802 |
796 /** |
803 /** |
797 * Called by the socket server to indicate the provider should wait for an |
804 * Called by the socket server to indicate the provider should wait for an |
803 */ |
810 */ |
804 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/) |
811 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/) |
805 { |
812 { |
806 // Ignore in code coverage - not intended to be used |
813 // Ignore in code coverage - not intended to be used |
807 BULLSEYE_OFF |
814 BULLSEYE_OFF |
808 LOGSMSPROT1("CSmsProvider::PassiveOpen [not supported]"); |
815 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_PASSIVEOPEN_1, "CSmsProvider::PassiveOpen [not supported]"); |
809 return KErrNotSupported; |
816 return KErrNotSupported; |
810 BULLSEYE_RESTORE |
817 BULLSEYE_RESTORE |
811 } |
818 } |
812 |
819 |
813 /** |
820 /** |
820 */ |
827 */ |
821 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/,const TDesC8& /*aConnectionData*/) |
828 TInt CSmsProvider::PassiveOpen(TUint /*aQueSize*/,const TDesC8& /*aConnectionData*/) |
822 { |
829 { |
823 // Ignore in code coverage - not intended to be used |
830 // Ignore in code coverage - not intended to be used |
824 BULLSEYE_OFF |
831 BULLSEYE_OFF |
825 LOGSMSPROT1("CSmsProvider::PassiveOpen [not supported]"); |
832 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_PASSIVEOPEN1_1, "CSmsProvider::PassiveOpen [not supported]"); |
826 return KErrNotSupported; |
833 return KErrNotSupported; |
827 BULLSEYE_RESTORE |
834 BULLSEYE_RESTORE |
828 } |
835 } |
829 |
836 |
830 /** |
837 /** |
833 * Implementation of the pure virtual CServProviderBase::Shutdown(). |
840 * Implementation of the pure virtual CServProviderBase::Shutdown(). |
834 * |
841 * |
835 */ |
842 */ |
836 void CSmsProvider::Shutdown(TCloseType aOption) |
843 void CSmsProvider::Shutdown(TCloseType aOption) |
837 { |
844 { |
838 LOGSMSPROT2("CSmsProvider::Shutdown [aOption=%d]", aOption); |
845 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN_1, "CSmsProvider::Shutdown [aOption=%d]", aOption); |
839 |
846 |
840 TInt messagesInBuffer = iRecvBufSegArray->Count(); |
847 TInt messagesInBuffer = iRecvBufSegArray->Count(); |
841 for( TInt index = 0; index < messagesInBuffer; ++index ) |
848 for( TInt index = 0; index < messagesInBuffer; ++index ) |
842 { |
849 { |
843 // Read message from the socket |
850 // Read message from the socket |
844 CSmsMessage*smsmessage=NULL; |
851 CSmsMessage*smsmessage=NULL; |
845 TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(index)))); |
852 TRAPD(ret,(smsmessage=InternalizeMessageL(iRecvBufSegArray->At(index)))); |
846 if( ret == KErrNone ) |
853 if( ret == KErrNone ) |
847 { |
854 { |
848 TRAP(ret, (iProtocol.iReassemblyStore->SetMessagePassedToClientL(*smsmessage, EFalse))); |
855 TRAP(ret, (iProtocol.iReassemblyStore->SetMessagePassedToClientL(*smsmessage, EFalse))); |
849 LOGSMSPROT2("-> CSmsProvider::Shutdown - SetMessagePassedToClientL [ret=%d]", ret); |
856 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN_2, "-> CSmsProvider::Shutdown - SetMessagePassedToClientL [ret=%d]", ret); |
850 } |
857 } |
851 else |
858 else |
852 { |
859 { |
853 LOGSMSPROT2("-> CSmsProvider::Shutdown - CSmsProvider::InternalizeMessageL leave [ret=%d]", ret); |
860 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN_3, "-> CSmsProvider::Shutdown - CSmsProvider::InternalizeMessageL leave [ret=%d]", ret); |
854 } |
861 } |
855 delete smsmessage; |
862 delete smsmessage; |
856 } |
863 } |
857 |
864 |
858 if( iEnumSocket && iProtocol.iPhoneEnumerationObserver == this ) |
865 if( iEnumSocket && iProtocol.iPhoneEnumerationObserver == this ) |
877 * Implementation of the pure virtual CServProviderBase::Shutdown(). |
884 * Implementation of the pure virtual CServProviderBase::Shutdown(). |
878 * |
885 * |
879 */ |
886 */ |
880 void CSmsProvider::Shutdown(TCloseType aOption, const TDesC8& /*aDisconnectionData*/) |
887 void CSmsProvider::Shutdown(TCloseType aOption, const TDesC8& /*aDisconnectionData*/) |
881 { |
888 { |
882 LOGSMSPROT1("CSmsProvider::Shutdown"); |
889 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SHUTDOWN1_1, "CSmsProvider::Shutdown"); |
883 Shutdown(aOption); |
890 Shutdown(aOption); |
884 } |
891 } |
885 |
892 |
886 /** |
893 /** |
887 * Called by the socket server to indicate the provider should choose |
894 * Called by the socket server to indicate the provider should choose |
892 */ |
899 */ |
893 void CSmsProvider::AutoBind() |
900 void CSmsProvider::AutoBind() |
894 { |
901 { |
895 // Ignore in code coverage - not intended to be used |
902 // Ignore in code coverage - not intended to be used |
896 BULLSEYE_OFF |
903 BULLSEYE_OFF |
897 LOGSMSPROT1("CSmsProvider::AutoBind [does nothing]"); |
904 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_AUTOBIND_1, "CSmsProvider::AutoBind [does nothing]"); |
898 BULLSEYE_RESTORE |
905 BULLSEYE_RESTORE |
899 } |
906 } |
900 |
907 |
901 /** |
908 /** |
902 * Called by the SMS protocol to obtain the local address of this SAP. |
909 * Called by the SMS protocol to obtain the local address of this SAP. |
904 * @return the local address of this SAP. |
911 * @return the local address of this SAP. |
905 * |
912 * |
906 */ |
913 */ |
907 const TSmsAddr& CSmsProvider::GetLocalAddress() const |
914 const TSmsAddr& CSmsProvider::GetLocalAddress() const |
908 { |
915 { |
909 LOGSMSPROT1("CSmsProvider::GetLocalAddress"); |
916 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_GETLOCALADDRESS_1, "CSmsProvider::GetLocalAddress"); |
910 return iLocalAddress; |
917 return iLocalAddress; |
911 } |
918 } |
912 |
919 |
913 /** |
920 /** |
914 * Called by the SMS protocol to bind a local address to this SAP. |
921 * Called by the SMS protocol to bind a local address to this SAP. |
915 * |
922 * |
916 */ |
923 */ |
917 void CSmsProvider::SetLocalAddress(const TSmsAddr& aSmsAddr) |
924 void CSmsProvider::SetLocalAddress(const TSmsAddr& aSmsAddr) |
918 { |
925 { |
919 LOGSMSPROT1("CSmsProvider::SetLocalAddress"); |
926 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SETLOCALADDRESS_1, "CSmsProvider::SetLocalAddress"); |
920 iLocalAddress = aSmsAddr; |
927 iLocalAddress = aSmsAddr; |
921 } |
928 } |
922 |
929 |
923 /** |
930 /** |
924 * Called by the protocol when the modem connection state has changed. |
931 * Called by the protocol when the modem connection state has changed. |
927 * @param aStatus either KIoctlSelectModemPresent or KIoctlSelectModemNotPresent. |
934 * @param aStatus either KIoctlSelectModemPresent or KIoctlSelectModemNotPresent. |
928 * |
935 * |
929 */ |
936 */ |
930 void CSmsProvider::ModemNotificationCompleted(TInt aStatus) |
937 void CSmsProvider::ModemNotificationCompleted(TInt aStatus) |
931 { |
938 { |
932 LOGSMSPROT2("CSmsProvider::ModemNotificationCompleted [aStatus=%d]", aStatus); |
939 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MODEMNOTIFICATIONCOMPLETED_1, "CSmsProvider::ModemNotificationCompleted [aStatus=%d]", aStatus); |
933 |
940 |
934 if( !IoctlOutstanding() ) |
941 if( !IoctlOutstanding() ) |
935 { |
942 { |
936 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
943 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
937 } |
944 } |
944 * @param aStatus the result of the send. |
951 * @param aStatus the result of the send. |
945 * |
952 * |
946 */ |
953 */ |
947 void CSmsProvider::MessageSendCompleted(TInt aStatus) |
954 void CSmsProvider::MessageSendCompleted(TInt aStatus) |
948 { |
955 { |
949 LOGSMSPROT2("CSmsProvider::MessageSendCompleted [aStatus=%d]", aStatus); |
956 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGESENDCOMPLETED_1, "CSmsProvider::MessageSendCompleted [aStatus=%d]", aStatus); |
950 |
957 |
951 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
958 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
952 SetIoctlOutstanding(EFalse); |
959 SetIoctlOutstanding(EFalse); |
953 } |
960 } |
954 |
961 |
959 * @return KErrNone if the message was serialized to the receive buffer successfully. |
966 * @return KErrNone if the message was serialized to the receive buffer successfully. |
960 * |
967 * |
961 */ |
968 */ |
962 TInt CSmsProvider::MessageReceived(const CSmsMessage& aSmsMessage,TDes& /*aDes*/) |
969 TInt CSmsProvider::MessageReceived(const CSmsMessage& aSmsMessage,TDes& /*aDes*/) |
963 { |
970 { |
964 LOGSMSPROT1("CSmsProvider::MessageReceived"); |
971 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGERECEIVED_1, "CSmsProvider::MessageReceived"); |
965 |
972 |
966 // Attempt to serial the message to the receive buffer & notify |
973 // Attempt to serial the message to the receive buffer & notify |
967 // the socket of the new data |
974 // the socket of the new data |
968 TInt numnewsegments=0; |
975 TInt numnewsegments=0; |
969 TRAPD(ret,(numnewsegments=ExternalizeMessageL(aSmsMessage,ETrue))); |
976 TRAPD(ret,(numnewsegments=ExternalizeMessageL(aSmsMessage,ETrue))); |
977 /** |
984 /** |
978 * Informs protocol whether client confirms received message |
985 * Informs protocol whether client confirms received message |
979 */ |
986 */ |
980 TBool CSmsProvider::ClientConfirmsMessage() const |
987 TBool CSmsProvider::ClientConfirmsMessage() const |
981 { |
988 { |
982 LOGSMSPROT1("CSmsProvider::ClientConfirmsMessage"); |
989 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_CLIENTCONFIRMSMESSAGE_1, "CSmsProvider::ClientConfirmsMessage"); |
983 |
990 |
984 return ETrue; |
991 return ETrue; |
985 } |
992 } |
986 |
993 |
987 /** |
994 /** |
988 * Informs protocol whether address is ued by the observer |
995 * Informs protocol whether address is ued by the observer |
989 */ |
996 */ |
990 TInt CSmsProvider::SmsAddrIsDuplicate(const MSmsMessageObserver* aObserver, const TSmsAddr& aAddr) const |
997 TInt CSmsProvider::SmsAddrIsDuplicate(const MSmsMessageObserver* aObserver, const TSmsAddr& aAddr) const |
991 { |
998 { |
992 LOGSMSPROT1("CSmsProvider::SmsAddrIsDuplicate"); |
999 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SMSADDRISDUPLICATE_1, "CSmsProvider::SmsAddrIsDuplicate"); |
993 |
1000 |
994 if( this == aObserver ) |
1001 if( this == aObserver ) |
995 { |
1002 { |
996 return EFalse; |
1003 return EFalse; |
997 } |
1004 } |
1005 * @param aStatus the result of the enumeration. |
1012 * @param aStatus the result of the enumeration. |
1006 * |
1013 * |
1007 */ |
1014 */ |
1008 void CSmsProvider::EnumeratePhoneCompleted(TInt aStatus) |
1015 void CSmsProvider::EnumeratePhoneCompleted(TInt aStatus) |
1009 { |
1016 { |
1010 LOGSMSPROT2("CSmsProvider::EnumeratePhoneCompleted [aStatus=%d]", aStatus); |
1017 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_ENUMERATEPHONECOMPLETED_1, "CSmsProvider::EnumeratePhoneCompleted [aStatus=%d]", aStatus); |
1011 |
1018 |
1012 // Attempt to serialize all enumerated messages to the receive buffer |
1019 // Attempt to serialize all enumerated messages to the receive buffer |
1013 TInt numnewsegments=0; |
1020 TInt numnewsegments=0; |
1014 TInt count=0; |
1021 TInt count=0; |
1015 if( aStatus==KErrNone ) |
1022 if( aStatus==KErrNone ) |
1072 * @param aStatus the result of the write operation. |
1079 * @param aStatus the result of the write operation. |
1073 * |
1080 * |
1074 */ |
1081 */ |
1075 void CSmsProvider::MessageWriteCompleted(TInt aStatus, const CSmsMessage* aSmsMessage) |
1082 void CSmsProvider::MessageWriteCompleted(TInt aStatus, const CSmsMessage* aSmsMessage) |
1076 { |
1083 { |
1077 LOGSMSPROT2("CSmsProvider::MessageWriteCompleted [aStatus=%d]", aStatus); |
1084 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGEWRITECOMPLETED_1, "CSmsProvider::MessageWriteCompleted [aStatus=%d]", aStatus); |
1078 |
1085 |
1079 // If no errors at present populate the buffer |
1086 // If no errors at present populate the buffer |
1080 if( aStatus == KErrNone ) |
1087 if( aStatus == KErrNone ) |
1081 { |
1088 { |
1082 TRAP(aStatus, (PopulateBufferWithPDUSlotsL(*aSmsMessage))); |
1089 TRAP(aStatus, (PopulateBufferWithPDUSlotsL(*aSmsMessage))); |
1095 * @param aSmsMessage the message containing the slot information. |
1102 * @param aSmsMessage the message containing the slot information. |
1096 * |
1103 * |
1097 */ |
1104 */ |
1098 void CSmsProvider::PopulateBufferWithPDUSlotsL(const CSmsMessage& aSmsMessage) |
1105 void CSmsProvider::PopulateBufferWithPDUSlotsL(const CSmsMessage& aSmsMessage) |
1099 { |
1106 { |
1100 LOGSMSPROT1("CSmsProvider::PopulateBufferWithPDUSlotsL"); |
1107 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_POPULATEBUFFERWITHPDUSLOTSL_1, "CSmsProvider::PopulateBufferWithPDUSlotsL"); |
1101 |
1108 |
1102 // Create buffer for store id and PDU slot indexes based on size of slot array |
1109 // Create buffer for store id and PDU slot indexes based on size of slot array |
1103 |
1110 |
1104 HBufC8* buf = HBufC8::NewL(aSmsMessage.iSlotArray.Count()+1 * sizeof(TUint)); |
1111 HBufC8* buf = HBufC8::NewL(aSmsMessage.iSlotArray.Count()+1 * sizeof(TUint)); |
1105 buf->Des().Append(aSmsMessage.Storage()); |
1112 buf->Des().Append(aSmsMessage.Storage()); |
1113 TPtr8 textBufPtr(buf->Des()); |
1120 TPtr8 textBufPtr(buf->Des()); |
1114 |
1121 |
1115 iSocket->IoctlComplete(&textBufPtr); |
1122 iSocket->IoctlComplete(&textBufPtr); |
1116 delete buf; |
1123 delete buf; |
1117 |
1124 |
1118 LOGSMSPROT1("-> CSmsProvider::PopulateBufferWithPDUSlotsL - done"); |
1125 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_POPULATEBUFFERWITHPDUSLOTSL_2, "-> CSmsProvider::PopulateBufferWithPDUSlotsL - done"); |
1119 } |
1126 } |
1120 |
1127 |
1121 /** |
1128 /** |
1122 * Called by the protocol when a request to delete a message from |
1129 * Called by the protocol when a request to delete a message from |
1123 * a phone store by this SAP has completed. |
1130 * a phone store by this SAP has completed. |
1126 * @param aStatus the result of the deletion. |
1133 * @param aStatus the result of the deletion. |
1127 * |
1134 * |
1128 */ |
1135 */ |
1129 void CSmsProvider::MessageDeleteCompleted(TInt aStatus) |
1136 void CSmsProvider::MessageDeleteCompleted(TInt aStatus) |
1130 { |
1137 { |
1131 LOGSMSPROT2("CSmsProvider::MessageDeleteCompleted [aStatus=%d]", aStatus); |
1138 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_MESSAGEDELETECOMPLETED_1, "CSmsProvider::MessageDeleteCompleted [aStatus=%d]", aStatus); |
1132 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
1139 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
1133 SetIoctlOutstanding(EFalse); |
1140 SetIoctlOutstanding(EFalse); |
1134 } |
1141 } |
1135 |
1142 |
1136 /** |
1143 /** |
1141 * @param aSmspList SMS parameter list |
1148 * @param aSmspList SMS parameter list |
1142 * |
1149 * |
1143 */ |
1150 */ |
1144 void CSmsProvider::ReadSmsParamsCompleted(TInt aStatus, CMobilePhoneSmspList* aSmspList) |
1151 void CSmsProvider::ReadSmsParamsCompleted(TInt aStatus, CMobilePhoneSmspList* aSmspList) |
1145 { |
1152 { |
1146 LOGSMSPROT2("CSmsProvider::ReadSmsParamsCompleted [aStatus=%d]", aStatus); |
1153 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_READSMSPARAMSCOMPLETED_1, "CSmsProvider::ReadSmsParamsCompleted [aStatus=%d]", aStatus); |
1147 |
1154 |
1148 TInt numNewSegments=0; |
1155 TInt numNewSegments=0; |
1149 |
1156 |
1150 if( aStatus == KErrNone ) |
1157 if( aStatus == KErrNone ) |
1151 { |
1158 { |
1175 * @param aStatus the result of the write operation. |
1182 * @param aStatus the result of the write operation. |
1176 * |
1183 * |
1177 */ |
1184 */ |
1178 void CSmsProvider::WriteSmsParamsCompleted(TInt aStatus) |
1185 void CSmsProvider::WriteSmsParamsCompleted(TInt aStatus) |
1179 { |
1186 { |
1180 LOGSMSPROT2("CSmsProvider::WriteSmsParamsCompleted [aStatus=%d]", aStatus); |
1187 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_WRITESMSPARAMSCOMPLETED_1, "CSmsProvider::WriteSmsParamsCompleted [aStatus=%d]", aStatus); |
1181 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
1188 iSocket->Error(aStatus,MSocketNotify::EErrorIoctl); |
1182 SetIoctlOutstanding(EFalse); |
1189 SetIoctlOutstanding(EFalse); |
1183 } |
1190 } |
1184 |
1191 |
1185 /** |
1192 /** |
1190 * @return the total number of segments the messages were split into. |
1197 * @return the total number of segments the messages were split into. |
1191 * |
1198 * |
1192 */ |
1199 */ |
1193 TInt CSmsProvider::ExternalizeEnumeratedMessagesL(TInt& aCount) |
1200 TInt CSmsProvider::ExternalizeEnumeratedMessagesL(TInt& aCount) |
1194 { |
1201 { |
1195 LOGSMSPROT1("CSmsProvider::ExternalizeEnumeratedMessagesL"); |
1202 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEENUMERATEDMESSAGESL_1, "CSmsProvider::ExternalizeEnumeratedMessagesL"); |
1196 |
1203 |
1197 TInt numnewsegments(0); |
1204 TInt numnewsegments(0); |
1198 numnewsegments=iProtocol.ExternalizeEnumeratedMessagesL(*this,aCount); |
1205 numnewsegments=iProtocol.ExternalizeEnumeratedMessagesL(*this,aCount); |
1199 |
1206 |
1200 LOGSMSPROT1("-> CSmsProvider::ExternalizeEnumeratedMessagesL - done"); |
1207 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEENUMERATEDMESSAGESL_2, "-> CSmsProvider::ExternalizeEnumeratedMessagesL - done"); |
1201 |
1208 |
1202 return numnewsegments; |
1209 return numnewsegments; |
1203 } |
1210 } |
1204 |
1211 |
1205 /** |
1212 /** |
1213 * @return the number of segments the message was split into. |
1220 * @return the number of segments the message was split into. |
1214 * |
1221 * |
1215 */ |
1222 */ |
1216 TInt CSmsProvider::ExternalizeMessageL(const CSmsMessage& aSmsMessage,TBool aAppend) |
1223 TInt CSmsProvider::ExternalizeMessageL(const CSmsMessage& aSmsMessage,TBool aAppend) |
1217 { |
1224 { |
1218 LOGSMSPROT1("CSmsProvider::ExternalizeMessageL()"); |
1225 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEMESSAGEL_1, "CSmsProvider::ExternalizeMessageL()"); |
1219 |
1226 |
1220 // Create a new segmented buffer for the serialization of this message |
1227 // Create a new segmented buffer for the serialization of this message |
1221 CBufSeg* recvbufseg = CBufSeg::NewL(KSmsMaxSegmentLength); |
1228 CBufSeg* recvbufseg = CBufSeg::NewL(KSmsMaxSegmentLength); |
1222 CleanupStack::PushL(recvbufseg); |
1229 CleanupStack::PushL(recvbufseg); |
1223 |
1230 |
1237 iRecvBufSegArray->InsertL(0,recvbufseg); |
1244 iRecvBufSegArray->InsertL(0,recvbufseg); |
1238 } |
1245 } |
1239 CleanupStack::PopAndDestroy(); // writestream |
1246 CleanupStack::PopAndDestroy(); // writestream |
1240 CleanupStack::Pop(); // recvbufseg |
1247 CleanupStack::Pop(); // recvbufseg |
1241 |
1248 |
1242 LOGSMSPROT1("-> CSmsProvider::ExternalizeMessageL - done"); |
1249 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEMESSAGEL_2, "-> CSmsProvider::ExternalizeMessageL - done"); |
1243 |
1250 |
1244 return NumSegments(recvbufseg->Size()); |
1251 return NumSegments(recvbufseg->Size()); |
1245 } |
1252 } |
1246 |
1253 |
1247 /** |
1254 /** |
1253 * @return the de-serialized CSmsMessage object. |
1260 * @return the de-serialized CSmsMessage object. |
1254 * |
1261 * |
1255 */ |
1262 */ |
1256 CSmsMessage* CSmsProvider::InternalizeMessageL() |
1263 CSmsMessage* CSmsProvider::InternalizeMessageL() |
1257 { |
1264 { |
1258 LOGSMSPROT1("CSmsProvider::InternalizeMessageL()"); |
1265 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEMESSAGEL_1, "CSmsProvider::InternalizeMessageL()"); |
1259 |
1266 |
1260 // Initialize the read stream with the buffer |
1267 // Initialize the read stream with the buffer |
1261 RBufReadStream readstream(*iSendBufSeg); |
1268 RBufReadStream readstream(*iSendBufSeg); |
1262 readstream.Open(*iSendBufSeg,0); |
1269 readstream.Open(*iSendBufSeg,0); |
1263 CleanupClosePushL(readstream); |
1270 CleanupClosePushL(readstream); |
1289 * @return the number of segments the parameters was split into. |
1296 * @return the number of segments the parameters was split into. |
1290 * |
1297 * |
1291 */ |
1298 */ |
1292 TInt CSmsProvider::ExternalizeParametersL(const CMobilePhoneSmspList& aMobilePhoneSmspList) |
1299 TInt CSmsProvider::ExternalizeParametersL(const CMobilePhoneSmspList& aMobilePhoneSmspList) |
1293 { |
1300 { |
1294 LOGSMSPROT1("CSmsProvider::ExternalizeParametersL"); |
1301 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEPARAMETERSL_1, "CSmsProvider::ExternalizeParametersL"); |
1295 |
1302 |
1296 // Create a new segmented buffer for the serialization of this message |
1303 // Create a new segmented buffer for the serialization of this message |
1297 CBufSeg* recvBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength); |
1304 CBufSeg* recvBufSeg = CBufSeg::NewL(KSmsMaxSegmentLength); |
1298 CleanupStack::PushL(recvBufSeg); |
1305 CleanupStack::PushL(recvBufSeg); |
1299 |
1306 |
1307 // Append start of the other serialized message buffers |
1314 // Append start of the other serialized message buffers |
1308 CleanupStack::PopAndDestroy(); //writeStream |
1315 CleanupStack::PopAndDestroy(); //writeStream |
1309 iRecvBufSegArray->InsertL(0,recvBufSeg); |
1316 iRecvBufSegArray->InsertL(0,recvBufSeg); |
1310 CleanupStack::Pop(recvBufSeg); |
1317 CleanupStack::Pop(recvBufSeg); |
1311 |
1318 |
1312 LOGSMSPROT1("-> CSmsProvider::ExternalizeParametersL - done"); |
1319 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_EXTERNALIZEPARAMETERSL_2, "-> CSmsProvider::ExternalizeParametersL - done"); |
1313 |
1320 |
1314 return NumSegments(recvBufSeg->Size()); |
1321 return NumSegments(recvBufSeg->Size()); |
1315 } |
1322 } |
1316 |
1323 |
1317 /** |
1324 /** |
1323 * @return the retrieved CMobilePhoneSmspList object. |
1330 * @return the retrieved CMobilePhoneSmspList object. |
1324 * |
1331 * |
1325 */ |
1332 */ |
1326 CMobilePhoneSmspList* CSmsProvider::InternalizeParametersL() |
1333 CMobilePhoneSmspList* CSmsProvider::InternalizeParametersL() |
1327 { |
1334 { |
1328 LOGSMSPROT1("CSmsProvider::InternalizeParametersL"); |
1335 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEPARAMETERSL_1, "CSmsProvider::InternalizeParametersL"); |
1329 |
1336 |
1330 // Initialize the read stream with the buffer |
1337 // Initialize the read stream with the buffer |
1331 RBufReadStream readStream(*iSendBufSeg); |
1338 RBufReadStream readStream(*iSendBufSeg); |
1332 readStream.Open(*iSendBufSeg,0); |
1339 readStream.Open(*iSendBufSeg,0); |
1333 CleanupClosePushL(readStream); |
1340 CleanupClosePushL(readStream); |
1341 |
1348 |
1342 CleanupStack::Pop(mobilePhoneSmspList); |
1349 CleanupStack::Pop(mobilePhoneSmspList); |
1343 CleanupStack::PopAndDestroy(); //readStream |
1350 CleanupStack::PopAndDestroy(); //readStream |
1344 iSendBufSeg->Reset(); |
1351 iSendBufSeg->Reset(); |
1345 |
1352 |
1346 LOGSMSPROT1("-> CSmsProvider::InternalizeParametersL - done"); |
1353 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEPARAMETERSL_2, "-> CSmsProvider::InternalizeParametersL - done"); |
1347 |
1354 |
1348 return mobilePhoneSmspList; |
1355 return mobilePhoneSmspList; |
1349 } |
1356 } |
1350 |
1357 |
1351 CSmsMessage* CSmsProvider::InternalizeMessageL( CBufSeg* aBufSeg) |
1358 CSmsMessage* CSmsProvider::InternalizeMessageL( CBufSeg* aBufSeg) |
1352 { |
1359 { |
1353 LOGSMSPROT1("CSmsProvider::InternalizeMessageL"); |
1360 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEMESSAGEL1_1, "CSmsProvider::InternalizeMessageL"); |
1354 |
1361 |
1355 RBufReadStream readstream(*aBufSeg); |
1362 RBufReadStream readstream(*aBufSeg); |
1356 readstream.Open(*aBufSeg,0); |
1363 readstream.Open(*aBufSeg,0); |
1357 CleanupClosePushL(readstream); |
1364 CleanupClosePushL(readstream); |
1358 CSmsBufferBase* buffer = CSmsBuffer::NewL(); |
1365 CSmsBufferBase* buffer = CSmsBuffer::NewL(); |
1362 readstream >> *smsmessage; |
1369 readstream >> *smsmessage; |
1363 |
1370 |
1364 CleanupStack::Pop(); // smsmessage |
1371 CleanupStack::Pop(); // smsmessage |
1365 CleanupStack::PopAndDestroy(); // readsream |
1372 CleanupStack::PopAndDestroy(); // readsream |
1366 |
1373 |
1367 LOGSMSPROT1("-> CSmsProvider::InternalizeMessageL - done"); |
1374 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_INTERNALIZEMESSAGEL1_2, "-> CSmsProvider::InternalizeMessageL - done"); |
1368 |
1375 |
1369 return smsmessage; |
1376 return smsmessage; |
1370 } |
1377 } |
1371 |
1378 |
1372 TInt CSmsProvider::SecurityCheck(MProvdSecurityChecker* aSecurityChecker) |
1379 TInt CSmsProvider::SecurityCheck(MProvdSecurityChecker* aSecurityChecker) |
1373 { |
1380 { |
1374 LOGSMSPROT1("CSmsProvider::SecurityCheck"); |
1381 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPROVIDER_SECURITYCHECK_1, "CSmsProvider::SecurityCheck"); |
1375 iSecurityChecker = aSecurityChecker; |
1382 iSecurityChecker = aSecurityChecker; |
1376 return KErrNone; |
1383 return KErrNone; |
1377 } |
1384 } |