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 CPhoneSingleAndCallSetup class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <featmgr.h>
|
|
21 |
#include <cpephonemodelif.h>
|
|
22 |
#include "cphonesingleandcallsetup.h"
|
|
23 |
#include "mphonestatemachine.h"
|
|
24 |
#include "phoneviewcommanddefinitions.h"
|
|
25 |
#include "tphonecmdparamcallheaderdata.h"
|
|
26 |
#include "tphonecmdparamcallstatedata.h"
|
|
27 |
#include "tphonecmdparamboolean.h"
|
|
28 |
#include "tphonecmdparaminteger.h"
|
|
29 |
#include "phonestatedefinitionsgsm.h"
|
|
30 |
#include "phonelogger.h"
|
|
31 |
#include "phonerssbase.h"
|
|
32 |
#include "phoneui.hrh"
|
|
33 |
#include "tphonecmdparamglobalnote.h"
|
|
34 |
#include "cphonemainresourceresolver.h"
|
|
35 |
|
|
36 |
// ================= MEMBER FUNCTIONS =======================
|
|
37 |
|
|
38 |
// C++ default constructor can NOT contain any code, that
|
|
39 |
// might leave.
|
|
40 |
//
|
|
41 |
CPhoneSingleAndCallSetup::CPhoneSingleAndCallSetup(
|
|
42 |
MPhoneStateMachine* aStateMachine,
|
|
43 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
44 |
MPhoneCustomization* aPhoneCustomization ) :
|
|
45 |
CPhoneCallSetup( aStateMachine, aViewCommandHandle, aPhoneCustomization )
|
|
46 |
{
|
|
47 |
}
|
|
48 |
|
|
49 |
// -----------------------------------------------------------
|
|
50 |
// CPhoneSingleAndCallSetup::~CPhoneSingleAndCallSetup()
|
|
51 |
// Destructor
|
|
52 |
// (other items were commented in a header).
|
|
53 |
// -----------------------------------------------------------
|
|
54 |
//
|
|
55 |
CPhoneSingleAndCallSetup::~CPhoneSingleAndCallSetup()
|
|
56 |
{
|
|
57 |
}
|
|
58 |
|
|
59 |
// -----------------------------------------------------------
|
|
60 |
// CPhoneSingleAndCallSetup::ConstructL()
|
|
61 |
// Constructor
|
|
62 |
// (other items were commented in a header).
|
|
63 |
// -----------------------------------------------------------
|
|
64 |
//
|
|
65 |
void CPhoneSingleAndCallSetup::ConstructL()
|
|
66 |
{
|
|
67 |
CPhoneCallSetup::ConstructL();
|
|
68 |
}
|
|
69 |
|
|
70 |
// -----------------------------------------------------------
|
|
71 |
// CPhoneSingleAndCallSetup::NewL()
|
|
72 |
// Constructor
|
|
73 |
// (other items were commented in a header).
|
|
74 |
// -----------------------------------------------------------
|
|
75 |
//
|
|
76 |
CPhoneSingleAndCallSetup* CPhoneSingleAndCallSetup::NewL(
|
|
77 |
MPhoneStateMachine* aStateMachine,
|
|
78 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
79 |
MPhoneCustomization* aPhoneCustomization )
|
|
80 |
{
|
|
81 |
CPhoneSingleAndCallSetup* self = new( ELeave ) CPhoneSingleAndCallSetup(
|
|
82 |
aStateMachine, aViewCommandHandle, aPhoneCustomization );
|
|
83 |
|
|
84 |
CleanupStack::PushL( self );
|
|
85 |
self->ConstructL();
|
|
86 |
CleanupStack::Pop( self );
|
|
87 |
|
|
88 |
return self;
|
|
89 |
}
|
|
90 |
|
|
91 |
// -----------------------------------------------------------
|
|
92 |
// CPhoneSingleAndCallSetup::HandlePhoneEngineMessageL
|
|
93 |
// -----------------------------------------------------------
|
|
94 |
//
|
|
95 |
void CPhoneSingleAndCallSetup::HandlePhoneEngineMessageL(
|
|
96 |
const TInt aMessage,
|
|
97 |
TInt aCallId )
|
|
98 |
{
|
|
99 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
100 |
"CPhoneSingleAndCallSetup::HandlePhoneEngineMessageL()");
|
|
101 |
switch ( aMessage )
|
|
102 |
{
|
|
103 |
case MEngineMonitor::EPEMessageConnecting:
|
|
104 |
HandleConnectingL( aCallId );
|
|
105 |
break;
|
|
106 |
|
|
107 |
case MEngineMonitor::EPEMessageConnected:
|
|
108 |
HandleConnectedL( aCallId );
|
|
109 |
break;
|
|
110 |
|
|
111 |
case MEngineMonitor::EPEMessageIdle:
|
|
112 |
HandleIdleL( aCallId );
|
|
113 |
break;
|
|
114 |
|
|
115 |
default:
|
|
116 |
CPhoneCallSetup::HandlePhoneEngineMessageL( aMessage,
|
|
117 |
aCallId );
|
|
118 |
break;
|
|
119 |
}
|
|
120 |
}
|
|
121 |
|
|
122 |
// --------------------------------------------------------------
|
|
123 |
// CPhoneSingleAndCallSetup::HandleKeyMessageL
|
|
124 |
// --------------------------------------------------------------
|
|
125 |
//
|
|
126 |
void CPhoneSingleAndCallSetup::HandleKeyMessageL(
|
|
127 |
TPhoneKeyEventMessages aMessage,
|
|
128 |
TKeyCode aCode )
|
|
129 |
{
|
|
130 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
131 |
"CPhoneSingleAndCallSetup::HandleKeyMessageL()");
|
|
132 |
switch ( aCode )
|
|
133 |
{
|
|
134 |
// send-key
|
|
135 |
case EKeyYes:
|
|
136 |
if ( CPhoneState::IsNumberEntryUsedL() )
|
|
137 |
{
|
|
138 |
// send a manual control sequence
|
|
139 |
CPhoneState::CallFromNumberEntryL();
|
|
140 |
}
|
|
141 |
else
|
|
142 |
{
|
|
143 |
// Show not allowed note
|
|
144 |
CPhoneState::SendGlobalErrorNoteL(
|
|
145 |
EPhoneNoteTextNotAllowed );
|
|
146 |
}
|
|
147 |
break;
|
|
148 |
|
|
149 |
// end-key
|
|
150 |
case EKeyNo:
|
|
151 |
if ( aMessage == EPhoneKeyLongPress )
|
|
152 |
{
|
|
153 |
iStateMachine->SendPhoneEngineMessage(
|
|
154 |
CPEPhoneModelIF::EPEMessageTerminateAllConnections );
|
|
155 |
}
|
|
156 |
else
|
|
157 |
{
|
|
158 |
// Fetch active call's id from view
|
|
159 |
TPhoneCmdParamCallStateData callStateData;
|
|
160 |
// Find the dialing call
|
|
161 |
callStateData.SetCallState( EPEStateDialing );
|
|
162 |
iViewCommandHandle->HandleCommandL(
|
|
163 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
164 |
|
|
165 |
if( callStateData.CallId() > KErrNotFound )
|
|
166 |
{
|
|
167 |
// Release the call
|
|
168 |
iStateMachine->SetCallId(
|
|
169 |
callStateData.CallId() );
|
|
170 |
iStateMachine->SendPhoneEngineMessage(
|
|
171 |
MPEPhoneModel::EPEMessageRelease );
|
|
172 |
}
|
|
173 |
else
|
|
174 |
{
|
|
175 |
callStateData.SetCallState( EPEStateDisconnecting );
|
|
176 |
iViewCommandHandle->HandleCommandL(
|
|
177 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
178 |
|
|
179 |
if ( callStateData.CallId() > KErrNotFound )
|
|
180 |
{
|
|
181 |
// Release the call
|
|
182 |
iStateMachine->SetCallId(
|
|
183 |
callStateData.CallId() );
|
|
184 |
iStateMachine->SendPhoneEngineMessage(
|
|
185 |
MPEPhoneModel::EPEMessageRelease );
|
|
186 |
}
|
|
187 |
}
|
|
188 |
}
|
|
189 |
break;
|
|
190 |
|
|
191 |
default:
|
|
192 |
// do base operation
|
|
193 |
CPhoneCallSetup::HandleKeyMessageL( aMessage, aCode );
|
|
194 |
break;
|
|
195 |
}
|
|
196 |
}
|
|
197 |
|
|
198 |
|
|
199 |
// -----------------------------------------------------------
|
|
200 |
// CPhoneSingleAndCallSetup::HandleConnectingL
|
|
201 |
// -----------------------------------------------------------
|
|
202 |
//
|
|
203 |
void CPhoneSingleAndCallSetup::HandleConnectingL( TInt aCallId )
|
|
204 |
{
|
|
205 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetup::HandleConnectingL()");
|
|
206 |
|
|
207 |
BeginUiUpdateLC();
|
|
208 |
|
|
209 |
UpdateRemoteInfoDataL ( aCallId );
|
|
210 |
|
|
211 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveGlobalNote );
|
|
212 |
|
|
213 |
// Re-enable global notes
|
|
214 |
TPhoneCmdParamBoolean globalNotifierParam;
|
|
215 |
globalNotifierParam.SetBoolean( EFalse );
|
|
216 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
|
|
217 |
&globalNotifierParam );
|
|
218 |
|
|
219 |
// Stop capturing keys
|
|
220 |
CaptureKeysDuringCallNotificationL( EFalse );
|
|
221 |
|
|
222 |
// Remove the number entry if it isn't DTMF dialer
|
|
223 |
if ( !iOnScreenDialer || !IsNumberEntryVisibleL() || !IsDTMFEditorVisibleL() )
|
|
224 |
{
|
|
225 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
|
|
226 |
}
|
|
227 |
|
|
228 |
TPhoneCmdParamCallHeaderData callHeaderParam;
|
|
229 |
callHeaderParam.SetCallState( EPEStateConnecting );
|
|
230 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
|
|
231 |
&callHeaderParam );
|
|
232 |
|
|
233 |
EndUiUpdate();
|
|
234 |
|
|
235 |
// Set Hold flag to view EFalse that dtmf menu item not delete
|
|
236 |
TPhoneCmdParamBoolean holdFlag;
|
|
237 |
holdFlag.SetBoolean( EFalse );
|
|
238 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
|
|
239 |
|
|
240 |
SetTouchPaneButtons( EPhoneCallSetupAndSingleButtons );
|
|
241 |
|
|
242 |
// Go to alerting state
|
|
243 |
UpdateCbaL( EPhoneCallHandlingInCallCBA );
|
|
244 |
iStateMachine->ChangeState( EPhoneStateAlertingInSingle );
|
|
245 |
}
|
|
246 |
|
|
247 |
// -----------------------------------------------------------
|
|
248 |
// CPhoneSingleAndCallSetup::HandleConnectedL
|
|
249 |
// -----------------------------------------------------------
|
|
250 |
//
|
|
251 |
void CPhoneSingleAndCallSetup::HandleConnectedL( TInt aCallId )
|
|
252 |
{
|
|
253 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
254 |
"CPhoneSingleAndCallSetup::HandleConnectedL()");
|
|
255 |
|
|
256 |
BeginUiUpdateLC();
|
|
257 |
|
|
258 |
// Show bubble
|
|
259 |
TPhoneCmdParamCallHeaderData callHeaderParam;
|
|
260 |
callHeaderParam.SetCallState( EPEStateConnected );
|
|
261 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
|
|
262 |
&callHeaderParam );
|
|
263 |
|
|
264 |
// Capturing keys and number entry must be removed because some
|
|
265 |
// networks jump over connecting state directly to connected state.
|
|
266 |
CaptureKeysDuringCallNotificationL( EFalse );
|
|
267 |
|
|
268 |
// Remove the number entry if it isn't DTMF dialer
|
|
269 |
if ( !iOnScreenDialer || !IsNumberEntryVisibleL() || !IsDTMFEditorVisibleL() )
|
|
270 |
{
|
|
271 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
|
|
272 |
}
|
|
273 |
|
|
274 |
// Set Hold flag to view
|
|
275 |
TPhoneCmdParamBoolean holdFlag;
|
|
276 |
holdFlag.SetBoolean( EFalse );
|
|
277 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
|
|
278 |
|
|
279 |
SetTouchPaneButtons( EPhoneTwoSinglesButtons );
|
|
280 |
|
|
281 |
EndUiUpdate();
|
|
282 |
|
|
283 |
// Go to two singles state
|
|
284 |
UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA );
|
|
285 |
iStateMachine->ChangeState( EPhoneStateTwoSingles );
|
|
286 |
|
|
287 |
}
|
|
288 |
|
|
289 |
// -----------------------------------------------------------
|
|
290 |
// CPhoneSingleAndCallSetup::HandleIdleL
|
|
291 |
// -----------------------------------------------------------
|
|
292 |
//
|
|
293 |
void CPhoneSingleAndCallSetup::HandleIdleL( TInt aCallId )
|
|
294 |
{
|
|
295 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetup::HandleIdleL()");
|
|
296 |
|
|
297 |
BeginTransEffectLC( ENumberEntryOpen );
|
|
298 |
BeginUiUpdateLC();
|
|
299 |
|
|
300 |
// Remove call
|
|
301 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
|
|
302 |
|
|
303 |
// Close menu bar, if it is displayed
|
|
304 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
|
|
305 |
|
|
306 |
// Find out do we have single or outgoing call left
|
|
307 |
TPhoneCmdParamInteger activeCallCount;
|
|
308 |
iViewCommandHandle->ExecuteCommandL(
|
|
309 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount );
|
|
310 |
|
|
311 |
if( activeCallCount.Integer() )
|
|
312 |
{
|
|
313 |
CheckIfRestoreNEContentAfterDtmfDialer();
|
|
314 |
|
|
315 |
if ( IsNumberEntryUsedL() )
|
|
316 |
{
|
|
317 |
// Show the number entry if it exists
|
|
318 |
SetNumberEntryVisibilityL(ETrue);
|
|
319 |
}
|
|
320 |
else
|
|
321 |
{
|
|
322 |
// Set incall CBAs
|
|
323 |
UpdateCbaL( EPhoneCallHandlingInCallCBA );
|
|
324 |
}
|
|
325 |
|
|
326 |
SetTouchPaneButtons( EPhoneIncallButtons );
|
|
327 |
// UnCapture keys callsetup fails
|
|
328 |
CaptureKeysDuringCallNotificationL( EFalse );
|
|
329 |
// Setup call was terminated
|
|
330 |
iStateMachine->ChangeState( EPhoneStateSingle );
|
|
331 |
}
|
|
332 |
else
|
|
333 |
{
|
|
334 |
// Display call termination note, if necessary
|
|
335 |
DisplayCallTerminationNoteL();
|
|
336 |
|
|
337 |
// Single call was terminated
|
|
338 |
SetTouchPaneButtons( EPhoneCallSetupButtons );
|
|
339 |
SetToolbarDimming( ETrue );
|
|
340 |
SetToolbarButtonLoudspeakerEnabled();
|
|
341 |
// Update call setup CBAs
|
|
342 |
UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
|
|
343 |
iStateMachine->ChangeState( EPhoneStateCallSetup );
|
|
344 |
}
|
|
345 |
|
|
346 |
EndUiUpdate();
|
|
347 |
EndTransEffect();
|
|
348 |
}
|
|
349 |
|
|
350 |
// -----------------------------------------------------------
|
|
351 |
// CPhoneSingleAndCallSetup::HandleCommandL
|
|
352 |
// -----------------------------------------------------------
|
|
353 |
//
|
|
354 |
TBool CPhoneSingleAndCallSetup::HandleCommandL( TInt aCommand )
|
|
355 |
{
|
|
356 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
357 |
"CPhoneSingleAndCallSetup::HandleCommandL()");
|
|
358 |
TBool commandStatus = ETrue;
|
|
359 |
|
|
360 |
switch( aCommand )
|
|
361 |
{
|
|
362 |
case EPhoneInCallCmdEndThisOutgoingCall:
|
|
363 |
{
|
|
364 |
// Fetch call's id from view
|
|
365 |
TPhoneCmdParamCallStateData callStateData;
|
|
366 |
callStateData.SetCallState( EPEStateDialing );
|
|
367 |
iViewCommandHandle->HandleCommandL(
|
|
368 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
369 |
|
|
370 |
if ( callStateData.CallId() > KErrNotFound )
|
|
371 |
{
|
|
372 |
// Release the call
|
|
373 |
iStateMachine->SetCallId(
|
|
374 |
callStateData.CallId() );
|
|
375 |
iStateMachine->SendPhoneEngineMessage(
|
|
376 |
MPEPhoneModel::EPEMessageRelease );
|
|
377 |
}
|
|
378 |
else
|
|
379 |
{
|
|
380 |
callStateData.SetCallState( EPEStateDisconnecting );
|
|
381 |
iViewCommandHandle->HandleCommandL(
|
|
382 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
383 |
|
|
384 |
if ( callStateData.CallId() > KErrNotFound )
|
|
385 |
{
|
|
386 |
// Release the call
|
|
387 |
iStateMachine->SetCallId(
|
|
388 |
callStateData.CallId() );
|
|
389 |
iStateMachine->SendPhoneEngineMessage(
|
|
390 |
MPEPhoneModel::EPEMessageRelease );
|
|
391 |
}
|
|
392 |
__PHONELOG( EOnlyFatal, EPhoneUIStates,
|
|
393 |
"CPhoneSingleAndCallSetup::HandleCommandL EPhoneInCallCmdEndThisOutgoingCall has negative call id!" );
|
|
394 |
}
|
|
395 |
}
|
|
396 |
break;
|
|
397 |
|
|
398 |
default:
|
|
399 |
commandStatus = CPhoneStateCallSetup::HandleCommandL( aCommand );
|
|
400 |
break;
|
|
401 |
}
|
|
402 |
|
|
403 |
return commandStatus;
|
|
404 |
}
|
|
405 |
|
|
406 |
// End of File
|
|
407 |
|