1 /* |
|
2 * Copyright (c) 2002-2010 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 "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: Handles SetUpCall command |
|
15 * |
|
16 */ |
|
17 #include <e32base.h> |
|
18 #include <etelmm.h> |
|
19 #include <exterror.h> |
|
20 |
|
21 #include "MSatApi.h" |
|
22 #include "MSatUtils.h" |
|
23 #include "MSatSystemState.h" |
|
24 #include "MSatUiSession.h" |
|
25 #include "SatSOpcodes.h" |
|
26 #include "MSatSUiClientHandler.h" |
|
27 #include "csetupcallrequesthandler.h" |
|
28 #include "CSetUpCallHandler.h" |
|
29 #include "TSatExtErrorUtils.h" |
|
30 #include "SatLog.h" |
|
31 |
|
32 const TUint8 KBCDAsterisk( 0x0A ); |
|
33 const TUint8 KBCDDash( 0x0B ); |
|
34 const TUint8 KBCDDTMF( 0x0C ); |
|
35 const TUint8 KBCDWild( 0x0D ); |
|
36 const TUint8 KBCDExpansion( 0x0E ); |
|
37 |
|
38 const TUint8 KAsteriskChar( 0x2A ); |
|
39 const TUint8 KDashChar( 0x23 ); |
|
40 const TUint8 KDTMFChar( 0x70 ); |
|
41 const TUint8 KWildChar( 0x77 ); |
|
42 const TUint8 KExpansionChar( 0x2E ); |
|
43 |
|
44 /** Maximum name length. */ |
|
45 const TInt KSatMaximumNameLength = 50; |
|
46 |
|
47 /** Maximum phone number length same as used by phone. */ |
|
48 const TInt KSatMaximumPhoneNumberLength = 100; |
|
49 |
|
50 /** The subaddress length, see ITU-T I.330 and 3GPP TS 11.14. */ |
|
51 const TInt KSatSubAddressLength = 21; |
|
52 |
|
53 /** The maximum bearer length. The bearer capabilities as |
|
54 defined in GSM 04.08. */ |
|
55 const TInt KSatBearerLength = 14; |
|
56 |
|
57 |
|
58 _LIT( KFixedSimEmergencyNumber, "112" ); |
|
59 |
|
60 // ======== MEMBER FUNCTIONS ======== |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // Two-phased constructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CSetUpCallHandler* CSetUpCallHandler::NewL( MSatUtils* aUtils ) |
|
67 { |
|
68 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::NewL calling" ) |
|
69 |
|
70 CSetUpCallHandler* self = new( ELeave ) CSetUpCallHandler; |
|
71 |
|
72 CleanupStack::PushL( self ); |
|
73 self->BaseConstructL( aUtils ); |
|
74 self->ConstructL(); |
|
75 CleanupStack::Pop( self ); |
|
76 |
|
77 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::NewL exiting" ) |
|
78 return self; |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // Destructor. |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 CSetUpCallHandler::~CSetUpCallHandler() |
|
86 { |
|
87 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler calling" ) |
|
88 |
|
89 Cancel(); |
|
90 |
|
91 delete iRequestHandler; |
|
92 iRequestHandler = NULL; |
|
93 |
|
94 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler exiting" ) |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // From class MSatEventObserver. |
|
99 // Event notification. |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CSetUpCallHandler::Event( TInt aEvent ) |
|
103 { |
|
104 LOG2( SIMPLE, "SETUPCALL: CSetUpCallHandler::Event calling,aEvent: %i", |
|
105 aEvent ) |
|
106 |
|
107 if ( MSatUtils::ECallControlExecuting == aEvent ) |
|
108 { |
|
109 LOG( SIMPLE, |
|
110 "SETUPCALL: CSetUpCallHandler::Event: ECallControlExecuting" ) |
|
111 iCallControlActive = ETrue; |
|
112 } |
|
113 else if ( MSatUtils::ECallControlDone == aEvent ) |
|
114 { |
|
115 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::Event: ECallControlDone" ) |
|
116 iCallControlActive = EFalse; |
|
117 |
|
118 // Check if SetUpCall command has arrived from SIM during CC execution |
|
119 // Emergency call is made immediate regardless of call control. |
|
120 if ( !IsActive() && iPCmdPending && !iEmergencyCall ) |
|
121 { |
|
122 LOG( SIMPLE, |
|
123 "SETUPCALL: CSetUpCallHandler::Event: setupcall" ) |
|
124 iPCmdPending = EFalse; |
|
125 // Execute the setupcall. |
|
126 DoHandleCommand(); |
|
127 } |
|
128 } |
|
129 |
|
130 CSatCommandHandler::Event( aEvent ); |
|
131 |
|
132 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::Event exiting" ) |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // From class MSatCommand. |
|
137 // Response from the client. |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CSetUpCallHandler::ClientResponse() |
|
141 { |
|
142 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ClientResponse calling" ) |
|
143 |
|
144 if ( iQueryRsp.iAccepted ) |
|
145 { |
|
146 // User accepted the call, make the call |
|
147 if( iRequestHandler ) |
|
148 { |
|
149 DoSetupCall( *iRequestHandler ); |
|
150 } |
|
151 else |
|
152 { |
|
153 CompleteSetupCall( |
|
154 RSat::KMeUnableToProcessCmd, |
|
155 RSat::KNoSpecificMeProblem ); |
|
156 } |
|
157 } |
|
158 else |
|
159 { |
|
160 LOG( NORMAL, |
|
161 "SETUPCALL: CSetUpCallHandler::ClientResponse User Cancel" ) |
|
162 |
|
163 if ( iQueryRsp.iSessionTerminatedByUser ) |
|
164 { |
|
165 LOG( SIMPLE, |
|
166 "SETUPCALL: CSetUpCallHandler::ClientResponse TerminatedByUser" ) |
|
167 // Notify sim session end command that next sim session end |
|
168 // should close the ui session. |
|
169 iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser ); |
|
170 } |
|
171 |
|
172 // End key is pressed during confirmation or user denied call setup, |
|
173 // KPCmdNotAcceptedByUser is an expected response, |
|
174 CompleteSetupCall( RSat::KPCmdNotAcceptedByUser ); |
|
175 } |
|
176 |
|
177 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ClientResponse exiting" ) |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // From class CActive. |
|
182 // Cancels the sat request. |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 void CSetUpCallHandler::DoCancel() |
|
186 { |
|
187 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel calling" ) |
|
188 |
|
189 iUtils->USatAPI().NotifySetUpCallCancel(); |
|
190 if( iRequestHandler ) |
|
191 { |
|
192 iRequestHandler->Cancel(); |
|
193 } |
|
194 |
|
195 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel exiting" ) |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // From class CSatCommandHandler. |
|
200 // Requests the command notification. |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 void CSetUpCallHandler::IssueUSATRequest( TRequestStatus& aStatus ) |
|
204 { |
|
205 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::IssueUSATRequest calling" ) |
|
206 |
|
207 // Clear the IPC package. |
|
208 new (&iSetUpCallData) RSat::TSetUpCallV1(); |
|
209 iPCmdPending = EFalse; |
|
210 iQueryRsp.iAccepted = EFalse; |
|
211 |
|
212 iUtils->USatAPI().NotifySetUpCall( aStatus, iSetUpCallPckg ); |
|
213 |
|
214 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::IssueUSATRequest exiting" ) |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // From class CSatCommandHandler. |
|
219 // SetUpCall command is not allowed in following situations: |
|
220 // - Phone is not registered to homenetwork and roaming. |
|
221 // - phone is ringing, alerting or call is on and SetUpCall command |
|
222 // is "make call only if not busy", "make call only if not busy wiht |
|
223 // redial" or "Call type not set". |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 TBool CSetUpCallHandler::CommandAllowed() |
|
227 { |
|
228 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CommandAllowed calling" ) |
|
229 TBool commandAllowed( ETrue ); |
|
230 |
|
231 // Emergency call can newer be denied. |
|
232 // The usage of constant emergency number is according to ETSI TS 31.111. |
|
233 iEmergencyCall = |
|
234 ( 0 == iSetUpCallData.iAddress.iTelNumber.Compare( |
|
235 KFixedSimEmergencyNumber ) ); |
|
236 |
|
237 if ( !iEmergencyCall ) |
|
238 { |
|
239 RMobilePhone::TMobilePhoneRegistrationStatus networkStatus( |
|
240 iUtils->SystemState().GetNetworkRegistrationStatus() ); |
|
241 |
|
242 if ( ( ( RSat::EAlphaIdProvided != |
|
243 iSetUpCallData.iAlphaIdConfirmationPhase.iStatus ) && |
|
244 ( ( RSat::ESelfExplanatory == |
|
245 iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) || |
|
246 ( RSat::ENotSelfExplanatory == |
|
247 iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) ) ) |
|
248 || |
|
249 ( ( RSat::EAlphaIdProvided != |
|
250 iSetUpCallData.iAlphaIdCallSetUpPhase.iStatus ) && |
|
251 ( ( RSat::ESelfExplanatory == |
|
252 iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) || |
|
253 ( RSat::ENotSelfExplanatory == |
|
254 iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) ) ) ) |
|
255 { |
|
256 // Icon data is received without alpha id. |
|
257 CompleteSetupCall( RSat::KCmdDataNotUnderstood ); |
|
258 |
|
259 commandAllowed = EFalse; |
|
260 LOG( SIMPLE, |
|
261 "SETUPCALL: CSetUpCallHandler::CommandAllowed Icon received \ |
|
262 without alpha id" ) |
|
263 } |
|
264 else if ( ( RMobilePhone::ERegisteredOnHomeNetwork != networkStatus ) && |
|
265 ( RMobilePhone::ERegisteredRoaming != networkStatus ) ) |
|
266 { |
|
267 // Not registered to network. |
|
268 CompleteSetupCall( RSat::KMeUnableToProcessCmd, RSat::KNoService ); |
|
269 |
|
270 commandAllowed = EFalse; |
|
271 LOG( SIMPLE, |
|
272 "SETUPCALL: CSetUpCallHandler::CommandAllowed Registration not \ |
|
273 valid" ) |
|
274 } |
|
275 else |
|
276 { |
|
277 LOG( SIMPLE, |
|
278 "SETUPCALL: CSetUpCallHandler::CommandAllowed others" ) |
|
279 // Call type |
|
280 const RSat::TSetUpCallType callType( iSetUpCallData.iType ); |
|
281 |
|
282 // Command does not allow to make a call if busy |
|
283 const TBool dontMakeCallIfBusy( |
|
284 ( RSat::EOnlyIfNotBusy == callType ) || |
|
285 ( RSat::EOnlyIfNotBusyWithRedial == callType ) || |
|
286 ( RSat::ESetUpCallTypeNotSet == callType ) ); |
|
287 |
|
288 if ( dontMakeCallIfBusy ) |
|
289 { |
|
290 LOG( SIMPLE, |
|
291 "SETUPCALL: CSetUpCallHandler::CommandAllowed \ |
|
292 dontMakeCallIfBusy true" ) |
|
293 // Is the call ongoing |
|
294 const TBool callIsOngoing( |
|
295 iUtils->SystemState().IsCallActive() ); |
|
296 |
|
297 // Is the call incoming |
|
298 const TBool callIsIncoming( |
|
299 iUtils->SystemState().IsCallIncoming() ); |
|
300 |
|
301 if ( callIsOngoing || callIsIncoming ) |
|
302 { |
|
303 // Set the terminal response info. |
|
304 CompleteSetupCall( |
|
305 RSat::KMeUnableToProcessCmd, |
|
306 RSat::KMeBusyOnCall ); |
|
307 |
|
308 commandAllowed = EFalse; |
|
309 LOG( SIMPLE, |
|
310 "SETUPCALL: CSetUpCallHandler::CommandAllowed Busy" ) |
|
311 } |
|
312 } |
|
313 } |
|
314 |
|
315 if ( commandAllowed ) |
|
316 { |
|
317 LOG( SIMPLE, |
|
318 "SETUPCALL: CSetUpCallHandler::CommandAllowed Allowed to call" ) |
|
319 |
|
320 // Set icon command flag whether icon data was received and |
|
321 // set qualifier to no icon id |
|
322 // To be removed when icons are allowed in this command |
|
323 if ( ( RSat::ESelfExplanatory == |
|
324 iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) || |
|
325 ( RSat::ENotSelfExplanatory == |
|
326 iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) || |
|
327 ( RSat::ESelfExplanatory == |
|
328 iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) || |
|
329 ( RSat::ENotSelfExplanatory == |
|
330 iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) ) |
|
331 { |
|
332 LOG( SIMPLE, "SETUPCALL: ENoIconId" ) |
|
333 iIconCommand = ETrue; |
|
334 iSetUpCallData.iIconIdConfirmationPhase.iQualifier = |
|
335 RSat::ENoIconId; |
|
336 iSetUpCallData.iIconIdCallSetUpPhase.iQualifier = |
|
337 RSat::ENoIconId; |
|
338 } |
|
339 else |
|
340 { |
|
341 iIconCommand = EFalse; |
|
342 } |
|
343 } |
|
344 } |
|
345 else |
|
346 { |
|
347 LOG( SIMPLE, |
|
348 "SETUPCALL: CSetUpCallHandler::CommandAllowed Emergency call" ) |
|
349 } |
|
350 |
|
351 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CommandAllowed exiting" ) |
|
352 |
|
353 return commandAllowed; |
|
354 } |
|
355 |
|
356 // ----------------------------------------------------------------------------- |
|
357 // From class CSatCommandHandler. |
|
358 // Need for ui session. |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 TBool CSetUpCallHandler::NeedUiSession() |
|
362 { |
|
363 LOG( NORMAL, "SETUPCALL: CSetUpCallHandler::NeedUiSession calling" ) |
|
364 |
|
365 // Notify Cover UI if it's supported |
|
366 if ( iUtils->CoverUiSupported() ) |
|
367 { |
|
368 LOG( NORMAL, |
|
369 "SETUPCALL: CSetUpCallHandler::NeedUiSession CoverUiSupported" ) |
|
370 TSatCommandData medEventData; |
|
371 medEventData.iPCmdNumber = RSat::ESetUpCall; |
|
372 medEventData.iAlphaId = iSetUpCallData.iAlphaIdCallSetUpPhase; |
|
373 medEventData.iDuration.iTimeUnit = RSat::ESeconds; |
|
374 medEventData.iDuration.iNumOfUnits = KSatDefaultDuration; |
|
375 medEventData.iIconID = iSetUpCallData.iIconIdCallSetUpPhase; |
|
376 TSatCommandPckg tPckg( medEventData ); |
|
377 iUtils->RaiseSatEvent( tPckg ); |
|
378 } |
|
379 |
|
380 LOG( NORMAL, "SETUPCALL: CSetUpCallHandler::NeedUiSession exiting" ) |
|
381 return ETrue; |
|
382 } |
|
383 |
|
384 // ----------------------------------------------------------------------------- |
|
385 // From class CSatCommandHandler. |
|
386 // Called when USAT API notifies that command. |
|
387 // ----------------------------------------------------------------------------- |
|
388 // |
|
389 void CSetUpCallHandler::HandleCommand() |
|
390 { |
|
391 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleCommand calling" ) |
|
392 |
|
393 if ( iEmergencyCall ) |
|
394 { |
|
395 LOG( SIMPLE, |
|
396 "SETUPCALL: CSetUpCallHandler::HandleCommand iEmergencyCall true" ) |
|
397 if ( iRequestHandler ) |
|
398 { |
|
399 CreateEmergencyCall( *iRequestHandler ); |
|
400 } |
|
401 else |
|
402 { |
|
403 iEmergencyCall = EFalse; |
|
404 // Set the terminal response info. |
|
405 CompleteSetupCall( |
|
406 RSat::KMeUnableToProcessCmd, |
|
407 RSat::KNoSpecificMeProblem ); |
|
408 } |
|
409 } |
|
410 else |
|
411 { |
|
412 const RSat::TAlphaIdStatus alphaIdStatus( |
|
413 iSetUpCallData.iAlphaIdCallSetUpPhase.iStatus ); |
|
414 |
|
415 // If the alpha id is null, then use SAT name as a alpha identifier. |
|
416 if ( ( RSat::EAlphaIdNull == alphaIdStatus ) || |
|
417 ( RSat::EAlphaIdNotPresent == alphaIdStatus ) ) |
|
418 { |
|
419 LOG( SIMPLE, |
|
420 "SETUPCALL: CSetUpCallHandler::HandleCommand set AlphaId" ) |
|
421 iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId = |
|
422 iUtils->SatAppName(); |
|
423 iSetUpCallData.iAlphaIdCallSetUpPhase.iStatus = |
|
424 RSat::EAlphaIdProvided; |
|
425 } |
|
426 |
|
427 // Copy the data to package, which is sent to client. |
|
428 iQueryData.iCommand = ESatSSetUpCallQuery; |
|
429 iQueryData.iQueryText.Copy( |
|
430 iSetUpCallData.iAlphaIdConfirmationPhase.iAlphaId ); |
|
431 iQueryData.iSimApplicationName.Copy( iUtils->SatAppName() ); |
|
432 iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull; // Always |
|
433 iQueryData.iIconId.iIdentifier = |
|
434 iSetUpCallData.iIconIdConfirmationPhase.iIdentifier; |
|
435 |
|
436 LOG2( SIMPLE, |
|
437 "SETUPCALL: iSetUpCallData.iIconIdConfirmationPhase.iQualifier: %d", |
|
438 iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) |
|
439 switch ( iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) |
|
440 { |
|
441 case RSat::ESelfExplanatory: |
|
442 { |
|
443 // Icon qualifier is self explanatory (to display instead |
|
444 // of the alpha id or text string). |
|
445 iQueryData.iIconId.iIconQualifier = ESatSelfExplanatory; |
|
446 break; |
|
447 } |
|
448 |
|
449 case RSat::ENotSelfExplanatory: |
|
450 { |
|
451 // Icon qualifier is not self explanatory. |
|
452 iQueryData.iIconId.iIconQualifier = ESatNotSelfExplanatory; |
|
453 break; |
|
454 } |
|
455 |
|
456 default: |
|
457 { |
|
458 // Icon qualifier not present |
|
459 iQueryData.iIconId.iIconQualifier = ESatENoIconId; |
|
460 break; |
|
461 } |
|
462 } |
|
463 |
|
464 // If call control is active, set up call is made |
|
465 // after the call control note is showed in ui ie |
|
466 // ECallControlDone event is notified. |
|
467 if ( !iCallControlActive ) |
|
468 { |
|
469 LOG( SIMPLE, |
|
470 "SETUPCALL: CSetUpCallHandler::HandleCommand iCallControlActive \ |
|
471 false" ) |
|
472 iUtils->NotifyEvent( MSatUtils::ESetUpCallExecuting ); |
|
473 |
|
474 TRAPD( regErr, iUtils->RegisterServiceRequestL( |
|
475 ESatSProactiveQuery, |
|
476 ESatSProactiveQueryResponse, |
|
477 this ) ); |
|
478 LOG2( SIMPLE, |
|
479 "SETUPCALL: CSetUpCallHandler::HandleCommand regErr: %d", regErr ) |
|
480 if ( KErrNone != regErr ) |
|
481 { |
|
482 // Possible memory allocation error. Send error terminal |
|
483 // response |
|
484 UiLaunchFailed(); |
|
485 } |
|
486 else |
|
487 { |
|
488 // Send query to UI |
|
489 iUtils->SatUiHandler().UiSession()->SendCommand( |
|
490 &iQueryPckg, |
|
491 &iQueryRspPckg, |
|
492 ESatSProactiveQuery ); |
|
493 } |
|
494 } |
|
495 else |
|
496 { |
|
497 LOG( SIMPLE, |
|
498 "SETUPCALL: CSetUpCallHandler::HandleCommand iCallControlActive \ |
|
499 true" ) |
|
500 // Set pending flag on |
|
501 iPCmdPending = ETrue; |
|
502 } |
|
503 } |
|
504 |
|
505 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleCommand exiting" ) |
|
506 } |
|
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // From class CSatCommandHandler. |
|
510 // Indication that UI lanching failed. |
|
511 // ----------------------------------------------------------------------------- |
|
512 // |
|
513 void CSetUpCallHandler::UiLaunchFailed() |
|
514 { |
|
515 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::UiLaunchFailed calling" ) |
|
516 |
|
517 CompleteSetupCall( RSat::KMeUnableToProcessCmd, |
|
518 RSat::KNoSpecificMeProblem ); |
|
519 |
|
520 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::UiLaunchFailed exiting" ) |
|
521 } |
|
522 |
|
523 // ----------------------------------------------------------------------------- |
|
524 // CSetUpCallHandler::SetupCallRequestComplete |
|
525 // (other items were commented in a header). |
|
526 // ----------------------------------------------------------------------------- |
|
527 // |
|
528 void CSetUpCallHandler::SetupCallRequestComplete( TInt aErrCode ) |
|
529 { |
|
530 LOG( SIMPLE, |
|
531 "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete calling" ) |
|
532 |
|
533 LOG2( NORMAL, |
|
534 "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete aErrCode %d", |
|
535 aErrCode ) |
|
536 |
|
537 if( !iEmergencyCall ) |
|
538 { |
|
539 CompleteSetupCallWithStatus( aErrCode ); |
|
540 } |
|
541 else |
|
542 { |
|
543 iEmergencyCall = EFalse; |
|
544 |
|
545 if ( KErrNone == aErrCode ) |
|
546 { |
|
547 // Set result |
|
548 CompleteSetupCall( RSat::KSuccess ); |
|
549 } |
|
550 else |
|
551 { |
|
552 // The emergency call implementation |
|
553 // before S60 SAT migration from AIW to EtelMM |
|
554 // According current information, no requirement for this. |
|
555 // We don't return extended network error. |
|
556 CompleteSetupCall( |
|
557 RSat::KNetworkUnableToProcessCmd, |
|
558 RSat::KNoSpecificMeProblem ); |
|
559 |
|
560 LOG( SIMPLE, |
|
561 "SETUPCALL: CSetUpCallHandler::HandleEmergencyDialL Network unable \ |
|
562 to process this" ) |
|
563 } |
|
564 } |
|
565 LOG2( NORMAL, |
|
566 "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete exiting %d", aErrCode ) |
|
567 } |
|
568 |
|
569 // ----------------------------------------------------------------------------- |
|
570 // C++ default constructor can NOT contain any code, that |
|
571 // might leave. |
|
572 // ----------------------------------------------------------------------------- |
|
573 // |
|
574 //lint -e{1403, 1769} Can not be initialized, harmless. |
|
575 CSetUpCallHandler::CSetUpCallHandler() : |
|
576 CSatCommandHandler(), |
|
577 iSetUpCallData(), |
|
578 iSetUpCallPckg( iSetUpCallData ), |
|
579 iSetUpCallRsp(), |
|
580 iSetUpCallRspPckg( iSetUpCallRsp ), |
|
581 iQueryData(), |
|
582 iQueryPckg( iQueryData ), |
|
583 iQueryRsp(), |
|
584 iQueryRspPckg( iQueryRsp ), |
|
585 // To be removed when icons are allowed in this command |
|
586 iIconCommand( EFalse ) |
|
587 { |
|
588 LOG( SIMPLE, |
|
589 "SETUPCALL: CSetUpCallHandler::CSetUpCallHandler calling - exiting" ) |
|
590 } |
|
591 |
|
592 // ----------------------------------------------------------------------------- |
|
593 // Symbian 2nd phase constructor can leave. |
|
594 // ----------------------------------------------------------------------------- |
|
595 // |
|
596 void CSetUpCallHandler::ConstructL() |
|
597 { |
|
598 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL calling" ) |
|
599 |
|
600 |
|
601 iRequestHandler = CSetupCallRequestHandler::NewL( iUtils->MultiModeApi(), |
|
602 this ); |
|
603 // Create request handler. This is same that LaunchBrowser uses, so this |
|
604 // is needed also in HandleCommand - function. |
|
605 iUtils->RegisterServiceRequestL( |
|
606 ESatSProactiveQuery, |
|
607 ESatSProactiveQueryResponse, |
|
608 this ); |
|
609 |
|
610 iUtils->RegisterL( this, MSatUtils::ECallControlExecuting ); |
|
611 iUtils->RegisterL( this, MSatUtils::ECallControlDone ); |
|
612 |
|
613 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL exiting" ) |
|
614 } |
|
615 |
|
616 // ----------------------------------------------------------------------------- |
|
617 // Performs the request to dial |
|
618 // ----------------------------------------------------------------------------- |
|
619 // |
|
620 void CSetUpCallHandler::DoSetupCall( CSetupCallRequestHandler& aHandler ) |
|
621 { |
|
622 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL calling" ) |
|
623 |
|
624 if( CheckSetupCallParam() ) |
|
625 { |
|
626 |
|
627 RSat::TSetUpCallType callType( iSetUpCallData.iType ); |
|
628 |
|
629 TDes& telNumber( iSetUpCallData.iAddress.iTelNumber ); |
|
630 CheckNumber( telNumber ); |
|
631 |
|
632 RMobileCall::TMobileCallParamsV7 dialParams; |
|
633 RMobileCall::TMobileCallParamsV7Pckg package( dialParams ); |
|
634 |
|
635 //Redail has been removed from MCL, no redail support. |
|
636 dialParams.iAutoRedial = EFalse; |
|
637 dialParams.iBearerMode = RMobileCall::EMulticallNewBearer; |
|
638 dialParams.iCallParamOrigin = RMobileCall::EOriginatorSIM; |
|
639 dialParams.iSubAddress = iSetUpCallData.iSubAddress; |
|
640 dialParams.iBearerCap1 = iSetUpCallData.iCapabilityConfigParams; |
|
641 |
|
642 dialParams.iBCRepeatIndicator = RMobileCall::EBCAlternateMode; |
|
643 |
|
644 dialParams.iIconId.iQualifier = RMobileCall::ENoIconId; |
|
645 |
|
646 |
|
647 dialParams.iAlphaId = iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId; |
|
648 LOG2( NORMAL, |
|
649 "SETUPCALL: CSetUpCallHandler::DoSetupCallL id:%S", |
|
650 &dialParams.iAlphaId ) |
|
651 |
|
652 LOG2( NORMAL, |
|
653 "SETUPCALL: CSetUpCallHandler::DoSetupCallL number:%S", |
|
654 &iSetUpCallData.iAddress.iTelNumber ) |
|
655 |
|
656 TBool terminateOtherCall( EFalse ); |
|
657 // check if we need to disconnect other calls |
|
658 if ( ( RSat::EDisconnectOtherCalls == callType ) || |
|
659 ( RSat::EDisconnectOtherCallsWithRedial == callType ) ) |
|
660 { |
|
661 LOG( SIMPLE, |
|
662 "SETUPCALL: CSetUpCallHandler::DoSetupCallL end other call" ) |
|
663 terminateOtherCall = ETrue ; |
|
664 } |
|
665 |
|
666 aHandler.DialNumber( package, iSetUpCallData.iAddress.iTelNumber, |
|
667 terminateOtherCall, iUtils->CreateAsyncToSyncHelper() ); |
|
668 } |
|
669 else |
|
670 { |
|
671 CompleteSetupCallWithStatus( KErrArgument ); |
|
672 } |
|
673 |
|
674 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL exiting" ) |
|
675 } |
|
676 |
|
677 // ----------------------------------------------------------------------------- |
|
678 // Return terminal response filled according to dial result. |
|
679 // ----------------------------------------------------------------------------- |
|
680 // |
|
681 void CSetUpCallHandler::CompleteSetupCallWithStatus( |
|
682 const TInt32 aStatus ) |
|
683 { |
|
684 LOG2( SIMPLE, |
|
685 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus calling: \ |
|
686 %i", aStatus ) |
|
687 |
|
688 // Form Terminal Response |
|
689 if ( KErrNone != aStatus ) |
|
690 { |
|
691 switch ( aStatus ) |
|
692 { |
|
693 case KErrGsmCCCallRejected: |
|
694 { |
|
695 LOG( SIMPLE, |
|
696 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Call \ |
|
697 Control not allowed" ) |
|
698 // If SetUpCall is not allowed by SIM in Call Control, then |
|
699 // give a correct response. |
|
700 CompleteSetupCall( |
|
701 RSat::KInteractionWithCCPermanentError, |
|
702 RSat::KActionNotAllowed ); |
|
703 break; |
|
704 } |
|
705 |
|
706 case KErrGsmCCBearerCapabilityNotAuthorised: |
|
707 { |
|
708 LOG( SIMPLE, |
|
709 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
710 Beyond ME Capabilities" ) |
|
711 // If bearer capability is not authorized, return correct value |
|
712 CompleteSetupCall( RSat::KCmdBeyondMeCapabilities ); |
|
713 break; |
|
714 } |
|
715 |
|
716 case KErrAbort: |
|
717 { |
|
718 LOG( SIMPLE, |
|
719 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus User \ |
|
720 abort" ) |
|
721 if ( iQueryRsp.iSessionTerminatedByUser ) |
|
722 { |
|
723 LOG( SIMPLE, |
|
724 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
725 TerminatedByUser" ) |
|
726 // Notify sim session end command that next sim session end |
|
727 // should close the ui session. |
|
728 iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser ); |
|
729 } |
|
730 |
|
731 // User has ended redial mechanism. |
|
732 CompleteSetupCall( RSat::KCallClearedBeforeConnectionOrReleased ); |
|
733 break; |
|
734 } |
|
735 |
|
736 case KErrGeneral: |
|
737 case KErrArgument: |
|
738 { |
|
739 LOG( SIMPLE, |
|
740 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Data \ |
|
741 not understood" ) |
|
742 CompleteSetupCall( RSat::KCmdDataNotUnderstood ); |
|
743 break; |
|
744 } |
|
745 |
|
746 case KErrAccessDenied: |
|
747 { |
|
748 LOG( SIMPLE, |
|
749 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
750 Network unable to process this" ) |
|
751 CompleteSetupCall( |
|
752 RSat::KNetworkUnableToProcessCmd, |
|
753 RSat::KNoSpecificMeProblem ); |
|
754 break; |
|
755 } |
|
756 |
|
757 case KErrSatControl: |
|
758 { |
|
759 LOG( SIMPLE, |
|
760 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
761 Call Command performed, but modified by Call Control" ) |
|
762 // Call control modified the type of request indicated in |
|
763 // the proactive command, and the action requested by |
|
764 // call control was performed successfully. |
|
765 CompleteSetupCall( RSat::KModifiedByCallControl ); |
|
766 break; |
|
767 } |
|
768 |
|
769 default: |
|
770 { |
|
771 LOG( SIMPLE, |
|
772 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
773 Network unable to process with error info" ) |
|
774 |
|
775 iSetUpCallRsp.iGeneralResult = RSat::KNetworkUnableToProcessCmd; |
|
776 iSetUpCallRsp.iInfoType = RSat::KSatNetworkErrorInfo; |
|
777 |
|
778 // Lower byte contains the error cause. |
|
779 iSetUpCallRsp.iAdditionalInfo.SetLength( 1 ); |
|
780 |
|
781 // Get mapped additional info |
|
782 TUint8 addInfo( TSatExtErrorUtils::MapError( aStatus ) ); |
|
783 iSetUpCallRsp.iAdditionalInfo[0] = |
|
784 static_cast<TUint16>( addInfo ); |
|
785 |
|
786 // Send terminal response |
|
787 TerminalRsp( RSat::ESetUpCall, iSetUpCallRspPckg ); |
|
788 break; |
|
789 } |
|
790 } |
|
791 } |
|
792 else |
|
793 { |
|
794 // Convert terminal rsp if icon used |
|
795 RSat::TIconQualifier qualifier1( |
|
796 iSetUpCallData.iIconIdConfirmationPhase.iQualifier ); |
|
797 RSat::TIconQualifier qualifier2( |
|
798 iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ); |
|
799 |
|
800 RSat::TPCmdResult result( RSat::KSuccess ); |
|
801 |
|
802 // Icon support for call confirmtion phase not done. |
|
803 if ( !iQueryRsp.iRequestedIconDisplayed && |
|
804 ( ( RSat::ESelfExplanatory == qualifier1 ) || |
|
805 ( RSat::ENotSelfExplanatory == qualifier1 ) ) ) |
|
806 { |
|
807 result = RSat::KSuccessRequestedIconNotDisplayed; |
|
808 LOG( SIMPLE, |
|
809 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
810 Confirmation icon not shown" ) |
|
811 } |
|
812 // Icon support for call setup phase not done. |
|
813 else if ( ( RSat::ESelfExplanatory == qualifier2 ) || |
|
814 ( RSat::ENotSelfExplanatory == qualifier2 ) ) |
|
815 { |
|
816 // Until 2009-10 the phone and NTSY not support the icon. |
|
817 // to be updated after the updating of the phone and NTSY |
|
818 result = RSat::KSuccessRequestedIconNotDisplayed; |
|
819 LOG( SIMPLE, |
|
820 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Icon \ |
|
821 not shown" ) |
|
822 } |
|
823 // If command had icon data and was done succesfully, report that icon |
|
824 // was not shown. |
|
825 // To be removed when icons are allowed in this command. |
|
826 else |
|
827 { |
|
828 LOG( SIMPLE, |
|
829 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
830 others" ) |
|
831 if ( iIconCommand ) |
|
832 { |
|
833 LOG( SIMPLE, |
|
834 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \ |
|
835 iIconCommand true" ) |
|
836 result = RSat::KSuccessRequestedIconNotDisplayed; |
|
837 } |
|
838 } |
|
839 // Set result |
|
840 CompleteSetupCall( result ); |
|
841 } |
|
842 |
|
843 LOG( SIMPLE, |
|
844 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus exiting" ) |
|
845 } |
|
846 |
|
847 // ----------------------------------------------------------------------------- |
|
848 // Return terminal response filled according to result. |
|
849 // ----------------------------------------------------------------------------- |
|
850 // |
|
851 void CSetUpCallHandler::CompleteSetupCall( |
|
852 const RSat::TPCmdResult aGeneralResult ) |
|
853 { |
|
854 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall calling" ) |
|
855 |
|
856 // Fill Terminal Response. |
|
857 iSetUpCallRsp.iGeneralResult = aGeneralResult; |
|
858 iSetUpCallRsp.iInfoType = RSat::KNoAdditionalInfo; |
|
859 iSetUpCallRsp.iAdditionalInfo.Zero(); |
|
860 iSetUpCallRsp.SetPCmdNumber( iSetUpCallData.PCmdNumber() ); |
|
861 |
|
862 // Send terminal response. |
|
863 TerminalRsp( RSat::ESetUpCall, iSetUpCallRspPckg ); |
|
864 |
|
865 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall exiting" ) |
|
866 } |
|
867 |
|
868 // ----------------------------------------------------------------------------- |
|
869 // Return terminal response filled according to result. |
|
870 // ----------------------------------------------------------------------------- |
|
871 // |
|
872 void CSetUpCallHandler::CompleteSetupCall( |
|
873 const RSat::TPCmdResult aGeneralResult, |
|
874 const TInt16 aAdditionalInfo ) |
|
875 { |
|
876 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall calling" ) |
|
877 |
|
878 // Fill Terminal Response. |
|
879 iSetUpCallRsp.iGeneralResult = aGeneralResult; |
|
880 iSetUpCallRsp.iInfoType = RSat::KMeProblem; |
|
881 iSetUpCallRsp.iAdditionalInfo.SetLength( 1 ); |
|
882 iSetUpCallRsp.iAdditionalInfo[0] = aAdditionalInfo; |
|
883 iSetUpCallRsp.SetPCmdNumber( iSetUpCallData.PCmdNumber() ); |
|
884 |
|
885 // Send terminal response. |
|
886 TerminalRsp( RSat::ESetUpCall, iSetUpCallRspPckg ); |
|
887 |
|
888 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall exiting" ) |
|
889 } |
|
890 |
|
891 // ----------------------------------------------------------------------------- |
|
892 // Checks the dialling number string for extended BCD |
|
893 // values. Changes them to correct characters |
|
894 // see ETSI 11.11 10.5.1 |
|
895 // ----------------------------------------------------------------------------- |
|
896 // |
|
897 void CSetUpCallHandler::CheckNumber( TDes& aNumber ) const |
|
898 { |
|
899 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber calling" ) |
|
900 |
|
901 for ( TInt i = 0; i < aNumber.Length(); i++ ) |
|
902 { |
|
903 // check values |
|
904 if ( KBCDAsterisk == aNumber[i] ) |
|
905 { |
|
906 LOG( SIMPLE, |
|
907 "SETUPCALL: CSetUpCallHandler::CheckNumber KAsteriskChar" ) |
|
908 aNumber[i] = KAsteriskChar; |
|
909 } |
|
910 |
|
911 if ( KBCDDash == aNumber[i] ) |
|
912 { |
|
913 LOG( SIMPLE, |
|
914 "SETUPCALL: CSetUpCallHandler::CheckNumber KDashChar" ) |
|
915 aNumber[i] = KDashChar; |
|
916 } |
|
917 |
|
918 if ( KBCDDTMF == aNumber[i] ) |
|
919 { |
|
920 LOG( SIMPLE, |
|
921 "SETUPCALL: CSetUpCallHandler::CheckNumber KDTMFChar" ) |
|
922 aNumber[i] = KDTMFChar; |
|
923 } |
|
924 |
|
925 if ( KBCDWild == aNumber[i] ) |
|
926 { |
|
927 LOG( SIMPLE, |
|
928 "SETUPCALL: CSetUpCallHandler::CheckNumber KWildChar" ) |
|
929 aNumber[i] = KWildChar; |
|
930 } |
|
931 |
|
932 if ( KBCDExpansion == aNumber[i] ) |
|
933 { |
|
934 LOG( SIMPLE, |
|
935 "SETUPCALL: CSetUpCallHandler::CheckNumber KExpansionChar" ) |
|
936 aNumber[i] = KExpansionChar; |
|
937 } |
|
938 } |
|
939 |
|
940 LOG2( SIMPLE, |
|
941 "SETUPCALL: CSetUpCallHandler::CheckNumber length of aNumber: %d", |
|
942 aNumber.Length() ) |
|
943 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber exiting" ) |
|
944 } |
|
945 |
|
946 // ----------------------------------------------------------------------------- |
|
947 // Create emergency call |
|
948 // ----------------------------------------------------------------------------- |
|
949 // |
|
950 void CSetUpCallHandler::CreateEmergencyCall( |
|
951 CSetupCallRequestHandler& aHandler ) |
|
952 { |
|
953 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCall calling" ) |
|
954 |
|
955 aHandler.DialEmergencyCall( iSetUpCallData.iAddress.iTelNumber ); |
|
956 |
|
957 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCall exiting" ) |
|
958 } |
|
959 |
|
960 // ----------------------------------------------------------------------------- |
|
961 // check setup call param. |
|
962 // ----------------------------------------------------------------------------- |
|
963 // |
|
964 TBool CSetUpCallHandler::CheckSetupCallParam() |
|
965 { |
|
966 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam calling" ) |
|
967 |
|
968 TBool valid( ETrue ); |
|
969 if ( iSetUpCallData.iAddress.iTelNumber.Length() |
|
970 > KSatMaximumPhoneNumberLength ) |
|
971 { |
|
972 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam num" ) |
|
973 valid = EFalse; |
|
974 } |
|
975 else if ( iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId.Length() |
|
976 > KSatMaximumNameLength ) |
|
977 { |
|
978 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam name" ) |
|
979 valid = EFalse; |
|
980 } |
|
981 else if ( iSetUpCallData.iSubAddress.Length() > KSatSubAddressLength ) |
|
982 { |
|
983 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam sub" ) |
|
984 valid = EFalse; |
|
985 } |
|
986 else if ( iSetUpCallData.iCapabilityConfigParams.Length() |
|
987 > KSatBearerLength ) |
|
988 { |
|
989 LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam bear" ) |
|
990 valid = EFalse; |
|
991 } |
|
992 LOG2( SIMPLE, |
|
993 "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam exiting %d", valid ) |
|
994 |
|
995 return valid; |
|
996 } |
|
997 // End Of File |
|