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 CPhoneAlerting class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <pevirtualengine.h>
|
|
21 |
#include <mpeengineinfo.h>
|
|
22 |
#include <mpeclientinformation.h>
|
|
23 |
#include <MediatorDomainUIDs.h>
|
|
24 |
#include "cphonealerting.h"
|
|
25 |
#include "mphonestatemachine.h"
|
|
26 |
#include "tphonecmdparamboolean.h"
|
|
27 |
#include "tphonecmdparaminteger.h"
|
|
28 |
#include "tphonecmdparamcallstatedata.h"
|
|
29 |
#include "phoneviewcommanddefinitions.h"
|
|
30 |
#include "phoneui.hrh"
|
|
31 |
#include "cphonemainresourceresolver.h"
|
|
32 |
#include "phonerssbase.h"
|
|
33 |
#include "phonestatedefinitionsgsm.h"
|
|
34 |
#include "phonelogger.h"
|
|
35 |
#include "phoneconstants.h"
|
|
36 |
#include "cphonemediatorfactory.h"
|
|
37 |
#include "cphonemediatorsender.h"
|
|
38 |
|
|
39 |
|
|
40 |
// ================= MEMBER FUNCTIONS =======================
|
|
41 |
|
|
42 |
// C++ default constructor can NOT contain any code, that
|
|
43 |
// might leave.
|
|
44 |
//
|
|
45 |
EXPORT_C CPhoneAlerting::CPhoneAlerting(
|
|
46 |
MPhoneStateMachine* aStateMachine,
|
|
47 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
48 |
MPhoneCustomization* aPhoneCustomization ) :
|
|
49 |
CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization ),
|
|
50 |
iIncomingCallId( KErrNotFound )
|
|
51 |
{
|
|
52 |
}
|
|
53 |
|
|
54 |
// -----------------------------------------------------------
|
|
55 |
// CPhoneAlerting::~CPhoneAlerting()
|
|
56 |
// Destructor
|
|
57 |
// (other items were commented in a header).
|
|
58 |
// -----------------------------------------------------------
|
|
59 |
//
|
|
60 |
EXPORT_C CPhoneAlerting::~CPhoneAlerting()
|
|
61 |
{
|
|
62 |
}
|
|
63 |
|
|
64 |
// -----------------------------------------------------------
|
|
65 |
// CPhoneAlerting::ConstructL()
|
|
66 |
// Constructor
|
|
67 |
// (other items were commented in a header).
|
|
68 |
// -----------------------------------------------------------
|
|
69 |
//
|
|
70 |
EXPORT_C void CPhoneAlerting::ConstructL()
|
|
71 |
{
|
|
72 |
CPhoneGsmInCall::ConstructL();
|
|
73 |
}
|
|
74 |
|
|
75 |
// -----------------------------------------------------------
|
|
76 |
// CPhoneAlerting::NewL()
|
|
77 |
// Constructor
|
|
78 |
// (other items were commented in a header).
|
|
79 |
// -----------------------------------------------------------
|
|
80 |
//
|
|
81 |
CPhoneAlerting* CPhoneAlerting::NewL(
|
|
82 |
MPhoneStateMachine* aStateMachine,
|
|
83 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
84 |
MPhoneCustomization* aPhoneCustomization )
|
|
85 |
{
|
|
86 |
CPhoneAlerting* self = new( ELeave ) CPhoneAlerting(
|
|
87 |
aStateMachine, aViewCommandHandle, aPhoneCustomization );
|
|
88 |
|
|
89 |
CleanupStack::PushL( self );
|
|
90 |
self->ConstructL();
|
|
91 |
CleanupStack::Pop( self );
|
|
92 |
|
|
93 |
return self;
|
|
94 |
}
|
|
95 |
|
|
96 |
// --------------------------------------------------------------
|
|
97 |
// CPhoneAlerting::HandleKeyMessageL
|
|
98 |
// --------------------------------------------------------------
|
|
99 |
//
|
|
100 |
EXPORT_C void CPhoneAlerting::HandleKeyMessageL(
|
|
101 |
TPhoneKeyEventMessages aMessage,
|
|
102 |
TKeyCode aCode )
|
|
103 |
{
|
|
104 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
105 |
"CPhoneAlerting::HandleKeyMessageL()");
|
|
106 |
switch ( aCode )
|
|
107 |
{
|
|
108 |
// send-key
|
|
109 |
case EKeyYes:
|
|
110 |
if ( IsNumberEntryUsedL() )
|
|
111 |
{
|
|
112 |
// send a manual control sequence
|
|
113 |
CallFromNumberEntryL();
|
|
114 |
}
|
|
115 |
else
|
|
116 |
{
|
|
117 |
// Show not allowed note
|
|
118 |
SendGlobalErrorNoteL(
|
|
119 |
EPhoneNoteTextNotAllowed );
|
|
120 |
}
|
|
121 |
break;
|
|
122 |
|
|
123 |
// end-key
|
|
124 |
case EKeyNo:
|
|
125 |
// handle long press
|
|
126 |
if ( aMessage == EPhoneKeyLongPress )
|
|
127 |
{
|
|
128 |
// Close all connections
|
|
129 |
iStateMachine->SendPhoneEngineMessage(
|
|
130 |
MPEPhoneModel::EPEMessageTerminateAllConnections );
|
|
131 |
|
|
132 |
if ( IsNumberEntryUsedL() )
|
|
133 |
{
|
|
134 |
BeginTransEffectLC( ENumberEntryClose );
|
|
135 |
// Remove number entry from screen
|
|
136 |
iViewCommandHandle->ExecuteCommandL(
|
|
137 |
EPhoneViewRemoveNumberEntry );
|
|
138 |
EndTransEffect();
|
|
139 |
// Do state-specific operation when number entry is cleared
|
|
140 |
HandleNumberEntryClearedL();
|
|
141 |
}
|
|
142 |
if ( !TopAppIsDisplayedL() )
|
|
143 |
{
|
|
144 |
// Bring app to foreground
|
|
145 |
TPhoneCmdParamInteger uidParam;
|
|
146 |
uidParam.SetInteger( KUidPhoneApplication.iUid );
|
|
147 |
iViewCommandHandle->ExecuteCommandL(
|
|
148 |
EPhoneViewBringAppToForeground, &uidParam );
|
|
149 |
}
|
|
150 |
}
|
|
151 |
else
|
|
152 |
{
|
|
153 |
// handle end key
|
|
154 |
DisconnectOutgoingCallL();
|
|
155 |
}
|
|
156 |
break;
|
|
157 |
|
|
158 |
default:
|
|
159 |
// do base operation
|
|
160 |
CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
|
|
161 |
break;
|
|
162 |
}
|
|
163 |
}
|
|
164 |
|
|
165 |
// -----------------------------------------------------------
|
|
166 |
// CPhoneAlerting::HandlePhoneEngineMessageL
|
|
167 |
// -----------------------------------------------------------
|
|
168 |
//
|
|
169 |
EXPORT_C void CPhoneAlerting::HandlePhoneEngineMessageL(
|
|
170 |
const TInt aMessage,
|
|
171 |
TInt aCallId )
|
|
172 |
{
|
|
173 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
174 |
"CPhoneAlerting::HandlePhoneEngineMessageL()");
|
|
175 |
|
|
176 |
switch ( aMessage )
|
|
177 |
{
|
|
178 |
case MEngineMonitor::EPEMessageConnected:
|
|
179 |
HandleConnectedL( aCallId );
|
|
180 |
break;
|
|
181 |
|
|
182 |
case MEngineMonitor::EPEMessageDisconnecting:
|
|
183 |
HandleDisconnectingL( aCallId );
|
|
184 |
break;
|
|
185 |
|
|
186 |
case MEngineMonitor::EPEMessageRemoteTerminated:
|
|
187 |
iViewCommandHandle->ExecuteCommandL(
|
|
188 |
EPhoneViewHideNaviPaneAudioVolume );
|
|
189 |
CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
|
|
190 |
break;
|
|
191 |
|
|
192 |
case MEngineMonitor::EPEMessageIncoming:
|
|
193 |
{
|
|
194 |
// If incoming message is received in alerting state, teardown of
|
|
195 |
// alerting call must be ongoing. Handling of the incoming call is
|
|
196 |
// buffered until first call teardown is completed.
|
|
197 |
iIncomingCallId = aCallId;
|
|
198 |
}
|
|
199 |
break;
|
|
200 |
|
|
201 |
case MEngineMonitor::EPEMessageIdle:
|
|
202 |
{
|
|
203 |
if ( KErrNotFound < iIncomingCallId )
|
|
204 |
{
|
|
205 |
TInt incomingCallId = iIncomingCallId;
|
|
206 |
iIncomingCallId = KErrNotFound;
|
|
207 |
|
|
208 |
if ( aCallId != incomingCallId )
|
|
209 |
{
|
|
210 |
CPhoneGsmInCall::HandlePhoneEngineMessageL(
|
|
211 |
aMessage, aCallId );
|
|
212 |
|
|
213 |
// Simulate incoming event which was received while
|
|
214 |
// teardown of first call was ongoing.
|
|
215 |
iStateMachine->State()->HandlePhoneEngineMessageL(
|
|
216 |
MEngineMonitor::EPEMessageIncoming, incomingCallId );
|
|
217 |
}
|
|
218 |
|
|
219 |
return;
|
|
220 |
}
|
|
221 |
}
|
|
222 |
break;
|
|
223 |
|
|
224 |
default:
|
|
225 |
break;
|
|
226 |
}
|
|
227 |
|
|
228 |
CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
|
|
229 |
}
|
|
230 |
|
|
231 |
// -----------------------------------------------------------
|
|
232 |
// CPhoneAlerting::HandleConnectedL
|
|
233 |
// -----------------------------------------------------------
|
|
234 |
//
|
|
235 |
EXPORT_C void CPhoneAlerting::HandleConnectedL( TInt aCallId )
|
|
236 |
{
|
|
237 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
238 |
"CPhoneAlerting::HandleConnectedL()");
|
|
239 |
// Keep Phone in the foreground
|
|
240 |
TPhoneCmdParamBoolean booleanParam;
|
|
241 |
booleanParam.SetBoolean( EFalse );
|
|
242 |
iViewCommandHandle->ExecuteCommandL(
|
|
243 |
EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
|
|
244 |
|
|
245 |
// Close menu bar, if it is displayed
|
|
246 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
|
|
247 |
|
|
248 |
BeginUiUpdateLC();
|
|
249 |
|
|
250 |
// Update the single call
|
|
251 |
UpdateSingleActiveCallL( aCallId );
|
|
252 |
|
|
253 |
SetTouchPaneButtons( EPhoneIncallButtons );
|
|
254 |
|
|
255 |
SetToolbarDimming( EFalse );
|
|
256 |
|
|
257 |
EndUiUpdate();
|
|
258 |
|
|
259 |
HandleColpNoteL( aCallId );
|
|
260 |
|
|
261 |
// Go to single state
|
|
262 |
UpdateCbaL( EPhoneCallHandlingInCallCBA );
|
|
263 |
iStateMachine->ChangeState( EPhoneStateSingle );
|
|
264 |
}
|
|
265 |
|
|
266 |
// -----------------------------------------------------------
|
|
267 |
// CPhoneAlerting::OpenMenuBarL
|
|
268 |
// -----------------------------------------------------------
|
|
269 |
//
|
|
270 |
EXPORT_C void CPhoneAlerting::OpenMenuBarL()
|
|
271 |
{
|
|
272 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
273 |
"CPhoneAlerting::OpenMenuBarL()");
|
|
274 |
TInt resourceId;
|
|
275 |
|
|
276 |
if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
|
|
277 |
{
|
|
278 |
resourceId = EPhoneDtmfDialerMenubar;
|
|
279 |
}
|
|
280 |
else if ( IsNumberEntryVisibleL() )
|
|
281 |
{
|
|
282 |
resourceId = EPhoneAlertingCallMenubarWithNumberEntry;
|
|
283 |
}
|
|
284 |
// Use different resources for alerting data, video and cs call
|
|
285 |
else if( IsVideoCallAlertingL() )
|
|
286 |
{
|
|
287 |
resourceId = EPhoneAlertingVideoCallMenubar;
|
|
288 |
}
|
|
289 |
else
|
|
290 |
{
|
|
291 |
resourceId = EPhoneAlertingCallMenubar;
|
|
292 |
}
|
|
293 |
|
|
294 |
TPhoneCmdParamInteger integerParam;
|
|
295 |
integerParam.SetInteger(
|
|
296 |
CPhoneMainResourceResolver::Instance()->
|
|
297 |
ResolveResourceID( resourceId ) );
|
|
298 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen,
|
|
299 |
&integerParam );
|
|
300 |
}
|
|
301 |
|
|
302 |
// -----------------------------------------------------------
|
|
303 |
// CPhoneAlerting::HandleCommandL
|
|
304 |
// -----------------------------------------------------------
|
|
305 |
//
|
|
306 |
EXPORT_C TBool CPhoneAlerting::HandleCommandL( TInt aCommand )
|
|
307 |
{
|
|
308 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
309 |
"CPhoneAlerting::HandleCommandL()" );
|
|
310 |
TBool commandStatus = ETrue;
|
|
311 |
|
|
312 |
switch( aCommand )
|
|
313 |
{
|
|
314 |
case EPhoneInCallCmdHelp:
|
|
315 |
{
|
|
316 |
TPtrC contextName;
|
|
317 |
if ( IsVideoCallAlertingL() )
|
|
318 |
{
|
|
319 |
contextName.Set( KINCAL_HLP_VIDEOCALL() );
|
|
320 |
}
|
|
321 |
else
|
|
322 |
{
|
|
323 |
contextName.Set( KINCAL_HLP_CALL_HANDLING() );
|
|
324 |
}
|
|
325 |
iViewCommandHandle->ExecuteCommandL(
|
|
326 |
EPhoneViewLaunchHelpApplication, 0, contextName );
|
|
327 |
}
|
|
328 |
break;
|
|
329 |
default:
|
|
330 |
commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
|
|
331 |
break;
|
|
332 |
}
|
|
333 |
return commandStatus;
|
|
334 |
}
|
|
335 |
|
|
336 |
// -----------------------------------------------------------
|
|
337 |
// CPhoneAlerting::IsVideoCallAlertingL
|
|
338 |
// -----------------------------------------------------------
|
|
339 |
//
|
|
340 |
TBool CPhoneAlerting::IsVideoCallAlertingL()
|
|
341 |
{
|
|
342 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
343 |
"CPhoneAlerting::IsVideoCallAlerting()" );
|
|
344 |
TBool retVal = EFalse;
|
|
345 |
// Fetch active call's id from view
|
|
346 |
TPhoneCmdParamCallStateData callStateData;
|
|
347 |
callStateData.SetCallState( EPEStateConnecting );
|
|
348 |
iViewCommandHandle->HandleCommandL(
|
|
349 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
350 |
|
|
351 |
if ( callStateData.CallId() > KErrNotFound )
|
|
352 |
{
|
|
353 |
retVal = IsVideoCall( callStateData.CallId() );
|
|
354 |
}
|
|
355 |
|
|
356 |
return retVal;
|
|
357 |
}
|
|
358 |
|
|
359 |
// -----------------------------------------------------------
|
|
360 |
// CPhoneAlerting::CheckIfShowTerminationNote
|
|
361 |
// -----------------------------------------------------------
|
|
362 |
//
|
|
363 |
EXPORT_C TBool CPhoneAlerting::CheckIfShowCallTerminationNote( )
|
|
364 |
{
|
|
365 |
// Alerting state does not need call termination since
|
|
366 |
// call has not begun.
|
|
367 |
return EFalse;
|
|
368 |
}
|
|
369 |
|
|
370 |
// -----------------------------------------------------------
|
|
371 |
// CPhoneAlerting::HandleDisconnectingL
|
|
372 |
// -----------------------------------------------------------
|
|
373 |
//
|
|
374 |
EXPORT_C void CPhoneAlerting::HandleDisconnectingL( TInt aCallId )
|
|
375 |
{
|
|
376 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
377 |
"CPhoneAlerting::HandleDisconnectingL()" );
|
|
378 |
CPhoneGsmInCall::HandleDisconnectingL( aCallId );
|
|
379 |
}
|
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
// End of File
|