1 /* |
|
2 * Copyright (c) 2005-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 "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: Implementation of CPhoneSingleAndWaiting class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <eikmenub.h> |
|
21 #include <eikenv.h> |
|
22 #include <StringLoader.h> |
|
23 #include <featmgr.h> |
|
24 #include <pevirtualengine.h> |
|
25 #include <mpeengineinfo.h> |
|
26 #include <telephonyvariant.hrh> |
|
27 #include <cpephonemodelif.h> |
|
28 #include "cphonesingleandwaiting.h" |
|
29 #include "mphonestatemachine.h" |
|
30 #include "phoneviewcommanddefinitions.h" |
|
31 #include "phoneui.hrh" |
|
32 #include "cphonemainresourceresolver.h" |
|
33 #include "phonerssbase.h" |
|
34 #include "cphonegsmincall.h" |
|
35 #include "tphonecmdparaminteger.h" |
|
36 #include "tphonecmdparamboolean.h" |
|
37 #include "tphonecmdparamstring.h" |
|
38 #include "tphonecmdparamcallheaderdata.h" |
|
39 #include "tphonecmdparamglobalnote.h" |
|
40 #include "tphonecmdparamcallstatedata.h" |
|
41 #include "phonestatedefinitionsgsm.h" |
|
42 #include "phonelogger.h" |
|
43 #include "cphonecenrepproxy.h" |
|
44 #include "cphonepubsubproxy.h" |
|
45 #include "mphonestorage.h" |
|
46 |
|
47 // ================= MEMBER FUNCTIONS ======================= |
|
48 |
|
49 // C++ default constructor can NOT contain any code, that |
|
50 // might leave. |
|
51 // |
|
52 CPhoneSingleAndWaiting::CPhoneSingleAndWaiting( |
|
53 MPhoneStateMachine* aStateMachine, |
|
54 MPhoneViewCommandHandle* aViewCommandHandle, |
|
55 MPhoneCustomization* aPhoneCustomization ) : |
|
56 CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization ), |
|
57 iSingleCallId ( KErrNotFound ) |
|
58 { |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------- |
|
62 // CPhoneSingleAndWaiting::~CPhoneSingleAndWaiting() |
|
63 // Destructor |
|
64 // (other items were commented in a header). |
|
65 // ----------------------------------------------------------- |
|
66 // |
|
67 CPhoneSingleAndWaiting::~CPhoneSingleAndWaiting() |
|
68 { |
|
69 if ( iViewCommandHandle ) |
|
70 { |
|
71 TPhoneCmdParamBoolean dtmfSendFlag; |
|
72 dtmfSendFlag.SetBoolean( EFalse ); |
|
73 iViewCommandHandle->ExecuteCommand( EPhoneViewSetVideoCallDTMFVisibilityFlag, |
|
74 &dtmfSendFlag ); |
|
75 } |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------- |
|
79 // CPhoneSingleAndWaiting::ConstructL() |
|
80 // Constructor |
|
81 // (other items were commented in a header). |
|
82 // ----------------------------------------------------------- |
|
83 // |
|
84 void CPhoneSingleAndWaiting::ConstructL() |
|
85 { |
|
86 CPhoneGsmInCall::ConstructL(); |
|
87 |
|
88 TPhoneCmdParamCallStateData callStateData; |
|
89 callStateData.SetCallState( EPEStateConnected ); |
|
90 |
|
91 iViewCommandHandle->HandleCommandL( |
|
92 EPhoneViewGetCallIdByState, &callStateData ); |
|
93 |
|
94 if ( callStateData.CallId() == KErrNotFound ) |
|
95 { |
|
96 callStateData.SetCallState( EPEStateHeld ); |
|
97 iViewCommandHandle->HandleCommandL( |
|
98 EPhoneViewGetCallIdByState, &callStateData ); |
|
99 } |
|
100 iSingleCallId = callStateData.CallId(); |
|
101 |
|
102 __PHONELOG1( EBasic, EPhoneUIStates, |
|
103 "CPhoneSingleAndWaiting::ConstructL() (iSingleCallId=%d)", iSingleCallId); |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------- |
|
107 // CPhoneSingleAndWaiting::NewL() |
|
108 // Constructor |
|
109 // (other items were commented in a header). |
|
110 // ----------------------------------------------------------- |
|
111 // |
|
112 CPhoneSingleAndWaiting* CPhoneSingleAndWaiting::NewL( |
|
113 MPhoneStateMachine* aStateMachine, |
|
114 MPhoneViewCommandHandle* aViewCommandHandle, |
|
115 MPhoneCustomization* aPhoneCustomization ) |
|
116 { |
|
117 CPhoneSingleAndWaiting* self = new( ELeave ) CPhoneSingleAndWaiting( |
|
118 aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
119 |
|
120 CleanupStack::PushL( self ); |
|
121 self->ConstructL(); |
|
122 CleanupStack::Pop( self ); |
|
123 |
|
124 return self; |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------- |
|
128 // CPhoneSingleAndWaiting::HandlePhoneEngineMessageL |
|
129 // ----------------------------------------------------------- |
|
130 // |
|
131 void CPhoneSingleAndWaiting::HandlePhoneEngineMessageL( |
|
132 const TInt aMessage, |
|
133 TInt aCallId ) |
|
134 { |
|
135 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
136 "CPhoneSingleAndWaiting::HandlePhoneEngineMessageL() "); |
|
137 switch ( aMessage ) |
|
138 { |
|
139 case MEngineMonitor::EPEMessageIdle: |
|
140 HandleIdleL( aCallId ); |
|
141 break; |
|
142 |
|
143 case MEngineMonitor::EPEMessageHeld: |
|
144 HandleHeldL( aCallId ); |
|
145 break; |
|
146 |
|
147 case MEngineMonitor::EPEMessageConnected: |
|
148 HandleConnectedL( aCallId ); |
|
149 break; |
|
150 |
|
151 case MEngineMonitor::EPEMessageDialing: |
|
152 HandleDiallingL( aCallId ); |
|
153 break; |
|
154 |
|
155 case MEngineMonitor::EPEMessageDisconnecting: |
|
156 HandleDisconnectingL( aCallId ); |
|
157 /* Flow through */ |
|
158 |
|
159 default: |
|
160 CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
161 break; |
|
162 } |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------- |
|
166 // CPhoneSingleAndWaiting:HandleCommandL |
|
167 // ----------------------------------------------------------- |
|
168 // |
|
169 TBool CPhoneSingleAndWaiting::HandleCommandL( TInt aCommand ) |
|
170 { |
|
171 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
172 "CPhoneSingleAndWaiting::HandleCommandL() "); |
|
173 TBool commandStatus = ETrue; |
|
174 |
|
175 switch( aCommand ) |
|
176 { |
|
177 case EPhoneInCallCmdHold: |
|
178 { |
|
179 iStateMachine->SetCallId( iSingleCallId ); |
|
180 iStateMachine->SendPhoneEngineMessage( |
|
181 CPEPhoneModelIF::EPEMessageHold ); |
|
182 break; |
|
183 } |
|
184 |
|
185 case EPhoneInCallCmdUnhold: |
|
186 { |
|
187 iStateMachine->SetCallId( iSingleCallId ); |
|
188 iStateMachine->SendPhoneEngineMessage( |
|
189 CPEPhoneModelIF::EPEMessageResume ); |
|
190 break; |
|
191 } |
|
192 |
|
193 case EPhoneInCallCmdNewCall: |
|
194 LaunchNewCallQueryL(); |
|
195 break; |
|
196 |
|
197 case EPhoneInCallCmdNewCallCall: |
|
198 CallFromNewCallQueryL(); |
|
199 break; |
|
200 |
|
201 case EPhoneCallComingCmdReject: // fall through |
|
202 { |
|
203 // Get waiting callid |
|
204 TPhoneCmdParamCallStateData callStateData; |
|
205 callStateData.SetCallState( EPEStateRinging ); |
|
206 iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState, |
|
207 &callStateData ); |
|
208 iStateMachine->SetCallId( callStateData.CallId() ); |
|
209 iStateMachine->SendPhoneEngineMessage( |
|
210 MPEPhoneModel::EPEMessageReject ); |
|
211 break; |
|
212 } |
|
213 |
|
214 |
|
215 case EPhoneInCallCmdReject: |
|
216 iStateMachine->SetCallId( iSingleCallId ); |
|
217 iStateMachine->SendPhoneEngineMessage( |
|
218 MPEPhoneModel::EPEMessageReject ); |
|
219 break; |
|
220 |
|
221 case EPhoneCmdUpdateUiControls: |
|
222 UpdateUiControlsL(); |
|
223 break; |
|
224 |
|
225 default: |
|
226 commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand ); |
|
227 break; |
|
228 } |
|
229 |
|
230 return commandStatus; |
|
231 } |
|
232 |
|
233 // ----------------------------------------------------------- |
|
234 // CPhoneSingleAndWaiting::OpenMenuBarL |
|
235 // ----------------------------------------------------------- |
|
236 // |
|
237 void CPhoneSingleAndWaiting::OpenMenuBarL() |
|
238 { |
|
239 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
240 "CPhoneSingleAndWaiting::OpenMenuBarL() "); |
|
241 TInt resourceId ( KErrNone ); |
|
242 |
|
243 |
|
244 if ( !IsAutoLockOn() ) |
|
245 { |
|
246 if( IsVideoCallActiveL() || IsVideoCallRingingL() ) |
|
247 { |
|
248 //DTMF hiding will be set to TRUE |
|
249 if( IsVideoCallActiveL() ) |
|
250 { |
|
251 TPhoneCmdParamBoolean dtmfSendFlag; |
|
252 dtmfSendFlag.SetBoolean( ETrue ); |
|
253 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetVideoCallDTMFVisibilityFlag, |
|
254 &dtmfSendFlag ); |
|
255 } |
|
256 if ( IsNumberEntryVisibleL() ) |
|
257 { |
|
258 resourceId = EPhoneVideoCallWaitingMenubarWithNumberEntry; |
|
259 } |
|
260 else |
|
261 { |
|
262 resourceId = EPhoneVideoCallWaitingMenubar; |
|
263 } |
|
264 } |
|
265 |
|
266 else // single voice and waiting voice |
|
267 { |
|
268 if ( IsNumberEntryVisibleL() ) |
|
269 { |
|
270 resourceId = EPhoneCallWaitingMenubarWithNumberEntry; |
|
271 } |
|
272 else |
|
273 { |
|
274 resourceId = EPhoneCallWaitingMenubar; |
|
275 } |
|
276 } |
|
277 } |
|
278 else |
|
279 { |
|
280 resourceId = EPhoneCallWaitingLockMenubar; |
|
281 } |
|
282 |
|
283 |
|
284 TPhoneCmdParamInteger integerParam; |
|
285 integerParam.SetInteger( |
|
286 CPhoneMainResourceResolver::Instance()-> |
|
287 ResolveResourceID( resourceId ) ); |
|
288 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, |
|
289 &integerParam ); |
|
290 } |
|
291 |
|
292 // -------------------------------------------------------------- |
|
293 // CPhoneSingleAndWaiting::HandleKeyMessageL |
|
294 // -------------------------------------------------------------- |
|
295 // |
|
296 void CPhoneSingleAndWaiting::HandleKeyMessageL( |
|
297 TPhoneKeyEventMessages aMessage, |
|
298 TKeyCode aCode ) |
|
299 { |
|
300 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
301 "CPhoneSingleAndWaiting::HandleKeyMessageL() "); |
|
302 switch ( aCode ) |
|
303 { |
|
304 // send-key |
|
305 case EKeyYes: |
|
306 { |
|
307 if( IsNumberEntryVisibleL() ) |
|
308 { |
|
309 // Send a manual control sequence by providing number |
|
310 // information with Dial command |
|
311 CallFromNumberEntryL(); |
|
312 } |
|
313 else |
|
314 { |
|
315 // Close DTMF sending note if it exists |
|
316 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote ); |
|
317 |
|
318 // Number entry is below incoming call bubble so |
|
319 // answer the call |
|
320 iStateMachine->SendPhoneEngineMessage( |
|
321 CPEPhoneModelIF::EPEMessageAnswer ); |
|
322 } |
|
323 break; |
|
324 } |
|
325 |
|
326 default: |
|
327 // do base operation |
|
328 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode ); |
|
329 break; |
|
330 } |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------- |
|
334 // CPhoneSingleAndWaiting::HandleKeyEventL |
|
335 // ----------------------------------------------------------- |
|
336 // |
|
337 void CPhoneSingleAndWaiting::HandleKeyEventL( |
|
338 const TKeyEvent& aKeyEvent, |
|
339 TEventCode /*aEventCode*/ ) |
|
340 { |
|
341 if( EKeyDeviceF == aKeyEvent.iCode ) |
|
342 { |
|
343 __PHONELOG( EBasic, EPhoneUIStates, |
|
344 "CPhoneSingleAndWaiting::HandleKeyMessageL-deviceF" ); |
|
345 HandleHoldSwitchL(); |
|
346 } |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------- |
|
350 // CPhoneSingleAndWaiting::HandleIdleL |
|
351 // ----------------------------------------------------------- |
|
352 // |
|
353 void CPhoneSingleAndWaiting::HandleIdleL( TInt aCallId ) |
|
354 { |
|
355 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
356 "CPhoneSingleAndWaiting::HandleIdleL() "); |
|
357 // Close menu bar, if it is displayed |
|
358 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
359 |
|
360 if ( iSingleCallId == KErrNotFound ) |
|
361 { |
|
362 TPhoneCmdParamCallStateData callStateData; |
|
363 callStateData.SetCallState( EPEStateDisconnecting ); |
|
364 |
|
365 iViewCommandHandle->HandleCommandL( |
|
366 EPhoneViewGetCallIdByState, &callStateData ); |
|
367 |
|
368 if ( callStateData.CallId() == KErrNotFound ) |
|
369 { |
|
370 callStateData.SetCallState( EPEStateConnected ); |
|
371 iViewCommandHandle->HandleCommandL( |
|
372 EPhoneViewGetCallIdByState, &callStateData ); |
|
373 |
|
374 if ( callStateData.CallId() == KErrNotFound ) |
|
375 { |
|
376 callStateData.SetCallState( EPEStateHeld ); |
|
377 iViewCommandHandle->HandleCommandL( |
|
378 EPhoneViewGetCallIdByState, &callStateData ); |
|
379 } |
|
380 } |
|
381 |
|
382 iSingleCallId = callStateData.CallId(); |
|
383 } |
|
384 |
|
385 __PHONELOG1( EBasic, EPhoneControl, |
|
386 "CPhoneSingleAndWaiting::HandleIdleL iSingleCallId(%d)", |
|
387 iSingleCallId ); |
|
388 __PHONELOG1( EBasic, EPhoneControl, |
|
389 "CPhoneSingleAndWaiting::HandleIdleL aCallId(%d)", |
|
390 aCallId ); |
|
391 |
|
392 if( iSingleCallId == aCallId ) |
|
393 { |
|
394 // Idle message came for active call |
|
395 BeginUiUpdateLC(); |
|
396 |
|
397 // Remove call |
|
398 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
399 |
|
400 // Get waiting callId |
|
401 TPhoneCmdParamCallStateData callStateData; |
|
402 callStateData.SetCallState( EPEStateRinging ); |
|
403 iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState, |
|
404 &callStateData ); |
|
405 |
|
406 __PHONELOG1( EBasic, EPhoneControl, |
|
407 "CPhoneSingleAndWaiting::HandleIdleL EPEStateRinging CallId(%d)", |
|
408 callStateData.CallId() ); |
|
409 |
|
410 if ( callStateData.CallId() > KErrNotFound ) |
|
411 { |
|
412 // Display ringing bubble |
|
413 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
414 callHeaderParam.SetCallState( EPEStateRinging ); |
|
415 |
|
416 // Set Hold flag to view |
|
417 TPhoneCmdParamBoolean holdFlag; |
|
418 holdFlag.SetBoolean( EFalse ); |
|
419 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
420 |
|
421 SetCallHeaderTextsForCallComingInL( callStateData.CallId(), EFalse, &callHeaderParam ); |
|
422 |
|
423 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, |
|
424 callStateData.CallId(), |
|
425 &callHeaderParam ); |
|
426 |
|
427 // Hide number entry if visible |
|
428 if ( IsNumberEntryVisibleL() ) |
|
429 { |
|
430 SetNumberEntryVisibilityL(EFalse); |
|
431 } |
|
432 |
|
433 // Check if HW Keys or Call UI should be disabled |
|
434 CheckDisableHWKeysAndCallUIL(); |
|
435 |
|
436 SetTouchPaneButtons( EPhoneIncomingCallButtons ); |
|
437 SetTouchPaneButtonEnabled( EPhoneCallComingCmdSilent ); |
|
438 |
|
439 // Bring up callhandling view |
|
440 BringIncomingToForegroundL(); |
|
441 |
|
442 //Set incoming cba |
|
443 iCbaManager->UpdateIncomingCbaL( callStateData.CallId() ); |
|
444 UpdateSilenceButtonDimming(); |
|
445 |
|
446 // Play ringtone |
|
447 SetRingingTonePlaybackL( callStateData.CallId() ); |
|
448 } |
|
449 SetToolbarDimming( ETrue ); |
|
450 SetBackButtonActive(EFalse); |
|
451 EndUiUpdate(); |
|
452 |
|
453 iStateMachine->ChangeState( EPhoneStateIncoming ); |
|
454 } |
|
455 else |
|
456 { |
|
457 // Effect is shown when dialer exist. |
|
458 TBool effectStarted ( EFalse ); |
|
459 if ( !NeedToSendToBackgroundL() ) |
|
460 { |
|
461 BeginTransEffectLC( ENumberEntryOpen ); |
|
462 effectStarted = ETrue; |
|
463 } |
|
464 |
|
465 BeginUiUpdateLC(); |
|
466 |
|
467 // Remove call |
|
468 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
469 |
|
470 // Idle message came for waiting call |
|
471 if ( IsNumberEntryUsedL() ) |
|
472 { |
|
473 if ( NeedToSendToBackgroundL() ) |
|
474 { |
|
475 // Return phone to the background if send to background is needed. |
|
476 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
477 |
|
478 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility ); |
|
479 |
|
480 UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
481 } |
|
482 else |
|
483 { |
|
484 // Show the number entry if it exists |
|
485 SetNumberEntryVisibilityL(ETrue); |
|
486 } |
|
487 } |
|
488 else |
|
489 { |
|
490 UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
491 // If numberentry is not open just check NeedToSendToBackgroundL and |
|
492 // sendbackround if needed. |
|
493 if ( NeedToSendToBackgroundL() ) |
|
494 { |
|
495 // Return phone to the background if send to background is needed. |
|
496 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
497 } |
|
498 } |
|
499 |
|
500 // Enable call UI |
|
501 if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
502 && iStateMachine->PhoneStorage()->IsScreenLocked() ) |
|
503 { |
|
504 EnableCallUIL(); |
|
505 } |
|
506 |
|
507 // Reset blocked keys list |
|
508 iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
509 |
|
510 SetTouchPaneButtons( EPhoneIncallButtons ); |
|
511 EndUiUpdate(); |
|
512 if( effectStarted ) |
|
513 { |
|
514 EndTransEffect(); |
|
515 } |
|
516 // CBA updates in above if-else conditions |
|
517 iStateMachine->ChangeState( EPhoneStateSingle ); |
|
518 } |
|
519 |
|
520 } |
|
521 |
|
522 // ----------------------------------------------------------- |
|
523 // CPhoneSingleAndWaiting::HandleHeldL |
|
524 // ----------------------------------------------------------- |
|
525 // |
|
526 void CPhoneSingleAndWaiting::HandleHeldL( TInt aCallId ) |
|
527 { |
|
528 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
529 "CPhoneSingleAndWaiting::HandleHeldL() "); |
|
530 |
|
531 // Display hold bubble |
|
532 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
533 callHeaderParam.SetCallState( EPEStateHeld ); |
|
534 |
|
535 TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC ); |
|
536 TInt callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
537 ResolveResourceID( EPhoneCallOnHold ); |
|
538 |
|
539 StringLoader::Load( labelText, callLabelId, CCoeEnv::Static() ); |
|
540 callHeaderParam.SetLabelText( labelText ); |
|
541 |
|
542 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
543 &callHeaderParam ); |
|
544 |
|
545 // Set Hold flag to view |
|
546 TPhoneCmdParamBoolean holdFlag; |
|
547 holdFlag.SetBoolean( ETrue ); |
|
548 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
549 |
|
550 if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) ) |
|
551 { |
|
552 HandleHoldNoteL( aCallId, ETrue ); |
|
553 } |
|
554 |
|
555 UpdateInCallCbaL(); |
|
556 |
|
557 SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
558 } |
|
559 |
|
560 // ----------------------------------------------------------- |
|
561 // CPhoneSingleAndWaiting::HandleConnectedL |
|
562 // ----------------------------------------------------------- |
|
563 // |
|
564 void CPhoneSingleAndWaiting::HandleConnectedL( TInt aCallId ) |
|
565 { |
|
566 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
567 "CPhoneSingleAndWaiting::HandleConnectedL() "); |
|
568 |
|
569 __PHONELOG1( EBasic, EPhoneUIStates, |
|
570 "CPhoneSingleAndWaiting::HandleConnectedL (CallId=%d)", aCallId); |
|
571 |
|
572 if ( iSingleCallId == aCallId ) |
|
573 { |
|
574 // Connected message came for the hold call, we still |
|
575 // have the waiting call also |
|
576 HandleUnholdL( aCallId ); |
|
577 } |
|
578 else |
|
579 { |
|
580 // Connected message came for waiting call |
|
581 MakeStateTransitionToTwoSinglesL( aCallId ); |
|
582 } |
|
583 } |
|
584 |
|
585 // ----------------------------------------------------------- |
|
586 // CPhoneSingleAndWaiting::HandleUnholdL |
|
587 // ----------------------------------------------------------- |
|
588 // |
|
589 void CPhoneSingleAndWaiting::HandleUnholdL( TInt aCallId ) |
|
590 { |
|
591 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
592 "CPhoneSingleAndWaiting::HandleUnholdL() "); |
|
593 // Close menu if focus is somewhere else than number entry. |
|
594 if ( !IsNumberEntryUsedL() ) |
|
595 { |
|
596 // Close menubar |
|
597 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
598 } |
|
599 |
|
600 // Show bubble |
|
601 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
602 callHeaderParam.SetCallState( EPEStateConnected ); |
|
603 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
604 &callHeaderParam ); |
|
605 |
|
606 // Set Hold flag to view |
|
607 TPhoneCmdParamBoolean holdFlag; |
|
608 holdFlag.SetBoolean( EFalse ); |
|
609 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
610 |
|
611 if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) ) |
|
612 { |
|
613 HandleHoldNoteL( aCallId, EFalse ); |
|
614 } |
|
615 |
|
616 // Set CBAs |
|
617 UpdateInCallCbaL(); |
|
618 |
|
619 SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
620 } |
|
621 |
|
622 // ----------------------------------------------------------- |
|
623 // CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL |
|
624 // ----------------------------------------------------------- |
|
625 // |
|
626 void CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL( TInt aCallId ) |
|
627 { |
|
628 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
629 "CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL() "); |
|
630 |
|
631 // Effect is shown when dialer exist. |
|
632 TBool effectStarted ( EFalse ); |
|
633 if ( !NeedToSendToBackgroundL() ) |
|
634 { |
|
635 BeginTransEffectLC( ENumberEntryOpen ); |
|
636 effectStarted = ETrue; |
|
637 } |
|
638 |
|
639 // Reset blocked keys list |
|
640 iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
641 |
|
642 BeginUiUpdateLC(); |
|
643 |
|
644 UpdateRemoteInfoDataL ( aCallId ); |
|
645 // Show bubble |
|
646 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
647 callHeaderParam.SetCallState( EPEStateConnected ); |
|
648 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
649 &callHeaderParam ); |
|
650 |
|
651 // Set Hold flag to view |
|
652 TPhoneCmdParamBoolean holdFlag; |
|
653 holdFlag.SetBoolean( EFalse ); |
|
654 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
655 |
|
656 if ( IsNumberEntryUsedL() ) |
|
657 { |
|
658 if ( NeedToSendToBackgroundL() ) |
|
659 { |
|
660 // Return phone to the background if send to background is needed. |
|
661 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
662 |
|
663 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility ); |
|
664 |
|
665 UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
666 } |
|
667 else |
|
668 { |
|
669 // Show the number entry if it exists. |
|
670 SetNumberEntryVisibilityL(ETrue); |
|
671 } |
|
672 } |
|
673 else |
|
674 { |
|
675 // Set Two singles softkeys |
|
676 UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA ); |
|
677 } |
|
678 |
|
679 // Close dtmf dialer if exist. |
|
680 if ( iOnScreenDialer && IsDTMFEditorVisibleL() ) |
|
681 { |
|
682 CloseDTMFEditorL(); |
|
683 } |
|
684 else if ( iOnScreenDialer && IsCustomizedDialerVisibleL() ) |
|
685 { |
|
686 CloseCustomizedDialerL(); |
|
687 } |
|
688 |
|
689 SetTouchPaneButtons( EPhoneTwoSinglesButtons ); |
|
690 EndUiUpdate(); |
|
691 if( effectStarted ) |
|
692 { |
|
693 EndTransEffect(); |
|
694 } |
|
695 |
|
696 // Go to two singles state |
|
697 // CBA updates in above if-else conditions |
|
698 iStateMachine->ChangeState( EPhoneStateTwoSingles ); |
|
699 } |
|
700 |
|
701 // --------------------------------------------------------- |
|
702 // CPhoneSingleAndWaiting::CallFromNewCallQueryL |
|
703 // --------------------------------------------------------- |
|
704 // |
|
705 void CPhoneSingleAndWaiting::CallFromNewCallQueryL() |
|
706 { |
|
707 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
708 "CPhoneSingleAndWaiting::CallFromNewCallQueryL() "); |
|
709 // First get the phone number from the dialog |
|
710 TPhoneCmdParamString phoneNumberParam; |
|
711 HBufC *content = HBufC::NewLC( KPhoneNumberEntryBufferSize ); |
|
712 TPtr ptr( content->Des() ); |
|
713 phoneNumberParam.SetString( &ptr ); |
|
714 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetTextQueryContent, |
|
715 &phoneNumberParam ); |
|
716 |
|
717 // Store the phone number |
|
718 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ); |
|
719 |
|
720 // clean up stack |
|
721 CleanupStack::PopAndDestroy( content ); |
|
722 |
|
723 DialVoiceCallL(); |
|
724 } |
|
725 |
|
726 // ----------------------------------------------------------- |
|
727 // CPhoneSingleAndWaiting::HandleDiallingL |
|
728 // ----------------------------------------------------------- |
|
729 // |
|
730 void CPhoneSingleAndWaiting::HandleDiallingL( TInt aCallId ) |
|
731 { |
|
732 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
733 "CPhoneSingleAndWaiting::HandleDiallingL() "); |
|
734 |
|
735 BeginTransEffectLC( ENumberEntryClose ); |
|
736 BeginUiUpdateLC(); |
|
737 |
|
738 // Hide number entry if it exists |
|
739 SetNumberEntryVisibilityL(EFalse); |
|
740 |
|
741 // Display call setup |
|
742 DisplayCallSetupL( aCallId ); |
|
743 |
|
744 // Set Hold flag to view ( DTMF menu label have to present ) |
|
745 TPhoneCmdParamBoolean holdFlag; |
|
746 holdFlag.SetBoolean( EFalse ); |
|
747 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
748 |
|
749 SetTouchPaneButtons( EPhoneCallSetupButtons ); |
|
750 |
|
751 EndUiUpdate(); |
|
752 EndTransEffect(); |
|
753 |
|
754 // Update call setup CBAs |
|
755 UpdateCbaL( EPhoneCallHandlingCallSetupCBA ); |
|
756 |
|
757 // Go to Single And Waiting And Call Setup state |
|
758 iStateMachine->ChangeState( EPhoneStateSingleAndCallSetupAndWaiting ); |
|
759 } |
|
760 |
|
761 // ----------------------------------------------------------- |
|
762 // CPhoneSingleAndWaiting::DisplayCallSetupL |
|
763 // ----------------------------------------------------------- |
|
764 // |
|
765 void CPhoneSingleAndWaiting::DisplayCallSetupL( TInt aCallId ) |
|
766 { |
|
767 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
768 "CPhoneSingleAndWaiting::DisplayCallSetupL() "); |
|
769 // Close menu bar, if it is displayed |
|
770 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
771 |
|
772 // Remove dialogs if necessary |
|
773 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs ); |
|
774 |
|
775 // Capture keys when the phone is dialling |
|
776 CaptureKeysDuringCallNotificationL( ETrue ); |
|
777 |
|
778 // Force telephony to the foreground |
|
779 TPhoneCmdParamInteger uidParam; |
|
780 uidParam.SetInteger( KUidPhoneApplication.iUid ); |
|
781 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, |
|
782 &uidParam ); |
|
783 |
|
784 // Display call setup header |
|
785 DisplayHeaderForOutgoingCallL( aCallId ); |
|
786 } |
|
787 |
|
788 // ----------------------------------------------------------- |
|
789 // CPhoneSingleAndWaiting::UpdateInCallCbaL |
|
790 // ----------------------------------------------------------- |
|
791 // |
|
792 void CPhoneSingleAndWaiting::UpdateInCallCbaL() |
|
793 { |
|
794 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
795 "CPhoneSingleAndWaiting::UpdateInCallCbaL() "); |
|
796 TPhoneCmdParamInteger callIdParam; |
|
797 iViewCommandHandle->ExecuteCommandL( |
|
798 EPhoneViewGetExpandedBubbleCallId, &callIdParam ); |
|
799 |
|
800 if ( callIdParam.Integer()==iSingleCallId ) |
|
801 { |
|
802 CPhoneGsmInCall::UpdateInCallCbaL(); |
|
803 } |
|
804 else |
|
805 { |
|
806 iCbaManager->SetCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
807 } |
|
808 } |
|
809 |
|
810 // ----------------------------------------------------------- |
|
811 // CPhoneSingleAndWaiting::HandleErrorL |
|
812 // ----------------------------------------------------------- |
|
813 // |
|
814 EXPORT_C void CPhoneSingleAndWaiting::HandleErrorL( const TPEErrorInfo& aErrorInfo ) |
|
815 { |
|
816 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndWaiting::HandleErrorL()"); |
|
817 |
|
818 if( aErrorInfo.iErrorCode == ECCPErrorCCUserAlertingNoAnswer ) |
|
819 { |
|
820 // Should not shown "Not Allowed" note, if active call. |
|
821 __PHONELOG1( EBasic, EPhoneUIStates, |
|
822 "PhoneUIControl: CPhoneSingleAndWaiting::HandleErrorL - aErrorInfo.iErrorCode =%d ", |
|
823 aErrorInfo.iErrorCode); |
|
824 } |
|
825 else |
|
826 { |
|
827 CPhoneState::HandleErrorL( aErrorInfo ); |
|
828 } |
|
829 } |
|
830 |
|
831 // ----------------------------------------------------------- |
|
832 // CPhoneSingleAndWaiting::HandleDisconnectingL |
|
833 // ----------------------------------------------------------- |
|
834 // |
|
835 void CPhoneSingleAndWaiting::HandleDisconnectingL( TInt aCallId ) |
|
836 { |
|
837 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndWaiting::HandleDisconnectingL( ) "); |
|
838 |
|
839 if( ( iSingleCallId == aCallId ) && IsVideoCall( aCallId ) ) |
|
840 { |
|
841 __PHONELOG( EBasic, EPhoneControl, |
|
842 "CPhoneSingleAndWaiting::HandleDisconnectingL EPhoneViewSetNeedToSendToBackgroundStatus" ); |
|
843 |
|
844 // Keep phone on the foreground |
|
845 TPhoneCmdParamBoolean booleanParam; |
|
846 booleanParam.SetBoolean( EFalse ); |
|
847 iViewCommandHandle->ExecuteCommandL( |
|
848 EPhoneViewSetNeedToSendToBackgroundStatus, |
|
849 &booleanParam ); |
|
850 } |
|
851 } |
|
852 |
|
853 // ----------------------------------------------------------- |
|
854 // CPhoneSingleAndWaiting::UpdateUiControlsL |
|
855 // ----------------------------------------------------------- |
|
856 // |
|
857 void CPhoneSingleAndWaiting::UpdateUiControlsL() |
|
858 { |
|
859 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndWaiting::UpdateUiControlsL( ) "); |
|
860 |
|
861 UpdateInCallCbaL(); |
|
862 } |
|
863 |
|
864 // End of File |
|