|
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 CPhoneStateIncoming class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <cntdef.h> |
|
21 #include <e32base.h> |
|
22 #include <eikenv.h> |
|
23 #include <featmgr.h> |
|
24 #include <StringLoader.h> |
|
25 #include <dundomainpskeys.h> |
|
26 #include <telephonyvariant.hrh> |
|
27 #include <mpeengineinfo.h> |
|
28 #include <MediatorDomainUIDs.h> |
|
29 #include <videotelcontrolmediatorapi.h> |
|
30 |
|
31 #include "cphonepubsubproxy.h" |
|
32 #include "phoneui.pan" |
|
33 #include "cphonestateincoming.h" |
|
34 #include "tphonecmdparamboolean.h" |
|
35 #include "tphonecmdparamcallheaderdata.h" |
|
36 #include "tphonecmdparaminteger.h" |
|
37 #include "tphonecmdparamcallstatedata.h" |
|
38 #include "tphonecmdparamringtone.h" |
|
39 #include "tphonecmdparamsfidata.h" |
|
40 #include "tphonecmdparamstring.h" |
|
41 #include "tphonecmdparamglobalnote.h" |
|
42 #include "tphonecmdparamdynmenu.h" |
|
43 #include "mphonestatemachine.h" |
|
44 #include "phonestatedefinitions.h" |
|
45 #include "phoneui.hrh" |
|
46 #include "phonerssbase.h" |
|
47 #include "cphonemainresourceresolver.h" |
|
48 #include "phonelogger.h" |
|
49 #include "cphonecenrepproxy.h" |
|
50 #include "cphonepubsubproxy.h" |
|
51 #include "tphonecmdparamquery.h" |
|
52 #include "cphonemediatorfactory.h" |
|
53 #include "cphonemediatorsender.h" |
|
54 #include "cphonereleasecommand.h" |
|
55 #include "mphonecustomization.h" |
|
56 #include "mphonestorage.h" |
|
57 |
|
58 // ================= MEMBER FUNCTIONS ======================= |
|
59 |
|
60 // C++ default constructor can NOT contain any code, that |
|
61 // might leave. |
|
62 // |
|
63 EXPORT_C CPhoneStateIncoming::CPhoneStateIncoming( |
|
64 MPhoneStateMachine* aStateMachine, |
|
65 MPhoneViewCommandHandle* aViewCommandHandle, |
|
66 MPhoneCustomization* aPhoneCustomization ) : |
|
67 CPhoneState( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
68 { |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------- |
|
72 // CPhoneStateIncoming::~CPhoneStateIncoming() |
|
73 // Destructor |
|
74 // (other items were commented in a header). |
|
75 // ----------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C CPhoneStateIncoming::~CPhoneStateIncoming() |
|
78 { |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------- |
|
82 // CPhoneStateIncoming::ConstructL() |
|
83 // Constructor |
|
84 // (other items were commented in a header). |
|
85 // ----------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C void CPhoneStateIncoming::ConstructL() |
|
88 { |
|
89 CPhoneState::BaseConstructL(); |
|
90 |
|
91 // Fetch incoming call's id from view |
|
92 TPhoneCmdParamCallStateData callStateData; |
|
93 callStateData.SetCallState( EPEStateRinging ); |
|
94 iViewCommandHandle->HandleCommandL( |
|
95 EPhoneViewGetCallIdByState, &callStateData ); |
|
96 |
|
97 // Do nothing if negative incoming call id |
|
98 if( callStateData.CallId() > KErrNotFound ) |
|
99 { |
|
100 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery ); |
|
101 |
|
102 iRingingCallId = callStateData.CallId(); |
|
103 } |
|
104 else |
|
105 { |
|
106 __PHONELOG( EOnlyFatal, EPhoneControl, |
|
107 "CPhoneStateIncoming::ConstructL - incoming call already in disconnecting state!"); |
|
108 } |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------- |
|
112 // CPhoneStateIncoming::NewL() |
|
113 // Constructor |
|
114 // (other items were commented in a header). |
|
115 // ----------------------------------------------------------- |
|
116 // |
|
117 CPhoneStateIncoming* CPhoneStateIncoming::NewL( |
|
118 MPhoneStateMachine* aStateMachine, |
|
119 MPhoneViewCommandHandle* aViewCommandHandle, |
|
120 MPhoneCustomization* aPhoneCustomization ) |
|
121 { |
|
122 CPhoneStateIncoming* self = new (ELeave) CPhoneStateIncoming( |
|
123 aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
124 |
|
125 CleanupStack::PushL( self ); |
|
126 self->ConstructL(); |
|
127 CleanupStack::Pop( self ); |
|
128 |
|
129 return self; |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------- |
|
133 // CPhoneStateIncoming::HandleKeyEventL |
|
134 // ----------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C void CPhoneStateIncoming::HandleKeyEventL( |
|
137 const TKeyEvent& aKeyEvent, |
|
138 TEventCode aEventCode ) |
|
139 { |
|
140 __LOGMETHODSTARTEND(EPhoneControl, |
|
141 "CPhoneStateIncoming::HandleKeyEventL ()" ); |
|
142 // Handle numeric keys when key events are received in incoming state |
|
143 CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode ); |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------- |
|
147 // CPhoneStateIncoming::HandleNumberEntryClearedL() |
|
148 // ----------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C void CPhoneStateIncoming::HandleNumberEntryClearedL() |
|
151 { |
|
152 __LOGMETHODSTARTEND(EPhoneControl, |
|
153 "CPhoneStateIncoming::HandleNumberEntryClearedL ()" ); |
|
154 // Set incoming call CBA when number entry is cleared |
|
155 iCbaManager->UpdateIncomingCbaL( iRingingCallId ); |
|
156 UpdateSilenceButtonDimming(); |
|
157 } |
|
158 |
|
159 // ----------------------------------------------------------- |
|
160 // CPhoneStateIncoming::HandleKeyMessageL |
|
161 // ----------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C void CPhoneStateIncoming::HandleKeyMessageL( |
|
164 TPhoneKeyEventMessages aMessage, |
|
165 TKeyCode aCode ) |
|
166 { |
|
167 __LOGMETHODSTARTEND( EPhoneControl, |
|
168 "CPhoneStateIncoming::HandleKeyMessageL ()" ); |
|
169 __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), |
|
170 Panic( EPhoneCtrlInvariant ) ); |
|
171 |
|
172 switch ( aCode ) |
|
173 { |
|
174 // end-key |
|
175 case EKeyNo: |
|
176 { |
|
177 // handle long press |
|
178 if ( aMessage == EPhoneKeyLongPress ) |
|
179 { |
|
180 // Close all connections |
|
181 iStateMachine->SendPhoneEngineMessage( |
|
182 MPEPhoneModel::EPEMessageTerminateAllConnections ); |
|
183 iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW ); |
|
184 |
|
185 if ( CPhoneState::IsNumberEntryUsedL() ) |
|
186 { |
|
187 // Remove number entry from screen |
|
188 iViewCommandHandle->ExecuteCommandL( |
|
189 EPhoneViewRemoveNumberEntry ); |
|
190 // Do state-specific operation when number entry is cleared |
|
191 HandleNumberEntryClearedL(); |
|
192 } |
|
193 } |
|
194 else |
|
195 { |
|
196 // handle end key |
|
197 DisconnectWaitingCallL(); |
|
198 } |
|
199 } |
|
200 break; |
|
201 |
|
202 // send-key |
|
203 case EKeyYes: |
|
204 if( CPhoneState::IsNumberEntryVisibleL() ) |
|
205 { |
|
206 HandleSendL(); |
|
207 } |
|
208 else |
|
209 { |
|
210 // Answer the call |
|
211 AnswerCallL(); |
|
212 } |
|
213 break; |
|
214 |
|
215 // OK key |
|
216 case EKeyDevice3: |
|
217 if ( aMessage == EPhoneKeyLongPress ) |
|
218 { |
|
219 // Answer the call if long press of selection key |
|
220 AnswerCallL(); |
|
221 } |
|
222 else if ( CPhoneCenRepProxy::Instance()->IsTelephonyFeatureSupported( |
|
223 KTelephonyLVFlagCoverHideSendEndKey )) |
|
224 { |
|
225 // Open number entry OK menubar |
|
226 OpenMenuBarL(); |
|
227 } |
|
228 break; |
|
229 |
|
230 case EKeyDeviceF: |
|
231 { |
|
232 __PHONELOG( EBasic, EPhoneUIStates, |
|
233 "CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL-deviceF" ); |
|
234 HandleHoldSwitchL(); |
|
235 } |
|
236 break; |
|
237 |
|
238 default: |
|
239 break; |
|
240 } |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------- |
|
244 // CPhoneStateIncoming::HandleSendL |
|
245 // ----------------------------------------------------------- |
|
246 // |
|
247 void CPhoneStateIncoming::HandleSendL() |
|
248 { |
|
249 // Get the number entry contents |
|
250 HBufC* phoneNumber = PhoneNumberFromEntryLC(); |
|
251 TPtr ptr( phoneNumber->Des() ); |
|
252 |
|
253 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ); |
|
254 iStateMachine->SendPhoneEngineMessage( |
|
255 MPEPhoneModel::EPEMessagePhoneNumberEdited ); |
|
256 |
|
257 if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength |
|
258 && iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() ) |
|
259 { |
|
260 // Send a manual control sequence by providing number |
|
261 // information with dial command |
|
262 CPhoneState::CallFromNumberEntryL(); |
|
263 } |
|
264 else |
|
265 { |
|
266 iStateMachine->SendPhoneEngineMessage( |
|
267 MPEPhoneModel::EPEMessageCheckEmergencyNumber ); |
|
268 } |
|
269 CleanupStack::PopAndDestroy( phoneNumber ); |
|
270 } |
|
271 |
|
272 // ----------------------------------------------------------- |
|
273 // CPhoneStateIncoming::HandleKeyPressDurationL |
|
274 // ----------------------------------------------------------- |
|
275 // |
|
276 EXPORT_C void CPhoneStateIncoming::HandleKeyPressDurationL( |
|
277 TKeyCode /*aCode*/, |
|
278 TTimeIntervalMicroSeconds /*aKeyPressDuration*/ ) |
|
279 { |
|
280 __LOGMETHODSTARTEND(EPhoneControl, |
|
281 "CPhoneStateIncoming::HandleKeyPressDurationL ()" ); |
|
282 |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------- |
|
286 // CPhoneStateIncoming::HandlePhoneEngineMessageL |
|
287 // ----------------------------------------------------------- |
|
288 // |
|
289 EXPORT_C void CPhoneStateIncoming::HandlePhoneEngineMessageL( |
|
290 const TInt aMessage, |
|
291 TInt aCallId ) |
|
292 { |
|
293 __LOGMETHODSTARTEND(EPhoneControl, |
|
294 "CPhoneStateIncoming::HandlePhoneEngineMessageL ()" ); |
|
295 switch ( aMessage ) |
|
296 { |
|
297 case MEngineMonitor::EPEMessageIdle: |
|
298 HandleIdleL( aCallId ); |
|
299 break; |
|
300 |
|
301 case MEngineMonitor::EPEMessageConnected: |
|
302 HandleConnectedL( aCallId ); |
|
303 break; |
|
304 |
|
305 case MEngineMonitor::EPEMessageInValidEmergencyNumber: |
|
306 // Answer the call |
|
307 AnswerCallL(); |
|
308 break; |
|
309 |
|
310 case MEngineMonitor::EPEMessageValidEmergencyNumber: |
|
311 DialVoiceCallL(); |
|
312 break; |
|
313 |
|
314 case MEngineMonitor::EPEMessageAnswering: |
|
315 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
316 break; |
|
317 |
|
318 case MEngineMonitor::EPEMessageAudioOutputChanged: |
|
319 HandleAudioOutputChangedL(); |
|
320 break; |
|
321 |
|
322 case MEngineMonitor::EPEMessageMuteRingingTone: |
|
323 // Silence the ringer. And stop vibrating, if it is active. |
|
324 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
325 HandleAudioPlayStoppedL(); |
|
326 iStateMachine->SendPhoneEngineMessage( |
|
327 MPEPhoneModel::EPEMessageStopTonePlay ); |
|
328 break; |
|
329 |
|
330 case MEngineMonitor::EPEMessageAvailableAudioOutputsChanged: |
|
331 HandleAudioAvailableOutputChangedL(); |
|
332 // Need to avoid CBA update |
|
333 break; |
|
334 |
|
335 case MEngineMonitor::EPEMessageRemotePartyInfoChanged: |
|
336 // Update remote info data |
|
337 UpdateRemoteInfoDataAndLabelL( aCallId, UpdateCallHeaderInfoL( aCallId ) ); |
|
338 break; |
|
339 |
|
340 default: |
|
341 CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
342 break; |
|
343 } |
|
344 } |
|
345 |
|
346 // ----------------------------------------------------------- |
|
347 // CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL |
|
348 // ----------------------------------------------------------- |
|
349 // |
|
350 void CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL( |
|
351 TInt aCallId, |
|
352 TPhoneCmdParamCallHeaderData aCallHeaderParam ) |
|
353 { |
|
354 __LOGMETHODSTARTEND(EPhoneControl, |
|
355 "CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL ()" ); |
|
356 // Update the remote info data in the call header |
|
357 iViewCommandHandle->ExecuteCommandL( |
|
358 EPhoneViewUpdateCallHeaderRemoteInfoDataAndLabel, |
|
359 aCallId, |
|
360 &aCallHeaderParam ); |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------- |
|
364 // CPhoneStateIncoming::HandleConnectedL |
|
365 // ----------------------------------------------------------- |
|
366 // |
|
367 void CPhoneStateIncoming::HandleConnectedL( TInt aCallId ) |
|
368 { |
|
369 __LOGMETHODSTARTEND(EPhoneControl, |
|
370 "CPhoneStateIncoming::HandleConnectedL ()" ); |
|
371 |
|
372 // Re-enable global notes |
|
373 TPhoneCmdParamBoolean globalNotifierParam; |
|
374 globalNotifierParam.SetBoolean( EFalse ); |
|
375 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled, |
|
376 &globalNotifierParam ); |
|
377 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled, |
|
378 &globalNotifierParam ); |
|
379 // Stop tone playing, if necessary |
|
380 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
381 |
|
382 if( IsVideoCall( aCallId ) && !IsAutoLockOn() ) |
|
383 { |
|
384 // For keeping video call on top |
|
385 TPhoneCmdParamBoolean booleanParam; |
|
386 booleanParam.SetBoolean( EFalse ); |
|
387 iViewCommandHandle->ExecuteCommandL( |
|
388 EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam ); |
|
389 } |
|
390 |
|
391 BeginTransEffectLC( ENumberEntryOpen ); |
|
392 |
|
393 if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
394 && iStateMachine->PhoneStorage()->IsScreenLocked() ) |
|
395 { |
|
396 EnableCallUIL(); |
|
397 } |
|
398 |
|
399 // Reset blocked keys list |
|
400 iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
401 |
|
402 BeginUiUpdateLC(); |
|
403 |
|
404 // Update single call |
|
405 UpdateSingleActiveCallL( aCallId ); |
|
406 |
|
407 SetTouchPaneButtons( EPhoneIncallButtons ); |
|
408 SetToolbarDimming( EFalse ); |
|
409 SetBackButtonActive(ETrue); |
|
410 |
|
411 EndUiUpdate(); |
|
412 EndTransEffect(); |
|
413 |
|
414 // Go to single state |
|
415 iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
416 |
|
417 iStateMachine->ChangeState( EPhoneStateSingle ); |
|
418 } |
|
419 |
|
420 // ----------------------------------------------------------- |
|
421 // CPhoneStateIncoming::HandleAudioPlayStoppedL |
|
422 // ----------------------------------------------------------- |
|
423 // |
|
424 EXPORT_C void CPhoneStateIncoming::HandleAudioPlayStoppedL() |
|
425 { |
|
426 __LOGMETHODSTARTEND(EPhoneControl, |
|
427 "CPhoneStateIncoming::HandleAudioPlayStoppedL ()" ); |
|
428 // Update the CBA |
|
429 |
|
430 // Set the ringtone silenced status |
|
431 iCbaManager->SetRingtoneSilencedStatus( ETrue ); |
|
432 TInt resourceId = EPhoneCallHandlingIncomingRejectCBA; |
|
433 // Get the soft reject flag status |
|
434 TPhoneCmdParamBoolean softRejectParam; |
|
435 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSoftRejectFlag, |
|
436 &softRejectParam ); |
|
437 |
|
438 if ( IsNumberEntryVisibleL() && !iOnScreenDialer ) |
|
439 { |
|
440 resourceId = EPhoneNumberAcqCBA; |
|
441 } |
|
442 else if ( softRejectParam.Boolean() ) |
|
443 { |
|
444 resourceId = EPhoneCallHandlingIncomingSoftRejectCBA; |
|
445 } |
|
446 iCbaManager->SetCbaL( resourceId ); |
|
447 } |
|
448 |
|
449 // ----------------------------------------------------------- |
|
450 // CPhoneStateIncoming::HandleIdleL |
|
451 // ----------------------------------------------------------- |
|
452 // |
|
453 void CPhoneStateIncoming::HandleIdleL( TInt aCallId ) |
|
454 { |
|
455 __LOGMETHODSTARTEND(EPhoneControl, |
|
456 "CPhoneStateIncoming::HandleIdleL ()" ); |
|
457 |
|
458 BeginTransEffectLC( ENumberEntryOpen ); |
|
459 BeginUiUpdateLC(); |
|
460 |
|
461 // Enable call UI |
|
462 if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
463 && iStateMachine->PhoneStorage()->IsScreenLocked() ) |
|
464 { |
|
465 EnableCallUIL(); |
|
466 } |
|
467 |
|
468 // Reset blocked keys list |
|
469 iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
470 |
|
471 // Remove call |
|
472 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
473 // Close menu bar, if it is displayed |
|
474 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
475 // Stop tone playing, if necessary |
|
476 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
477 |
|
478 TPhoneCmdParamBoolean globalNotifierParam; |
|
479 globalNotifierParam.SetBoolean( EFalse ); |
|
480 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled, |
|
481 &globalNotifierParam ); |
|
482 |
|
483 SetDefaultFlagsL(); |
|
484 |
|
485 if ( IsNumberEntryUsedL() ) |
|
486 { |
|
487 if ( NeedToSendToBackgroundL() ) |
|
488 { |
|
489 // Return phone to the background if send to background is needed. |
|
490 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
491 |
|
492 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility ); |
|
493 |
|
494 // Set Number Entry CBA |
|
495 iCbaManager->SetCbaL( EPhoneNumberAcqCBA ); |
|
496 } |
|
497 else |
|
498 { |
|
499 // Show the number entry if it exists. |
|
500 SetNumberEntryVisibilityL(ETrue); |
|
501 } |
|
502 } |
|
503 else if ( NeedToSendToBackgroundL() || |
|
504 SoftRejectMessageEditorIsDisplayedL() ) |
|
505 { |
|
506 // Continue displaying current app but set up the |
|
507 // idle screen in the background |
|
508 SetupIdleScreenInBackgroundL(); |
|
509 } |
|
510 else |
|
511 { |
|
512 // Display idle screen |
|
513 DisplayIdleScreenL(); |
|
514 } |
|
515 |
|
516 DeleteTouchPaneButtons(); |
|
517 SetBackButtonActive(ETrue); |
|
518 |
|
519 EndUiUpdate(); |
|
520 EndTransEffect(); |
|
521 // Go to idle state |
|
522 iCbaManager->UpdateCbaL( EPhoneEmptyCBA ); |
|
523 iStateMachine->ChangeState( EPhoneStateIdle ); |
|
524 } |
|
525 |
|
526 // ----------------------------------------------------------- |
|
527 // CPhoneStateIncoming::HandleCommandL |
|
528 // ----------------------------------------------------------- |
|
529 // |
|
530 EXPORT_C TBool CPhoneStateIncoming::HandleCommandL( TInt aCommand ) |
|
531 { |
|
532 __LOGMETHODSTARTEND(EPhoneControl, |
|
533 "CPhoneStateIncoming::HandleCommandL ()" ); |
|
534 TBool commandStatus = ETrue; |
|
535 |
|
536 switch( aCommand ) |
|
537 { |
|
538 case EPhoneCmdOptions: |
|
539 // Stop tone playing, if necessary. |
|
540 // And stop vibrating, if it is active. |
|
541 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
542 // Open the menu bar |
|
543 OpenMenuBarL(); |
|
544 break; |
|
545 |
|
546 case EPhoneCallComingCmdAnswer: |
|
547 AnswerCallL(); |
|
548 break; |
|
549 |
|
550 case EPhoneCallComingCmdAnswerHandPortableVideo: |
|
551 case EPhoneCallComingCmdAnswerHandPortable: |
|
552 iStateMachine->PhoneEngineInfo()->SetAudioOutputCommand( |
|
553 EPEHandset, ETrue ); |
|
554 iStateMachine->SendPhoneEngineMessage( |
|
555 MPEPhoneModel::EPEMessageSetAudioOutput ); |
|
556 AnswerCallL(); |
|
557 break; |
|
558 |
|
559 case EPhoneCallComingCmdReject: |
|
560 DisconnectWaitingCallL(); |
|
561 break; |
|
562 |
|
563 case EPhoneCallComingCmdSilent: |
|
564 // Silence the ringer. And stop vibrating, if it is active. |
|
565 iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingTone ); |
|
566 // Dim silence button |
|
567 SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent ); |
|
568 HandleAudioPlayStoppedL(); |
|
569 iStateMachine->SendPhoneEngineMessage( |
|
570 MPEPhoneModel::EPEMessageStopTonePlay ); |
|
571 break; |
|
572 |
|
573 case EPhoneCallComingCmdSoftReject: |
|
574 // Open Soft reject message editor |
|
575 OpenSoftRejectMessageL(); |
|
576 break; |
|
577 |
|
578 case EPhoneNumberAcqCmdSendCommand: |
|
579 HandleSendL(); |
|
580 break; |
|
581 |
|
582 case EPhoneInCallCmdHelp: |
|
583 { |
|
584 TPtrC contextName; |
|
585 if( IsVideoCall( iRingingCallId ) ) |
|
586 { |
|
587 contextName.Set( KINCAL_HLP_VIDEOCALL() ); |
|
588 } |
|
589 else |
|
590 { |
|
591 contextName.Set( KINCAL_HLP_CALL_HANDLING() ); |
|
592 } |
|
593 iViewCommandHandle->ExecuteCommandL( |
|
594 EPhoneViewLaunchHelpApplication, 0, contextName ); |
|
595 } |
|
596 break; |
|
597 |
|
598 default: |
|
599 commandStatus = CPhoneState::HandleCommandL( aCommand ); |
|
600 break; |
|
601 } |
|
602 |
|
603 return commandStatus; |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------- |
|
607 // CPhoneStateIncoming::AnswerCallL |
|
608 // ----------------------------------------------------------- |
|
609 // |
|
610 void CPhoneStateIncoming::AnswerCallL() |
|
611 { |
|
612 __LOGMETHODSTARTEND(EPhoneControl, |
|
613 "CPhoneStateIncoming::AnswerCallL ()" ); |
|
614 // Mute the ring tone |
|
615 iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingToneOnAnswer ); |
|
616 iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW ); |
|
617 // Answer the call |
|
618 iStateMachine->SendPhoneEngineMessage( |
|
619 MPEPhoneModel::EPEMessageAnswer ); |
|
620 } |
|
621 |
|
622 // ----------------------------------------------------------- |
|
623 // CPhoneStateIncoming::DisconnectWaitingCallL |
|
624 // ----------------------------------------------------------- |
|
625 // |
|
626 void CPhoneStateIncoming::DisconnectWaitingCallL() |
|
627 { |
|
628 __LOGMETHODSTARTEND(EPhoneControl, |
|
629 "CPhoneStateIncoming::DisconnectWaitingCallL ()" ); |
|
630 |
|
631 // Stop tone playing, if necessary |
|
632 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
633 iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW ); |
|
634 |
|
635 // The ringing call might have changed |
|
636 TPhoneCmdParamCallStateData callStateData; |
|
637 callStateData.SetCallState( EPEStateRinging ); |
|
638 iViewCommandHandle->HandleCommandL( |
|
639 EPhoneViewGetCallIdByState, &callStateData ); |
|
640 |
|
641 if ( callStateData.CallId() > KErrNotFound ) |
|
642 { |
|
643 iRingingCallId = callStateData.CallId(); |
|
644 } |
|
645 |
|
646 iStateMachine->SetCallId( iRingingCallId ); |
|
647 |
|
648 if( IsVideoCall( iRingingCallId ) ) |
|
649 { |
|
650 // Video call can be released only after we get response to VT Shutdown Command |
|
651 CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain, |
|
652 KCatPhoneToVideotelCommands, |
|
653 EVtCmdReleaseDataport, |
|
654 TVersion( KPhoneToVideotelCmdVersionMajor, |
|
655 KPhoneToVideotelCmdVersionMinor, |
|
656 KPhoneToVideotelCmdVersionBuild ), |
|
657 KNullDesC8, |
|
658 CPhoneReleaseCommand::NewL( *iStateMachine ) ); |
|
659 } |
|
660 else |
|
661 { |
|
662 // Release the call |
|
663 iStateMachine->SendPhoneEngineMessage( |
|
664 MPEPhoneModel::EPEMessageRelease ); |
|
665 } |
|
666 |
|
667 ShowDisconnectingL( iRingingCallId ); |
|
668 } |
|
669 |
|
670 // ----------------------------------------------------------- |
|
671 // CPhoneStateIncoming::OpenSoftRejectMessageEditorL |
|
672 // ----------------------------------------------------------- |
|
673 // |
|
674 void CPhoneStateIncoming::OpenSoftRejectMessageL() |
|
675 { |
|
676 __LOGMETHODSTARTEND(EPhoneControl, |
|
677 "CPhoneStateIncoming::OpenSoftRejectMessageEditorL ()" ); |
|
678 // Clear the soft reject flag |
|
679 TPhoneCmdParamBoolean softRejectParam; |
|
680 softRejectParam.SetBoolean( EFalse ); |
|
681 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSoftRejectFlag, |
|
682 &softRejectParam ); |
|
683 |
|
684 // Dim silence button |
|
685 SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent ); |
|
686 |
|
687 // Silence the vibrating |
|
688 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
689 iStateMachine->SendPhoneEngineMessage( |
|
690 MPEPhoneModel::EPEMessageStopTonePlay ); |
|
691 |
|
692 // Re-enable global notes. Otherwise message editor is not opened. |
|
693 TPhoneCmdParamBoolean globalNotifierParam; |
|
694 globalNotifierParam.SetBoolean( EFalse ); |
|
695 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled, |
|
696 &globalNotifierParam ); |
|
697 |
|
698 // Change the CBA to Options..Reject |
|
699 iCbaManager->SetCbaL( EPhoneCallHandlingIncomingRejectCBA ); |
|
700 |
|
701 TPhoneCmdParamSfiData sfiDataParam; |
|
702 |
|
703 if ( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ).Length() ) |
|
704 { |
|
705 // store both the name and the number |
|
706 sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) ); |
|
707 sfiDataParam.SetName( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ) ); |
|
708 } |
|
709 else |
|
710 { |
|
711 // store the number |
|
712 sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) ); |
|
713 } |
|
714 |
|
715 iViewCommandHandle->ExecuteCommandL( |
|
716 EPhoneViewOpenSoftRejectEditor, &sfiDataParam ); |
|
717 } |
|
718 |
|
719 // ----------------------------------------------------------- |
|
720 // CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL |
|
721 // ----------------------------------------------------------- |
|
722 // |
|
723 TBool CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL() const |
|
724 { |
|
725 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL () "); |
|
726 // Get the foreground application window group id |
|
727 TPhoneCmdParamInteger foregroundAppParam; |
|
728 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetForegroundApplication, |
|
729 &foregroundAppParam ); |
|
730 |
|
731 // Get the soft reject message editor window group id |
|
732 TPhoneCmdParamInteger softRejectMessageEditorWgId; |
|
733 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSoftRejectWindowGroupId, |
|
734 &softRejectMessageEditorWgId ); |
|
735 |
|
736 __PHONELOG1( |
|
737 EBasic, |
|
738 EPhoneControl, |
|
739 "CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL() SoftRejectGroupId %d", |
|
740 softRejectMessageEditorWgId.Integer() ); |
|
741 __PHONELOG1( |
|
742 EBasic, |
|
743 EPhoneControl, |
|
744 "CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL() ForegroundAppGroupId %d", |
|
745 foregroundAppParam.Integer() ); |
|
746 // Return ETrue if soft reject message editor is displayed |
|
747 return softRejectMessageEditorWgId.Integer() == foregroundAppParam.Integer(); |
|
748 } |
|
749 |
|
750 // ----------------------------------------------------------- |
|
751 // CPhoneStateIncoming::OpenMenuBarL |
|
752 // ----------------------------------------------------------- |
|
753 // |
|
754 void CPhoneStateIncoming::OpenMenuBarL() |
|
755 { |
|
756 __LOGMETHODSTARTEND(EPhoneControl, |
|
757 "CPhoneStateIncoming::OpenMenuBarL ()" ); |
|
758 TInt resourceId; |
|
759 |
|
760 // Determine the correct menu bar to display |
|
761 if ( CPhoneState::IsNumberEntryVisibleL() ) |
|
762 { |
|
763 resourceId = GetNumberEntryVisibleMenuBar(); |
|
764 } |
|
765 else |
|
766 { |
|
767 resourceId = GetNumberEntryNotVisibleMenuBar(); |
|
768 } |
|
769 |
|
770 // Silence the ringer. And stop vibrating, if it is active. |
|
771 iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
772 iStateMachine->SendPhoneEngineMessage( |
|
773 MPEPhoneModel::EPEMessageStopTonePlay ); |
|
774 |
|
775 //Set correct cba |
|
776 HandleAudioPlayStoppedL(); |
|
777 |
|
778 // Dim button |
|
779 SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent ); |
|
780 |
|
781 // Open the menu bar |
|
782 TPhoneCmdParamInteger integerParam; |
|
783 integerParam.SetInteger( |
|
784 CPhoneMainResourceResolver::Instance()-> |
|
785 ResolveResourceID( resourceId ) ); |
|
786 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, |
|
787 &integerParam ); |
|
788 } |
|
789 |
|
790 // ----------------------------------------------------------- |
|
791 // CPhoneStateIncoming::GetNumberEntryVisibleMenuBar |
|
792 // ----------------------------------------------------------- |
|
793 // |
|
794 TInt CPhoneStateIncoming::GetNumberEntryVisibleMenuBar() |
|
795 { |
|
796 if( CPhoneState::IsVideoCall ( iRingingCallId ) ) |
|
797 { |
|
798 return EPhoneIncomingVideoCallMenubarWithNumberEntry; |
|
799 } |
|
800 else |
|
801 { |
|
802 return EPhoneIncomingCallMenubarWithNumberEntry; |
|
803 } |
|
804 } |
|
805 |
|
806 // ----------------------------------------------------------- |
|
807 // CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar |
|
808 // ----------------------------------------------------------- |
|
809 // |
|
810 TInt CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar() |
|
811 { |
|
812 if( CPhoneState::IsVideoCall ( iRingingCallId ) ) |
|
813 { |
|
814 return EPhoneIncomingVideoCallMenubar; |
|
815 } |
|
816 else |
|
817 { |
|
818 return EPhoneIncomingCallMenubar; |
|
819 } |
|
820 } |
|
821 |
|
822 // ----------------------------------------------------------- |
|
823 // CPhoneStateIncoming::DynInitMenuPaneL |
|
824 // ----------------------------------------------------------- |
|
825 // |
|
826 EXPORT_C void CPhoneStateIncoming::DynInitMenuPaneL( |
|
827 TInt aResourceId, |
|
828 CEikMenuPane* aMenuPane ) |
|
829 { |
|
830 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::DynInitMenuPaneL() "); |
|
831 __ASSERT_DEBUG( aMenuPane && aResourceId, |
|
832 Panic( EPhoneCtrlParameterNotInitialized ) ); |
|
833 |
|
834 // Save the number of digits in the number entry before processing |
|
835 // the menu pane |
|
836 if ( IsNumberEntryUsedL() ) |
|
837 { |
|
838 TPhoneCmdParamBoolean serviceCodeParam; |
|
839 serviceCodeParam.SetBoolean( ETrue ); |
|
840 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetServiceCodeFlag, |
|
841 &serviceCodeParam ); |
|
842 } |
|
843 |
|
844 if ( iCustomization ) |
|
845 { |
|
846 iCustomization->CustomizeMenuPaneL(aResourceId, aMenuPane); |
|
847 } |
|
848 // Process the menu pane |
|
849 TPhoneCmdParamDynMenu dynMenuPane; |
|
850 dynMenuPane.SetResourceId( aResourceId ); |
|
851 dynMenuPane.SetDynMenu( aMenuPane ); |
|
852 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuPane, &dynMenuPane ); |
|
853 } |
|
854 |
|
855 // ----------------------------------------------------------- |
|
856 // CPhoneStateIncoming::ShowDisconnectingL |
|
857 // ----------------------------------------------------------- |
|
858 // |
|
859 void CPhoneStateIncoming::ShowDisconnectingL( TInt aCallId ) |
|
860 { |
|
861 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::ShowDisconnectingL( ) "); |
|
862 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
863 callHeaderParam.SetCallState( EPEStateDisconnecting ); |
|
864 |
|
865 TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC ); |
|
866 TInt callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
867 ResolveResourceID( EPhoneInCallDisconnected ); |
|
868 |
|
869 StringLoader::Load( labelText, callLabelId, CCoeEnv::Static() ); |
|
870 callHeaderParam.SetLabelText( labelText ); |
|
871 |
|
872 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
873 &callHeaderParam ); |
|
874 } |
|
875 |
|
876 // --------------------------------------------------------- |
|
877 // CPhoneStateIncoming::HandleKeyLockEnabledL |
|
878 // --------------------------------------------------------- |
|
879 // |
|
880 EXPORT_C void CPhoneStateIncoming::HandleKeyLockEnabled( TBool aKeylockEnabled ) |
|
881 { |
|
882 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::HandleKeyLockEnabledL( ) "); |
|
883 if( !FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
884 && CPhoneCenRepProxy::Instance()-> |
|
885 IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) ) |
|
886 { |
|
887 if( aKeylockEnabled ) |
|
888 { |
|
889 // Keylock enabled |
|
890 if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() ) |
|
891 { |
|
892 // Disable HW Keys if needed |
|
893 DisableHWKeysL(); |
|
894 } |
|
895 } |
|
896 else |
|
897 { |
|
898 // Keylock disabled |
|
899 // Reset blocked keys list |
|
900 iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
901 } |
|
902 } |
|
903 } |
|
904 |
|
905 // End of File |