author | hgs |
Fri, 06 Aug 2010 13:16:44 +0300 | |
changeset 53 | 22cc52eade9b |
parent 50 | 377c906a8701 |
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 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( |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
145 |
EPhoneNoteTextNotAllowed, ETrue ); |
37 | 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 |
|
50 | 223 |
if ( !iOnScreenDialer || !IsNumberEntryVisibleL() ) |
37 | 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 |
|
50 | 269 |
if ( !iOnScreenDialer || !IsNumberEntryVisibleL() ) |
37 | 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 |
BeginUiUpdateLC(); |
|
298 |
||
299 |
// Remove call |
|
300 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
301 |
||
302 |
// Find out do we have single or outgoing call left |
|
303 |
TPhoneCmdParamInteger activeCallCount; |
|
304 |
iViewCommandHandle->ExecuteCommandL( |
|
305 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount ); |
|
306 |
||
307 |
if( activeCallCount.Integer() ) |
|
308 |
{ |
|
309 |
CheckIfRestoreNEContentAfterDtmfDialer(); |
|
310 |
||
311 |
if ( IsNumberEntryUsedL() ) |
|
312 |
{ |
|
313 |
// Show the number entry if it exists |
|
314 |
SetNumberEntryVisibilityL(ETrue); |
|
315 |
} |
|
316 |
else |
|
317 |
{ |
|
318 |
// Set incall CBAs |
|
319 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
320 |
} |
|
321 |
||
322 |
SetTouchPaneButtons( EPhoneIncallButtons ); |
|
323 |
// UnCapture keys callsetup fails |
|
324 |
CaptureKeysDuringCallNotificationL( EFalse ); |
|
325 |
// Setup call was terminated |
|
326 |
iStateMachine->ChangeState( EPhoneStateSingle ); |
|
327 |
} |
|
328 |
else |
|
329 |
{ |
|
330 |
// Display call termination note, if necessary |
|
331 |
DisplayCallTerminationNoteL(); |
|
332 |
||
333 |
// Single call was terminated |
|
334 |
SetTouchPaneButtons( EPhoneCallSetupButtons ); |
|
335 |
SetToolbarButtonLoudspeakerEnabled(); |
|
336 |
// Update call setup CBAs |
|
337 |
UpdateCbaL( EPhoneCallHandlingCallSetupCBA ); |
|
338 |
iStateMachine->ChangeState( EPhoneStateCallSetup ); |
|
339 |
} |
|
340 |
||
341 |
EndUiUpdate(); |
|
342 |
} |
|
343 |
||
344 |
// ----------------------------------------------------------- |
|
345 |
// CPhoneSingleAndCallSetup::HandleCommandL |
|
346 |
// ----------------------------------------------------------- |
|
347 |
// |
|
348 |
TBool CPhoneSingleAndCallSetup::HandleCommandL( TInt aCommand ) |
|
349 |
{ |
|
350 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
351 |
"CPhoneSingleAndCallSetup::HandleCommandL()"); |
|
352 |
TBool commandStatus = ETrue; |
|
353 |
||
354 |
switch( aCommand ) |
|
355 |
{ |
|
356 |
case EPhoneInCallCmdEndThisOutgoingCall: |
|
357 |
{ |
|
358 |
// Fetch call's id from view |
|
359 |
TPhoneCmdParamCallStateData callStateData; |
|
360 |
callStateData.SetCallState( EPEStateDialing ); |
|
361 |
iViewCommandHandle->HandleCommandL( |
|
362 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
363 |
||
364 |
if ( callStateData.CallId() > KErrNotFound ) |
|
365 |
{ |
|
366 |
// Release the call |
|
367 |
iStateMachine->SetCallId( |
|
368 |
callStateData.CallId() ); |
|
369 |
iStateMachine->SendPhoneEngineMessage( |
|
370 |
MPEPhoneModel::EPEMessageRelease ); |
|
371 |
} |
|
372 |
else |
|
373 |
{ |
|
374 |
callStateData.SetCallState( EPEStateDisconnecting ); |
|
375 |
iViewCommandHandle->HandleCommandL( |
|
376 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
377 |
||
378 |
if ( callStateData.CallId() > KErrNotFound ) |
|
379 |
{ |
|
380 |
// Release the call |
|
381 |
iStateMachine->SetCallId( |
|
382 |
callStateData.CallId() ); |
|
383 |
iStateMachine->SendPhoneEngineMessage( |
|
384 |
MPEPhoneModel::EPEMessageRelease ); |
|
385 |
} |
|
386 |
__PHONELOG( EOnlyFatal, EPhoneUIStates, |
|
387 |
"CPhoneSingleAndCallSetup::HandleCommandL EPhoneInCallCmdEndThisOutgoingCall has negative call id!" ); |
|
388 |
} |
|
389 |
} |
|
390 |
break; |
|
391 |
||
392 |
default: |
|
393 |
commandStatus = CPhoneStateCallSetup::HandleCommandL( aCommand ); |
|
394 |
break; |
|
395 |
} |
|
396 |
||
397 |
return commandStatus; |
|
398 |
} |
|
399 |
||
400 |
// End of File |
|
401 |