37
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-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 CPhoneConferenceAndWaitingAndCallSetup class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <StringLoader.h>
|
|
21 |
#include <cpephonemodelif.h>
|
|
22 |
#include "cphoneconferenceandwaitingandcallsetup.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 |
|
|
36 |
// ================= MEMBER FUNCTIONS =======================
|
|
37 |
|
|
38 |
// C++ default constructor can NOT contain any code, that
|
|
39 |
// might leave.
|
|
40 |
//
|
|
41 |
CPhoneConferenceAndWaitingAndCallSetup::CPhoneConferenceAndWaitingAndCallSetup(
|
|
42 |
MPhoneStateMachine* aStateMachine,
|
|
43 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
44 |
MPhoneCustomization* aPhoneCustomization ) :
|
|
45 |
CPhoneConference( aStateMachine, aViewCommandHandle, aPhoneCustomization )
|
|
46 |
{
|
|
47 |
}
|
|
48 |
|
|
49 |
// -----------------------------------------------------------
|
|
50 |
// CPhoneConferenceAndWaitingAndCallSetup::~CPhoneConferenceAndWaitingAndCallSetup()
|
|
51 |
// Destructor
|
|
52 |
// (other items were commented in a header).
|
|
53 |
// -----------------------------------------------------------
|
|
54 |
//
|
|
55 |
CPhoneConferenceAndWaitingAndCallSetup::~CPhoneConferenceAndWaitingAndCallSetup()
|
|
56 |
{
|
|
57 |
}
|
|
58 |
|
|
59 |
// -----------------------------------------------------------
|
|
60 |
// CPhoneConferenceAndWaitingAndCallSetup::ConstructL()
|
|
61 |
// Constructor
|
|
62 |
// (other items were commented in a header).
|
|
63 |
// -----------------------------------------------------------
|
|
64 |
//
|
|
65 |
void CPhoneConferenceAndWaitingAndCallSetup::ConstructL()
|
|
66 |
{
|
|
67 |
CPhoneConference::ConstructL();
|
|
68 |
}
|
|
69 |
|
|
70 |
// -----------------------------------------------------------
|
|
71 |
// CPhoneConferenceAndWaitingAndCallSetup::NewL()
|
|
72 |
// Constructor
|
|
73 |
// (other items were commented in a header).
|
|
74 |
// -----------------------------------------------------------
|
|
75 |
//
|
|
76 |
CPhoneConferenceAndWaitingAndCallSetup* CPhoneConferenceAndWaitingAndCallSetup::NewL(
|
|
77 |
MPhoneStateMachine* aStateMachine,
|
|
78 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
79 |
MPhoneCustomization* aPhoneCustomization )
|
|
80 |
{
|
|
81 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
82 |
"CPhoneConferenceAndWaitingAndCallSetup::NewL");
|
|
83 |
CPhoneConferenceAndWaitingAndCallSetup* self =
|
|
84 |
new( ELeave ) CPhoneConferenceAndWaitingAndCallSetup(
|
|
85 |
aStateMachine, aViewCommandHandle, aPhoneCustomization );
|
|
86 |
|
|
87 |
CleanupStack::PushL( self );
|
|
88 |
self->ConstructL();
|
|
89 |
CleanupStack::Pop( self );
|
|
90 |
|
|
91 |
return self;
|
|
92 |
}
|
|
93 |
|
|
94 |
// -----------------------------------------------------------
|
|
95 |
// CPhoneConferenceAndWaitingAndCallSetup::HandlePhoneEngineMessageL
|
|
96 |
// -----------------------------------------------------------
|
|
97 |
//
|
|
98 |
void CPhoneConferenceAndWaitingAndCallSetup::HandlePhoneEngineMessageL(
|
|
99 |
const TInt aMessage,
|
|
100 |
TInt aCallId )
|
|
101 |
{
|
|
102 |
__LOGMETHODSTARTEND(EPhoneControl,
|
|
103 |
"CPhoneConferenceAndWaitingAndCallSetup::HandlePhoneEngineMessageL()");
|
|
104 |
switch ( aMessage )
|
|
105 |
{
|
|
106 |
case MEngineMonitor::EPEMessageConnecting:
|
|
107 |
iAlerting = ETrue;
|
|
108 |
HandleConnectingL( aCallId );
|
|
109 |
break;
|
|
110 |
|
|
111 |
case MEngineMonitor::EPEMessageConnected:
|
|
112 |
HandleConnectedL( aCallId );
|
|
113 |
break;
|
|
114 |
|
|
115 |
case MEngineMonitor::EPEMessageConferenceIdle:
|
|
116 |
HandleConferenceIdleL();
|
|
117 |
break;
|
|
118 |
|
|
119 |
case MEngineMonitor::EPEMessageIdle:
|
|
120 |
HandleIdleL( aCallId );
|
|
121 |
break;
|
|
122 |
|
|
123 |
default:
|
|
124 |
CPhoneConference::HandlePhoneEngineMessageL( aMessage,
|
|
125 |
aCallId );
|
|
126 |
break;
|
|
127 |
}
|
|
128 |
}
|
|
129 |
|
|
130 |
// -----------------------------------------------------------
|
|
131 |
// CPhoneConferenceAndWaitingAndCallSetup::HandleCommandL
|
|
132 |
// -----------------------------------------------------------
|
|
133 |
//
|
|
134 |
TBool CPhoneConferenceAndWaitingAndCallSetup::HandleCommandL( TInt aCommand )
|
|
135 |
{
|
|
136 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
137 |
"CPhoneConferenceAndWaitingAndCallSetup::HandleCommandL()");
|
|
138 |
TBool commandStatus = ETrue;
|
65
|
139 |
commandStatus = CPhoneConference::HandleCommandL( aCommand );
|
37
|
140 |
return commandStatus;
|
|
141 |
}
|
|
142 |
|
|
143 |
// --------------------------------------------------------------
|
|
144 |
// CPhoneConferenceAndWaitingAndCallSetup::HandleKeyMessageL
|
|
145 |
// --------------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CPhoneConferenceAndWaitingAndCallSetup::HandleKeyMessageL(
|
|
148 |
TPhoneKeyEventMessages aMessage,
|
|
149 |
TKeyCode aCode )
|
|
150 |
{
|
|
151 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
152 |
"CPhoneConferenceAndWaitingAndCallSetup::HandleKeyMessageL");
|
|
153 |
switch ( aCode )
|
|
154 |
{
|
65
|
155 |
case EKeyYes: // send-key
|
74
|
156 |
if( iNumberEntryManager->IsNumberEntryVisibleL() )
|
37
|
157 |
{
|
74
|
158 |
iNumberEntryManager->CallFromNumberEntryL();
|
37
|
159 |
}
|
|
160 |
else
|
|
161 |
{
|
|
162 |
// Number entry is behind waiting call bubble.
|
|
163 |
// We can't answer to call in this state so display
|
|
164 |
// Not allowed -note.
|
|
165 |
SendGlobalErrorNoteL(
|
65
|
166 |
EPhoneNoteTextNotAllowed, ETrue );
|
37
|
167 |
}
|
|
168 |
break;
|
|
169 |
|
|
170 |
default:
|
|
171 |
CPhoneConference::HandleKeyMessageL( aMessage, aCode );
|
|
172 |
break;
|
|
173 |
}
|
|
174 |
}
|
|
175 |
|
|
176 |
// -----------------------------------------------------------
|
|
177 |
// CPhoneConferenceAndWaitingAndCallSetup::HandleConnectingL
|
|
178 |
// -----------------------------------------------------------
|
|
179 |
//
|
|
180 |
void CPhoneConferenceAndWaitingAndCallSetup::HandleConnectingL( TInt aCallId )
|
|
181 |
{
|
|
182 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
183 |
"CPhoneConferenceAndWaitingAndCallSetup::HandleConnectingL");
|
|
184 |
BeginUiUpdateLC();
|
|
185 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveGlobalNote );
|
65
|
186 |
|
37
|
187 |
TPhoneCmdParamBoolean globalNotifierParam;
|
|
188 |
globalNotifierParam.SetBoolean( EFalse );
|
|
189 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
|
|
190 |
&globalNotifierParam );
|
|
191 |
|
76
|
192 |
UpdateCallHeaderAndUiCommandsL( aCallId );
|
37
|
193 |
|
74
|
194 |
iNumberEntryManager->RemoveNumberEntryIfVisibilityIsFalseL();
|
37
|
195 |
EndUiUpdate();
|
|
196 |
}
|
|
197 |
|
|
198 |
// -----------------------------------------------------------
|
|
199 |
// CPhoneConferenceAndWaitingAndCallSetup::HandleConnectedL
|
|
200 |
// -----------------------------------------------------------
|
|
201 |
//
|
|
202 |
void CPhoneConferenceAndWaitingAndCallSetup::HandleConnectedL( TInt aCallId )
|
|
203 |
{
|
|
204 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
205 |
"CPhoneConferenceAndWaitingAndCallSetup::HandleConnectedL");
|
|
206 |
BeginUiUpdateLC();
|
76
|
207 |
|
|
208 |
UpdateCallHeader( aCallId );
|
37
|
209 |
|
74
|
210 |
iNumberEntryManager->RemoveNumberEntryIfVisibilityIsFalseL();
|
37
|
211 |
|
74
|
212 |
UpdateUiCommands();
|
37
|
213 |
EndUiUpdate();
|
65
|
214 |
iStateMachine->ChangeState( EPhoneStateConferenceAndSingleAndWaiting );
|
37
|
215 |
}
|
|
216 |
|
|
217 |
// -----------------------------------------------------------
|
|
218 |
// CPhoneConferenceAndWaitingAndCallSetup::UpdateConnectingCbaL
|
|
219 |
// -----------------------------------------------------------
|
|
220 |
//
|
|
221 |
void CPhoneConferenceAndWaitingAndCallSetup::UpdateConnectingCbaL()
|
|
222 |
{
|
|
223 |
__LOGMETHODSTARTEND(EPhoneControl,
|
74
|
224 |
"CPhoneConferenceAndCallSetup::UpdateConnectingCbaL() ");
|
|
225 |
UpdateUiCommands();
|
37
|
226 |
}
|
|
227 |
|
|
228 |
// -----------------------------------------------------------
|
|
229 |
// CPhoneConferenceAndWaitingAndCallSetup::HandleConferenceIdleL
|
|
230 |
// -----------------------------------------------------------
|
|
231 |
//
|
|
232 |
void CPhoneConferenceAndWaitingAndCallSetup::HandleConferenceIdleL()
|
|
233 |
{
|
|
234 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
235 |
"CPhoneConferenceAndWaitingAndCallSetup::HandleConferenceIdleL");
|
|
236 |
BeginUiUpdateLC();
|
|
237 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveConferenceBubble );
|
74
|
238 |
iNumberEntryManager->SetVisibilityIfNumberEntryUsedL(ETrue);
|
37
|
239 |
|
|
240 |
TPhoneCmdParamCallStateData callStateData;
|
|
241 |
callStateData.SetCallState( EPEStateConnected );
|
|
242 |
iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState,
|
|
243 |
&callStateData );
|
|
244 |
|
65
|
245 |
if( callStateData.CallId() > KErrNotFound ) // No need update cba's.
|
37
|
246 |
{
|
74
|
247 |
UpdateUiCommands();
|
37
|
248 |
iStateMachine->ChangeState( EPhoneStateSingleAndCallSetupAndWaiting );
|
|
249 |
}
|
|
250 |
else
|
|
251 |
{
|
|
252 |
callStateData.SetCallState( EPEStateHeld );
|
|
253 |
iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState,
|
|
254 |
&callStateData );
|
65
|
255 |
|
74
|
256 |
UpdateUiCommands();
|
|
257 |
|
37
|
258 |
if( callStateData.CallId() > KErrNotFound )
|
74
|
259 |
{
|
37
|
260 |
iStateMachine->ChangeState( EPhoneStateSingleAndCallSetupAndWaiting );
|
|
261 |
}
|
|
262 |
else
|
|
263 |
{
|
|
264 |
iStateMachine->ChangeState( EPhoneStateCallSetupAndWaiting );
|
|
265 |
}
|
|
266 |
}
|
65
|
267 |
EndUiUpdate();
|
37
|
268 |
}
|
|
269 |
|
|
270 |
// -----------------------------------------------------------
|
|
271 |
// CPhoneConferenceAndWaitingAndCallSetup::HandleIdleL
|
|
272 |
// -----------------------------------------------------------
|
|
273 |
//
|
|
274 |
void CPhoneConferenceAndWaitingAndCallSetup::HandleIdleL( TInt aCallId )
|
|
275 |
{
|
|
276 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
65
|
277 |
"CPhoneConferenceAndWaitingAndCallSetup::HandleIdleL");
|
37
|
278 |
TPhoneCmdParamBoolean globalNotifierParam;
|
|
279 |
globalNotifierParam.SetBoolean( EFalse );
|
|
280 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
|
|
281 |
&globalNotifierParam );
|
|
282 |
|
|
283 |
TPhoneCmdParamBoolean conferenceExistsForCallId;
|
|
284 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference,
|
|
285 |
aCallId, &conferenceExistsForCallId );
|
|
286 |
|
|
287 |
if( conferenceExistsForCallId.Boolean() )
|
|
288 |
{
|
65
|
289 |
iViewCommandHandle->ExecuteCommandL(
|
|
290 |
EPhoneViewRemoveFromConference,
|
|
291 |
aCallId );
|
37
|
292 |
return;
|
|
293 |
}
|
|
294 |
else
|
|
295 |
{
|
|
296 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
|
|
297 |
|
|
298 |
TPhoneCmdParamBoolean conferenceBubbleExists;
|
|
299 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetIsConference,
|
65
|
300 |
&conferenceBubbleExists );
|
37
|
301 |
if( !conferenceBubbleExists.Boolean() )
|
|
302 |
{
|
|
303 |
// Idle message came for last conference member.
|
|
304 |
// Don't do anything, wait for ConferenceIdle message
|
65
|
305 |
}
|
37
|
306 |
else
|
|
307 |
{
|
|
308 |
BeginUiUpdateLC();
|
|
309 |
TPhoneCmdParamCallStateData callStateData;
|
|
310 |
callStateData.SetCallState( EPEStateRinging );
|
|
311 |
iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState,
|
|
312 |
&callStateData );
|
|
313 |
if( callStateData.CallId() > KErrNotFound )
|
65
|
314 |
{
|
74
|
315 |
// Show the number entry if callsetup failed with number busy
|
|
316 |
// etc reason.
|
|
317 |
iNumberEntryManager->SetVisibilityIfNumberEntryUsedL(ETrue);
|
|
318 |
UpdateUiCommands();
|
37
|
319 |
iStateMachine->ChangeState( EPhoneStateConferenceAndWaiting );
|
|
320 |
}
|
|
321 |
else
|
|
322 |
{
|
74
|
323 |
UpdateUiCommands();
|
37
|
324 |
iStateMachine->ChangeState( EPhoneStateConferenceAndCallSetup );
|
|
325 |
}
|
65
|
326 |
EndUiUpdate();
|
37
|
327 |
}
|
|
328 |
}
|
|
329 |
}
|
|
330 |
|
|
331 |
// End of File
|