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 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 |
// -----------------------------------------------------------
|
|
64 |
//
|
|
65 |
CPhoneSingleAndWaiting::~CPhoneSingleAndWaiting()
|
|
66 |
{
|
|
67 |
}
|
|
68 |
|
|
69 |
// -----------------------------------------------------------
|
|
70 |
// CPhoneSingleAndWaiting::ConstructL()
|
|
71 |
// -----------------------------------------------------------
|
|
72 |
//
|
|
73 |
void CPhoneSingleAndWaiting::ConstructL()
|
|
74 |
{
|
|
75 |
CPhoneGsmInCall::ConstructL();
|
65
|
76 |
|
37
|
77 |
TPhoneCmdParamCallStateData callStateData;
|
|
78 |
callStateData.SetCallState( EPEStateConnected );
|
|
79 |
iViewCommandHandle->HandleCommandL(
|
|
80 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
81 |
|
|
82 |
if ( callStateData.CallId() == KErrNotFound )
|
|
83 |
{
|
|
84 |
callStateData.SetCallState( EPEStateHeld );
|
|
85 |
iViewCommandHandle->HandleCommandL(
|
|
86 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
87 |
}
|
|
88 |
iSingleCallId = callStateData.CallId();
|
|
89 |
__PHONELOG1( EBasic, EPhoneUIStates,
|
|
90 |
"CPhoneSingleAndWaiting::ConstructL() (iSingleCallId=%d)", iSingleCallId);
|
|
91 |
}
|
|
92 |
|
|
93 |
// -----------------------------------------------------------
|
|
94 |
// CPhoneSingleAndWaiting::NewL()
|
|
95 |
// -----------------------------------------------------------
|
|
96 |
//
|
|
97 |
CPhoneSingleAndWaiting* CPhoneSingleAndWaiting::NewL(
|
|
98 |
MPhoneStateMachine* aStateMachine,
|
|
99 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
100 |
MPhoneCustomization* aPhoneCustomization )
|
|
101 |
{
|
|
102 |
CPhoneSingleAndWaiting* self = new( ELeave ) CPhoneSingleAndWaiting(
|
|
103 |
aStateMachine, aViewCommandHandle, aPhoneCustomization );
|
|
104 |
|
|
105 |
CleanupStack::PushL( self );
|
|
106 |
self->ConstructL();
|
|
107 |
CleanupStack::Pop( self );
|
|
108 |
|
|
109 |
return self;
|
|
110 |
}
|
|
111 |
|
|
112 |
// -----------------------------------------------------------
|
|
113 |
// CPhoneSingleAndWaiting::HandlePhoneEngineMessageL
|
|
114 |
// -----------------------------------------------------------
|
|
115 |
//
|
|
116 |
void CPhoneSingleAndWaiting::HandlePhoneEngineMessageL(
|
|
117 |
const TInt aMessage,
|
|
118 |
TInt aCallId )
|
|
119 |
{
|
|
120 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
121 |
"CPhoneSingleAndWaiting::HandlePhoneEngineMessageL() ");
|
|
122 |
switch ( aMessage )
|
|
123 |
{
|
|
124 |
case MEngineMonitor::EPEMessageIdle:
|
|
125 |
HandleIdleL( aCallId );
|
|
126 |
break;
|
|
127 |
|
|
128 |
case MEngineMonitor::EPEMessageHeld:
|
76
|
129 |
UpdateCallHeaderAndUiCommandsL( aCallId );
|
37
|
130 |
break;
|
|
131 |
|
|
132 |
case MEngineMonitor::EPEMessageConnected:
|
|
133 |
HandleConnectedL( aCallId );
|
|
134 |
break;
|
|
135 |
|
|
136 |
case MEngineMonitor::EPEMessageDialing:
|
74
|
137 |
HandleDialingL( aCallId );
|
37
|
138 |
break;
|
|
139 |
|
|
140 |
case MEngineMonitor::EPEMessageDisconnecting:
|
|
141 |
HandleDisconnectingL( aCallId );
|
|
142 |
/* Flow through */
|
|
143 |
|
|
144 |
default:
|
|
145 |
CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
|
|
146 |
break;
|
|
147 |
}
|
|
148 |
}
|
|
149 |
|
|
150 |
// -----------------------------------------------------------
|
|
151 |
// CPhoneSingleAndWaiting:HandleCommandL
|
|
152 |
// -----------------------------------------------------------
|
|
153 |
//
|
|
154 |
TBool CPhoneSingleAndWaiting::HandleCommandL( TInt aCommand )
|
|
155 |
{
|
|
156 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
157 |
"CPhoneSingleAndWaiting::HandleCommandL() ");
|
|
158 |
TBool commandStatus = ETrue;
|
|
159 |
switch( aCommand )
|
|
160 |
{
|
|
161 |
case EPhoneInCallCmdHold:
|
|
162 |
{
|
|
163 |
iStateMachine->SetCallId( iSingleCallId );
|
|
164 |
iStateMachine->SendPhoneEngineMessage(
|
|
165 |
CPEPhoneModelIF::EPEMessageHold );
|
|
166 |
break;
|
|
167 |
}
|
|
168 |
|
|
169 |
case EPhoneInCallCmdUnhold:
|
|
170 |
{
|
|
171 |
iStateMachine->SetCallId( iSingleCallId );
|
|
172 |
iStateMachine->SendPhoneEngineMessage(
|
|
173 |
CPEPhoneModelIF::EPEMessageResume );
|
|
174 |
break;
|
|
175 |
}
|
|
176 |
|
|
177 |
case EPhoneInCallCmdNewCall:
|
|
178 |
break;
|
|
179 |
|
|
180 |
case EPhoneCallComingCmdReject: // fall through
|
|
181 |
{
|
|
182 |
// Get waiting callid
|
|
183 |
TPhoneCmdParamCallStateData callStateData;
|
|
184 |
callStateData.SetCallState( EPEStateRinging );
|
|
185 |
iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState,
|
|
186 |
&callStateData );
|
|
187 |
iStateMachine->SetCallId( callStateData.CallId() );
|
|
188 |
iStateMachine->SendPhoneEngineMessage(
|
|
189 |
MPEPhoneModel::EPEMessageReject );
|
|
190 |
break;
|
|
191 |
}
|
|
192 |
|
|
193 |
case EPhoneInCallCmdReject:
|
|
194 |
iStateMachine->SetCallId( iSingleCallId );
|
|
195 |
iStateMachine->SendPhoneEngineMessage(
|
|
196 |
MPEPhoneModel::EPEMessageReject );
|
|
197 |
break;
|
|
198 |
|
|
199 |
case EPhoneCmdUpdateUiControls:
|
76
|
200 |
UpdateUiCommands();
|
37
|
201 |
break;
|
|
202 |
|
|
203 |
default:
|
|
204 |
commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
|
|
205 |
break;
|
|
206 |
}
|
|
207 |
return commandStatus;
|
|
208 |
}
|
|
209 |
|
|
210 |
// --------------------------------------------------------------
|
|
211 |
// CPhoneSingleAndWaiting::HandleKeyMessageL
|
|
212 |
// --------------------------------------------------------------
|
|
213 |
//
|
|
214 |
void CPhoneSingleAndWaiting::HandleKeyMessageL(
|
|
215 |
TPhoneKeyEventMessages aMessage,
|
|
216 |
TKeyCode aCode )
|
|
217 |
{
|
|
218 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
219 |
"CPhoneSingleAndWaiting::HandleKeyMessageL() ");
|
|
220 |
switch ( aCode )
|
|
221 |
{
|
65
|
222 |
case EKeyYes: // send-key
|
37
|
223 |
{
|
74
|
224 |
if( iNumberEntryManager->IsNumberEntryVisibleL() )
|
37
|
225 |
{
|
74
|
226 |
iNumberEntryManager->CallFromNumberEntryL();
|
37
|
227 |
}
|
|
228 |
else
|
|
229 |
{
|
|
230 |
// Close DTMF sending note if it exists
|
|
231 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
|
|
232 |
iStateMachine->SendPhoneEngineMessage(
|
|
233 |
CPEPhoneModelIF::EPEMessageAnswer );
|
|
234 |
}
|
|
235 |
break;
|
|
236 |
}
|
|
237 |
|
|
238 |
default:
|
|
239 |
CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
|
|
240 |
break;
|
|
241 |
}
|
|
242 |
}
|
|
243 |
|
|
244 |
// -----------------------------------------------------------
|
|
245 |
// CPhoneSingleAndWaiting::HandleIdleL
|
|
246 |
// -----------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CPhoneSingleAndWaiting::HandleIdleL( TInt aCallId )
|
|
249 |
{
|
|
250 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
251 |
"CPhoneSingleAndWaiting::HandleIdleL() ");
|
|
252 |
|
|
253 |
if ( iSingleCallId == KErrNotFound )
|
|
254 |
{
|
|
255 |
TPhoneCmdParamCallStateData callStateData;
|
|
256 |
callStateData.SetCallState( EPEStateDisconnecting );
|
|
257 |
iViewCommandHandle->HandleCommandL(
|
|
258 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
259 |
|
|
260 |
if ( callStateData.CallId() == KErrNotFound )
|
|
261 |
{
|
|
262 |
callStateData.SetCallState( EPEStateConnected );
|
|
263 |
iViewCommandHandle->HandleCommandL(
|
|
264 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
265 |
|
|
266 |
if ( callStateData.CallId() == KErrNotFound )
|
|
267 |
{
|
|
268 |
callStateData.SetCallState( EPEStateHeld );
|
|
269 |
iViewCommandHandle->HandleCommandL(
|
|
270 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
271 |
}
|
|
272 |
}
|
|
273 |
iSingleCallId = callStateData.CallId();
|
|
274 |
}
|
|
275 |
|
|
276 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
277 |
"CPhoneSingleAndWaiting::HandleIdleL iSingleCallId(%d)",
|
|
278 |
iSingleCallId );
|
|
279 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
280 |
"CPhoneSingleAndWaiting::HandleIdleL aCallId(%d)",
|
|
281 |
aCallId );
|
|
282 |
|
65
|
283 |
// Idle message came for active call
|
37
|
284 |
if( iSingleCallId == aCallId )
|
|
285 |
{
|
|
286 |
BeginUiUpdateLC();
|
|
287 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
|
|
288 |
|
|
289 |
// Get waiting callId
|
|
290 |
TPhoneCmdParamCallStateData callStateData;
|
|
291 |
callStateData.SetCallState( EPEStateRinging );
|
|
292 |
iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState,
|
|
293 |
&callStateData );
|
|
294 |
|
|
295 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
296 |
"CPhoneSingleAndWaiting::HandleIdleL EPEStateRinging CallId(%d)",
|
|
297 |
callStateData.CallId() );
|
|
298 |
|
65
|
299 |
// Display ringing bubble
|
37
|
300 |
if ( callStateData.CallId() > KErrNotFound )
|
74
|
301 |
{
|
76
|
302 |
UpdateCallHeaderAndUiCommandsL( callStateData.CallId() );
|
37
|
303 |
|
74
|
304 |
if ( iNumberEntryManager->IsNumberEntryVisibleL() )
|
37
|
305 |
{
|
74
|
306 |
iNumberEntryManager->SetNumberEntryVisibilityL(EFalse);
|
37
|
307 |
}
|
65
|
308 |
|
74
|
309 |
SetRingingTonePlaybackL( callStateData.CallId() );
|
37
|
310 |
BringIncomingToForegroundL();
|
|
311 |
}
|
|
312 |
SetBackButtonActive(EFalse);
|
|
313 |
EndUiUpdate();
|
|
314 |
iStateMachine->ChangeState( EPhoneStateIncoming );
|
|
315 |
}
|
|
316 |
else
|
|
317 |
{
|
|
318 |
BeginUiUpdateLC();
|
|
319 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
|
|
320 |
|
|
321 |
// Idle message came for waiting call
|
74
|
322 |
if ( iNumberEntryManager->IsNumberEntryUsedL() )
|
37
|
323 |
{
|
74
|
324 |
iNumberEntryManager->SetNumberEntryVisibilityL(ETrue);
|
37
|
325 |
}
|
|
326 |
|
74
|
327 |
UpdateUiCommands();
|
37
|
328 |
EndUiUpdate();
|
|
329 |
iStateMachine->ChangeState( EPhoneStateSingle );
|
|
330 |
}
|
|
331 |
|
|
332 |
}
|
|
333 |
|
|
334 |
|
|
335 |
|
|
336 |
// -----------------------------------------------------------
|
|
337 |
// CPhoneSingleAndWaiting::HandleConnectedL
|
|
338 |
// -----------------------------------------------------------
|
|
339 |
//
|
|
340 |
void CPhoneSingleAndWaiting::HandleConnectedL( TInt aCallId )
|
|
341 |
{
|
|
342 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
343 |
"CPhoneSingleAndWaiting::HandleConnectedL() ");
|
|
344 |
__PHONELOG1( EBasic, EPhoneUIStates,
|
|
345 |
"CPhoneSingleAndWaiting::HandleConnectedL (CallId=%d)", aCallId);
|
74
|
346 |
|
37
|
347 |
if ( iSingleCallId == aCallId )
|
|
348 |
{
|
|
349 |
// Connected message came for the hold call, we still
|
|
350 |
// have the waiting call also
|
76
|
351 |
UpdateCallHeaderAndUiCommandsL( aCallId );
|
37
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
// Connected message came for waiting call
|
|
356 |
MakeStateTransitionToTwoSinglesL( aCallId );
|
|
357 |
}
|
|
358 |
}
|
|
359 |
|
|
360 |
// -----------------------------------------------------------
|
|
361 |
// CPhoneSingleAndWaiting::HandleUnholdL
|
|
362 |
// -----------------------------------------------------------
|
|
363 |
//
|
|
364 |
void CPhoneSingleAndWaiting::HandleUnholdL( TInt aCallId )
|
|
365 |
{
|
|
366 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
367 |
"CPhoneSingleAndWaiting::HandleUnholdL() ");
|
76
|
368 |
UpdateCallHeaderAndUiCommandsL( aCallId );
|
37
|
369 |
}
|
|
370 |
|
|
371 |
// -----------------------------------------------------------
|
|
372 |
// CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL
|
|
373 |
// -----------------------------------------------------------
|
|
374 |
//
|
|
375 |
void CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL( TInt aCallId )
|
|
376 |
{
|
|
377 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
378 |
"CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL() ");
|
76
|
379 |
UpdateCallHeaderAndUiCommandsL( aCallId );
|
37
|
380 |
|
74
|
381 |
if ( iNumberEntryManager->IsNumberEntryUsedL() )
|
37
|
382 |
{
|
74
|
383 |
iNumberEntryManager->SetNumberEntryVisibilityL(ETrue);
|
37
|
384 |
}
|
|
385 |
|
|
386 |
iStateMachine->ChangeState( EPhoneStateTwoSingles );
|
|
387 |
}
|
|
388 |
|
|
389 |
// -----------------------------------------------------------
|
74
|
390 |
// CPhoneSingleAndWaiting::HandleDialingL
|
37
|
391 |
// -----------------------------------------------------------
|
|
392 |
//
|
74
|
393 |
void CPhoneSingleAndWaiting::HandleDialingL( TInt aCallId )
|
37
|
394 |
{
|
|
395 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
74
|
396 |
"CPhoneSingleAndWaiting::HandleDialingL() ");
|
|
397 |
DisplayCallHeaderL( aCallId, ESetNEVisibilityFalse);
|
|
398 |
iStateMachine->ChangeState( EPhoneStateSingleAndCallSetupAndWaiting );
|
37
|
399 |
}
|
|
400 |
|
|
401 |
// -----------------------------------------------------------
|
|
402 |
// CPhoneSingleAndWaiting::HandleErrorL
|
|
403 |
// -----------------------------------------------------------
|
|
404 |
//
|
|
405 |
EXPORT_C void CPhoneSingleAndWaiting::HandleErrorL( const TPEErrorInfo& aErrorInfo )
|
|
406 |
{
|
|
407 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndWaiting::HandleErrorL()");
|
|
408 |
if( aErrorInfo.iErrorCode == ECCPErrorCCUserAlertingNoAnswer )
|
|
409 |
{
|
|
410 |
// Should not shown "Not Allowed" note, if active call.
|
|
411 |
__PHONELOG1( EBasic, EPhoneUIStates,
|
|
412 |
"PhoneUIControl: CPhoneSingleAndWaiting::HandleErrorL - aErrorInfo.iErrorCode =%d ",
|
|
413 |
aErrorInfo.iErrorCode);
|
|
414 |
}
|
|
415 |
else
|
|
416 |
{
|
|
417 |
CPhoneState::HandleErrorL( aErrorInfo );
|
|
418 |
}
|
|
419 |
}
|
|
420 |
|
|
421 |
// -----------------------------------------------------------
|
|
422 |
// CPhoneSingleAndWaiting::HandleDisconnectingL
|
|
423 |
// -----------------------------------------------------------
|
|
424 |
//
|
74
|
425 |
void CPhoneSingleAndWaiting::HandleDisconnectingL( TInt /*aCallId*/ )
|
37
|
426 |
{
|
|
427 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndWaiting::HandleDisconnectingL( ) ");
|
|
428 |
}
|
|
429 |
|
|
430 |
// End of File
|