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