author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 00:16:48 +0300 | |
changeset 77 | 2be0b271d017 |
parent 72 | c76a0b1755b9 |
child 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 CPhoneSingleAndCallSetup class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDES |
|
20 |
#include <featmgr.h> |
|
21 |
#include <cpephonemodelif.h> |
|
22 |
#include "cphonesingleandcallsetup.h" |
|
23 |
#include "mphonestatemachine.h" |
|
24 |
#include "phoneviewcommanddefinitions.h" |
|
25 |
#include "tphonecmdparamcallheaderdata.h" |
|
26 |
#include "tphonecmdparamcallstatedata.h" |
|
27 |
#include "tphonecmdparamboolean.h" |
|
28 |
#include "tphonecmdparaminteger.h" |
|
29 |
#include "phonestatedefinitionsgsm.h" |
|
30 |
#include "phonelogger.h" |
|
31 |
#include "phonerssbase.h" |
|
32 |
#include "phoneui.hrh" |
|
33 |
#include "tphonecmdparamglobalnote.h" |
|
34 |
#include "cphonemainresourceresolver.h" |
|
35 |
||
36 |
// ================= MEMBER FUNCTIONS ======================= |
|
37 |
||
38 |
// C++ default constructor can NOT contain any code, that |
|
39 |
// might leave. |
|
40 |
// |
|
41 |
CPhoneSingleAndCallSetup::CPhoneSingleAndCallSetup( |
|
42 |
MPhoneStateMachine* aStateMachine, |
|
43 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
44 |
MPhoneCustomization* aPhoneCustomization ) : |
|
45 |
CPhoneCallSetup( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
46 |
{ |
|
47 |
} |
|
48 |
||
49 |
// ----------------------------------------------------------- |
|
50 |
// CPhoneSingleAndCallSetup::~CPhoneSingleAndCallSetup() |
|
51 |
// Destructor |
|
52 |
// (other items were commented in a header). |
|
53 |
// ----------------------------------------------------------- |
|
54 |
// |
|
55 |
CPhoneSingleAndCallSetup::~CPhoneSingleAndCallSetup() |
|
56 |
{ |
|
57 |
} |
|
58 |
||
59 |
// ----------------------------------------------------------- |
|
60 |
// CPhoneSingleAndCallSetup::ConstructL() |
|
61 |
// Constructor |
|
62 |
// (other items were commented in a header). |
|
63 |
// ----------------------------------------------------------- |
|
64 |
// |
|
65 |
void CPhoneSingleAndCallSetup::ConstructL() |
|
66 |
{ |
|
67 |
CPhoneCallSetup::ConstructL(); |
|
68 |
} |
|
69 |
||
70 |
// ----------------------------------------------------------- |
|
71 |
// CPhoneSingleAndCallSetup::NewL() |
|
72 |
// Constructor |
|
73 |
// (other items were commented in a header). |
|
74 |
// ----------------------------------------------------------- |
|
75 |
// |
|
76 |
CPhoneSingleAndCallSetup* CPhoneSingleAndCallSetup::NewL( |
|
77 |
MPhoneStateMachine* aStateMachine, |
|
78 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
79 |
MPhoneCustomization* aPhoneCustomization ) |
|
80 |
{ |
|
81 |
CPhoneSingleAndCallSetup* self = new( ELeave ) CPhoneSingleAndCallSetup( |
|
82 |
aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
83 |
||
84 |
CleanupStack::PushL( self ); |
|
85 |
self->ConstructL(); |
|
86 |
CleanupStack::Pop( self ); |
|
87 |
||
88 |
return self; |
|
89 |
} |
|
90 |
||
91 |
// ----------------------------------------------------------- |
|
92 |
// CPhoneSingleAndCallSetup::HandlePhoneEngineMessageL |
|
93 |
// ----------------------------------------------------------- |
|
94 |
// |
|
95 |
void CPhoneSingleAndCallSetup::HandlePhoneEngineMessageL( |
|
96 |
const TInt aMessage, |
|
97 |
TInt aCallId ) |
|
98 |
{ |
|
99 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
100 |
"CPhoneSingleAndCallSetup::HandlePhoneEngineMessageL()"); |
|
101 |
switch ( aMessage ) |
|
102 |
{ |
|
103 |
case MEngineMonitor::EPEMessageConnecting: |
|
104 |
HandleConnectingL( aCallId ); |
|
105 |
break; |
|
106 |
||
107 |
case MEngineMonitor::EPEMessageConnected: |
|
108 |
HandleConnectedL( aCallId ); |
|
109 |
break; |
|
110 |
||
111 |
case MEngineMonitor::EPEMessageIdle: |
|
112 |
HandleIdleL( aCallId ); |
|
113 |
break; |
|
114 |
||
115 |
default: |
|
116 |
CPhoneCallSetup::HandlePhoneEngineMessageL( aMessage, |
|
117 |
aCallId ); |
|
118 |
break; |
|
119 |
} |
|
120 |
} |
|
121 |
||
122 |
// -------------------------------------------------------------- |
|
123 |
// CPhoneSingleAndCallSetup::HandleKeyMessageL |
|
124 |
// -------------------------------------------------------------- |
|
125 |
// |
|
126 |
void CPhoneSingleAndCallSetup::HandleKeyMessageL( |
|
127 |
TPhoneKeyEventMessages aMessage, |
|
128 |
TKeyCode aCode ) |
|
129 |
{ |
|
130 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
131 |
"CPhoneSingleAndCallSetup::HandleKeyMessageL()"); |
|
132 |
switch ( aCode ) |
|
133 |
{ |
|
134 |
// send-key |
|
135 |
case EKeyYes: |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
136 |
if ( iNumberEntryManager->IsNumberEntryUsedL() ) |
37 | 137 |
{ |
138 |
// send a manual control sequence |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
139 |
iNumberEntryManager->CallFromNumberEntryL(); |
37 | 140 |
} |
141 |
else |
|
142 |
{ |
|
143 |
// Show not allowed note |
|
144 |
CPhoneState::SendGlobalErrorNoteL( |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
145 |
EPhoneNoteTextNotAllowed, ETrue ); |
37 | 146 |
} |
147 |
break; |
|
148 |
||
149 |
// end-key |
|
150 |
case EKeyNo: |
|
151 |
if ( aMessage == EPhoneKeyLongPress ) |
|
152 |
{ |
|
153 |
iStateMachine->SendPhoneEngineMessage( |
|
154 |
CPEPhoneModelIF::EPEMessageTerminateAllConnections ); |
|
155 |
} |
|
156 |
else |
|
157 |
{ |
|
158 |
// Fetch active call's id from view |
|
159 |
TPhoneCmdParamCallStateData callStateData; |
|
160 |
// Find the dialing call |
|
161 |
callStateData.SetCallState( EPEStateDialing ); |
|
162 |
iViewCommandHandle->HandleCommandL( |
|
163 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
164 |
||
165 |
if( callStateData.CallId() > KErrNotFound ) |
|
166 |
{ |
|
167 |
// Release the call |
|
168 |
iStateMachine->SetCallId( |
|
169 |
callStateData.CallId() ); |
|
170 |
iStateMachine->SendPhoneEngineMessage( |
|
171 |
MPEPhoneModel::EPEMessageRelease ); |
|
172 |
} |
|
173 |
else |
|
174 |
{ |
|
175 |
callStateData.SetCallState( EPEStateDisconnecting ); |
|
176 |
iViewCommandHandle->HandleCommandL( |
|
177 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
178 |
||
179 |
if ( callStateData.CallId() > KErrNotFound ) |
|
180 |
{ |
|
181 |
// Release the call |
|
182 |
iStateMachine->SetCallId( |
|
183 |
callStateData.CallId() ); |
|
184 |
iStateMachine->SendPhoneEngineMessage( |
|
185 |
MPEPhoneModel::EPEMessageRelease ); |
|
186 |
} |
|
187 |
} |
|
188 |
} |
|
189 |
break; |
|
190 |
||
191 |
default: |
|
192 |
// do base operation |
|
193 |
CPhoneCallSetup::HandleKeyMessageL( aMessage, aCode ); |
|
194 |
break; |
|
195 |
} |
|
196 |
} |
|
197 |
||
198 |
||
199 |
// ----------------------------------------------------------- |
|
200 |
// CPhoneSingleAndCallSetup::HandleConnectingL |
|
201 |
// ----------------------------------------------------------- |
|
202 |
// |
|
203 |
void CPhoneSingleAndCallSetup::HandleConnectingL( TInt aCallId ) |
|
204 |
{ |
|
205 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetup::HandleConnectingL()"); |
|
206 |
||
207 |
BeginUiUpdateLC(); |
|
208 |
||
209 |
UpdateRemoteInfoDataL ( aCallId ); |
|
210 |
||
211 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveGlobalNote ); |
|
212 |
||
213 |
// Re-enable global notes |
|
214 |
TPhoneCmdParamBoolean globalNotifierParam; |
|
215 |
globalNotifierParam.SetBoolean( EFalse ); |
|
216 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled, |
|
217 |
&globalNotifierParam ); |
|
218 |
||
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
219 |
iNumberEntryManager->RemoveNumberEntryIfVisibilityIsFalseL(); |
37 | 220 |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
221 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId ); |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
222 |
UpdateUiCommands(); |
37 | 223 |
EndUiUpdate(); |
224 |
||
225 |
// Go to alerting state |
|
226 |
iStateMachine->ChangeState( EPhoneStateAlertingInSingle ); |
|
227 |
} |
|
228 |
||
229 |
// ----------------------------------------------------------- |
|
230 |
// CPhoneSingleAndCallSetup::HandleConnectedL |
|
231 |
// ----------------------------------------------------------- |
|
232 |
// |
|
233 |
void CPhoneSingleAndCallSetup::HandleConnectedL( TInt aCallId ) |
|
234 |
{ |
|
235 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
236 |
"CPhoneSingleAndCallSetup::HandleConnectedL()"); |
|
237 |
||
238 |
BeginUiUpdateLC(); |
|
239 |
||
240 |
// Show bubble |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
241 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId ); |
37 | 242 |
|
243 |
// Remove the number entry if it isn't DTMF dialer |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
244 |
if ( !iNumberEntryManager->IsNumberEntryVisibleL() ) |
37 | 245 |
{ |
246 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry ); |
|
247 |
} |
|
248 |
||
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
249 |
UpdateUiCommands(); |
37 | 250 |
|
251 |
EndUiUpdate(); |
|
252 |
||
253 |
// Go to two singles state |
|
254 |
iStateMachine->ChangeState( EPhoneStateTwoSingles ); |
|
255 |
||
256 |
} |
|
257 |
||
258 |
// ----------------------------------------------------------- |
|
259 |
// CPhoneSingleAndCallSetup::HandleIdleL |
|
260 |
// ----------------------------------------------------------- |
|
261 |
// |
|
262 |
void CPhoneSingleAndCallSetup::HandleIdleL( TInt aCallId ) |
|
263 |
{ |
|
264 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetup::HandleIdleL()"); |
|
265 |
||
266 |
BeginUiUpdateLC(); |
|
267 |
||
268 |
// Remove call |
|
269 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
270 |
||
271 |
// Find out do we have single or outgoing call left |
|
272 |
TPhoneCmdParamInteger activeCallCount; |
|
273 |
iViewCommandHandle->ExecuteCommandL( |
|
274 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount ); |
|
275 |
||
276 |
if( activeCallCount.Integer() ) |
|
277 |
{ |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
278 |
iNumberEntryManager->SetVisibilityIfNumberEntryUsedL(ETrue); |
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
279 |
UpdateUiCommands(); |
72
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
280 |
iStateMachine->ChangeState( EPhoneStateSingle ); |
37 | 281 |
} |
282 |
else |
|
283 |
{ |
|
284 |
DisplayCallTerminationNoteL(); |
|
285 |
||
286 |
// Single call was terminated |
|
77
2be0b271d017
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
72
diff
changeset
|
287 |
UpdateUiCommands(); |
37 | 288 |
SetToolbarButtonLoudspeakerEnabled(); |
72
c76a0b1755b9
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
56
diff
changeset
|
289 |
iStateMachine->ChangeState( EPhoneStateCallSetup ); |
37 | 290 |
} |
291 |
EndUiUpdate(); |
|
292 |
} |
|
293 |
||
294 |
// ----------------------------------------------------------- |
|
295 |
// CPhoneSingleAndCallSetup::HandleCommandL |
|
296 |
// ----------------------------------------------------------- |
|
297 |
// |
|
298 |
TBool CPhoneSingleAndCallSetup::HandleCommandL( TInt aCommand ) |
|
299 |
{ |
|
300 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
301 |
"CPhoneSingleAndCallSetup::HandleCommandL()"); |
|
302 |
TBool commandStatus = ETrue; |
|
303 |
||
304 |
switch( aCommand ) |
|
305 |
{ |
|
306 |
case EPhoneInCallCmdEndThisOutgoingCall: |
|
307 |
{ |
|
308 |
// Fetch call's id from view |
|
309 |
TPhoneCmdParamCallStateData callStateData; |
|
310 |
callStateData.SetCallState( EPEStateDialing ); |
|
311 |
iViewCommandHandle->HandleCommandL( |
|
312 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
313 |
||
314 |
if ( callStateData.CallId() > KErrNotFound ) |
|
315 |
{ |
|
316 |
// Release the call |
|
317 |
iStateMachine->SetCallId( |
|
318 |
callStateData.CallId() ); |
|
319 |
iStateMachine->SendPhoneEngineMessage( |
|
320 |
MPEPhoneModel::EPEMessageRelease ); |
|
321 |
} |
|
322 |
else |
|
323 |
{ |
|
324 |
callStateData.SetCallState( EPEStateDisconnecting ); |
|
325 |
iViewCommandHandle->HandleCommandL( |
|
326 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
327 |
||
328 |
if ( callStateData.CallId() > KErrNotFound ) |
|
329 |
{ |
|
330 |
// Release the call |
|
331 |
iStateMachine->SetCallId( |
|
332 |
callStateData.CallId() ); |
|
333 |
iStateMachine->SendPhoneEngineMessage( |
|
334 |
MPEPhoneModel::EPEMessageRelease ); |
|
335 |
} |
|
336 |
__PHONELOG( EOnlyFatal, EPhoneUIStates, |
|
337 |
"CPhoneSingleAndCallSetup::HandleCommandL EPhoneInCallCmdEndThisOutgoingCall has negative call id!" ); |
|
338 |
} |
|
339 |
} |
|
340 |
break; |
|
341 |
||
342 |
default: |
|
343 |
commandStatus = CPhoneStateCallSetup::HandleCommandL( aCommand ); |
|
344 |
break; |
|
345 |
} |
|
346 |
||
347 |
return commandStatus; |
|
348 |
} |
|
349 |
||
350 |
// End of File |
|
351 |