1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-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". |
18 // |
18 // |
19 |
19 |
20 |
20 |
21 |
21 |
22 //INCLUDES |
22 //INCLUDES |
|
23 |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "CSatNotifySendUssdTraces.h" |
|
27 #endif |
|
28 |
23 #include <satcs.h> // Etel SAT IPC definitions |
29 #include <satcs.h> // Etel SAT IPC definitions |
24 #include "CSatTsy.h" // Tsy class header |
30 #include "CSatTsy.h" // Tsy class header |
25 #include "CSatNotifySendUssd.h" // Tsy class header |
31 #include "CSatNotifySendUssd.h" // Tsy class header |
26 #include "CSatNotificationsTsy.h" // Class header |
32 #include "CSatNotificationsTsy.h" // Class header |
27 #include "CBerTlv.h" // Ber Tlv data handling |
33 #include "CBerTlv.h" // Ber Tlv data handling |
28 #include "TTlv.h" // TTlv class |
34 #include "TTlv.h" // TTlv class |
29 #include "CSatDataPackage.h" // Parameter packing |
35 #include "CSatDataPackage.h" // Parameter packing |
30 #include "TfLogger.h" // For TFLOGSTRING |
|
31 #include "TSatUtility.h" // Utilities |
36 #include "TSatUtility.h" // Utilities |
32 #include "CSatTsyReqHandleStore.h" // Request handle class |
37 #include "CSatTsyReqHandleStore.h" // Request handle class |
33 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
38 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
34 |
39 |
35 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
40 CSatNotifySendUssd* CSatNotifySendUssd::NewL |
45 CSatNotifySendUssd* CSatNotifySendUssd::NewL |
41 ( |
46 ( |
42 CSatNotificationsTsy* aNotificationsTsy |
47 CSatNotificationsTsy* aNotificationsTsy |
43 ) |
48 ) |
44 { |
49 { |
45 TFLOGSTRING("CSAT: CSatNotifySendUssd::NewL"); |
50 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_NEWL_1, "CSAT: CSatNotifySendUssd::NewL"); |
46 CSatNotifySendUssd* const satNotifySendUssd = |
51 CSatNotifySendUssd* const satNotifySendUssd = |
47 new ( ELeave ) CSatNotifySendUssd( aNotificationsTsy ); |
52 new ( ELeave ) CSatNotifySendUssd( aNotificationsTsy ); |
48 CleanupStack::PushL( satNotifySendUssd ); |
53 CleanupStack::PushL( satNotifySendUssd ); |
49 satNotifySendUssd->ConstructL(); |
54 satNotifySendUssd->ConstructL(); |
50 CleanupStack::Pop( satNotifySendUssd ); |
55 CleanupStack::Pop( satNotifySendUssd ); |
51 TFLOGSTRING("CSAT: CSatNotifySendUssd::NewL, end of method"); |
56 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_NEWL_2, "CSAT: CSatNotifySendUssd::NewL, end of method"); |
52 return satNotifySendUssd; |
57 return satNotifySendUssd; |
53 } |
58 } |
54 |
59 |
55 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
56 // CSatNotifySendUssd::~CSatNotifySendUssd |
61 // CSatNotifySendUssd::~CSatNotifySendUssd |
60 CSatNotifySendUssd::~CSatNotifySendUssd |
65 CSatNotifySendUssd::~CSatNotifySendUssd |
61 ( |
66 ( |
62 // None |
67 // None |
63 ) |
68 ) |
64 { |
69 { |
65 TFLOGSTRING("CSAT: CSatNotifySendUssd::~CSatNotifySendUssd"); |
70 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_DTOR_1, "CSAT: CSatNotifySendUssd::~CSatNotifySendUssd"); |
66 } |
71 } |
67 |
72 |
68 // ----------------------------------------------------------------------------- |
73 // ----------------------------------------------------------------------------- |
69 // CSatNotifySendUssd::CSatNotifySendUssd |
74 // CSatNotifySendUssd::CSatNotifySendUssd |
70 // Default C++ constructor |
75 // Default C++ constructor |
86 void CSatNotifySendUssd::ConstructL |
91 void CSatNotifySendUssd::ConstructL |
87 ( |
92 ( |
88 // None |
93 // None |
89 ) |
94 ) |
90 { |
95 { |
91 TFLOGSTRING("CSAT: CSatNotifySendUssd::ConstructL"); |
96 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_CONSTRUCTL_1, "CSAT: CSatNotifySendUssd::ConstructL"); |
92 } |
97 } |
93 |
98 |
94 // ----------------------------------------------------------------------------- |
99 // ----------------------------------------------------------------------------- |
95 // CSatNotifySendUssd::Notify |
100 // CSatNotifySendUssd::Notify |
96 // This request allows a client to be notified of a SEND USSD proactive |
101 // This request allows a client to be notified of a SEND USSD proactive |
101 ( |
106 ( |
102 const TTsyReqHandle aTsyReqHandle, |
107 const TTsyReqHandle aTsyReqHandle, |
103 const TDataPackage& aPackage |
108 const TDataPackage& aPackage |
104 ) |
109 ) |
105 { |
110 { |
106 TFLOGSTRING("CSAT: CSatNotifySendUssd::Notify"); |
111 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_NOTIFY_1, "CSAT: CSatNotifySendUssd::Notify"); |
107 |
112 |
108 // Save data pointer to client side for completion |
113 // Save data pointer to client side for completion |
109 iSendUssdV1Pckg = reinterpret_cast<RSat::TSendUssdV1Pckg*>( |
114 iSendUssdV1Pckg = reinterpret_cast<RSat::TSendUssdV1Pckg*>( |
110 aPackage.Des1n() ); |
115 aPackage.Des1n() ); |
111 |
116 |
128 TInt CSatNotifySendUssd::CancelNotification |
133 TInt CSatNotifySendUssd::CancelNotification |
129 ( |
134 ( |
130 const TTsyReqHandle aTsyReqHandle |
135 const TTsyReqHandle aTsyReqHandle |
131 ) |
136 ) |
132 { |
137 { |
133 TFLOGSTRING("CSAT: CSatNotifySendUssd::CancelNotification"); |
138 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_CANCELNOTIFICATION_1, "CSAT: CSatNotifySendUssd::CancelNotification"); |
134 |
139 |
135 // Reset the request handle |
140 // Reset the request handle |
136 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
141 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
137 ResetTsyReqHandle( CSatTsy::ESatNotifySendUssdPCmdReqType ); |
142 ResetTsyReqHandle( CSatTsy::ESatNotifySendUssdPCmdReqType ); |
138 // Reset the data pointer |
143 // Reset the data pointer |
152 ( |
157 ( |
153 CSatDataPackage* aDataPackage, |
158 CSatDataPackage* aDataPackage, |
154 TInt aErrorCode |
159 TInt aErrorCode |
155 ) |
160 ) |
156 { |
161 { |
157 TFLOGSTRING("CSAT: CSatNotifySendUssd::CompleteNotifyL"); |
162 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_COMPLETENOTIFYL_1, "CSAT: CSatNotifySendUssd::CompleteNotifyL"); |
158 TInt ret( KErrNone ); |
163 TInt ret( KErrNone ); |
159 TInt returnValue( KErrNone ); |
164 TInt returnValue( KErrNone ); |
160 TBuf<1> additionalInfo; |
165 TBuf<1> additionalInfo; |
161 TBuf<1> emptyText; |
166 TBuf<1> emptyText; |
162 // Unpack parameters |
167 // Unpack parameters |
201 if ( KErrNotFound != returnValue ) |
206 if ( KErrNotFound != returnValue ) |
202 { |
207 { |
203 TUint16 alphaIdLength = alphaIdentifier.GetLength() ; |
208 TUint16 alphaIdLength = alphaIdentifier.GetLength() ; |
204 if ( RSat::KAlphaIdMaxSize < alphaIdLength ) |
209 if ( RSat::KAlphaIdMaxSize < alphaIdLength ) |
205 { |
210 { |
206 TFLOGSTRING("CSAT: CSatNotifySendUssd::CompleteNotifyL,\ |
211 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_COMPLETENOTIFYL_2, "CSAT: CSatNotifySendUssd::CompleteNotifyL, Alpha ID length exceeded"); |
207 Alpha ID length exceeded"); |
|
208 // String too long |
212 // String too long |
209 additionalInfo.Zero(); |
213 additionalInfo.Zero(); |
210 additionalInfo.Append( KNoCause ); |
214 additionalInfo.Append( KNoCause ); |
211 CreateTerminalRespL( pCmdNumber, |
215 CreateTerminalRespL( pCmdNumber, |
212 RSat::KMeUnableToProcessCmd, additionalInfo, |
216 RSat::KMeUnableToProcessCmd, additionalInfo, |
228 { |
232 { |
229 sendUssdV1.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
233 sendUssdV1.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
230 } |
234 } |
231 else |
235 else |
232 { |
236 { |
233 TFLOGSTRING("CSAT: CSatNotifySendUssd::CompleteNotifyL,\ |
237 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_COMPLETENOTIFYL_3, "CSAT: CSatNotifySendUssd::CompleteNotifyL, Alpha ID is NULL"); |
234 Alpha ID is NULL"); |
|
235 sendUssdV1.iAlphaId.iStatus = RSat::EAlphaIdNull; |
238 sendUssdV1.iAlphaId.iStatus = RSat::EAlphaIdNull; |
236 } |
239 } |
237 } |
240 } |
238 else |
241 else |
239 { |
242 { |
240 TFLOGSTRING("CSAT: CSatNotifySendUssd::CompleteNotifyL,\ |
243 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_COMPLETENOTIFYL_4, "CSAT: CSatNotifySendUssd::CompleteNotifyL, Alpha ID not present"); |
241 Alpha ID not present"); |
|
242 sendUssdV1.iAlphaId.iStatus = RSat::EAlphaIdNotPresent; |
244 sendUssdV1.iAlphaId.iStatus = RSat::EAlphaIdNotPresent; |
243 } |
245 } |
244 |
246 |
245 |
247 |
246 // Ussd string (mandatory) |
248 // Ussd string (mandatory) |
271 && RSat::KStringMaxSize<ussdStringLengthInBytes) |
273 && RSat::KStringMaxSize<ussdStringLengthInBytes) |
272 || ( ( ESms7BitDcs==decodedDcs ) |
274 || ( ( ESms7BitDcs==decodedDcs ) |
273 && RSat::KStringMaxSize<8*ussdStringLengthInBytes/7)) |
275 && RSat::KStringMaxSize<8*ussdStringLengthInBytes/7)) |
274 { |
276 { |
275 // The Ussd text string is too long. |
277 // The Ussd text string is too long. |
276 TFLOGSTRING("CSAT:CSatNotifySendUssd::CompleteNotifyL, \ |
278 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_COMPLETENOTIFYL_5, "CSAT:CSatNotifySendUssd::CompleteNotifyL, USSD String too long"); |
277 USSD String too long"); |
|
278 // Text string too long |
279 // Text string too long |
279 ret = KErrCorrupt; |
280 ret = KErrCorrupt; |
280 additionalInfo.Zero(); |
281 additionalInfo.Zero(); |
281 CreateTerminalRespL( pCmdNumber, |
282 CreateTerminalRespL( pCmdNumber, |
282 RSat::KCmdDataNotUnderstood, additionalInfo, |
283 RSat::KCmdDataNotUnderstood, additionalInfo, |
309 sendUssdV1.iUssdString.iUssdString ); |
310 sendUssdV1.iUssdString.iUssdString ); |
310 break; |
311 break; |
311 } |
312 } |
312 default: |
313 default: |
313 { |
314 { |
314 TFLOGSTRING("CSAT:CSatNotifySendUssd::CompleteNotifyL, \ |
315 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_COMPLETENOTIFYL_6, "CSAT:CSatNotifySendUssd::CompleteNotifyL, USSD DCS has a reserved value"); |
315 USSD DCS has a reserved value"); |
|
316 // The DCS has a reserved value |
316 // The DCS has a reserved value |
317 ret = KErrCorrupt; |
317 ret = KErrCorrupt; |
318 additionalInfo.Zero(); |
318 additionalInfo.Zero(); |
319 CreateTerminalRespL( pCmdNumber, |
319 CreateTerminalRespL( pCmdNumber, |
320 RSat::KCmdDataNotUnderstood, additionalInfo, |
320 RSat::KCmdDataNotUnderstood, additionalInfo, |
350 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
350 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
351 |
351 |
352 } // End of if ( reqHandle != CSatTsy::ESatReqHandleUnknown ) |
352 } // End of if ( reqHandle != CSatTsy::ESatReqHandleUnknown ) |
353 else |
353 else |
354 { |
354 { |
355 TFLOGSTRING("CSAT: CSatNotifySendUssd::CompleteNotifyL,\ |
355 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_COMPLETENOTIFYL_7, "CSAT: CSatNotifySendUssd::CompleteNotifyL, Request not ongoing"); |
356 Request not ongoing"); |
|
357 // Request not on, returning response immediately |
356 // Request not on, returning response immediately |
358 additionalInfo.Zero(); |
357 additionalInfo.Zero(); |
359 additionalInfo.Append( KNoCause ); |
358 additionalInfo.Append( KNoCause ); |
360 CreateTerminalRespL( |
359 CreateTerminalRespL( |
361 pCmdNumber, RSat::KMeUnableToProcessCmd, |
360 pCmdNumber, RSat::KMeUnableToProcessCmd, |
374 TInt CSatNotifySendUssd::TerminalResponseL |
373 TInt CSatNotifySendUssd::TerminalResponseL |
375 ( |
374 ( |
376 TDes8* aRsp |
375 TDes8* aRsp |
377 ) |
376 ) |
378 { |
377 { |
379 TFLOGSTRING("CSAT: CSatNotifySendUssd::TerminalResponseL"); |
378 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_TERMINALRESPONSEL_1, "CSAT: CSatNotifySendUssd::TerminalResponseL"); |
380 |
379 |
381 TInt ret( KErrNone ); |
380 TInt ret( KErrNone ); |
382 TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo; |
381 TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo; |
383 RSat::TSendUssdRspV1Pckg* aRspPckg = |
382 RSat::TSendUssdRspV1Pckg* aRspPckg = |
384 reinterpret_cast<RSat::TSendUssdRspV1Pckg*>( aRsp ); |
383 reinterpret_cast<RSat::TSendUssdRspV1Pckg*>( aRsp ); |
401 && ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult ) |
400 && ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult ) |
402 && ( RSat::KNetworkUnableToProcessCmd != rspV1.iGeneralResult ) |
401 && ( RSat::KNetworkUnableToProcessCmd != rspV1.iGeneralResult ) |
403 && ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) |
402 && ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) |
404 && ( RSat::KUssdReturnError != rspV1.iGeneralResult ) ) |
403 && ( RSat::KUssdReturnError != rspV1.iGeneralResult ) ) |
405 { |
404 { |
406 TFLOGSTRING("CSAT: CSatNotifySendUssd::CompleteNotifyL,\ |
405 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_TERMINALRESPONSEL_2, "CSAT: CSatNotifySendUssd::CompleteNotifyL, Invalid General Result"); |
407 Invalid General Result"); |
|
408 // Invalid general result |
406 // Invalid general result |
409 ret = KErrCorrupt; |
407 ret = KErrCorrupt; |
410 } |
408 } |
411 |
409 |
412 // If there is Me (Mobile Entity) error, network error or text string, |
410 // If there is Me (Mobile Entity) error, network error or text string, |
419 { |
417 { |
420 // Check the length of additional info: |
418 // Check the length of additional info: |
421 if ( 0 == rspV1.iAdditionalInfo.Length() ) |
419 if ( 0 == rspV1.iAdditionalInfo.Length() ) |
422 { |
420 { |
423 // No info |
421 // No info |
424 TFLOGSTRING("CSAT:CSatNotifySendUssd::TerminalResponseL, \ |
422 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_TERMINALRESPONSEL_3, "CSAT:CSatNotifySendUssd::TerminalResponseL, AdditionalInfoType set, but no additional info available"); |
425 AdditionalInfoType set, but no additional info available"); |
|
426 ret = KErrCorrupt; |
423 ret = KErrCorrupt; |
427 } |
424 } |
428 else if ( RSat::KTextString == rspV1.iInfoType ) |
425 else if ( RSat::KTextString == rspV1.iInfoType ) |
429 { |
426 { |
430 // Text string - additional info for a |
427 // Text string - additional info for a |
431 // successful GET INKEY, GET INPUT or SEND USSD. |
428 // successful GET INKEY, GET INPUT or SEND USSD. |
432 // --> Not used by SAT Server when the command has been |
429 // --> Not used by SAT Server when the command has been |
433 // performed successfully, SAT Server uses the |
430 // performed successfully, SAT Server uses the |
434 // rspV1.iUssdString.iUssdString to return the USSD string |
431 // rspV1.iUssdString.iUssdString to return the USSD string |
435 // sent by the network. |
432 // sent by the network. |
436 TFLOGSTRING("CSAT:CSatNotifySendUssd::TerminalResponseL, \ |
433 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_TERMINALRESPONSEL_4, "CSAT:CSatNotifySendUssd::TerminalResponseL, AdditionalInfoType set to TextString."); |
437 AdditionalInfoType set to TextString."); |
|
438 } |
434 } |
439 else |
435 else |
440 { |
436 { |
441 additionalInfo.Zero(); |
437 additionalInfo.Zero(); |
442 additionalInfo.Append( rspV1.iAdditionalInfo[0] ); |
438 additionalInfo.Append( rspV1.iAdditionalInfo[0] ); |
469 TDesC16& aAdditionalInfo, |
465 TDesC16& aAdditionalInfo, |
470 TDesC16& aTextString, |
466 TDesC16& aTextString, |
471 TUint8 aDcs |
467 TUint8 aDcs |
472 ) |
468 ) |
473 { |
469 { |
474 TFLOGSTRING("CSAT: CSatNotifySendUssd::CreateTerminalRespL"); |
470 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_CREATETERMINALRESPL_1, "CSAT: CSatNotifySendUssd::CreateTerminalRespL"); |
475 TTlv tlvSpecificData; |
471 TTlv tlvSpecificData; |
476 TBuf8<RSat::KStringMaxSize> string; |
472 TBuf8<RSat::KStringMaxSize> string; |
477 |
473 |
478 tlvSpecificData.AddTag( KTlvResultTag ); |
474 tlvSpecificData.AddTag( KTlvResultTag ); |
479 tlvSpecificData.AddByte( aGeneralResult ); |
475 tlvSpecificData.AddByte( aGeneralResult ); |
531 default: |
527 default: |
532 { |
528 { |
533 // Reserved |
529 // Reserved |
534 // The general result should in fact prevent reaching this branch of |
530 // The general result should in fact prevent reaching this branch of |
535 // the switch. |
531 // the switch. |
536 TFLOGSTRING("TSY:CSatMessHandler::SendUssdTerminalRespL, \ |
532 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDUSSD_CREATETERMINALRESPL_2, "TSY:CSatMessHandler::SendUssdTerminalRespL, The DCS sent by the network has a reserved value. The general result should have been set to UssdReturnError"); |
537 The DCS sent by the network has a reserved value. The general result \ |
|
538 should have been set to UssdReturnError"); |
|
539 break; |
533 break; |
540 } |
534 } |
541 } |
535 } |
542 // Text |
536 // Text |
543 tlvSpecificData.AddData( string ); |
537 tlvSpecificData.AddData( string ); |