|
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 CPhoneSingleCall 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 <cpephonemodelif.h> |
|
27 #include <connect/sbdefs.h> |
|
28 #include <videotelcontrolmediatorapi.h> |
|
29 #include <MediatorDomainUIDs.h> |
|
30 #include <TelephonyVariant.hrh> |
|
31 |
|
32 #include "cphonesinglecall.h" |
|
33 #include "tphonecmdparamstring.h" |
|
34 #include "tphonecmdparamboolean.h" |
|
35 #include "tphonecmdparamcallheaderdata.h" |
|
36 #include "mphonestatemachine.h" |
|
37 #include "tphonecmdparaminteger.h" |
|
38 #include "phoneviewcommanddefinitions.h" |
|
39 #include "phoneui.hrh" |
|
40 #include "cphonemainresourceresolver.h" |
|
41 #include "phonerssbase.h" |
|
42 #include "phonestatedefinitionsgsm.h" |
|
43 #include "tphonecmdparamglobalnote.h" |
|
44 #include "tphonecmdparamcallstatedata.h" |
|
45 #include "phonelogger.h" |
|
46 #include "cphonepubsubproxy.h" |
|
47 #include "cphonemediatorfactory.h" |
|
48 #include "cphonemediatorsender.h" |
|
49 #include "cphoneswitchtovideoorvoicecommand.h" |
|
50 #include "mphonestorage.h" |
|
51 #include "cphonecenrepproxy.h" |
|
52 |
|
53 // ================= MEMBER FUNCTIONS ======================= |
|
54 |
|
55 // C++ default constructor can NOT contain any code, that |
|
56 // might leave. |
|
57 // |
|
58 EXPORT_C CPhoneSingleCall::CPhoneSingleCall( |
|
59 MPhoneStateMachine* aStateMachine, |
|
60 MPhoneViewCommandHandle* aViewCommandHandle, |
|
61 MPhoneCustomization* aPhoneCustomization ) : |
|
62 CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
63 { |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------- |
|
67 // CPhoneSingleCall::~CPhoneSingleCall() |
|
68 // Destructor |
|
69 // (other items were commented in a header). |
|
70 // ----------------------------------------------------------- |
|
71 // |
|
72 EXPORT_C CPhoneSingleCall::~CPhoneSingleCall() |
|
73 { |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------- |
|
77 // CPhoneSingleCall::ConstructL() |
|
78 // Constructor |
|
79 // (other items were commented in a header). |
|
80 // ----------------------------------------------------------- |
|
81 // |
|
82 EXPORT_C void CPhoneSingleCall::ConstructL() |
|
83 { |
|
84 CPhoneGsmInCall::ConstructL(); |
|
85 |
|
86 // Re-enable global notes |
|
87 TPhoneCmdParamBoolean globalNotifierParam; |
|
88 globalNotifierParam.SetBoolean( EFalse ); |
|
89 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled, |
|
90 &globalNotifierParam ); |
|
91 |
|
92 TPhoneCmdParamBoolean holdFlag; |
|
93 holdFlag.SetBoolean( EFalse ); |
|
94 // Fetch active call's id from view |
|
95 TPhoneCmdParamCallStateData callStateData; |
|
96 callStateData.SetCallState( EPEStateConnected ); |
|
97 iViewCommandHandle->HandleCommandL( |
|
98 EPhoneViewGetCallIdByState, &callStateData ); |
|
99 |
|
100 if( callStateData.CallId() == KErrNotFound ) |
|
101 { |
|
102 holdFlag.SetBoolean( ETrue ); |
|
103 // No connected call, find the hold call |
|
104 callStateData.SetCallState( EPEStateHeld ); |
|
105 iViewCommandHandle->HandleCommandL( |
|
106 EPhoneViewGetCallIdByState, &callStateData ); |
|
107 |
|
108 if ( callStateData.CallId() == KErrNotFound ) |
|
109 { |
|
110 // No hold call, find the disconnected call |
|
111 callStateData.SetCallState( EPEStateDisconnecting ); |
|
112 iViewCommandHandle->HandleCommandL( |
|
113 EPhoneViewGetCallIdByState, &callStateData ); |
|
114 } |
|
115 } |
|
116 |
|
117 iCallId = callStateData.CallId(); |
|
118 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
119 |
|
120 |
|
121 // Update phone number availability for menu use |
|
122 PhoneNumberAvailableInPhoneEngineL( callStateData.CallId() ); |
|
123 |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------- |
|
127 // CPhoneSingleCall::NewL() |
|
128 // Constructor |
|
129 // (other items were commented in a header). |
|
130 // ----------------------------------------------------------- |
|
131 // |
|
132 CPhoneSingleCall* CPhoneSingleCall::NewL( |
|
133 MPhoneStateMachine* aStateMachine, |
|
134 MPhoneViewCommandHandle* aViewCommandHandle, |
|
135 MPhoneCustomization* aPhoneCustomization ) |
|
136 { |
|
137 CPhoneSingleCall* self = new( ELeave ) CPhoneSingleCall( |
|
138 aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
139 |
|
140 CleanupStack::PushL( self ); |
|
141 self->ConstructL(); |
|
142 CleanupStack::Pop( self ); |
|
143 |
|
144 return self; |
|
145 } |
|
146 |
|
147 // -------------------------------------------------------------- |
|
148 // CPhoneSingleCall::HandleKeyMessageL |
|
149 // -------------------------------------------------------------- |
|
150 // |
|
151 EXPORT_C void CPhoneSingleCall::HandleKeyMessageL( |
|
152 TPhoneKeyEventMessages aMessage, |
|
153 TKeyCode aCode ) |
|
154 { |
|
155 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::HandleKeyMessageL()"); |
|
156 switch ( aCode ) |
|
157 { |
|
158 // send-key |
|
159 case EKeyYes: |
|
160 if( IsNumberEntryUsedL() ) |
|
161 { |
|
162 if ( IsVideoCallActiveL() ) |
|
163 { |
|
164 HBufC *phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize ); |
|
165 TPtr ptr( phoneNumber->Des() ); |
|
166 TPhoneCmdParamString stringParam; |
|
167 stringParam.SetString( &ptr ); |
|
168 iViewCommandHandle->ExecuteCommand( |
|
169 EPhoneViewGetNumberFromEntry, |
|
170 &stringParam ); |
|
171 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ) ; |
|
172 |
|
173 if ( iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() || |
|
174 phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength ) |
|
175 { |
|
176 // Send a manual control sequence by providing number |
|
177 // information with dial command |
|
178 CallFromNumberEntryL(); |
|
179 } |
|
180 else |
|
181 { |
|
182 iStateMachine->SendPhoneEngineMessage( |
|
183 MPEPhoneModel::EPEMessageCheckEmergencyNumber ); |
|
184 } |
|
185 CleanupStack::PopAndDestroy( phoneNumber ); |
|
186 } |
|
187 else |
|
188 { |
|
189 // Provide number information with dial command |
|
190 CallFromNumberEntryL(); |
|
191 } |
|
192 } |
|
193 else |
|
194 { |
|
195 ToggleHoldL(); |
|
196 } |
|
197 break; |
|
198 |
|
199 default: |
|
200 // do base operation |
|
201 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode ); |
|
202 break; |
|
203 } |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------- |
|
207 // CPhoneSingleCall::HandlePhoneEngineMessageL |
|
208 // ----------------------------------------------------------- |
|
209 // |
|
210 EXPORT_C void CPhoneSingleCall::HandlePhoneEngineMessageL( |
|
211 const TInt aMessage, |
|
212 TInt aCallId ) |
|
213 { |
|
214 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::HandlePhoneEngineMessageL()"); |
|
215 switch ( aMessage ) |
|
216 { |
|
217 case MEngineMonitor::EPEMessageHeld: |
|
218 HandleHeldL( aCallId ); |
|
219 break; |
|
220 |
|
221 case MEngineMonitor::EPEMessageConnected: |
|
222 HandleConnectedL( aCallId ); |
|
223 break; |
|
224 |
|
225 case MEngineMonitor::EPEMessageIncoming: |
|
226 HandleIncomingL( aCallId ); |
|
227 break; |
|
228 |
|
229 case MEngineMonitor::EPEMessageDialing: |
|
230 HandleDiallingL( aCallId ); |
|
231 break; |
|
232 |
|
233 /* Flow through */ |
|
234 case MEngineMonitor::EPEMessageRemoteTerminated: |
|
235 case MEngineMonitor::EPEMessageDisconnecting: |
|
236 iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume ); |
|
237 CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
238 break; |
|
239 |
|
240 case MEngineMonitor::EPEMessageInValidEmergencyNumber: |
|
241 SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed ); |
|
242 break; |
|
243 |
|
244 case MEngineMonitor::EPEMessageValidEmergencyNumber: |
|
245 DialVoiceCallL(); |
|
246 break; |
|
247 |
|
248 default: |
|
249 CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
250 break; |
|
251 } |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------- |
|
255 // CPhoneSingleCall::HandleCommandL |
|
256 // ----------------------------------------------------------- |
|
257 // |
|
258 EXPORT_C TBool CPhoneSingleCall::HandleCommandL( TInt aCommand ) |
|
259 { |
|
260 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::HandleCommandL()"); |
|
261 TBool commandStatus = ETrue; |
|
262 |
|
263 switch( aCommand ) |
|
264 { |
|
265 /* Flow through */ |
|
266 case EPhoneInCallCmdHold: |
|
267 case EPhoneInCallCmdUnhold: |
|
268 ToggleHoldL(); |
|
269 break; |
|
270 |
|
271 case EPhoneInCallCmdNewCall: |
|
272 LaunchNewCallQueryL(); |
|
273 break; |
|
274 |
|
275 case EPhoneInCallCmdNewCallCall: |
|
276 CallFromNewCallQueryL(); |
|
277 break; |
|
278 |
|
279 case EPhoneInCallCmdSwitchToVideo: |
|
280 SwitchToVideoL(); |
|
281 break; |
|
282 |
|
283 case EPhoneInCallCmdSwitchToVoice: |
|
284 SwitchToVoiceL(); |
|
285 break; |
|
286 |
|
287 case EPhoneCmdYesSwitchToVideo: |
|
288 // Set current call id |
|
289 iStateMachine->SetCallId( iCallId ); |
|
290 iStateMachine->SendPhoneEngineMessage( |
|
291 CPEPhoneModelIF::EPEMessageSwitchToVideoOrVoice ); |
|
292 break; |
|
293 |
|
294 /* Flow through */ |
|
295 case EPhoneCmdNoSwitchToVideo: |
|
296 case EPhoneCmdNoSwitchToVoice: |
|
297 // Sets touch buttons to correct status if 'No' command has occured. |
|
298 iViewCommandHandle->ExecuteCommand( EPhoneResetTouchButtons ); |
|
299 break; |
|
300 |
|
301 case EPhoneCmdYesSwitchToVoice: |
|
302 // Set current call id |
|
303 iStateMachine->SetCallId( iCallId ); |
|
304 if( IsVideoCall( iCallId ) ) |
|
305 { |
|
306 // Video call can be released only after we get response to VT Shutdown Command |
|
307 CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain, |
|
308 KCatPhoneToVideotelCommands, |
|
309 EVtCmdReleaseDataport, |
|
310 TVersion( KPhoneToVideotelCmdVersionMajor, |
|
311 KPhoneToVideotelCmdVersionMinor, |
|
312 KPhoneToVideotelCmdVersionBuild ), |
|
313 KNullDesC8, |
|
314 CPhoneSwitchToVideoOrVoiceCommand::NewL( *iStateMachine ) ); |
|
315 } |
|
316 else |
|
317 { |
|
318 iStateMachine->SendPhoneEngineMessage( |
|
319 CPEPhoneModelIF::EPEMessageSwitchToVideoOrVoice ); |
|
320 } |
|
321 break; |
|
322 |
|
323 case EPhoneVideoSharing: |
|
324 case EPhoneVideoSharingOpt2: |
|
325 case EPhoneVideoSharingOpt3: |
|
326 { |
|
327 TPhoneCmdParamInteger command; |
|
328 command.SetInteger( aCommand ); |
|
329 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendAiwCommand, |
|
330 &command ); |
|
331 } |
|
332 break; |
|
333 |
|
334 default: |
|
335 commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand ); |
|
336 break; |
|
337 } |
|
338 |
|
339 return commandStatus; |
|
340 } |
|
341 |
|
342 // ----------------------------------------------------------- |
|
343 // CPhoneSingleCall::OpenMenuBarL |
|
344 // ----------------------------------------------------------- |
|
345 // |
|
346 EXPORT_C void CPhoneSingleCall::OpenMenuBarL() |
|
347 { |
|
348 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::OpenMenuBarL()"); |
|
349 |
|
350 if ( IsVideoCall ( iCallId )) |
|
351 { |
|
352 OpenVideoCallMenuBarL(); |
|
353 } |
|
354 else |
|
355 { |
|
356 CPhoneGsmInCall::OpenMenuBarL(); |
|
357 } |
|
358 } |
|
359 |
|
360 // ----------------------------------------------------------- |
|
361 // CPhoneSingleCall::CallId |
|
362 // ----------------------------------------------------------- |
|
363 // |
|
364 EXPORT_C TInt CPhoneSingleCall::CallId() const |
|
365 { |
|
366 return iCallId; |
|
367 } |
|
368 |
|
369 // ----------------------------------------------------------- |
|
370 // CPhoneSingleCall::OpenVideoCallMenuBarL |
|
371 // ----------------------------------------------------------- |
|
372 // |
|
373 void CPhoneSingleCall::OpenVideoCallMenuBarL() |
|
374 { |
|
375 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::OpenVideoCallMenuBarL()"); |
|
376 if( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) ) |
|
377 { |
|
378 TInt resourceId; |
|
379 |
|
380 if ( IsNumberEntryUsedL() ) |
|
381 { |
|
382 resourceId = EPhoneVideoCallMenubarWithNumberEntry; |
|
383 } |
|
384 else |
|
385 { |
|
386 resourceId = EPhoneVideoCallMenubar; |
|
387 } |
|
388 |
|
389 TPhoneCmdParamInteger integerParam; |
|
390 integerParam.SetInteger( |
|
391 CPhoneMainResourceResolver::Instance()-> |
|
392 ResolveResourceID( resourceId ) ); |
|
393 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, |
|
394 &integerParam ); |
|
395 } |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------- |
|
399 // CPhoneSingleCall::HandleHeldL |
|
400 // ----------------------------------------------------------- |
|
401 // |
|
402 void CPhoneSingleCall::HandleHeldL( TInt aCallId ) |
|
403 { |
|
404 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
405 "CPhoneSingleCall::HandleHeldL()"); |
|
406 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
407 callHeaderParam.SetCallState( EPEStateHeld ); |
|
408 |
|
409 TInt callLabelId; |
|
410 TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC ); |
|
411 callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
412 ResolveResourceID( EPhoneCallOnHold ); |
|
413 |
|
414 StringLoader::Load( |
|
415 labelText, |
|
416 callLabelId, |
|
417 CCoeEnv::Static() ); |
|
418 callHeaderParam.SetLabelText( labelText ); |
|
419 |
|
420 iViewCommandHandle->ExecuteCommandL( |
|
421 EPhoneViewUpdateBubble, aCallId, &callHeaderParam ); |
|
422 |
|
423 // Set Hold flag to view |
|
424 TPhoneCmdParamBoolean holdFlag; |
|
425 holdFlag.SetBoolean( ETrue ); |
|
426 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
427 |
|
428 if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) ) |
|
429 { |
|
430 HandleHoldNoteL( aCallId , ETrue ); |
|
431 } |
|
432 |
|
433 UpdateInCallCbaL(); |
|
434 } |
|
435 |
|
436 // ----------------------------------------------------------- |
|
437 // CPhoneSingleCall::HandleConnectedL |
|
438 // ----------------------------------------------------------- |
|
439 // |
|
440 void CPhoneSingleCall::HandleConnectedL( TInt aCallId ) |
|
441 { |
|
442 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
443 "CPhoneSingleCall::HandleConnectedL()"); |
|
444 |
|
445 // Show bubble |
|
446 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
447 callHeaderParam.SetCallState( EPEStateConnected ); |
|
448 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
449 &callHeaderParam ); |
|
450 |
|
451 // Get initial hold flag from view. |
|
452 TPhoneCmdParamBoolean holdFlag; |
|
453 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetHoldFlag, &holdFlag ); |
|
454 |
|
455 if ( holdFlag.Boolean() ) |
|
456 { |
|
457 // Update hold flag to view |
|
458 holdFlag.SetBoolean( EFalse ); |
|
459 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
460 |
|
461 if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) ) |
|
462 { |
|
463 HandleHoldNoteL( aCallId , EFalse ); |
|
464 } |
|
465 } |
|
466 |
|
467 UpdateInCallCbaL(); |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------- |
|
471 // CPhoneSingleCall::ToggleHold |
|
472 // ----------------------------------------------------------- |
|
473 // |
|
474 void CPhoneSingleCall::ToggleHoldL() |
|
475 { |
|
476 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
477 "CPhoneSingleCall::ToggleHoldL()"); |
|
478 TPhoneCmdParamBoolean hold; |
|
479 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetHoldFlag, &hold ); |
|
480 |
|
481 if( hold.Boolean() ) |
|
482 { |
|
483 SetCallResumeL(); |
|
484 } |
|
485 else |
|
486 { |
|
487 SetCallHoldL(); |
|
488 } |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------- |
|
492 // CPhoneSingleCall::HandleIncomingL |
|
493 // ----------------------------------------------------------- |
|
494 // |
|
495 void CPhoneSingleCall::HandleIncomingL( TInt aCallId ) |
|
496 { |
|
497 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
498 "CPhoneSingleCall::HandleIncomingL()"); |
|
499 |
|
500 BeginUiUpdateLC(); |
|
501 |
|
502 TPhoneCmdParamBoolean dialerParam; |
|
503 dialerParam.SetBoolean( ETrue ); |
|
504 |
|
505 // Get allow waiting call header param value. |
|
506 AllowShowingOfWaitingCallHeaderL( dialerParam ); |
|
507 |
|
508 // Close fast swap window if it's displayed |
|
509 CEikonEnv::Static()->DismissTaskList(); |
|
510 |
|
511 // Show incoming call buttons |
|
512 SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
513 |
|
514 // Display incoming call |
|
515 DisplayIncomingCallL( aCallId, dialerParam ); |
|
516 |
|
517 if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
518 && !CPhoneCenRepProxy::Instance()-> |
|
519 IsTelephonyFeatureSupported( KTelephonyLVFlagAllowUnlockOnIncoming ) |
|
520 && ( IsKeyLockOn() || IsAutoLockOn() ) ) |
|
521 { |
|
522 DisableCallUIL(); |
|
523 } |
|
524 else |
|
525 { |
|
526 // if keys have been locked, disable keylock without information note |
|
527 if ( IsKeyLockOn() ) |
|
528 { |
|
529 iViewCommandHandle->ExecuteCommandL( EPhoneViewDisableKeyLockWithoutNote ); |
|
530 } |
|
531 } |
|
532 |
|
533 if( CPhoneCenRepProxy::Instance()-> |
|
534 IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) |
|
535 && ( IsKeyLockOn() || IsAutoLockOn() ) ) |
|
536 { |
|
537 DisableHWKeysL(); |
|
538 } |
|
539 |
|
540 EndUiUpdate(); |
|
541 |
|
542 // This query is required to dismiss |
|
543 // Operation cannot be completed in waiting and single state |
|
544 if ( iSwitchToVideoQuery ) |
|
545 { |
|
546 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery ); |
|
547 } |
|
548 |
|
549 // Go to incoming state |
|
550 UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
551 iStateMachine->ChangeState( EPhoneStateWaitingInSingle ); |
|
552 } |
|
553 |
|
554 // ----------------------------------------------------------- |
|
555 // CPhoneSingleCall::DisplayIncomingCallL |
|
556 // ----------------------------------------------------------- |
|
557 // |
|
558 void CPhoneSingleCall::DisplayIncomingCallL( |
|
559 TInt aCallId, |
|
560 const TPhoneCmdParamBoolean aCommandParam ) |
|
561 { |
|
562 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
563 "CPhoneSingleCall::DisplayIncomingCallL()"); |
|
564 // Close menu bar, if it is displayed |
|
565 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
566 |
|
567 // Cannot delete active note, e.g. New call query, |
|
568 // but show waiting note with or without caller name |
|
569 if ( IsAnyQueryActiveL() || |
|
570 ( !aCommandParam.Boolean() && iOnScreenDialer ) ) |
|
571 { |
|
572 CallWaitingNoteL( aCallId ); |
|
573 } |
|
574 else |
|
575 { |
|
576 // Remove any phone dialogs if they are displayed |
|
577 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs ); |
|
578 } |
|
579 |
|
580 // Indicate that the Phone needs to be sent to the background if |
|
581 // an application other than the top application is in the foreground |
|
582 TPhoneCmdParamBoolean booleanParam; |
|
583 booleanParam.SetBoolean( !TopAppIsDisplayedL() ); |
|
584 iViewCommandHandle->ExecuteCommandL( |
|
585 EPhoneViewSetNeedToSendToBackgroundStatus, |
|
586 &booleanParam ); |
|
587 |
|
588 // Bring Phone app in the foreground |
|
589 TPhoneCmdParamInteger uidParam; |
|
590 uidParam.SetInteger( KUidPhoneApplication.iUid ); |
|
591 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, |
|
592 &uidParam ); |
|
593 |
|
594 // Set Phone as the top application |
|
595 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication, |
|
596 &uidParam ); |
|
597 |
|
598 DisplayHeaderForCallComingInL( aCallId, ETrue ); //waiting call |
|
599 } |
|
600 |
|
601 // --------------------------------------------------------- |
|
602 // CPhoneSingleCall::CallFromNewCallQueryL |
|
603 // --------------------------------------------------------- |
|
604 // |
|
605 void CPhoneSingleCall::CallFromNewCallQueryL() |
|
606 { |
|
607 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
608 "CPhoneSingleCall::CallFromNewCallQueryL()"); |
|
609 // First get the phone number from the dialog |
|
610 TPhoneCmdParamString phoneNumberParam; |
|
611 HBufC *content = HBufC::NewLC( KPhoneNumberEntryBufferSize ); |
|
612 TPtr ptr( content->Des() ); |
|
613 phoneNumberParam.SetString( &ptr ); |
|
614 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetTextQueryContent, |
|
615 &phoneNumberParam ); |
|
616 |
|
617 // Store the phone number |
|
618 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ); |
|
619 |
|
620 // clean up stack |
|
621 CleanupStack::PopAndDestroy( content ); |
|
622 |
|
623 DialVoiceCallL(); |
|
624 } |
|
625 |
|
626 // ----------------------------------------------------------- |
|
627 // CPhoneSingleCall::HandleDiallingL |
|
628 // ----------------------------------------------------------- |
|
629 // |
|
630 void CPhoneSingleCall::HandleDiallingL( TInt aCallId ) |
|
631 { |
|
632 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
633 "CPhoneSingleCall::HandleDiallingL()"); |
|
634 |
|
635 BeginTransEffectLC( ENumberEntryClose ); |
|
636 BeginUiUpdateLC(); |
|
637 |
|
638 SetNumberEntryVisibilityL(EFalse); |
|
639 |
|
640 // Show incoming call buttons |
|
641 SetTouchPaneButtons( EPhoneCallSetupAndSingleButtons ); |
|
642 |
|
643 // Display call setup |
|
644 DisplayCallSetupL( aCallId ); |
|
645 |
|
646 EndUiUpdate(); |
|
647 |
|
648 EndTransEffect(); |
|
649 |
|
650 // Go to call setup state |
|
651 UpdateCbaL( EPhoneCallHandlingCallSetupCBA ); |
|
652 iStateMachine->ChangeState( EPhoneStateCallSetupInSingle ); |
|
653 } |
|
654 |
|
655 // ----------------------------------------------------------- |
|
656 // CPhoneSingleCall::DisplayCallSetupL |
|
657 // ----------------------------------------------------------- |
|
658 // |
|
659 void CPhoneSingleCall::DisplayCallSetupL( TInt aCallId ) |
|
660 { |
|
661 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
662 "CPhoneSingleCall::DisplayCallSetupL()"); |
|
663 // Close menu bar, if it is displayed |
|
664 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
665 |
|
666 // Remove dialogs if necessary |
|
667 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs ); |
|
668 |
|
669 // Capture keys when the phone is dialling |
|
670 CaptureKeysDuringCallNotificationL( ETrue ); |
|
671 |
|
672 // Force telephony to the foreground |
|
673 TPhoneCmdParamInteger uidParam; |
|
674 uidParam.SetInteger( KUidPhoneApplication.iUid ); |
|
675 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, |
|
676 &uidParam ); |
|
677 |
|
678 // Display call setup header |
|
679 DisplayHeaderForOutgoingCallL( aCallId ); |
|
680 } |
|
681 |
|
682 // ----------------------------------------------------------- |
|
683 // CPhoneSingleCall::SetCallHoldL |
|
684 // ----------------------------------------------------------- |
|
685 // |
|
686 void CPhoneSingleCall::SetCallHoldL() |
|
687 { |
|
688 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
689 "CPhoneSingleCall::SetCallHold()"); |
|
690 |
|
691 TPhoneCmdParamCallStateData callStateData; |
|
692 callStateData.SetCallId( iCallId ); |
|
693 iViewCommandHandle->HandleCommandL( EPhoneViewGetCallState, |
|
694 &callStateData ); |
|
695 |
|
696 if( callStateData.CallState() == EPEStateConnected && !IsVideoCallActiveL() ) |
|
697 { |
|
698 iStateMachine->SetCallId( iCallId ); |
|
699 iStateMachine->SendPhoneEngineMessage( |
|
700 CPEPhoneModelIF::EPEMessageHold ); |
|
701 } |
|
702 else |
|
703 { |
|
704 // Show not allowed note |
|
705 SendGlobalInfoNoteL( EPhoneNoteTextNotAllowed ); |
|
706 } |
|
707 } |
|
708 |
|
709 // ----------------------------------------------------------- |
|
710 // CPhoneSingleCall::SetCallResumeL |
|
711 // ----------------------------------------------------------- |
|
712 // |
|
713 void CPhoneSingleCall::SetCallResumeL() |
|
714 { |
|
715 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
716 "CPhoneSingleCall::SetCallHold()"); |
|
717 |
|
718 TPhoneCmdParamCallStateData callStateData; |
|
719 callStateData.SetCallId( iCallId ); |
|
720 iViewCommandHandle->HandleCommandL( EPhoneViewGetCallState, |
|
721 &callStateData ); |
|
722 |
|
723 if( callStateData.CallState() == EPEStateHeld ) |
|
724 { |
|
725 iStateMachine->SetCallId( iCallId ); |
|
726 iStateMachine->SendPhoneEngineMessage( |
|
727 CPEPhoneModelIF::EPEMessageResume ); |
|
728 } |
|
729 else |
|
730 { |
|
731 // Show not allowed note |
|
732 SendGlobalInfoNoteL( EPhoneNoteTextNotAllowed ); |
|
733 } |
|
734 } |
|
735 |
|
736 // ----------------------------------------------------------- |
|
737 // CPhoneSingleCall::SwitchToVideoL |
|
738 // ----------------------------------------------------------- |
|
739 // |
|
740 void CPhoneSingleCall::SwitchToVideoL() |
|
741 { |
|
742 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
743 "CPhoneSingleCall::SwitchToVideoL()"); |
|
744 |
|
745 if( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) ) |
|
746 { |
|
747 TInt networkMode( CPhonePubSubProxy::Instance()->Value( KPSUidNetworkInfo, |
|
748 KNWTelephonyNetworkMode ) ); |
|
749 TBool restoreOngoing( CPhonePubSubProxy::Instance()->Value( KUidSystemCategory, |
|
750 conn::KUidBackupRestoreKey )); |
|
751 |
|
752 TBool resetTouchButtons = EFalse; |
|
753 |
|
754 if ( networkMode != ENWNetworkModeWcdma ) |
|
755 { |
|
756 // We aren't in 3G, video call not possible |
|
757 SendGlobalInfoNoteL( EPhoneInformationNoNetworkSupportForVideoCallNote ); |
|
758 resetTouchButtons = ETrue; |
|
759 } |
|
760 else if ( restoreOngoing & ( conn::EBURRestoreFull | conn::EBURRestorePartial )) |
|
761 { |
|
762 // MC restore ongoing |
|
763 SendGlobalInfoNoteL( EPhoneInformationVideoCallNotAllowedDuringRestoreNote ); |
|
764 resetTouchButtons = ETrue; |
|
765 } |
|
766 else |
|
767 { |
|
768 iSwitchToVideoQuery = ETrue; |
|
769 ShowQueryL( EPhoneSwitchToVideoQuery ); |
|
770 iSwitchToVideoQuery = EFalse; |
|
771 } |
|
772 |
|
773 if( resetTouchButtons ) |
|
774 { |
|
775 // Sets touch buttons to correct status if error has occured. |
|
776 iViewCommandHandle->ExecuteCommand( EPhoneResetTouchButtons ); |
|
777 } |
|
778 } |
|
779 } |
|
780 |
|
781 // ----------------------------------------------------------- |
|
782 // CPhoneSingleCall::SwitchToVoiceL |
|
783 // ----------------------------------------------------------- |
|
784 // |
|
785 void CPhoneSingleCall::SwitchToVoiceL() |
|
786 { |
|
787 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
788 "CPhoneSingleCall::SwitchToVoiceL()"); |
|
789 |
|
790 ShowQueryL( EPhoneSwitchToVoiceQuery ); |
|
791 } |
|
792 |
|
793 // End of File |