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 CPhoneConferenceAndSingle class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDES |
|
20 |
#include <StringLoader.h> |
|
21 |
#include <cpephonemodelif.h> |
|
22 |
#include <mpeengineinfo.h> |
|
23 |
#include <featmgr.h> |
|
24 |
#include "cphoneconferenceandsingle.h" |
|
25 |
#include "mphonestatemachine.h" |
|
26 |
#include "phoneviewcommanddefinitions.h" |
|
27 |
#include "tphonecmdparamcallheaderdata.h" |
|
28 |
#include "tphonecmdparamstring.h" |
|
29 |
#include "phonestatedefinitionsgsm.h" |
|
30 |
#include "phonelogger.h" |
|
31 |
#include "tphonecmdparamboolean.h" |
|
32 |
#include "tphonecmdparaminteger.h" |
|
33 |
#include "tphonecmdparamcallstatedata.h" |
|
34 |
#include "cphonemainresourceresolver.h" |
|
35 |
#include "phonerssbase.h" |
|
36 |
#include "tphonecmdparamglobalnote.h" |
|
37 |
#include "phoneui.hrh" |
|
38 |
||
39 |
// ================= MEMBER FUNCTIONS ======================= |
|
40 |
||
41 |
// C++ default constructor can NOT contain any code, that |
|
42 |
// might leave. |
|
43 |
// |
|
44 |
CPhoneConferenceAndSingle::CPhoneConferenceAndSingle( |
|
45 |
MPhoneStateMachine* aStateMachine, |
|
46 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
47 |
MPhoneCustomization* aPhoneCustomization ) : |
|
48 |
CPhoneConference( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
49 |
{ |
|
50 |
} |
|
51 |
||
52 |
// ----------------------------------------------------------- |
|
53 |
// CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle() |
|
54 |
// Destructor |
|
55 |
// (other items were commented in a header). |
|
56 |
// ----------------------------------------------------------- |
|
57 |
// |
|
58 |
CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle() |
|
59 |
{ |
|
60 |
} |
|
61 |
||
62 |
// ----------------------------------------------------------- |
|
63 |
// CPhoneConferenceAndSingle::ConstructL() |
|
64 |
// Constructor |
|
65 |
// (other items were commented in a header). |
|
66 |
// ----------------------------------------------------------- |
|
67 |
// |
|
68 |
void CPhoneConferenceAndSingle::ConstructL() |
|
69 |
{ |
|
70 |
CPhoneConference::ConstructL(); |
|
71 |
} |
|
72 |
||
73 |
// ----------------------------------------------------------- |
|
74 |
// CPhoneConferenceAndSingle::NewL() |
|
75 |
// Constructor |
|
76 |
// (other items were commented in a header). |
|
77 |
// ----------------------------------------------------------- |
|
78 |
// |
|
79 |
CPhoneConferenceAndSingle* CPhoneConferenceAndSingle::NewL( |
|
80 |
MPhoneStateMachine* aStateMachine, |
|
81 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
82 |
MPhoneCustomization* aPhoneCustomization ) |
|
83 |
{ |
|
84 |
CPhoneConferenceAndSingle* self = new( ELeave ) CPhoneConferenceAndSingle( |
|
85 |
aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
86 |
||
87 |
CleanupStack::PushL( self ); |
|
88 |
self->ConstructL(); |
|
89 |
CleanupStack::Pop( self ); |
|
90 |
||
91 |
return self; |
|
92 |
} |
|
93 |
||
94 |
// ----------------------------------------------------------- |
|
95 |
// CPhoneConferenceAndSingle::HandlePhoneEngineMessageL |
|
96 |
// ----------------------------------------------------------- |
|
97 |
// |
|
98 |
void CPhoneConferenceAndSingle::HandlePhoneEngineMessageL( |
|
99 |
const TInt aMessage, |
|
100 |
TInt aCallId ) |
|
101 |
{ |
|
102 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingle::HandlePhoneEngineMessageL()"); |
|
103 |
switch ( aMessage ) |
|
104 |
{ |
|
105 |
case MEngineMonitor::EPEMessageConnectedConference: |
|
106 |
HandleConnectedConferenceL(); |
|
107 |
break; |
|
108 |
||
109 |
case MEngineMonitor::EPEMessageHeldConference: |
|
110 |
HandleHeldConferenceL(); |
|
111 |
break; |
|
112 |
||
113 |
case MEngineMonitor::EPEMessageConnected: |
|
114 |
HandleConnectedL( aCallId ); |
|
115 |
break; |
|
116 |
||
117 |
case MEngineMonitor::EPEMessageHeld: |
|
118 |
HandleHeldL( aCallId ); |
|
119 |
break; |
|
120 |
||
65 | 121 |
case MEngineMonitor::EPEMessageInValidEmergencyNumber: |
122 |
SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue ); |
|
37 | 123 |
break; |
124 |
||
125 |
case MEngineMonitor::EPEMessageValidEmergencyNumber: |
|
126 |
DialVoiceCallL(); |
|
127 |
break; |
|
128 |
||
129 |
case MEngineMonitor::EPEMessageAddedConferenceMember: |
|
130 |
HandleAddedConferenceMemberL( aCallId ); |
|
131 |
break; |
|
132 |
||
133 |
default: |
|
134 |
CPhoneConference::HandlePhoneEngineMessageL( aMessage, |
|
135 |
aCallId ); |
|
136 |
break; |
|
137 |
} |
|
138 |
} |
|
139 |
||
140 |
// ----------------------------------------------------------- |
|
141 |
// CPhoneConferenceAndSingle:HandleCommandL |
|
142 |
// ----------------------------------------------------------- |
|
143 |
// |
|
144 |
TBool CPhoneConferenceAndSingle::HandleCommandL( TInt aCommand ) |
|
145 |
{ |
|
146 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleCommandL"); |
|
147 |
TBool commandStatus = ETrue; |
|
148 |
switch( aCommand ) |
|
149 |
{ |
|
150 |
case EPhoneNumberAcqCmdCall: |
|
151 |
case EPhoneNumberAcqCmdSendCommand: |
|
152 |
HandleSendL(); |
|
153 |
break; |
|
154 |
||
155 |
case EAknSoftkeyCancel: |
|
156 |
commandStatus = CPhoneConference::HandleCommandL( aCommand ); |
|
157 |
SetTouchPaneButtons( EPhoneConferenceAndHeldSingleButtons ); |
|
158 |
break; |
|
159 |
||
160 |
case EPhoneInCallCmdJoin: |
|
161 |
iStateMachine->SendPhoneEngineMessage( |
|
162 |
CPEPhoneModelIF::EPEMessageAddConferenceMember ); |
|
163 |
break; |
|
164 |
||
165 |
case EPhoneInCallCmdParticipants: |
|
166 |
break; |
|
167 |
||
168 |
default: |
|
169 |
commandStatus = CPhoneConference::HandleCommandL( aCommand ); |
|
170 |
break; |
|
171 |
} |
|
172 |
return commandStatus; |
|
173 |
} |
|
174 |
||
175 |
// ----------------------------------------------------------- |
|
176 |
// CPhoneConferenceAndSingle::HandleConnectedConferenceL |
|
177 |
// ----------------------------------------------------------- |
|
178 |
// |
|
179 |
void CPhoneConferenceAndSingle::HandleConnectedConferenceL() |
|
180 |
{ |
|
181 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConnectedConferenceL"); |
|
182 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
183 |
callHeaderParam.SetCallState( EPEStateConnectedConference ); |
|
184 |
||
185 |
TBuf<KPhoneCallHeaderLabelMaxLength> conferenceText( KNullDesC ); |
|
186 |
TInt callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
187 |
ResolveResourceID( EPhoneCLIConferenceCall ); |
|
188 |
||
189 |
StringLoader::Load( |
|
190 |
conferenceText, |
|
191 |
callLabelId, |
|
192 |
CCoeEnv::Static() ); |
|
193 |
callHeaderParam.SetLabelText( conferenceText ); |
|
194 |
||
195 |
// Conference call is no longer on hold |
|
196 |
TPhoneCmdParamBoolean holdFlag; |
|
197 |
holdFlag.SetBoolean( EFalse ); |
|
198 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
199 |
||
200 |
BeginUiUpdateLC(); |
|
201 |
iViewCommandHandle->ExecuteCommandL( |
|
202 |
EPhoneViewUpdateBubble, KConferenceCallId, &callHeaderParam ); |
|
203 |
||
204 |
SetTouchPaneButtons( EPhoneConferenceAndHeldSingleButtons ); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
205 |
UpdateInCallCbaL(); |
65 | 206 |
EndUiUpdate(); |
37 | 207 |
} |
208 |
||
209 |
// ----------------------------------------------------------- |
|
210 |
// CPhoneConferenceAndSingle::HandleHeldConferenceL |
|
211 |
// |
|
212 |
// one of the calls is on hold all the time, conference or single call |
|
213 |
// ----------------------------------------------------------- |
|
214 |
// |
|
215 |
void CPhoneConferenceAndSingle::HandleHeldConferenceL() |
|
216 |
{ |
|
217 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleHeldConferenceL"); |
|
218 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
219 |
callHeaderParam.SetCallState( EPEStateHeldConference ); |
|
220 |
TInt callLabelId; |
|
221 |
TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC ); |
|
222 |
callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
223 |
ResolveResourceID( EPhoneCallOnHold ); |
|
224 |
StringLoader::Load( |
|
225 |
labelText, |
|
226 |
callLabelId, |
|
227 |
CCoeEnv::Static() ); |
|
228 |
callHeaderParam.SetLabelText( labelText ); |
|
229 |
BeginUiUpdateLC(); |
|
65 | 230 |
|
37 | 231 |
iViewCommandHandle->ExecuteCommandL( |
232 |
EPhoneViewUpdateBubble, KConferenceCallId, &callHeaderParam ); |
|
65 | 233 |
SetTouchPaneButtons( EPhoneConferenceAndSingleButtons ); |
234 |
||
235 |
EndUiUpdate(); |
|
37 | 236 |
} |
237 |
||
238 |
// ----------------------------------------------------------- |
|
239 |
// CPhoneConferenceAndSingle::HandleConnectedL |
|
240 |
// ----------------------------------------------------------- |
|
241 |
// |
|
242 |
void CPhoneConferenceAndSingle::HandleConnectedL( TInt aCallId ) |
|
243 |
{ |
|
244 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConnectedL"); |
|
245 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
246 |
callHeaderParam.SetCallState( EPEStateConnected ); |
|
247 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
248 |
&callHeaderParam ); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
249 |
UpdateInCallCbaL(); |
37 | 250 |
SetTouchPaneButtons( EPhoneConferenceButtons ); |
251 |
} |
|
252 |
||
253 |
// ----------------------------------------------------------- |
|
254 |
// CPhoneConferenceAndSingle::HandleHeldL |
|
255 |
// ----------------------------------------------------------- |
|
256 |
// |
|
257 |
void CPhoneConferenceAndSingle::HandleHeldL( TInt aCallId ) |
|
258 |
{ |
|
259 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleHeldL"); |
|
260 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
261 |
callHeaderParam.SetCallState( EPEStateHeld ); |
|
262 |
||
263 |
TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC ); |
|
264 |
TInt callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
265 |
ResolveResourceID( EPhoneCallOnHold ); |
|
266 |
StringLoader::Load( |
|
267 |
labelText, |
|
268 |
callLabelId, |
|
269 |
CCoeEnv::Static() ); |
|
270 |
callHeaderParam.SetLabelText( labelText ); |
|
271 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
65 | 272 |
&callHeaderParam ); |
37 | 273 |
SetTouchPaneButtons( EPhoneConferenceButtons ); |
274 |
} |
|
275 |
||
276 |
// ----------------------------------------------------------- |
|
277 |
// CPhoneConferenceAndSingle::HandleAddedConferenceMemberL |
|
278 |
// ----------------------------------------------------------- |
|
279 |
// |
|
280 |
void CPhoneConferenceAndSingle::HandleAddedConferenceMemberL( TInt aCallId ) |
|
281 |
{ |
|
282 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleAddedConferenceMemberL"); |
|
283 |
BeginUiUpdateLC(); |
|
284 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference ); |
|
285 |
UpdateConferenceSecurityStatusL( aCallId ); |
|
286 |
SetTouchPaneButtons( EPhoneConferenceButtons ); |
|
287 |
EndUiUpdate(); |
|
288 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
65 | 289 |
iStateMachine->ChangeState( EPhoneStateConference ); |
37 | 290 |
} |
291 |
||
292 |
// ----------------------------------------------------------- |
|
293 |
// CPhoneConferenceAndSingle::UpdateInCallCbaL |
|
294 |
// ----------------------------------------------------------- |
|
295 |
// |
|
296 |
void CPhoneConferenceAndSingle::UpdateInCallCbaL() |
|
297 |
{ |
|
298 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingle::UpdateInCallCbaL() "); |
|
299 |
UpdateCbaL ( EPhoneCallHandlingNewCallSwapCBA ); |
|
300 |
} |
|
301 |
||
302 |
// ----------------------------------------------------------- |
|
303 |
// CPhoneConferenceAndSingle::HandleIncomingL |
|
304 |
// ----------------------------------------------------------- |
|
305 |
// |
|
306 |
void CPhoneConferenceAndSingle::HandleIncomingL( TInt aCallId ) |
|
307 |
{ |
|
308 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
309 |
"CPhoneConferenceAndSingle::HandleIncomingL"); |
|
65 | 310 |
BeginUiUpdateLC(); |
37 | 311 |
|
312 |
TPhoneCmdParamBoolean dialerParam; |
|
313 |
dialerParam.SetBoolean( ETrue ); |
|
314 |
AllowShowingOfWaitingCallHeaderL( dialerParam ); |
|
315 |
||
316 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW ); |
|
317 |
||
318 |
CheckDisableHWKeysAndCallUIL(); |
|
319 |
DisplayIncomingCallL( aCallId, dialerParam ); |
|
320 |
SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
321 |
||
322 |
EndUiUpdate(); |
|
323 |
||
324 |
UpdateCbaL( EPhoneCallHandlingIncomingRejectCBA ); |
|
65 | 325 |
iStateMachine->ChangeState( EPhoneStateConferenceAndSingleAndWaiting ); |
37 | 326 |
} |
327 |
||
328 |
// ----------------------------------------------------------- |
|
329 |
// CPhoneConferenceAndSingle::HandleIdleL |
|
330 |
// ----------------------------------------------------------- |
|
331 |
// |
|
332 |
void CPhoneConferenceAndSingle::HandleIdleL( TInt aCallId ) |
|
333 |
{ |
|
334 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
335 |
"CPhoneConferenceAndSingle::HandleIdleL"); |
|
336 |
TPhoneCmdParamBoolean conferenceExistsForCallId; |
|
337 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference, |
|
338 |
aCallId, &conferenceExistsForCallId ); |
|
339 |
||
340 |
if( conferenceExistsForCallId.Boolean() ) |
|
341 |
{ |
|
342 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveFromConference, |
|
65 | 343 |
aCallId ); |
37 | 344 |
} |
345 |
else |
|
65 | 346 |
{ |
37 | 347 |
BeginUiUpdateLC(); |
348 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
50 | 349 |
SetTouchPaneButtons( EPhoneConferenceButtons ); |
350 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
37 | 351 |
EndUiUpdate(); |
352 |
iStateMachine->ChangeState( EPhoneStateConference ); |
|
353 |
} |
|
354 |
} |
|
355 |
||
356 |
// ----------------------------------------------------------- |
|
357 |
// CPhoneConferenceAndSingle::HandleConferenceIdleL |
|
358 |
// ----------------------------------------------------------- |
|
359 |
// |
|
360 |
void CPhoneConferenceAndSingle::HandleConferenceIdleL() |
|
361 |
{ |
|
362 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConferenceIdleL"); |
|
363 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveConferenceBubble ); |
|
364 |
TPhoneCmdParamInteger intParam; |
|
365 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCountOfActiveCalls, |
|
366 |
&intParam ); |
|
367 |
||
368 |
switch( intParam.Integer() ) |
|
369 |
{ |
|
370 |
case EOneActiveCall: |
|
371 |
MakeStateTransitionToSingleL(); |
|
372 |
break; |
|
373 |
||
374 |
case ETwoActiveCalls: // Fall through |
|
375 |
default: |
|
376 |
MakeStateTransitionToTwoSinglesL(); |
|
377 |
break; |
|
378 |
} |
|
379 |
} |
|
380 |
||
381 |
// -------------------------------------------------------------- |
|
382 |
// CPhoneConferenceAndSingle::HandleKeyMessageL |
|
383 |
// -------------------------------------------------------------- |
|
384 |
// |
|
385 |
void CPhoneConferenceAndSingle::HandleKeyMessageL( |
|
386 |
TPhoneKeyEventMessages aMessage, |
|
387 |
TKeyCode aCode ) |
|
388 |
{ |
|
389 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
390 |
"CPhoneConferenceAndSingle::HandleKeyMessageL()"); |
|
391 |
switch ( aCode ) |
|
392 |
{ |
|
65 | 393 |
case EKeyYes: // send-key |
37 | 394 |
if( IsNumberEntryVisibleL() ) |
395 |
{ |
|
396 |
HandleSendL(); |
|
397 |
} |
|
398 |
else |
|
399 |
{ |
|
400 |
iStateMachine->SendPhoneEngineMessage( |
|
65 | 401 |
CPEPhoneModelIF::EPEMessageSwap ); |
37 | 402 |
} |
403 |
break; |
|
404 |
||
405 |
default: |
|
406 |
CPhoneConference::HandleKeyMessageL( aMessage, aCode ); |
|
407 |
break; |
|
408 |
} |
|
409 |
} |
|
410 |
||
411 |
// -------------------------------------------------------------- |
|
412 |
// CPhoneConferenceAndSingle::HandleSendL |
|
413 |
// -------------------------------------------------------------- |
|
414 |
// |
|
415 |
void CPhoneConferenceAndSingle::HandleSendL() |
|
416 |
{ |
|
417 |
HBufC *phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize ); |
|
418 |
TPtr ptr( phoneNumber->Des() ); |
|
419 |
TPhoneCmdParamString stringParam; |
|
420 |
stringParam.SetString( &ptr ); |
|
421 |
iViewCommandHandle->ExecuteCommand( |
|
422 |
EPhoneViewGetNumberFromEntry, |
|
423 |
&stringParam ); |
|
424 |
iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ) ; |
|
425 |
||
426 |
if ( iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() || |
|
427 |
phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength ) |
|
65 | 428 |
{ |
37 | 429 |
CallFromNumberEntryL(); |
430 |
} |
|
431 |
else |
|
432 |
{ |
|
433 |
iStateMachine->SendPhoneEngineMessage( |
|
434 |
MPEPhoneModel::EPEMessageCheckEmergencyNumber ); |
|
435 |
} |
|
436 |
CleanupStack::PopAndDestroy( phoneNumber ); |
|
437 |
} |
|
438 |
||
439 |
// End of File |