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 CPhoneSingleAndAlerting class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <pevirtualengine.h>
|
|
21 |
#include <cpephonemodelif.h>
|
|
22 |
#include "cphonesingleandalerting.h"
|
|
23 |
#include "tphonecmdparamboolean.h"
|
|
24 |
#include "mphonestatemachine.h"
|
|
25 |
#include "tphonecmdparamboolean.h"
|
|
26 |
#include "tphonecmdparaminteger.h"
|
|
27 |
#include "tphonecmdparamcallheaderdata.h"
|
|
28 |
#include "tphonecmdparamglobalnote.h"
|
|
29 |
#include "tphonecmdparamcallstatedata.h"
|
|
30 |
#include "phoneviewcommanddefinitions.h"
|
|
31 |
#include "phoneui.hrh"
|
|
32 |
#include "cphonemainresourceresolver.h"
|
|
33 |
#include "phonerssbase.h"
|
|
34 |
#include "phonestatedefinitionsgsm.h"
|
|
35 |
#include "phonelogger.h"
|
|
36 |
|
|
37 |
// ================= MEMBER FUNCTIONS =======================
|
|
38 |
|
|
39 |
// C++ default constructor can NOT contain any code, that
|
|
40 |
// might leave.
|
|
41 |
//
|
|
42 |
CPhoneSingleAndAlerting::CPhoneSingleAndAlerting(
|
|
43 |
MPhoneStateMachine* aStateMachine,
|
|
44 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
45 |
MPhoneCustomization* aPhoneCustomization ) :
|
|
46 |
CPhoneAlerting( aStateMachine, aViewCommandHandle, aPhoneCustomization )
|
|
47 |
{
|
|
48 |
}
|
|
49 |
|
|
50 |
// -----------------------------------------------------------
|
|
51 |
// CPhoneSingleAndAlerting::~CPhoneSingleAndAlerting()
|
|
52 |
// Destructor
|
|
53 |
// (other items were commented in a header).
|
|
54 |
// -----------------------------------------------------------
|
|
55 |
//
|
|
56 |
CPhoneSingleAndAlerting::~CPhoneSingleAndAlerting()
|
|
57 |
{
|
|
58 |
}
|
|
59 |
|
|
60 |
// -----------------------------------------------------------
|
|
61 |
// CPhoneSingleAndAlerting::ConstructL()
|
|
62 |
// Constructor
|
|
63 |
// (other items were commented in a header).
|
|
64 |
// -----------------------------------------------------------
|
|
65 |
//
|
|
66 |
void CPhoneSingleAndAlerting::ConstructL()
|
|
67 |
{
|
|
68 |
CPhoneAlerting::ConstructL();
|
|
69 |
}
|
|
70 |
|
|
71 |
// -----------------------------------------------------------
|
|
72 |
// CPhoneSingleAndAlerting::NewL()
|
|
73 |
// Constructor
|
|
74 |
// (other items were commented in a header).
|
|
75 |
// -----------------------------------------------------------
|
|
76 |
//
|
|
77 |
CPhoneSingleAndAlerting* CPhoneSingleAndAlerting::NewL(
|
|
78 |
MPhoneStateMachine* aStateMachine,
|
|
79 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
80 |
MPhoneCustomization* aPhoneCustomization )
|
|
81 |
{
|
|
82 |
CPhoneSingleAndAlerting* self = new( ELeave ) CPhoneSingleAndAlerting(
|
|
83 |
aStateMachine, aViewCommandHandle, aPhoneCustomization );
|
|
84 |
|
|
85 |
CleanupStack::PushL( self );
|
|
86 |
self->ConstructL();
|
|
87 |
CleanupStack::Pop( self );
|
|
88 |
|
|
89 |
return self;
|
|
90 |
}
|
|
91 |
|
|
92 |
// -----------------------------------------------------------
|
|
93 |
// CPhoneSingleAndAlerting::HandlePhoneEngineMessageL
|
|
94 |
// -----------------------------------------------------------
|
|
95 |
//
|
|
96 |
void CPhoneSingleAndAlerting::HandlePhoneEngineMessageL(
|
|
97 |
const TInt aMessage,
|
|
98 |
TInt aCallId )
|
|
99 |
{
|
|
100 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
101 |
"CPhoneSingleAndAlerting::HandlePhoneEngineMessageL()");
|
|
102 |
switch ( aMessage )
|
|
103 |
{
|
|
104 |
case MEngineMonitor::EPEMessageConnected:
|
|
105 |
HandleConnectedL( aCallId );
|
|
106 |
break;
|
|
107 |
|
|
108 |
case MEngineMonitor::EPEMessageIdle:
|
|
109 |
HandleIdleL( aCallId );
|
|
110 |
break;
|
|
111 |
|
|
112 |
default:
|
|
113 |
CPhoneAlerting::HandlePhoneEngineMessageL( aMessage, aCallId );
|
|
114 |
break;
|
|
115 |
}
|
|
116 |
}
|
|
117 |
|
|
118 |
// --------------------------------------------------------------
|
|
119 |
// CPhoneSingleAndAlerting::HandleKeyMessageL
|
|
120 |
// --------------------------------------------------------------
|
|
121 |
//
|
|
122 |
void CPhoneSingleAndAlerting::HandleKeyMessageL(
|
|
123 |
TPhoneKeyEventMessages aMessage,
|
|
124 |
TKeyCode aCode )
|
|
125 |
{
|
|
126 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
127 |
"CPhoneSingleAndAlerting::HandleKeyMessageL()");
|
|
128 |
switch ( aCode )
|
|
129 |
{
|
|
130 |
// send-key
|
|
131 |
case EKeyYes:
|
|
132 |
if ( CPhoneState::IsNumberEntryUsedL() )
|
|
133 |
{
|
|
134 |
// send a manual control sequence
|
|
135 |
CPhoneState::CallFromNumberEntryL();
|
|
136 |
}
|
|
137 |
else
|
|
138 |
{
|
|
139 |
// Show not allowed note
|
|
140 |
CPhoneState::SendGlobalErrorNoteL(
|
|
141 |
EPhoneNoteTextNotAllowed );
|
|
142 |
}
|
|
143 |
break;
|
|
144 |
|
|
145 |
// end-key
|
|
146 |
case EKeyNo:
|
|
147 |
if ( aMessage == EPhoneKeyLongPress )
|
|
148 |
{
|
|
149 |
iStateMachine->SendPhoneEngineMessage(
|
|
150 |
CPEPhoneModelIF::EPEMessageTerminateAllConnections );
|
|
151 |
}
|
|
152 |
else
|
|
153 |
{
|
|
154 |
DisconnectOutgoingCallL();
|
|
155 |
}
|
|
156 |
|
|
157 |
if ( CPhoneState::IsNumberEntryUsedL() )
|
|
158 |
{
|
|
159 |
// Remove number entry from screen
|
|
160 |
iViewCommandHandle->ExecuteCommandL(
|
|
161 |
EPhoneViewRemoveNumberEntry );
|
|
162 |
// Do state-specific operation when number entry is cleared
|
|
163 |
HandleNumberEntryClearedL();
|
|
164 |
}
|
|
165 |
break;
|
|
166 |
|
|
167 |
default:
|
|
168 |
// do base operation
|
|
169 |
CPhoneAlerting::HandleKeyMessageL( aMessage, aCode );
|
|
170 |
break;
|
|
171 |
}
|
|
172 |
}
|
|
173 |
|
|
174 |
// -----------------------------------------------------------
|
|
175 |
// CPhoneSingleAndAlerting::HandleConnectedL
|
|
176 |
// -----------------------------------------------------------
|
|
177 |
//
|
|
178 |
void CPhoneSingleAndAlerting::HandleConnectedL( TInt aCallId )
|
|
179 |
{
|
|
180 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
181 |
"CPhoneSingleAndAlerting::HandleConnectedL()");
|
|
182 |
|
|
183 |
// Find the alerting call
|
|
184 |
TPhoneCmdParamCallStateData callStateData;
|
|
185 |
callStateData.SetCallState( EPEStateConnecting );
|
|
186 |
iViewCommandHandle->HandleCommandL(
|
|
187 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
188 |
|
|
189 |
if( callStateData.CallId() == aCallId )
|
|
190 |
{
|
|
191 |
// Keep Phone in the foreground
|
|
192 |
TPhoneCmdParamBoolean booleanParam;
|
|
193 |
booleanParam.SetBoolean( EFalse );
|
|
194 |
iViewCommandHandle->ExecuteCommandL(
|
|
195 |
EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
|
|
196 |
|
|
197 |
// Close menu bar, if it is displayed
|
|
198 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
|
|
199 |
|
|
200 |
CPhoneState::BeginUiUpdateLC();
|
|
201 |
|
|
202 |
// Show bubble
|
|
203 |
TPhoneCmdParamCallHeaderData callHeaderParam;
|
|
204 |
callHeaderParam.SetCallState( EPEStateConnected );
|
|
205 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
|
|
206 |
&callHeaderParam );
|
|
207 |
|
|
208 |
CPhoneState::SetTouchPaneButtons( EPhoneTwoSinglesButtons );
|
|
209 |
CPhoneState::EndUiUpdate();
|
|
210 |
|
|
211 |
// Set Hold flag to view
|
|
212 |
TPhoneCmdParamBoolean holdFlag;
|
|
213 |
holdFlag.SetBoolean( EFalse );
|
|
214 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
|
|
215 |
|
|
216 |
|
|
217 |
// Set Two singles softkeys
|
|
218 |
UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA );
|
|
219 |
|
|
220 |
// Go to two singles state
|
|
221 |
iStateMachine->ChangeState( EPhoneStateTwoSingles );
|
|
222 |
}
|
|
223 |
else
|
|
224 |
{
|
|
225 |
// Show bubble
|
|
226 |
TPhoneCmdParamCallHeaderData callHeaderParam;
|
|
227 |
callHeaderParam.SetCallState( EPEStateConnected );
|
|
228 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
|
|
229 |
&callHeaderParam );
|
|
230 |
|
|
231 |
TPhoneCmdParamBoolean holdFlag;
|
|
232 |
holdFlag.SetBoolean( EFalse );
|
|
233 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
|
|
234 |
}
|
|
235 |
|
|
236 |
CPhoneGsmInCall::HandleColpNoteL( aCallId );
|
|
237 |
}
|
|
238 |
// -----------------------------------------------------------
|
|
239 |
// CPhoneSingleAndAlerting::HandleIdleL
|
|
240 |
// -----------------------------------------------------------
|
|
241 |
//
|
|
242 |
void CPhoneSingleAndAlerting::HandleIdleL( TInt aCallId )
|
|
243 |
{
|
|
244 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
245 |
"CPhoneSingleAndAlerting::HandleIdleL()");
|
|
246 |
|
|
247 |
BeginUiUpdateLC();
|
|
248 |
|
|
249 |
// Remove call
|
|
250 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
|
|
251 |
|
|
252 |
// Close menu bar, if it is displayed
|
|
253 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
|
|
254 |
|
|
255 |
if ( !TopAppIsDisplayedL() )
|
|
256 |
{
|
|
257 |
// Continue displaying current app but set up the
|
|
258 |
// idle screen in the background
|
|
259 |
SetupIdleScreenInBackgroundL();
|
|
260 |
}
|
|
261 |
|
|
262 |
TPhoneCmdParamInteger countParam;
|
|
263 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCountOfActiveCalls, &countParam);
|
|
264 |
|
|
265 |
if ( countParam.Integer() )
|
|
266 |
{
|
|
267 |
SetTouchPaneButtons( EPhoneIncallButtons );
|
|
268 |
// Set Hold flag to view
|
|
269 |
TPhoneCmdParamBoolean holdFlag;
|
|
270 |
holdFlag.SetBoolean( ETrue );
|
|
271 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
|
|
272 |
UpdateCbaL( EPhoneCallHandlingInCallCBA );
|
|
273 |
iStateMachine->ChangeState( EPhoneStateSingle );
|
|
274 |
}
|
|
275 |
else
|
|
276 |
{
|
|
277 |
// Display call termination note, if necessary
|
|
278 |
DisplayCallTerminationNoteL();
|
|
279 |
SetTouchPaneButtons( EPhoneCallSetupButtons );
|
|
280 |
UpdateCbaL( EPhoneCallHandlingInCallCBA );
|
|
281 |
iStateMachine->ChangeState( EPhoneStateAlerting );
|
|
282 |
}
|
|
283 |
|
|
284 |
EndUiUpdate();
|
|
285 |
}
|
|
286 |
|
|
287 |
// -----------------------------------------------------------
|
|
288 |
// CPhoneSingleAndAlerting::OpenMenuBarL
|
|
289 |
// -----------------------------------------------------------
|
|
290 |
//
|
|
291 |
void CPhoneSingleAndAlerting::OpenMenuBarL()
|
|
292 |
{
|
|
293 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
294 |
"CPhoneSingleAndAlerting::OpenMenuBarL()");
|
|
295 |
TInt resourceId;
|
|
296 |
|
|
297 |
if ( IsNumberEntryVisibleL() )
|
|
298 |
{
|
|
299 |
resourceId = EPhoneAlertingAndHeldCallMenuBarWithNumberEntry;
|
|
300 |
}
|
|
301 |
else
|
|
302 |
{
|
|
303 |
resourceId = EPhoneAlertingAndHeldCallMenuBar;
|
|
304 |
}
|
|
305 |
|
|
306 |
TPhoneCmdParamInteger integerParam;
|
|
307 |
integerParam.SetInteger(
|
|
308 |
CPhoneMainResourceResolver::Instance()->
|
|
309 |
ResolveResourceID( resourceId ) );
|
|
310 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen,
|
|
311 |
&integerParam );
|
|
312 |
}
|
|
313 |
|
|
314 |
// -----------------------------------------------------------
|
|
315 |
// CPhoneSingleAndAlerting::UpdateInCallCbaL
|
|
316 |
// -----------------------------------------------------------
|
|
317 |
//
|
|
318 |
void CPhoneSingleAndAlerting::UpdateInCallCbaL()
|
|
319 |
{
|
|
320 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneSingleAndAlerting::UpdateInCallCbaL() ");
|
|
321 |
UpdateCbaL( EPhoneCallHandlingInCallCBA );
|
|
322 |
}
|
|
323 |
|
|
324 |
|
|
325 |
// End of File
|