author | hgs |
Fri, 03 Sep 2010 13:33:36 +0300 | |
changeset 65 | 2a5d4ab426d3 |
parent 50 | 377c906a8701 |
child 74 | d1c62c765e48 |
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 CPhoneConferenceAndSingleAndWaiting class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDES |
|
20 |
#include <StringLoader.h> |
|
21 |
#include <cpephonemodelif.h> |
|
22 |
#include "cphoneconferenceandsingleandwaiting.h" |
|
23 |
#include "mphonestatemachine.h" |
|
24 |
#include "phoneviewcommanddefinitions.h" |
|
25 |
#include "tphonecmdparamcallheaderdata.h" |
|
26 |
#include "phonestatedefinitionsgsm.h" |
|
27 |
#include "phonelogger.h" |
|
28 |
#include "tphonecmdparamboolean.h" |
|
29 |
#include "tphonecmdparaminteger.h" |
|
30 |
#include "tphonecmdparamcallstatedata.h" |
|
31 |
#include "cphonemainresourceresolver.h" |
|
32 |
#include "phonerssbase.h" |
|
33 |
#include "tphonecmdparamglobalnote.h" |
|
34 |
#include "phoneui.hrh" |
|
35 |
#include "mphonestorage.h" |
|
36 |
#include "cphonecenrepproxy.h" |
|
37 |
#include <telephonyvariant.hrh> |
|
38 |
||
39 |
// ================= MEMBER FUNCTIONS ======================= |
|
40 |
||
41 |
// C++ default constructor can NOT contain any code, that |
|
42 |
// might leave. |
|
43 |
// |
|
44 |
CPhoneConferenceAndSingleAndWaiting::CPhoneConferenceAndSingleAndWaiting( |
|
45 |
MPhoneStateMachine* aStateMachine, |
|
46 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
47 |
MPhoneCustomization* aPhoneCustomization ) : |
|
48 |
CPhoneConferenceAndSingle( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
49 |
{ |
|
50 |
} |
|
51 |
||
52 |
// ----------------------------------------------------------- |
|
53 |
// CPhoneConferenceAndSingleAndWaiting::~CPhoneConferenceAndSingleAndWaiting() |
|
54 |
// Destructor |
|
55 |
// (other items were commented in a header). |
|
56 |
// ----------------------------------------------------------- |
|
57 |
// |
|
58 |
CPhoneConferenceAndSingleAndWaiting::~CPhoneConferenceAndSingleAndWaiting() |
|
59 |
{ |
|
60 |
} |
|
61 |
||
62 |
// ----------------------------------------------------------- |
|
63 |
// CPhoneConferenceAndSingleAndWaiting::ConstructL() |
|
64 |
// Constructor |
|
65 |
// (other items were commented in a header). |
|
66 |
// ----------------------------------------------------------- |
|
67 |
// |
|
68 |
void CPhoneConferenceAndSingleAndWaiting::ConstructL() |
|
69 |
{ |
|
70 |
CPhoneConferenceAndSingle::ConstructL(); |
|
71 |
} |
|
72 |
||
73 |
// ----------------------------------------------------------- |
|
74 |
// CPhoneConferenceAndSingleAndWaiting::NewL() |
|
75 |
// Constructor |
|
76 |
// (other items were commented in a header). |
|
77 |
// ----------------------------------------------------------- |
|
78 |
// |
|
79 |
CPhoneConferenceAndSingleAndWaiting* CPhoneConferenceAndSingleAndWaiting::NewL( |
|
80 |
MPhoneStateMachine* aStateMachine, |
|
81 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
82 |
MPhoneCustomization* aPhoneCustomization ) |
|
83 |
{ |
|
84 |
CPhoneConferenceAndSingleAndWaiting* self = new( ELeave ) CPhoneConferenceAndSingleAndWaiting( |
|
85 |
aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
86 |
||
87 |
CleanupStack::PushL( self ); |
|
88 |
self->ConstructL(); |
|
89 |
CleanupStack::Pop( self ); |
|
90 |
||
91 |
return self; |
|
92 |
} |
|
93 |
||
94 |
// ----------------------------------------------------------- |
|
95 |
// CPhoneConferenceAndSingleAndWaiting::HandlePhoneEngineMessageL |
|
96 |
// ----------------------------------------------------------- |
|
97 |
// |
|
98 |
void CPhoneConferenceAndSingleAndWaiting::HandlePhoneEngineMessageL( |
|
99 |
const TInt aMessage, |
|
100 |
TInt aCallId ) |
|
101 |
{ |
|
102 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingleAndWaiting::HandlePhoneEngineMessageL()"); |
|
103 |
switch ( aMessage ) |
|
104 |
{ |
|
105 |
case MEngineMonitor::EPEMessageAddedConferenceMember: |
|
106 |
HandleAddedConferenceMemberL( aCallId ); |
|
107 |
break; |
|
108 |
||
109 |
case MEngineMonitor::EPEMessageIdle: |
|
110 |
HandleIdleL( aCallId ); |
|
111 |
break; |
|
112 |
||
113 |
default: |
|
114 |
CPhoneConferenceAndSingle::HandlePhoneEngineMessageL( aMessage, |
|
115 |
aCallId ); |
|
116 |
break; |
|
117 |
} |
|
118 |
} |
|
119 |
||
120 |
// ----------------------------------------------------------- |
|
121 |
// CPhoneConferenceAndSingleAndWaiting::HandleIdleL |
|
122 |
// ----------------------------------------------------------- |
|
123 |
// |
|
124 |
void CPhoneConferenceAndSingleAndWaiting::HandleIdleL( TInt aCallId ) |
|
125 |
{ |
|
126 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
127 |
"CPhoneConferenceAndSingleAndWaiting::HandleIdleL()"); |
|
128 |
BeginUiUpdateLC(); |
|
129 |
SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
130 |
||
131 |
TPhoneCmdParamBoolean conferenceExistsForCallId; |
|
132 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference, |
|
133 |
aCallId, &conferenceExistsForCallId ); |
|
134 |
||
135 |
if( conferenceExistsForCallId.Boolean() ) |
|
136 |
{ |
|
137 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveFromConference, |
|
138 |
aCallId ); |
|
139 |
} |
|
140 |
else |
|
141 |
{ |
|
142 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
143 |
||
144 |
TPhoneCmdParamBoolean conferenceBubbleExists; |
|
145 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetIsConference, |
|
146 |
&conferenceBubbleExists ); |
|
147 |
if( !conferenceBubbleExists.Boolean() ) |
|
148 |
{ |
|
149 |
// Idle message came for conference member. |
|
150 |
MakeTransitionAccordingToActiveCallsL(); |
|
151 |
} |
|
152 |
else |
|
153 |
{ |
|
154 |
TPhoneCmdParamCallStateData callStateData; |
|
155 |
callStateData.SetCallState( EPEStateRinging ); |
|
156 |
iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState, |
|
157 |
&callStateData ); |
|
158 |
if( callStateData.CallId() >= 0 ) |
|
159 |
{ |
|
160 |
// We have Conference and Waiting calls left |
|
161 |
MakeStateTransitionToConferenceAndWaitingL( aCallId ); |
|
162 |
} |
|
163 |
else |
|
164 |
{ |
|
165 |
// We have Conference and Single calls left |
|
166 |
MakeStateTransitionToConferenceAndSingleL( aCallId ); |
|
167 |
} |
|
168 |
} |
|
169 |
} |
|
170 |
EndUiUpdate(); |
|
171 |
} |
|
172 |
||
173 |
// ----------------------------------------------------------- |
|
174 |
// CPhoneConferenceAndSingleAndWaiting::HandleAddedConferenceMemberL |
|
175 |
// ----------------------------------------------------------- |
|
176 |
// |
|
177 |
void CPhoneConferenceAndSingleAndWaiting::HandleAddedConferenceMemberL( TInt aCallId ) |
|
178 |
{ |
|
179 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingleAndWaiting::HandleAddedConferenceMemberL"); |
|
180 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference ); |
|
181 |
UpdateConferenceSecurityStatusL( aCallId ); |
|
182 |
MakeStateTransitionToConferenceAndWaitingL( KConferenceCallId ); |
|
183 |
} |
|
184 |
||
185 |
// ----------------------------------------------------------- |
|
186 |
// CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndWaitingL |
|
187 |
// ----------------------------------------------------------- |
|
188 |
// |
|
189 |
void CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndWaitingL( TInt /*aCallId*/ ) |
|
190 |
{ |
|
191 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
192 |
"CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndWaitingL()"); |
|
193 |
SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
194 |
CheckDisableHWKeysAndCallUIL(); |
|
195 |
UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
196 |
iStateMachine->ChangeState( EPhoneStateConferenceAndWaiting ); |
|
197 |
} |
|
198 |
||
199 |
// ----------------------------------------------------------- |
|
200 |
// CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndSingleL |
|
201 |
// ----------------------------------------------------------- |
|
202 |
// |
|
65 | 203 |
void CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndSingleL( |
204 |
TInt /*aCallId*/ ) |
|
37 | 205 |
{ |
206 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
207 |
"CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndSingleL()"); |
|
65 | 208 |
if( iStateMachine->PhoneStorage()->IsScreenLocked() ) |
37 | 209 |
{ |
210 |
EnableCallUIL(); |
|
211 |
} |
|
212 |
iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
213 |
||
214 |
if ( IsNumberEntryUsedL() ) |
|
215 |
{ |
|
216 |
if ( NeedToSendToBackgroundL() ) |
|
217 |
{ |
|
218 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
219 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
220 |
} |
|
221 |
else |
|
222 |
{ |
|
223 |
SetNumberEntryVisibilityL(ETrue); |
|
224 |
} |
|
225 |
} |
|
226 |
else |
|
227 |
{ |
|
228 |
UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA ); |
|
229 |
// If numberentry is not open just check NeedToSendToBackgroundL and |
|
230 |
// sendbackround if needed. |
|
231 |
if ( NeedToSendToBackgroundL() ) |
|
232 |
{ |
|
233 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
234 |
} |
|
235 |
} |
|
236 |
SetTouchPaneButtons( EPhoneConferenceAndSingleButtons ); |
|
237 |
iStateMachine->ChangeState( EPhoneStateConferenceAndSingle ); |
|
238 |
} |
|
239 |
||
240 |
// ----------------------------------------------------------- |
|
241 |
// CPhoneConferenceAndSingleAndWaiting::HandleConferenceIdleL |
|
242 |
// ----------------------------------------------------------- |
|
243 |
// |
|
244 |
void CPhoneConferenceAndSingleAndWaiting::HandleConferenceIdleL() |
|
245 |
{ |
|
246 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
247 |
"CPhoneConferenceAndSingleAndWaiting::HandleConferenceIdleL()"); |
|
248 |
BeginUiUpdateLC(); |
|
249 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveConferenceBubble ); |
|
250 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs ); |
|
251 |
MakeTransitionAccordingToActiveCallsL(); |
|
252 |
EndUiUpdate(); |
|
253 |
} |
|
254 |
||
255 |
// -------------------------------------------------------------- |
|
256 |
// CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL |
|
257 |
// -------------------------------------------------------------- |
|
258 |
// |
|
259 |
void CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL( |
|
260 |
TPhoneKeyEventMessages aMessage, |
|
261 |
TKeyCode aCode ) |
|
262 |
{ |
|
263 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
264 |
"CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL()"); |
|
265 |
switch ( aCode ) |
|
266 |
{ |
|
65 | 267 |
case EKeyYes: // send-key |
37 | 268 |
if( IsNumberEntryVisibleL() ) |
269 |
{ |
|
270 |
CallFromNumberEntryL(); |
|
271 |
} |
|
272 |
else |
|
273 |
{ |
|
274 |
SendGlobalWarningNoteL( |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
275 |
EPhoneNoteTextCallNotAllowed, ETrue ); |
37 | 276 |
} |
277 |
break; |
|
278 |
||
279 |
default: |
|
280 |
CPhoneConferenceAndSingle::HandleKeyMessageL( aMessage, aCode ); |
|
281 |
break; |
|
282 |
} |
|
283 |
} |
|
284 |
||
285 |
// ----------------------------------------------------------- |
|
286 |
// CPhoneConferenceAndSingleAndWaiting::HandleKeyEventL |
|
287 |
// ----------------------------------------------------------- |
|
288 |
// |
|
289 |
void CPhoneConferenceAndSingleAndWaiting::HandleKeyEventL( |
|
290 |
const TKeyEvent& aKeyEvent, |
|
291 |
TEventCode /*aEventCode*/ ) |
|
292 |
{ |
|
293 |
if( EKeyDeviceF == aKeyEvent.iCode ) |
|
294 |
{ |
|
295 |
__PHONELOG( EBasic, EPhoneUIStates, |
|
296 |
"CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL-deviceF" ); |
|
297 |
HandleHoldSwitchL(); |
|
298 |
} |
|
299 |
} |
|
300 |
||
301 |
// ----------------------------------------------------------- |
|
302 |
// CPhoneConferenceAndSingleAndWaiting::UpdateInCallCbaL |
|
303 |
// ----------------------------------------------------------- |
|
304 |
// |
|
305 |
void CPhoneConferenceAndSingleAndWaiting::UpdateInCallCbaL() |
|
306 |
{ |
|
307 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingleAndWaiting::UpdateInCallCbaL() "); |
|
308 |
UpdateCbaL ( EPhoneCallHandlingCallWaitingCBA ); |
|
309 |
} |
|
310 |
||
311 |
// ----------------------------------------------------------- |
|
312 |
// CPhoneConferenceAndSingleAndWaiting::MakeTransitionAccordingToActiveCallsL |
|
313 |
// ----------------------------------------------------------- |
|
314 |
// |
|
315 |
void CPhoneConferenceAndSingleAndWaiting::MakeTransitionAccordingToActiveCallsL() |
|
316 |
{ |
|
317 |
TPhoneCmdParamInteger activeCallCount; |
|
318 |
iViewCommandHandle->ExecuteCommandL( |
|
319 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount ); |
|
320 |
switch( activeCallCount.Integer() ) |
|
321 |
{ |
|
322 |
case ENoActiveCalls: // Go to incoming state |
|
323 |
{ |
|
324 |
TPhoneCmdParamCallStateData callStateData; |
|
325 |
callStateData.SetCallState( EPEStateRinging ); |
|
326 |
iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState, |
|
327 |
&callStateData ); |
|
328 |
if ( callStateData.CallId() != KErrNotFound ) |
|
329 |
{ |
|
330 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
331 |
callHeaderParam.SetCallState( EPEStateRinging ); |
|
332 |
SetCallHeaderTextsForCallComingInL( callStateData.CallId(), EFalse, &callHeaderParam ); |
|
333 |
||
334 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, |
|
335 |
callStateData.CallId(), |
|
336 |
&callHeaderParam ); |
|
65 | 337 |
|
37 | 338 |
iCbaManager->UpdateIncomingCbaL( callStateData.CallId() ); |
339 |
CheckDisableHWKeysAndCallUIL(); |
|
340 |
SetTouchPaneButtons( EPhoneIncomingCallButtons ); |
|
341 |
SetRingingTonePlaybackL( callStateData.CallId() ); |
|
342 |
SetBackButtonActive(EFalse); |
|
343 |
iStateMachine->ChangeState( EPhoneStateIncoming ); |
|
344 |
} |
|
345 |
else |
|
346 |
{ |
|
347 |
SetDefaultFlagsL(); |
|
348 |
UpdateCbaL( EPhoneEmptyCBA ); |
|
349 |
iStateMachine->ChangeState( EPhoneStateIdle ); |
|
350 |
} |
|
351 |
} |
|
352 |
break; |
|
65 | 353 |
case EOneActiveCall: // Go to Single And Waiting state |
37 | 354 |
{ |
355 |
UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
356 |
SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
357 |
CheckDisableHWKeysAndCallUIL(); |
|
358 |
iStateMachine->ChangeState( EPhoneStateWaitingInSingle ); |
|
359 |
} |
|
360 |
break; |
|
65 | 361 |
case ETwoActiveCalls: // Go to Two Singles And Waiting state |
37 | 362 |
{ |
363 |
UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
364 |
CheckDisableHWKeysAndCallUIL(); |
|
365 |
SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
366 |
iStateMachine->ChangeState( EPhoneStateTwoSinglesAndWaiting ); |
|
367 |
} |
|
368 |
break; |
|
369 |
default: |
|
370 |
// Too many active calls to handle reliable state change now. |
|
371 |
// Waiting for all conference member idles |
|
372 |
// This case may happen when 'End all calls' because conferenceIdle may |
|
373 |
// come earlier than idle for conference member |
|
374 |
break; |
|
375 |
} |
|
376 |
||
377 |
} |
|
378 |
||
379 |
// End of File |