author | hgs |
Fri, 15 Oct 2010 12:58:46 +0300 | |
changeset 78 | baacf668fe89 |
parent 76 | cfea66083b62 |
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 "cphonemainresourceresolver.h" |
|
31 |
#include "phonerssbase.h" |
|
32 |
#include "tphonecmdparamglobalnote.h" |
|
33 |
#include "phoneui.hrh" |
|
34 |
#include "mphonestorage.h" |
|
35 |
#include "cphonecenrepproxy.h" |
|
78 | 36 |
#include "phonecallutil.h" |
37 | 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(); |
|
74 | 129 |
UpdateUiCommands(); |
37 | 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 |
{ |
|
78 | 154 |
TInt callId = PhoneCallUtil::CallIdByState( EPEStateRinging ); |
155 |
if( callId >= 0 ) |
|
37 | 156 |
{ |
157 |
// We have Conference and Waiting calls left |
|
158 |
MakeStateTransitionToConferenceAndWaitingL( aCallId ); |
|
159 |
} |
|
160 |
else |
|
161 |
{ |
|
162 |
// We have Conference and Single calls left |
|
163 |
MakeStateTransitionToConferenceAndSingleL( aCallId ); |
|
164 |
} |
|
165 |
} |
|
166 |
} |
|
167 |
EndUiUpdate(); |
|
168 |
} |
|
169 |
||
170 |
// ----------------------------------------------------------- |
|
171 |
// CPhoneConferenceAndSingleAndWaiting::HandleAddedConferenceMemberL |
|
172 |
// ----------------------------------------------------------- |
|
173 |
// |
|
76 | 174 |
void CPhoneConferenceAndSingleAndWaiting::HandleAddedConferenceMemberL( TInt /*aCallId*/ ) |
37 | 175 |
{ |
176 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingleAndWaiting::HandleAddedConferenceMemberL"); |
|
177 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference ); |
|
76 | 178 |
UpdateConferenceSecurityStatusL(); |
37 | 179 |
MakeStateTransitionToConferenceAndWaitingL( KConferenceCallId ); |
180 |
} |
|
181 |
||
182 |
// ----------------------------------------------------------- |
|
183 |
// CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndWaitingL |
|
184 |
// ----------------------------------------------------------- |
|
185 |
// |
|
186 |
void CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndWaitingL( TInt /*aCallId*/ ) |
|
187 |
{ |
|
188 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
189 |
"CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndWaitingL()"); |
|
74 | 190 |
UpdateUiCommands(); |
37 | 191 |
iStateMachine->ChangeState( EPhoneStateConferenceAndWaiting ); |
192 |
} |
|
193 |
||
194 |
// ----------------------------------------------------------- |
|
195 |
// CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndSingleL |
|
196 |
// ----------------------------------------------------------- |
|
197 |
// |
|
65 | 198 |
void CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndSingleL( |
199 |
TInt /*aCallId*/ ) |
|
37 | 200 |
{ |
201 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
202 |
"CPhoneConferenceAndSingleAndWaiting::MakeStateTransitionToConferenceAndSingleL()"); |
|
74 | 203 |
iNumberEntryManager->SetVisibilityIfNumberEntryUsedL( ETrue ); |
204 |
UpdateUiCommands(); |
|
37 | 205 |
iStateMachine->ChangeState( EPhoneStateConferenceAndSingle ); |
206 |
} |
|
207 |
||
208 |
// ----------------------------------------------------------- |
|
209 |
// CPhoneConferenceAndSingleAndWaiting::HandleConferenceIdleL |
|
210 |
// ----------------------------------------------------------- |
|
211 |
// |
|
212 |
void CPhoneConferenceAndSingleAndWaiting::HandleConferenceIdleL() |
|
213 |
{ |
|
214 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
215 |
"CPhoneConferenceAndSingleAndWaiting::HandleConferenceIdleL()"); |
|
216 |
BeginUiUpdateLC(); |
|
217 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveConferenceBubble ); |
|
218 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs ); |
|
219 |
MakeTransitionAccordingToActiveCallsL(); |
|
220 |
EndUiUpdate(); |
|
221 |
} |
|
222 |
||
223 |
// -------------------------------------------------------------- |
|
224 |
// CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL |
|
225 |
// -------------------------------------------------------------- |
|
226 |
// |
|
227 |
void CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL( |
|
228 |
TPhoneKeyEventMessages aMessage, |
|
229 |
TKeyCode aCode ) |
|
230 |
{ |
|
231 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
232 |
"CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL()"); |
|
233 |
switch ( aCode ) |
|
234 |
{ |
|
65 | 235 |
case EKeyYes: // send-key |
74 | 236 |
if( iNumberEntryManager->IsNumberEntryVisibleL() ) |
37 | 237 |
{ |
74 | 238 |
iNumberEntryManager->CallFromNumberEntryL(); |
37 | 239 |
} |
240 |
else |
|
241 |
{ |
|
242 |
SendGlobalWarningNoteL( |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
243 |
EPhoneNoteTextCallNotAllowed, ETrue ); |
37 | 244 |
} |
245 |
break; |
|
246 |
||
247 |
default: |
|
248 |
CPhoneConferenceAndSingle::HandleKeyMessageL( aMessage, aCode ); |
|
249 |
break; |
|
250 |
} |
|
251 |
} |
|
252 |
||
253 |
// ----------------------------------------------------------- |
|
254 |
// CPhoneConferenceAndSingleAndWaiting::MakeTransitionAccordingToActiveCallsL |
|
255 |
// ----------------------------------------------------------- |
|
256 |
// |
|
257 |
void CPhoneConferenceAndSingleAndWaiting::MakeTransitionAccordingToActiveCallsL() |
|
258 |
{ |
|
259 |
TPhoneCmdParamInteger activeCallCount; |
|
260 |
iViewCommandHandle->ExecuteCommandL( |
|
261 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount ); |
|
262 |
switch( activeCallCount.Integer() ) |
|
263 |
{ |
|
264 |
case ENoActiveCalls: // Go to incoming state |
|
265 |
{ |
|
78 | 266 |
TInt callId = PhoneCallUtil::CallIdByState( EPEStateRinging ); |
267 |
if ( callId != KErrNotFound ) |
|
37 | 268 |
{ |
78 | 269 |
SetRingingTonePlaybackL( callId ); |
270 |
UpdateCallHeaderAndUiCommandsL( callId ); |
|
37 | 271 |
SetBackButtonActive(EFalse); |
272 |
iStateMachine->ChangeState( EPhoneStateIncoming ); |
|
273 |
} |
|
274 |
else |
|
275 |
{ |
|
276 |
SetDefaultFlagsL(); |
|
277 |
iStateMachine->ChangeState( EPhoneStateIdle ); |
|
278 |
} |
|
279 |
} |
|
280 |
break; |
|
65 | 281 |
case EOneActiveCall: // Go to Single And Waiting state |
37 | 282 |
{ |
74 | 283 |
UpdateUiCommands(); |
37 | 284 |
iStateMachine->ChangeState( EPhoneStateWaitingInSingle ); |
285 |
} |
|
286 |
break; |
|
65 | 287 |
case ETwoActiveCalls: // Go to Two Singles And Waiting state |
37 | 288 |
{ |
74 | 289 |
UpdateUiCommands(); |
37 | 290 |
iStateMachine->ChangeState( EPhoneStateTwoSinglesAndWaiting ); |
291 |
} |
|
292 |
break; |
|
293 |
default: |
|
294 |
// Too many active calls to handle reliable state change now. |
|
295 |
// Waiting for all conference member idles |
|
296 |
// This case may happen when 'End all calls' because conferenceIdle may |
|
297 |
// come earlier than idle for conference member |
|
298 |
break; |
|
299 |
} |
|
300 |
||
301 |
} |
|
302 |
||
303 |
// End of File |