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