author | William Roberts <williamr@symbian.org> |
Wed, 15 Sep 2010 17:56:16 +0100 | |
changeset 68 | 82f96d64ae88 |
parent 56 | 5bcb308bd24d |
child 65 | 2a5d4ab426d3 |
permissions | -rw-r--r-- |
37 | 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 |
} |
|
157 |
||
158 |
// ----------------------------------------------------------- |
|
159 |
// CPhoneStateIncoming::HandleKeyMessageL |
|
160 |
// ----------------------------------------------------------- |
|
161 |
// |
|
162 |
EXPORT_C void CPhoneStateIncoming::HandleKeyMessageL( |
|
163 |
TPhoneKeyEventMessages aMessage, |
|
164 |
TKeyCode aCode ) |
|
165 |
{ |
|
166 |
__LOGMETHODSTARTEND( EPhoneControl, |
|
167 |
"CPhoneStateIncoming::HandleKeyMessageL ()" ); |
|
168 |
__ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), |
|
169 |
Panic( EPhoneCtrlInvariant ) ); |
|
170 |
||
171 |
switch ( aCode ) |
|
172 |
{ |
|
173 |
// end-key |
|
174 |
case EKeyNo: |
|
175 |
{ |
|
176 |
// handle long press |
|
177 |
if ( aMessage == EPhoneKeyLongPress ) |
|
178 |
{ |
|
179 |
// Close all connections |
|
180 |
iStateMachine->SendPhoneEngineMessage( |
|
181 |
MPEPhoneModel::EPEMessageTerminateAllConnections ); |
|
182 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW ); |
|
183 |
||
184 |
if ( CPhoneState::IsNumberEntryUsedL() ) |
|
185 |
{ |
|
186 |
// Remove number entry from screen |
|
187 |
iViewCommandHandle->ExecuteCommandL( |
|
188 |
EPhoneViewRemoveNumberEntry ); |
|
189 |
// Do state-specific operation when number entry is cleared |
|
190 |
HandleNumberEntryClearedL(); |
|
191 |
} |
|
192 |
} |
|
193 |
else |
|
194 |
{ |
|
195 |
// handle end key |
|
196 |
DisconnectWaitingCallL(); |
|
197 |
} |
|
198 |
} |
|
199 |
break; |
|
200 |
||
201 |
// send-key |
|
202 |
case EKeyYes: |
|
203 |
if( CPhoneState::IsNumberEntryVisibleL() ) |
|
204 |
{ |
|
205 |
HandleSendL(); |
|
206 |
} |
|
207 |
else |
|
208 |
{ |
|
209 |
// Answer the call |
|
210 |
AnswerCallL(); |
|
211 |
} |
|
212 |
break; |
|
213 |
||
214 |
// OK key |
|
215 |
case EKeyDevice3: |
|
216 |
if ( aMessage == EPhoneKeyLongPress ) |
|
217 |
{ |
|
218 |
// Answer the call if long press of selection key |
|
219 |
AnswerCallL(); |
|
220 |
} |
|
221 |
break; |
|
222 |
||
223 |
case EKeyDeviceF: |
|
224 |
{ |
|
225 |
__PHONELOG( EBasic, EPhoneUIStates, |
|
226 |
"CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL-deviceF" ); |
|
227 |
HandleHoldSwitchL(); |
|
228 |
} |
|
229 |
break; |
|
230 |
||
231 |
default: |
|
232 |
break; |
|
233 |
} |
|
234 |
} |
|
235 |
||
236 |
// ----------------------------------------------------------- |
|
237 |
// CPhoneStateIncoming::HandleSendL |
|
238 |
// ----------------------------------------------------------- |
|
239 |
// |
|
240 |
void CPhoneStateIncoming::HandleSendL() |
|
241 |
{ |
|
242 |
// Get the number entry contents |
|
243 |
HBufC* phoneNumber = PhoneNumberFromEntryLC(); |
|
244 |
TPtr ptr( phoneNumber->Des() ); |
|
245 |
||
246 |
iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ); |
|
247 |
iStateMachine->SendPhoneEngineMessage( |
|
248 |
MPEPhoneModel::EPEMessagePhoneNumberEdited ); |
|
249 |
||
250 |
if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength |
|
251 |
&& iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() ) |
|
252 |
{ |
|
253 |
// Send a manual control sequence by providing number |
|
254 |
// information with dial command |
|
255 |
CPhoneState::CallFromNumberEntryL(); |
|
256 |
} |
|
257 |
else |
|
258 |
{ |
|
259 |
iStateMachine->SendPhoneEngineMessage( |
|
260 |
MPEPhoneModel::EPEMessageCheckEmergencyNumber ); |
|
261 |
} |
|
262 |
CleanupStack::PopAndDestroy( phoneNumber ); |
|
263 |
} |
|
264 |
||
265 |
// ----------------------------------------------------------- |
|
266 |
// CPhoneStateIncoming::HandleKeyPressDurationL |
|
267 |
// ----------------------------------------------------------- |
|
268 |
// |
|
269 |
EXPORT_C void CPhoneStateIncoming::HandleKeyPressDurationL( |
|
270 |
TKeyCode /*aCode*/, |
|
271 |
TTimeIntervalMicroSeconds /*aKeyPressDuration*/ ) |
|
272 |
{ |
|
273 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
274 |
"CPhoneStateIncoming::HandleKeyPressDurationL ()" ); |
|
275 |
||
276 |
} |
|
277 |
||
278 |
// ----------------------------------------------------------- |
|
279 |
// CPhoneStateIncoming::HandlePhoneEngineMessageL |
|
280 |
// ----------------------------------------------------------- |
|
281 |
// |
|
282 |
EXPORT_C void CPhoneStateIncoming::HandlePhoneEngineMessageL( |
|
283 |
const TInt aMessage, |
|
284 |
TInt aCallId ) |
|
285 |
{ |
|
286 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
287 |
"CPhoneStateIncoming::HandlePhoneEngineMessageL ()" ); |
|
288 |
switch ( aMessage ) |
|
289 |
{ |
|
290 |
case MEngineMonitor::EPEMessageIdle: |
|
291 |
HandleIdleL( aCallId ); |
|
292 |
break; |
|
293 |
||
294 |
case MEngineMonitor::EPEMessageConnected: |
|
295 |
HandleConnectedL( aCallId ); |
|
296 |
break; |
|
297 |
||
298 |
case MEngineMonitor::EPEMessageInValidEmergencyNumber: |
|
299 |
// Answer the call |
|
300 |
AnswerCallL(); |
|
301 |
break; |
|
302 |
||
303 |
case MEngineMonitor::EPEMessageValidEmergencyNumber: |
|
304 |
DialVoiceCallL(); |
|
305 |
break; |
|
306 |
||
307 |
case MEngineMonitor::EPEMessageAnswering: |
|
308 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
309 |
break; |
|
310 |
||
311 |
case MEngineMonitor::EPEMessageAudioOutputChanged: |
|
312 |
HandleAudioOutputChangedL(); |
|
313 |
break; |
|
314 |
||
315 |
case MEngineMonitor::EPEMessageMuteRingingTone: |
|
316 |
// Silence the ringer. And stop vibrating, if it is active. |
|
317 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
318 |
HandleAudioPlayStoppedL(); |
|
319 |
iStateMachine->SendPhoneEngineMessage( |
|
320 |
MPEPhoneModel::EPEMessageStopTonePlay ); |
|
321 |
break; |
|
322 |
||
323 |
case MEngineMonitor::EPEMessageAvailableAudioOutputsChanged: |
|
324 |
HandleAudioAvailableOutputChangedL(); |
|
325 |
// Need to avoid CBA update |
|
326 |
break; |
|
327 |
||
328 |
case MEngineMonitor::EPEMessageRemotePartyInfoChanged: |
|
329 |
// Update remote info data |
|
330 |
UpdateRemoteInfoDataAndLabelL( aCallId, UpdateCallHeaderInfoL( aCallId ) ); |
|
331 |
break; |
|
332 |
||
333 |
default: |
|
334 |
CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
335 |
break; |
|
336 |
} |
|
337 |
} |
|
338 |
||
339 |
// ----------------------------------------------------------- |
|
340 |
// CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL |
|
341 |
// ----------------------------------------------------------- |
|
342 |
// |
|
343 |
void CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL( |
|
344 |
TInt aCallId, |
|
345 |
TPhoneCmdParamCallHeaderData aCallHeaderParam ) |
|
346 |
{ |
|
347 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
348 |
"CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL ()" ); |
|
349 |
// Update the remote info data in the call header |
|
350 |
iViewCommandHandle->ExecuteCommandL( |
|
351 |
EPhoneViewUpdateCallHeaderRemoteInfoDataAndLabel, |
|
352 |
aCallId, |
|
353 |
&aCallHeaderParam ); |
|
354 |
} |
|
355 |
||
356 |
// ----------------------------------------------------------- |
|
357 |
// CPhoneStateIncoming::HandleConnectedL |
|
358 |
// ----------------------------------------------------------- |
|
359 |
// |
|
360 |
void CPhoneStateIncoming::HandleConnectedL( TInt aCallId ) |
|
361 |
{ |
|
362 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
363 |
"CPhoneStateIncoming::HandleConnectedL ()" ); |
|
364 |
||
365 |
// Re-enable global notes |
|
366 |
TPhoneCmdParamBoolean globalNotifierParam; |
|
367 |
globalNotifierParam.SetBoolean( EFalse ); |
|
368 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled, |
|
369 |
&globalNotifierParam ); |
|
370 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled, |
|
371 |
&globalNotifierParam ); |
|
372 |
// Stop tone playing, if necessary |
|
373 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
374 |
||
375 |
if( IsVideoCall( aCallId ) && !IsAutoLockOn() ) |
|
376 |
{ |
|
377 |
// For keeping video call on top |
|
378 |
TPhoneCmdParamBoolean booleanParam; |
|
379 |
booleanParam.SetBoolean( EFalse ); |
|
380 |
iViewCommandHandle->ExecuteCommandL( |
|
381 |
EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam ); |
|
382 |
} |
|
383 |
||
384 |
if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
385 |
&& iStateMachine->PhoneStorage()->IsScreenLocked() ) |
|
386 |
{ |
|
387 |
EnableCallUIL(); |
|
388 |
} |
|
389 |
||
390 |
// Reset blocked keys list |
|
391 |
iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
392 |
||
393 |
BeginUiUpdateLC(); |
|
394 |
||
395 |
// Update single call |
|
396 |
UpdateSingleActiveCallL( aCallId ); |
|
397 |
||
398 |
SetTouchPaneButtons( EPhoneIncallButtons ); |
|
399 |
SetBackButtonActive(ETrue); |
|
400 |
||
401 |
EndUiUpdate(); |
|
402 |
||
403 |
// Go to single state |
|
404 |
iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
405 |
||
406 |
iStateMachine->ChangeState( EPhoneStateSingle ); |
|
407 |
} |
|
408 |
||
409 |
// ----------------------------------------------------------- |
|
410 |
// CPhoneStateIncoming::HandleAudioPlayStoppedL |
|
411 |
// ----------------------------------------------------------- |
|
412 |
// |
|
413 |
EXPORT_C void CPhoneStateIncoming::HandleAudioPlayStoppedL() |
|
414 |
{ |
|
415 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
416 |
"CPhoneStateIncoming::HandleAudioPlayStoppedL ()" ); |
|
417 |
// Set the ringtone silenced status |
|
418 |
iCbaManager->SetRingtoneSilencedStatus( ETrue ); |
|
419 |
TInt resourceId = EPhoneCallHandlingIncomingRejectCBA; |
|
420 |
iCbaManager->SetCbaL( resourceId ); |
|
421 |
} |
|
422 |
||
423 |
// ----------------------------------------------------------- |
|
424 |
// CPhoneStateIncoming::HandleIdleL |
|
425 |
// ----------------------------------------------------------- |
|
426 |
// |
|
427 |
void CPhoneStateIncoming::HandleIdleL( TInt aCallId ) |
|
428 |
{ |
|
429 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
430 |
"CPhoneStateIncoming::HandleIdleL ()" ); |
|
431 |
BeginUiUpdateLC(); |
|
432 |
||
433 |
// Enable call UI |
|
434 |
if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
435 |
&& iStateMachine->PhoneStorage()->IsScreenLocked() ) |
|
436 |
{ |
|
437 |
EnableCallUIL(); |
|
438 |
} |
|
439 |
||
440 |
// Reset blocked keys list |
|
441 |
iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
442 |
||
443 |
// Remove call |
|
444 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
445 |
// Stop tone playing, if necessary |
|
446 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
447 |
||
448 |
TPhoneCmdParamBoolean globalNotifierParam; |
|
449 |
globalNotifierParam.SetBoolean( EFalse ); |
|
450 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled, |
|
451 |
&globalNotifierParam ); |
|
452 |
||
453 |
SetDefaultFlagsL(); |
|
454 |
||
455 |
if ( IsNumberEntryUsedL() ) |
|
456 |
{ |
|
457 |
if ( NeedToSendToBackgroundL() ) |
|
458 |
{ |
|
459 |
// Return phone to the background if send to background is needed. |
|
460 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
461 |
||
462 |
// Set Number Entry CBA |
|
463 |
iCbaManager->SetCbaL( EPhoneNumberAcqCBA ); |
|
464 |
} |
|
465 |
else |
|
466 |
{ |
|
467 |
// Show the number entry if it exists. |
|
468 |
SetNumberEntryVisibilityL(ETrue); |
|
469 |
} |
|
470 |
} |
|
56
5bcb308bd24d
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
471 |
else if ( NeedToSendToBackgroundL() ) |
37 | 472 |
{ |
473 |
// Continue displaying current app but set up the |
|
474 |
// idle screen in the background |
|
475 |
SetupIdleScreenInBackgroundL(); |
|
476 |
} |
|
477 |
else |
|
478 |
{ |
|
479 |
// Display idle screen |
|
480 |
DisplayIdleScreenL(); |
|
481 |
} |
|
482 |
||
483 |
DeleteTouchPaneButtons(); |
|
484 |
SetBackButtonActive(ETrue); |
|
485 |
||
486 |
EndUiUpdate(); |
|
487 |
// Go to idle state |
|
488 |
iCbaManager->UpdateCbaL( EPhoneEmptyCBA ); |
|
489 |
iStateMachine->ChangeState( EPhoneStateIdle ); |
|
490 |
} |
|
491 |
||
492 |
// ----------------------------------------------------------- |
|
493 |
// CPhoneStateIncoming::HandleCommandL |
|
494 |
// ----------------------------------------------------------- |
|
495 |
// |
|
496 |
EXPORT_C TBool CPhoneStateIncoming::HandleCommandL( TInt aCommand ) |
|
497 |
{ |
|
498 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
499 |
"CPhoneStateIncoming::HandleCommandL ()" ); |
|
500 |
TBool commandStatus = ETrue; |
|
501 |
||
502 |
switch( aCommand ) |
|
503 |
{ |
|
504 |
case EPhoneCmdOptions: |
|
505 |
// Stop tone playing, if necessary. |
|
506 |
// And stop vibrating, if it is active. |
|
507 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
508 |
break; |
|
509 |
||
510 |
case EPhoneCallComingCmdAnswer: |
|
511 |
AnswerCallL(); |
|
512 |
break; |
|
513 |
||
514 |
case EPhoneCallComingCmdAnswerHandPortableVideo: |
|
515 |
case EPhoneCallComingCmdAnswerHandPortable: |
|
516 |
iStateMachine->PhoneEngineInfo()->SetAudioOutputCommand( |
|
517 |
EPEHandset, ETrue ); |
|
518 |
iStateMachine->SendPhoneEngineMessage( |
|
519 |
MPEPhoneModel::EPEMessageSetAudioOutput ); |
|
520 |
AnswerCallL(); |
|
521 |
break; |
|
522 |
||
523 |
case EPhoneCallComingCmdReject: |
|
524 |
DisconnectWaitingCallL(); |
|
525 |
break; |
|
526 |
||
527 |
case EPhoneCallComingCmdSilent: |
|
528 |
// Silence the ringer. And stop vibrating, if it is active. |
|
529 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingTone ); |
|
530 |
HandleAudioPlayStoppedL(); |
|
531 |
iStateMachine->SendPhoneEngineMessage( |
|
532 |
MPEPhoneModel::EPEMessageStopTonePlay ); |
|
533 |
break; |
|
534 |
||
535 |
case EPhoneCallComingCmdSoftReject: |
|
536 |
// Open Soft reject message editor |
|
537 |
OpenSoftRejectMessageL(); |
|
538 |
break; |
|
539 |
||
540 |
case EPhoneNumberAcqCmdSendCommand: |
|
541 |
HandleSendL(); |
|
542 |
break; |
|
543 |
||
544 |
default: |
|
545 |
commandStatus = CPhoneState::HandleCommandL( aCommand ); |
|
546 |
break; |
|
547 |
} |
|
548 |
||
549 |
return commandStatus; |
|
550 |
} |
|
551 |
||
552 |
// ----------------------------------------------------------- |
|
553 |
// CPhoneStateIncoming::AnswerCallL |
|
554 |
// ----------------------------------------------------------- |
|
555 |
// |
|
556 |
void CPhoneStateIncoming::AnswerCallL() |
|
557 |
{ |
|
558 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
559 |
"CPhoneStateIncoming::AnswerCallL ()" ); |
|
560 |
// Mute the ring tone |
|
561 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingToneOnAnswer ); |
|
562 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW ); |
|
563 |
// Answer the call |
|
564 |
iStateMachine->SendPhoneEngineMessage( |
|
565 |
MPEPhoneModel::EPEMessageAnswer ); |
|
566 |
} |
|
567 |
||
568 |
// ----------------------------------------------------------- |
|
569 |
// CPhoneStateIncoming::DisconnectWaitingCallL |
|
570 |
// ----------------------------------------------------------- |
|
571 |
// |
|
572 |
void CPhoneStateIncoming::DisconnectWaitingCallL() |
|
573 |
{ |
|
574 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
575 |
"CPhoneStateIncoming::DisconnectWaitingCallL ()" ); |
|
576 |
||
577 |
// Stop tone playing, if necessary |
|
578 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
579 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW ); |
|
580 |
||
581 |
// The ringing call might have changed |
|
582 |
TPhoneCmdParamCallStateData callStateData; |
|
583 |
callStateData.SetCallState( EPEStateRinging ); |
|
584 |
iViewCommandHandle->HandleCommandL( |
|
585 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
586 |
||
587 |
if ( callStateData.CallId() > KErrNotFound ) |
|
588 |
{ |
|
589 |
iRingingCallId = callStateData.CallId(); |
|
590 |
} |
|
591 |
||
592 |
iStateMachine->SetCallId( iRingingCallId ); |
|
593 |
||
594 |
if( IsVideoCall( iRingingCallId ) ) |
|
595 |
{ |
|
596 |
// Video call can be released only after we get response to VT Shutdown Command |
|
597 |
CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain, |
|
598 |
KCatPhoneToVideotelCommands, |
|
599 |
EVtCmdReleaseDataport, |
|
600 |
TVersion( KPhoneToVideotelCmdVersionMajor, |
|
601 |
KPhoneToVideotelCmdVersionMinor, |
|
602 |
KPhoneToVideotelCmdVersionBuild ), |
|
603 |
KNullDesC8, |
|
604 |
CPhoneReleaseCommand::NewL( *iStateMachine ) ); |
|
605 |
} |
|
606 |
else |
|
607 |
{ |
|
608 |
// Release the call |
|
609 |
iStateMachine->SendPhoneEngineMessage( |
|
610 |
MPEPhoneModel::EPEMessageRelease ); |
|
611 |
} |
|
612 |
||
613 |
ShowDisconnectingL( iRingingCallId ); |
|
614 |
} |
|
615 |
||
616 |
// ----------------------------------------------------------- |
|
617 |
// CPhoneStateIncoming::OpenSoftRejectMessageEditorL |
|
618 |
// ----------------------------------------------------------- |
|
619 |
// |
|
620 |
void CPhoneStateIncoming::OpenSoftRejectMessageL() |
|
621 |
{ |
|
622 |
__LOGMETHODSTARTEND(EPhoneControl, |
|
623 |
"CPhoneStateIncoming::OpenSoftRejectMessageEditorL ()" ); |
|
624 |
||
625 |
// Silence the vibrating |
|
626 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone ); |
|
627 |
iStateMachine->SendPhoneEngineMessage( |
|
628 |
MPEPhoneModel::EPEMessageStopTonePlay ); |
|
629 |
||
630 |
// Re-enable global notes. Otherwise message editor is not opened. |
|
631 |
TPhoneCmdParamBoolean globalNotifierParam; |
|
632 |
globalNotifierParam.SetBoolean( EFalse ); |
|
633 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled, |
|
634 |
&globalNotifierParam ); |
|
635 |
||
636 |
// Change the CBA to Options..Reject |
|
637 |
iCbaManager->SetCbaL( EPhoneCallHandlingIncomingRejectCBA ); |
|
638 |
||
639 |
TPhoneCmdParamSfiData sfiDataParam; |
|
640 |
||
641 |
if ( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ).Length() ) |
|
642 |
{ |
|
643 |
// store both the name and the number |
|
644 |
sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) ); |
|
645 |
sfiDataParam.SetName( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ) ); |
|
646 |
} |
|
647 |
else |
|
648 |
{ |
|
649 |
// store the number |
|
650 |
sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) ); |
|
651 |
} |
|
652 |
||
653 |
iViewCommandHandle->ExecuteCommandL( |
|
654 |
EPhoneViewOpenSoftRejectEditor, &sfiDataParam ); |
|
655 |
} |
|
656 |
||
657 |
||
658 |
// ----------------------------------------------------------- |
|
659 |
// CPhoneStateIncoming::GetNumberEntryVisibleMenuBar |
|
660 |
// ----------------------------------------------------------- |
|
661 |
// |
|
662 |
TInt CPhoneStateIncoming::GetNumberEntryVisibleMenuBar() |
|
663 |
{ |
|
664 |
if( CPhoneState::IsVideoCall ( iRingingCallId ) ) |
|
665 |
{ |
|
666 |
return EPhoneIncomingVideoCallMenubarWithNumberEntry; |
|
667 |
} |
|
668 |
else |
|
669 |
{ |
|
670 |
return EPhoneIncomingCallMenubarWithNumberEntry; |
|
671 |
} |
|
672 |
} |
|
673 |
||
674 |
// ----------------------------------------------------------- |
|
675 |
// CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar |
|
676 |
// ----------------------------------------------------------- |
|
677 |
// |
|
678 |
TInt CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar() |
|
679 |
{ |
|
680 |
if( CPhoneState::IsVideoCall ( iRingingCallId ) ) |
|
681 |
{ |
|
682 |
return EPhoneIncomingVideoCallMenubar; |
|
683 |
} |
|
684 |
else |
|
685 |
{ |
|
686 |
return EPhoneIncomingCallMenubar; |
|
687 |
} |
|
688 |
} |
|
689 |
||
690 |
// ----------------------------------------------------------- |
|
691 |
// CPhoneStateIncoming::ShowDisconnectingL |
|
692 |
// ----------------------------------------------------------- |
|
693 |
// |
|
694 |
void CPhoneStateIncoming::ShowDisconnectingL( TInt aCallId ) |
|
695 |
{ |
|
696 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::ShowDisconnectingL( ) "); |
|
697 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
698 |
callHeaderParam.SetCallState( EPEStateDisconnecting ); |
|
699 |
||
700 |
TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC ); |
|
701 |
TInt callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
702 |
ResolveResourceID( EPhoneInCallDisconnected ); |
|
703 |
||
704 |
StringLoader::Load( labelText, callLabelId, CCoeEnv::Static() ); |
|
705 |
callHeaderParam.SetLabelText( labelText ); |
|
706 |
||
707 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
708 |
&callHeaderParam ); |
|
709 |
} |
|
710 |
||
711 |
// --------------------------------------------------------- |
|
712 |
// CPhoneStateIncoming::HandleKeyLockEnabledL |
|
713 |
// --------------------------------------------------------- |
|
714 |
// |
|
715 |
EXPORT_C void CPhoneStateIncoming::HandleKeyLockEnabled( TBool aKeylockEnabled ) |
|
716 |
{ |
|
717 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::HandleKeyLockEnabledL( ) "); |
|
718 |
if( !FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
719 |
&& CPhoneCenRepProxy::Instance()-> |
|
720 |
IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) ) |
|
721 |
{ |
|
722 |
if( aKeylockEnabled ) |
|
723 |
{ |
|
724 |
// Keylock enabled |
|
725 |
if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() ) |
|
726 |
{ |
|
727 |
// Disable HW Keys if needed |
|
728 |
DisableHWKeysL(); |
|
729 |
} |
|
730 |
} |
|
731 |
else |
|
732 |
{ |
|
733 |
// Keylock disabled |
|
734 |
// Reset blocked keys list |
|
735 |
iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
736 |
} |
|
737 |
} |
|
738 |
} |
|
739 |
||
740 |
// End of File |