|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // Include Files |
|
21 |
|
22 #include <ctsy/pluginapi/cmmdatapackage.h> |
|
23 #include <e32std.h> // error values |
|
24 #include <etelmm.h> |
|
25 #include <ctsy/serviceapi/mmtsy_defaults.h> |
|
26 #include <ss_wmisi.h> |
|
27 #include <tisi.h> |
|
28 |
|
29 #include "cmmmessagerouter.h" |
|
30 #include "cmmphonetsender.h" |
|
31 #include "cmmstaticutility.h" |
|
32 #include "cmmussdmesshandler.h" |
|
33 #include "tsylogger.h" |
|
34 #include "osttracedefinitions.h" |
|
35 #ifdef OST_TRACE_COMPILER_IN_USE |
|
36 #include "cmmussdmesshandlertraces.h" |
|
37 #endif |
|
38 |
|
39 // External Data Structures |
|
40 // none |
|
41 |
|
42 // External Function Prototypes |
|
43 // none |
|
44 |
|
45 // LOCAL CONSTANTS AND MACROS |
|
46 |
|
47 // hard-coded transaction id for ISA messages. |
|
48 const TUint8 KUssdTransId = 5; |
|
49 const TUint8 KFiller = 0x00; |
|
50 |
|
51 // MODULE DATA STRUCTURES |
|
52 // none |
|
53 |
|
54 // Local Data Structures |
|
55 // none |
|
56 |
|
57 // Local Function Prototypes |
|
58 // none |
|
59 |
|
60 // LOCAL FUNCTIONS |
|
61 // none |
|
62 |
|
63 // MEMBER FUNCTIONS |
|
64 |
|
65 //============================================================================= |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CMmUssdMessHandler::ConstructL |
|
69 // Symbian 2nd phase constructor. Initialises internal attributes. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CMmUssdMessHandler::CMmUssdMessHandler |
|
73 ( |
|
74 // None |
|
75 ) |
|
76 { |
|
77 TFLOGSTRING("TSY: CMmUssdMessHandler::CMmUssdMessHandler"); |
|
78 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_CMMUSSDMESSHANDLER, "CMmUssdMessHandler::CMmUssdMessHandler" ); |
|
79 //None |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CMmUssdMessHandler::~CMmUssdMessHandler |
|
84 // Destructor |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 CMmUssdMessHandler::~CMmUssdMessHandler |
|
88 ( |
|
89 // None |
|
90 ) |
|
91 { |
|
92 TFLOGSTRING("TSY: CMmUssdMessHandler::~CMmUssdMessHandler"); |
|
93 OstTrace0( TRACE_NORMAL, DUP1_CMMUSSDMESSHANDLER_CMMUSSDMESSHANDLER, "CMmUssdMessHandler::~CMmUssdMessHandler" ); |
|
94 } |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CMmUssdMessHandler::ConstructL |
|
97 // Symbian 2nd phase constructor. Initialises internal attributes. |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CMmUssdMessHandler::ConstructL |
|
101 ( |
|
102 // None |
|
103 ) |
|
104 { |
|
105 TFLOGSTRING("TSY: CMmUssdMessHandler::ConstructL"); |
|
106 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_CONSTRUCTL, "CMmUssdMessHandler::ConstructL" ); |
|
107 // The flag indicates the correct complete method in failed case for |
|
108 // SS_SERVICE_FAILED_RESP |
|
109 iIsSendReleaseCalled = EFalse; |
|
110 //No ongoing request |
|
111 iIsUssdSendReqOnGoing = EFalse; |
|
112 //No pending request |
|
113 iIsSendReleaseReqPending = EFalse; |
|
114 |
|
115 iNoFdnUSSDReq = EFalse; |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CMmUssdMessHandler::NewL |
|
120 // Two-phased constructor. |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 CMmUssdMessHandler* CMmUssdMessHandler::NewL |
|
124 ( |
|
125 CMmPhoNetSender* aPhoNetSender, //pointer to phonet sender |
|
126 CMmPhoNetReceiver* aPhoNetReceiver, // pointer to phonet receiver |
|
127 CMmMessageRouter* aMessageRouter //pointer to message router |
|
128 ) |
|
129 { |
|
130 TFLOGSTRING("TSY: CMmUssdMessHandler::NewL.\n"); |
|
131 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_NEWL, "CMmUssdMessHandler::NewL" ); |
|
132 |
|
133 CMmUssdMessHandler* ussdMessHandler = |
|
134 new( ELeave ) CMmUssdMessHandler(); |
|
135 |
|
136 CleanupStack::PushL( ussdMessHandler ); |
|
137 |
|
138 ussdMessHandler->ConstructL(); |
|
139 ussdMessHandler->iPhoNetSender = aPhoNetSender; |
|
140 ussdMessHandler->iMessageRouter = aMessageRouter; |
|
141 aPhoNetReceiver->RegisterL(ussdMessHandler, PN_SS, SS_GSM_USSD_SEND_RESP); |
|
142 aPhoNetReceiver->RegisterL(ussdMessHandler, PN_SS, SS_SERVICE_FAILED_RESP); |
|
143 aPhoNetReceiver->RegisterL(ussdMessHandler, PN_SS, SS_GSM_USSD_RECEIVE_IND); |
|
144 |
|
145 CleanupStack::Pop( ussdMessHandler ); |
|
146 |
|
147 return ussdMessHandler; |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CMmUssdMessHandler::ReceiveMessageL |
|
152 // Called when an ISI message has been received. |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CMmUssdMessHandler::ReceiveMessageL |
|
156 ( |
|
157 const TIsiReceiveC& aIsiMessage // ISI-message received |
|
158 ) |
|
159 { |
|
160 TInt resource (aIsiMessage.Get8bit(ISI_HEADER_OFFSET_RESOURCEID) ); |
|
161 TInt messageId (aIsiMessage.Get8bit(ISI_HEADER_OFFSET_MESSAGEID) ); |
|
162 |
|
163 TFLOGSTRING3("TSY: CMmUssdMessHandler::ReceiveMessageL - resouce: %d, msgId: %d", resource, messageId); |
|
164 OstTraceExt2( TRACE_NORMAL, CMMUSSDMESSHANDLER_RECEIVEMESSAGEL, "CMmUssdMessHandler::ReceiveMessageL;resource=%d;messageId=%d", resource, messageId ); |
|
165 |
|
166 switch( resource ) |
|
167 { |
|
168 case PN_SS: |
|
169 { |
|
170 switch( messageId ) |
|
171 { |
|
172 case SS_GSM_USSD_SEND_RESP: |
|
173 { |
|
174 SsGsmUssdSendResp( aIsiMessage ); |
|
175 break; |
|
176 } |
|
177 case SS_SERVICE_FAILED_RESP: |
|
178 { |
|
179 SsServiceFailedResp( aIsiMessage ); |
|
180 // SS_SERVICE_FAILED_RESP message is needed by Custom |
|
181 // message handler |
|
182 break; |
|
183 } |
|
184 case SS_GSM_USSD_RECEIVE_IND: |
|
185 { |
|
186 SsGsmUssdReceiveInd( aIsiMessage ); |
|
187 break; |
|
188 } |
|
189 default: |
|
190 { |
|
191 TFLOGSTRING2("TSY: CMmUssdMessHandler::ReceiveMessageL - PN_SS - unknown msgId: %d", messageId); |
|
192 OstTrace1( TRACE_NORMAL, DUP1_CMMUSSDMESSHANDLER_RECEIVEMESSAGEL, "CMmUssdMessHandler::ReceiveMessageL;unknown messageId=%d", messageId ); |
|
193 // No propiert handler methods for ISI-message found |
|
194 break; |
|
195 } |
|
196 } |
|
197 break; |
|
198 } |
|
199 default: |
|
200 { |
|
201 TFLOGSTRING2("TSY: CMmUssdMessHandler::ReceiveMessageL - unknown resource: %d", resource); |
|
202 OstTrace1( TRACE_NORMAL, DUP2_CMMUSSDMESSHANDLER_RECEIVEMESSAGEL, "CMmUssdMessHandler::ReceiveMessageL;resource=%d", resource ); |
|
203 break; |
|
204 } |
|
205 } |
|
206 } |
|
207 |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CMmUssdMessHandler::SsGsmUssdSendReq |
|
211 // Construct a SS_GSM_USSD_SEND_REQ ISI message |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 TInt CMmUssdMessHandler::SsGsmUssdSendReq |
|
215 ( |
|
216 const CMmDataPackage* aDataPackage |
|
217 ) |
|
218 { |
|
219 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendReq"); |
|
220 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq" ); |
|
221 TInt ret ( KErrNone ); |
|
222 TBuf8<RMobileUssdMessaging::KGsmUssdDataSize> data( 0 ); |
|
223 TDes8* attributes( 0 ); |
|
224 TUint8 numOfSubblocks( 2 ); |
|
225 |
|
226 aDataPackage->UnPackData( data, attributes ); |
|
227 |
|
228 RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* msgAttrPck ( |
|
229 (RMobileUssdMessaging::TMobileUssdAttributesV1Pckg*) ( attributes ) ); |
|
230 |
|
231 RMobileUssdMessaging::TMobileUssdAttributesV1 msgAttr ( ( *msgAttrPck )() ); |
|
232 |
|
233 TFLOGSTRING2("TSY: CMmUssdMessHandler::SsGsmUssdSendReq. AttributeType: %d", msgAttr.iType ); |
|
234 OstTrace1( TRACE_NORMAL, DUP1_CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq;msgAttr.iType=%d", msgAttr.iType ); |
|
235 |
|
236 TUint8 ussdType( KFiller ); //initialize ussdtype to 0 |
|
237 |
|
238 if ( RMobileUssdMessaging::KUssdMessageType & msgAttr.iFlags ) |
|
239 { |
|
240 switch ( msgAttr.iType ) |
|
241 { |
|
242 // User has requested to send MO USSD |
|
243 case RMobileUssdMessaging::EUssdMORequest: |
|
244 ussdType = SS_GSM_USSD_COMMAND; |
|
245 break; |
|
246 // User is replying to MT USSD. |
|
247 case RMobileUssdMessaging::EUssdMOReply: |
|
248 ussdType = SS_GSM_USSD_MT_REPLY; |
|
249 break; |
|
250 // User is signing for the MT request |
|
251 case RMobileUssdMessaging::EUssdMOAcknowledgement: |
|
252 ussdType = SS_GSM_USSD_NOTIFY; |
|
253 break; |
|
254 // Unknown or illegal cases return error to client |
|
255 default: |
|
256 // ussd type is unknown, report error |
|
257 ret = KErrArgument; |
|
258 break; |
|
259 } |
|
260 } |
|
261 else |
|
262 { |
|
263 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendReq. Type flag missing" ); |
|
264 OstTrace0( TRACE_NORMAL, DUP2_CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq, Type flag missing" ); |
|
265 // ussd type is unknown, report error |
|
266 ret = KErrArgument; |
|
267 } |
|
268 |
|
269 TUint8 codingInfo( KFiller ); //initialize codinginfo to 0 |
|
270 // If messagetype was valid, check data coding scheme. |
|
271 if ( KErrNone == ret ) |
|
272 { |
|
273 if ( RMobileUssdMessaging::KUssdMessageDcs & msgAttr.iFlags ) |
|
274 { |
|
275 //get data coding scheme |
|
276 codingInfo = msgAttr.iDcs; |
|
277 } |
|
278 else |
|
279 { |
|
280 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendReq. DCS flag missing" ); |
|
281 OstTrace0( TRACE_NORMAL, DUP3_CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq, DCS flag missing" ); |
|
282 // data coding scheme is unknown, report error. |
|
283 ret = KErrArgument; |
|
284 } |
|
285 } |
|
286 |
|
287 // If messagetype and data coding scheme were valid, send message. |
|
288 if ( KErrNone == ret ) |
|
289 { |
|
290 if ( RMobileUssdMessaging::KUssdDataFormat & msgAttr.iFlags ) |
|
291 { |
|
292 // Create UssdSendReq ISI-message |
|
293 TIsiSend ssGsmUssdSendReq( iPhoNetSender->SendBufferDes() ); |
|
294 ssGsmUssdSendReq.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_SS ); |
|
295 ssGsmUssdSendReq.Set8bit( ISI_HEADER_OFFSET_TRANSID, KUssdTransId ); |
|
296 ssGsmUssdSendReq.Set8bit( |
|
297 ISI_HEADER_OFFSET_MESSAGEID, |
|
298 SS_GSM_USSD_SEND_REQ ); |
|
299 |
|
300 ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE + |
|
301 SS_GSM_USSD_SEND_REQ_OFFSET_USSDTYPE, ussdType ); |
|
302 |
|
303 // Create SsGsmUssdString subblock. |
|
304 // subblock header + ussd string length subblock max length = 164 |
|
305 |
|
306 TBuf8<KMaxLengthOfUssdMessage + 3> ssGsmUssdStringSb( 0 ); |
|
307 |
|
308 TIsiSubBlock subblockSSGsmUssdString( |
|
309 ssGsmUssdStringSb, SS_GSM_USSD_STRING, EIsiSubBlockTypeId8Len8 ); |
|
310 |
|
311 ssGsmUssdStringSb.Append( codingInfo ); |
|
312 ssGsmUssdStringSb.Append( data.Length() ); |
|
313 ssGsmUssdStringSb.Append( data ); |
|
314 |
|
315 ssGsmUssdSendReq.CopyData( ISI_HEADER_SIZE + |
|
316 SIZE_SS_GSM_USSD_SEND_REQ, |
|
317 subblockSSGsmUssdString.CompleteSubBlock() ); |
|
318 |
|
319 // create subblock SS_SB_CHECK_INFO |
|
320 TBuf8<SIZE_SS_SB_CHECK_INFO>sbData( 0 ); |
|
321 TIsiSubBlock ssCheckInfoSb( |
|
322 sbData, |
|
323 SS_SB_CHECK_INFO, |
|
324 EIsiSubBlockTypeId8Len8 ); |
|
325 |
|
326 if( iNoFdnUSSDReq ) |
|
327 { |
|
328 sbData.Append( SS_FDN_CHECK_SUPPRESS ); |
|
329 } |
|
330 else |
|
331 { |
|
332 sbData.Append( SS_NO_FDN_CHECK_SUPPRESS ); |
|
333 } |
|
334 |
|
335 sbData.Append( SS_NO_RESOURCE_CONTROL_SUPPRESS ); |
|
336 |
|
337 // add the SIZE_SS_SB_CHECK_INFO subblock to service req |
|
338 ssGsmUssdSendReq.CopyData( |
|
339 ISI_HEADER_SIZE + SIZE_SS_GSM_USSD_SEND_REQ + |
|
340 ssGsmUssdStringSb.Length(), |
|
341 ssCheckInfoSb.CompleteSubBlock( ) ); |
|
342 |
|
343 ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE + |
|
344 SS_GSM_USSD_SEND_REQ_OFFSET_SUBBLOCKCOUNT, numOfSubblocks ); |
|
345 |
|
346 |
|
347 //send message via phonet |
|
348 ret = iPhoNetSender->Send( ssGsmUssdSendReq.Complete() ); |
|
349 } |
|
350 else |
|
351 { |
|
352 // dataformat is unspecified, report error. |
|
353 ret = KErrArgument; |
|
354 } |
|
355 } |
|
356 return ret; |
|
357 } |
|
358 |
|
359 // ----------------------------------------------------------------------------- |
|
360 // CMmUssdMessHandler::SsGsmUssdSendReq |
|
361 // Construct a SS_GSM_USSD_SEND_REQ ISI message that ends ussd session |
|
362 // ----------------------------------------------------------------------------- |
|
363 // |
|
364 TInt CMmUssdMessHandler::SsGsmUssdSendReq |
|
365 ( |
|
366 void |
|
367 ) |
|
368 { |
|
369 TFLOGSTRING("LTSY: CMmUssdMessHandler::SsGsmUssdSendReq. End USSD session" ); |
|
370 OstTrace0( TRACE_NORMAL, DUP4_CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq" ); |
|
371 |
|
372 // Change the flag to indicate the correct complete method for failed resp |
|
373 iIsSendReleaseCalled = ETrue; |
|
374 // No pending request anymore |
|
375 iIsSendReleaseReqPending = EFalse; |
|
376 |
|
377 // create buffer for isi msg data |
|
378 TBuf8<2> messageData( 0 ); |
|
379 |
|
380 messageData.Append( SS_GSM_USSD_END ); |
|
381 // number of sub blocks |
|
382 messageData.Append( 0 ); |
|
383 |
|
384 return iPhoNetSender->Send( |
|
385 PN_SS, |
|
386 KUssdTransId, |
|
387 SS_GSM_USSD_SEND_REQ, |
|
388 messageData ); |
|
389 } |
|
390 |
|
391 // ----------------------------------------------------------------------------- |
|
392 // CMmUssdMessHandler::SsGsmUssdSendResp |
|
393 // Completes successful Ss Gsm Ussd Send Request. |
|
394 // ----------------------------------------------------------------------------- |
|
395 // |
|
396 void CMmUssdMessHandler::SsGsmUssdSendResp |
|
397 ( |
|
398 const TIsiReceiveC &aIsiMessage //received isi message |
|
399 ) |
|
400 { |
|
401 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendResp" ); |
|
402 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_SSGSMUSSDSENDRESP, "CMmUssdMessHandler::SsGsmUssdSendResp" ); |
|
403 |
|
404 TUint8 length ( aIsiMessage.Get8bit( |
|
405 ISI_HEADER_SIZE + SS_GSM_USSD_SEND_RESP_OFFSET_LENGTHOFUSSDSTRING ) ); |
|
406 |
|
407 TBuf8<KMaxLengthOfUssdMessage> ussdString ( aIsiMessage.GetData( |
|
408 ISI_HEADER_SIZE + SS_GSM_USSD_SEND_RESP_OFFSET_USSDSTRING, length ) ); |
|
409 |
|
410 TUint8 ussdType ( aIsiMessage.Get8bit( |
|
411 ISI_HEADER_SIZE + SS_GSM_USSD_SEND_RESP_OFFSET_USSDTYPE ) ); |
|
412 |
|
413 //create package. |
|
414 CMmDataPackage package; |
|
415 |
|
416 // If the message sent was of type SS_GSM_USSD_END, and the request |
|
417 // was a SendRelease request, then a different request must be completed |
|
418 if ( SS_GSM_USSD_END == ussdType && iIsSendReleaseCalled ) |
|
419 { |
|
420 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendResp. Response to SendRelease." ); |
|
421 OstTrace0( TRACE_NORMAL, DUP1_CMMUSSDMESSHANDLER_SSGSMUSSDSENDRESP, "CMmUssdMessHandler::SsGsmUssdSendResp, Response to SendRelease" ); |
|
422 |
|
423 // Reset the flag |
|
424 iIsSendReleaseCalled = EFalse; |
|
425 |
|
426 RMobilePhone::TMobilePhoneSendSSRequestV3 returnResult; |
|
427 |
|
428 returnResult.iOpCode = KErrNone; |
|
429 returnResult.iAdditionalInfo.Append( KErrNone ); |
|
430 |
|
431 //pack the data |
|
432 package.PackData( &returnResult ); |
|
433 |
|
434 //complete the request |
|
435 iMessageRouter->Complete( |
|
436 EMobileUssdMessagingSendRelease, |
|
437 &package, |
|
438 KErrNone); |
|
439 } |
|
440 // otherwise complete the send message request |
|
441 else |
|
442 { |
|
443 if ( iNoFdnUSSDReq ) |
|
444 { |
|
445 // Call CompleteSendMessageNoFdnCheck request. |
|
446 iMessageRouter->Complete( |
|
447 EMobileUssdMessagingSendMessageNoFdnCheck, |
|
448 KErrNone ); |
|
449 } |
|
450 else |
|
451 { |
|
452 // Call CompleteSendMessage request. |
|
453 iMessageRouter->Complete( |
|
454 EMobileUssdMessagingSendMessage, |
|
455 KErrNone ); |
|
456 } |
|
457 |
|
458 //Req is not ongoing anymore |
|
459 iIsUssdSendReqOnGoing = EFalse; |
|
460 |
|
461 //if a cancel request has been made |
|
462 if ( iIsSendReleaseReqPending ) |
|
463 { |
|
464 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendResp. SendRelease pending." ); |
|
465 OstTrace0( TRACE_NORMAL, DUP2_CMMUSSDMESSHANDLER_SSGSMUSSDSENDRESP, "CMmUssdMessHandler::SsGsmUssdSendResp, SendRelease pending" ); |
|
466 |
|
467 TInt ret ( KErrNone ); |
|
468 ret = SsGsmUssdSendReq(); |
|
469 |
|
470 if ( KErrNone != ret ) |
|
471 { |
|
472 RMobilePhone::TMobilePhoneSendSSRequestV3 returnResult; |
|
473 |
|
474 returnResult.iOpCode = static_cast <TUint8 > ( KErrGeneral ); |
|
475 returnResult.iAdditionalInfo.Append( |
|
476 static_cast < TUint8 > ( KErrGeneral ) ); |
|
477 |
|
478 //complete the request |
|
479 iMessageRouter->Complete( |
|
480 EMobileUssdMessagingSendRelease, |
|
481 &package, |
|
482 KErrGeneral ); |
|
483 } |
|
484 } |
|
485 } |
|
486 } |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // CMmUssdMessHandler::SsServiceFailedResp |
|
490 // Completes unsuccessful Ss Gsm Ussd Send Request ( MO USSD ). |
|
491 // ----------------------------------------------------------------------------- |
|
492 // |
|
493 void CMmUssdMessHandler::SsServiceFailedResp |
|
494 ( |
|
495 const TIsiReceiveC &aIsiMessage //received isi message |
|
496 ) |
|
497 { |
|
498 |
|
499 TFLOGSTRING("TSY: CMmUssdMessHandler::SsServiceFailedResp" ); |
|
500 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_SSSERVICEFAILEDRESP, "CMmUssdMessHandler::SsServiceFailedResp" ); |
|
501 |
|
502 // Initialize cause type and value, if no specified. |
|
503 // subblock found, use SS_UNSPECIFIED_REASON. |
|
504 TUint8 causeType( KErrNone ); |
|
505 TUint8 causeValue( SS_UNSPECIFIED_REASON ); |
|
506 // If no sub block, set epocerror to KErrGeneral. |
|
507 TInt epocError( KErrGeneral ); |
|
508 |
|
509 // offset where the subblock starts |
|
510 TUint sbStartOffset( KErrNone ); |
|
511 |
|
512 //create package. |
|
513 CMmDataPackage package; |
|
514 |
|
515 if( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
516 ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP, |
|
517 SS_GSM_INDICATE_MSG_ERROR, |
|
518 EIsiSubBlockTypeId8Len8, |
|
519 sbStartOffset ) ) |
|
520 { |
|
521 causeType = SS_GSM_INDICATE_MSG_ERROR; |
|
522 causeValue = aIsiMessage.Get8bit( |
|
523 sbStartOffset + SS_GSM_INDICATE_MSG_ERROR_OFFSET_MESSAGEERRORCODE ); |
|
524 } |
|
525 else if( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
526 ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP, |
|
527 SS_GSM_INDICATE_ERROR, |
|
528 EIsiSubBlockTypeId8Len8, |
|
529 sbStartOffset ) ) |
|
530 { |
|
531 causeType = SS_GSM_INDICATE_ERROR; |
|
532 causeValue = aIsiMessage.Get8bit( |
|
533 sbStartOffset + SS_GSM_INDICATE_ERROR_OFFSET_ERRORCODE ); |
|
534 } |
|
535 else if( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
536 ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP, |
|
537 SS_GSM_INDICATE_PROBLEM, |
|
538 EIsiSubBlockTypeId8Len8, |
|
539 sbStartOffset ) ) |
|
540 { |
|
541 causeType = aIsiMessage.Get8bit( |
|
542 sbStartOffset + SS_GSM_INDICATE_PROBLEM_OFFSET_PROBLEMTYPE ); |
|
543 causeValue = aIsiMessage.Get8bit( |
|
544 sbStartOffset + SS_GSM_INDICATE_PROBLEM_OFFSET_PROBLEMCODE ); |
|
545 } |
|
546 else if( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
547 ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP, |
|
548 SS_OTHER_ERROR, |
|
549 EIsiSubBlockTypeId8Len8, |
|
550 sbStartOffset ) ) |
|
551 { |
|
552 causeType = SS_OTHER_ERROR; |
|
553 causeValue = aIsiMessage.Get8bit( |
|
554 sbStartOffset + SS_OTHER_ERROR_OFFSET_ERRORCODE ); |
|
555 } |
|
556 else if( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
557 ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP, |
|
558 SS_GSM_MM_RELEASED, |
|
559 EIsiSubBlockTypeId8Len8, |
|
560 sbStartOffset ) ) |
|
561 { |
|
562 causeType= SS_GSM_MM_RELEASED; |
|
563 causeValue = aIsiMessage.Get8bit( |
|
564 sbStartOffset + SS_GSM_MM_RELEASED_OFFSET_CAUSE ); |
|
565 } |
|
566 else |
|
567 { |
|
568 causeType = KNoCsCauseType; // causetype not defined |
|
569 } |
|
570 |
|
571 //If cause value is SS_GSM_SS_NOT_AVAILABLE (comes in SS_OTHER_ERROR sub block) |
|
572 //this indicates that there is not network coverage. |
|
573 if( SS_GSM_SS_NOT_AVAILABLE == causeValue ) |
|
574 { |
|
575 epocError = CMmStaticUtility::EpocErrorCode( |
|
576 KErrCouldNotConnect, |
|
577 KErrGsmSMSNoNetworkService ); |
|
578 TFLOGSTRING("TSY: CMmUssdMessHandler::SsServiceFailedResp. Cause: SS_GSM_SS_NOT_AVAILABLE => No network coverage." ); |
|
579 OstTrace0( TRACE_NORMAL, DUP1_CMMUSSDMESSHANDLER_SSSERVICEFAILEDRESP, "CMmUssdMessHandler::SsServiceFailedResp, Cause: SS_GSM_SS_NOT_AVAILABLE => No network coverage" ); |
|
580 } |
|
581 else |
|
582 { |
|
583 // Translate error to epoc world, Fix RFState problem |
|
584 epocError = CMmStaticUtility::CSCauseToEpocError( |
|
585 PN_SS, |
|
586 causeType, |
|
587 causeValue ); |
|
588 } |
|
589 |
|
590 if ( iIsSendReleaseCalled ) |
|
591 { |
|
592 TFLOGSTRING("TSY: CMmUssdMessHandler::SsServiceFailedResp. SendRelease failed." ); |
|
593 OstTrace0( TRACE_NORMAL, DUP2_CMMUSSDMESSHANDLER_SSSERVICEFAILEDRESP, "CMmUssdMessHandler::SsServiceFailedResp, SendRelease failed" ); |
|
594 |
|
595 // Reset the flag |
|
596 iIsSendReleaseCalled = EFalse; |
|
597 |
|
598 RMobilePhone::TMobilePhoneSendSSRequestV3 returnResult; |
|
599 |
|
600 returnResult.iOpCode = static_cast < TUint8 > ( KErrGeneral ); |
|
601 returnResult.iAdditionalInfo.Append( epocError ); |
|
602 |
|
603 //pack the data |
|
604 package.PackData( &returnResult ); |
|
605 |
|
606 // Call CompleteSendRelease request with epocError from TSY. |
|
607 iMessageRouter->Complete( |
|
608 EMobileUssdMessagingSendRelease, |
|
609 &package, |
|
610 epocError ); |
|
611 } |
|
612 else |
|
613 { |
|
614 if ( iNoFdnUSSDReq ) |
|
615 { |
|
616 // Call CompleteSendMessageNoFdnCheck request with epocError from TSY. |
|
617 iMessageRouter->Complete( |
|
618 EMobileUssdMessagingSendMessageNoFdnCheck, |
|
619 epocError ); |
|
620 } |
|
621 else |
|
622 { |
|
623 // Call CompleteSendMessage request with epocError from TSY. |
|
624 iMessageRouter->Complete( |
|
625 EMobileUssdMessagingSendMessage, |
|
626 epocError ); |
|
627 } |
|
628 |
|
629 //Request is not ongoing anymore |
|
630 iIsUssdSendReqOnGoing = EFalse; |
|
631 |
|
632 //if a Cancel request has been made |
|
633 if ( iIsSendReleaseReqPending ) |
|
634 { |
|
635 iIsSendReleaseReqPending = EFalse; |
|
636 |
|
637 RMobilePhone::TMobilePhoneSendSSRequestV3 returnResult; |
|
638 |
|
639 returnResult.iOpCode = static_cast < TUint8 > ( KErrNone ); |
|
640 returnResult.iAdditionalInfo.Append( KErrNone ); |
|
641 |
|
642 //pack the data |
|
643 package.PackData( &returnResult ); |
|
644 |
|
645 //complete the request immediately without having sent anything |
|
646 //to SS server because the 1rst request has failed so there is no |
|
647 //need to cancel it. |
|
648 iMessageRouter->Complete( |
|
649 EMobileUssdMessagingSendRelease, |
|
650 &package, |
|
651 KErrNone ); |
|
652 } |
|
653 } |
|
654 } |
|
655 |
|
656 // ----------------------------------------------------------------------------- |
|
657 // CMmUssdMessHandler::SsGsmUssdReceiveInd |
|
658 // Breaks a SS_GSM_USSD_RECEIVE_IND ISI message |
|
659 // ----------------------------------------------------------------------------- |
|
660 // |
|
661 void CMmUssdMessHandler::SsGsmUssdReceiveInd |
|
662 ( |
|
663 const TIsiReceiveC &aIsiMessage //received isi message |
|
664 ) |
|
665 { |
|
666 //create package. |
|
667 CMmDataPackage notifyPackage; |
|
668 |
|
669 TUint8 length ( aIsiMessage.Get8bit( |
|
670 ISI_HEADER_SIZE + SS_GSM_USSD_SEND_RESP_OFFSET_LENGTHOFUSSDSTRING ) ); |
|
671 |
|
672 TBuf8<KMaxLengthOfUssdMessage> ussdString ( aIsiMessage.GetData( |
|
673 ISI_HEADER_SIZE + SS_GSM_USSD_SEND_RESP_OFFSET_USSDSTRING, length ) ); |
|
674 |
|
675 TUint8 codingInfo ( aIsiMessage.Get8bit( |
|
676 ISI_HEADER_SIZE + SS_GSM_USSD_RECEIVE_IND_OFFSET_CODINGINFO ) ); |
|
677 |
|
678 TUint8 ussdType ( aIsiMessage.Get8bit( |
|
679 ISI_HEADER_SIZE + SS_GSM_USSD_RECEIVE_IND_OFFSET_USSDTYPE ) ); |
|
680 |
|
681 RMobileUssdMessaging::TMobileUssdAttributesV1 receiveUssdMessageAttributes; |
|
682 TBuf8<RMobileUssdMessaging::KGsmUssdDataSize> receiveUssdMessage( 0 ); |
|
683 |
|
684 receiveUssdMessage.Copy( ussdString ); |
|
685 |
|
686 receiveUssdMessageAttributes.iDcs = codingInfo; |
|
687 |
|
688 receiveUssdMessageAttributes.iFlags = |
|
689 ( RMobileUssdMessaging::KUssdDataFormat+ |
|
690 RMobileUssdMessaging::KUssdMessageType+ |
|
691 RMobileUssdMessaging::KUssdMessageDcs ); |
|
692 |
|
693 receiveUssdMessageAttributes.iFormat = |
|
694 ( RMobileUssdMessaging::EFormatPackedString ); |
|
695 |
|
696 TFLOGSTRING2("TSY: CMmUssdMessHandler::SsGsmUssdReceiveInd: UssdType %d", ussdType); |
|
697 OstTraceExt1( TRACE_NORMAL, CMMUSSDMESSHANDLER_SSGSMUSSDRECEIVEIND, "CMmUssdMessHandler::SsGsmUssdReceiveInd;ussdType=%hhu", ussdType ); |
|
698 |
|
699 switch ( ussdType ) |
|
700 { |
|
701 case SS_GSM_USSD_REQUEST: |
|
702 case SS_GSM_USSD_COMMAND: |
|
703 { |
|
704 receiveUssdMessageAttributes.iType = |
|
705 RMobileUssdMessaging::EUssdMTRequest; |
|
706 break; |
|
707 } |
|
708 // Set USSD message type to EUssdMTReply if ussdType is . |
|
709 // SS_GSM_USSD_MT_REPLY or SS_GSM_USSD_END. |
|
710 case SS_GSM_USSD_MT_REPLY: |
|
711 { |
|
712 receiveUssdMessageAttributes.iType = |
|
713 RMobileUssdMessaging::EUssdMTReply; |
|
714 break; |
|
715 } |
|
716 case SS_GSM_USSD_END: |
|
717 { |
|
718 receiveUssdMessageAttributes.iType = |
|
719 RMobileUssdMessaging::EUssdMTReply; |
|
720 RMobilePhone::TMobilePhoneSendSSRequestV3 returnResult; |
|
721 returnResult.iOpCode = KErrNone; |
|
722 returnResult.iAdditionalInfo.Append( KErrNone ); |
|
723 |
|
724 //pack the data |
|
725 notifyPackage.PackData( &returnResult ); |
|
726 break; |
|
727 } |
|
728 case SS_GSM_USSD_NOTIFY: |
|
729 { |
|
730 receiveUssdMessageAttributes.iType = |
|
731 RMobileUssdMessaging::EUssdMTNotify; |
|
732 break; |
|
733 } |
|
734 // Can't map SS_GSM_USSD_COMMAND to MM ETel values. |
|
735 default: |
|
736 { |
|
737 receiveUssdMessageAttributes.iType = |
|
738 RMobileUssdMessaging::EUssdUnknown; |
|
739 break; |
|
740 } |
|
741 } // end switch |
|
742 |
|
743 //create package. |
|
744 CMmDataPackage package; |
|
745 |
|
746 //pack the data |
|
747 package.PackData( &receiveUssdMessage, &receiveUssdMessageAttributes ); |
|
748 |
|
749 if ( SS_GSM_USSD_END != ussdType || ussdString.Length() ) |
|
750 { |
|
751 iMessageRouter->Complete( |
|
752 EMobileUssdMessagingReceiveMessage, |
|
753 &package, |
|
754 KErrNone ); |
|
755 |
|
756 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdReceiveInd: Complete : EMobileUssdMessagingReceiveMessage" ); |
|
757 OstTrace0( TRACE_NORMAL, DUP1_CMMUSSDMESSHANDLER_SSGSMUSSDRECEIVEIND, "CMmUssdMessHandler::SsGsmUssdReceiveInd, EMobileUssdMessagingReceiveMessage" ); |
|
758 } |
|
759 |
|
760 if ( SS_GSM_USSD_END == ussdType ) |
|
761 { |
|
762 // Complete the request |
|
763 // This notifies a client of a MT USSD release message to the mobile device. |
|
764 iMessageRouter->Complete( |
|
765 EMobileUssdMessagingNotifyNetworkRelease, |
|
766 ¬ifyPackage, |
|
767 KErrNone ); |
|
768 |
|
769 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdReceiveInd: Complete : EMobileUssdMessagingNotifyNetworkRelease" ); |
|
770 OstTrace0( TRACE_NORMAL, DUP2_CMMUSSDMESSHANDLER_SSGSMUSSDRECEIVEIND, "CMmUssdMessHandler::SsGsmUssdReceiveInd, EMobileUssdMessagingNotifyNetworkRelease" ); |
|
771 } |
|
772 } |
|
773 |
|
774 |
|
775 // ----------------------------------------------------------------------------- |
|
776 // CMmUssdMessHandler::ExtFuncL |
|
777 // Dispatches Etel requests to DOS level handlers |
|
778 // ----------------------------------------------------------------------------- |
|
779 // |
|
780 TInt CMmUssdMessHandler::ExtFuncL |
|
781 ( |
|
782 TInt aIpc, |
|
783 const CMmDataPackage* aDataPackage |
|
784 ) |
|
785 { |
|
786 |
|
787 //*************************************************************//. |
|
788 // NOTE. |
|
789 //. |
|
790 // LICENSEE SPECIFIC MESSAGE HANDLER IMPLEMENTATION STARTS HERE. |
|
791 //. |
|
792 //*************************************************************//. |
|
793 |
|
794 TFLOGSTRING("TSY: CMmUssdMessHandler::ExtFuncL"); |
|
795 OstTrace0( TRACE_NORMAL, DUP1_CMMUSSDMESSHANDLER_EXTFUNCL, "CMmUssdMessHandler::ExtFuncL" ); |
|
796 |
|
797 TInt ret( KErrNone ); |
|
798 |
|
799 if( EMobileUssdMessagingSendMessageNoFdnCheck == aIpc ) |
|
800 { |
|
801 TFLOGSTRING("TSY: CMmUssdMessHandler::ExtFuncL - iNoFdnUSSDReq --> TRUE"); |
|
802 // set flag |
|
803 iNoFdnUSSDReq = ETrue; |
|
804 } |
|
805 else |
|
806 { |
|
807 TFLOGSTRING("TSY: CMmUssdMessHandler::ExtFuncL - iNoFdnUSSDReq --> FALSE"); |
|
808 iNoFdnUSSDReq = EFalse; |
|
809 } |
|
810 |
|
811 switch ( aIpc ) |
|
812 { |
|
813 case EMobileUssdMessagingSendMessage: |
|
814 case EMobileUssdMessagingSendMessageNoFdnCheck: |
|
815 { |
|
816 ret = SsGsmUssdSendReq( aDataPackage ); |
|
817 iIsUssdSendReqOnGoing = ETrue; |
|
818 break; |
|
819 } |
|
820 case EMobileUssdMessagingSendRelease: |
|
821 { |
|
822 if ( iIsUssdSendReqOnGoing ) |
|
823 { |
|
824 iIsSendReleaseReqPending = ETrue; |
|
825 } |
|
826 else |
|
827 { |
|
828 ret = SsGsmUssdSendReq(); |
|
829 } |
|
830 break; |
|
831 } |
|
832 default: |
|
833 { |
|
834 TFLOGSTRING2("TSY: CMmUssdMessHandler::ExtFuncL - Unknown IPC: %d", aIpc); |
|
835 OstTrace1( TRACE_NORMAL, DUP2_CMMUSSDMESSHANDLER_EXTFUNCL, "CMmUssdMessHandler::ExtFuncL;aIpc=%d", aIpc ); |
|
836 ret = KErrNotSupported; |
|
837 break; |
|
838 } |
|
839 } |
|
840 return ret; |
|
841 } |
|
842 |
|
843 |
|
844 // ----------------------------------------------------------------------------- |
|
845 // CMmUssdMessHandler::HandlerError |
|
846 // Handles CMmUssdMessHandler's errors that comes via PhoNetReceiver RunError |
|
847 // method. |
|
848 // ----------------------------------------------------------------------------- |
|
849 // |
|
850 void CMmUssdMessHandler::HandleError |
|
851 ( |
|
852 const TIsiReceiveC& /*aIsiMessage*/,// Isi message |
|
853 TInt /*aError*/ // Error code |
|
854 ) |
|
855 { |
|
856 TFLOGSTRING("TSY: CMmUssdMessHandler::HandleError"); |
|
857 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_HANDLEERROR, "CMmUssdMessHandler::HandleError" ); |
|
858 } |
|
859 |
|
860 |
|
861 //end of file |
|
862 |