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 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 "tphonecmdparamboolean.h" |
|
27 |
#include "tphonecmdparaminteger.h" |
|
28 |
#include "phonestatedefinitionsgsm.h" |
|
29 |
#include "phonelogger.h" |
|
30 |
#include "phonerssbase.h" |
|
31 |
#include "phoneui.hrh" |
|
32 |
#include "tphonecmdparamglobalnote.h" |
|
33 |
#include "cphonemainresourceresolver.h" |
|
78 | 34 |
#include "phonecallutil.h" |
37 | 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: |
|
74 | 136 |
if ( iNumberEntryManager->IsNumberEntryUsedL() ) |
37 | 137 |
{ |
138 |
// send a manual control sequence |
|
74 | 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 |
// Find the dialing call |
|
78 | 159 |
TInt callId = PhoneCallUtil::CallIdByState( EPEStateDialing ); |
160 |
if( callId > KErrNotFound ) |
|
37 | 161 |
{ |
162 |
// Release the call |
|
78 | 163 |
iStateMachine->SetCallId( callId ); |
37 | 164 |
iStateMachine->SendPhoneEngineMessage( |
165 |
MPEPhoneModel::EPEMessageRelease ); |
|
166 |
} |
|
167 |
else |
|
168 |
{ |
|
78 | 169 |
callId = PhoneCallUtil::CallIdByState( EPEStateDisconnecting ); |
170 |
if ( callId > KErrNotFound ) |
|
37 | 171 |
{ |
172 |
// Release the call |
|
78 | 173 |
iStateMachine->SetCallId( callId ); |
37 | 174 |
iStateMachine->SendPhoneEngineMessage( |
175 |
MPEPhoneModel::EPEMessageRelease ); |
|
176 |
} |
|
177 |
} |
|
178 |
} |
|
179 |
break; |
|
180 |
||
181 |
default: |
|
182 |
// do base operation |
|
183 |
CPhoneCallSetup::HandleKeyMessageL( aMessage, aCode ); |
|
184 |
break; |
|
185 |
} |
|
186 |
} |
|
187 |
||
188 |
||
189 |
// ----------------------------------------------------------- |
|
190 |
// CPhoneSingleAndCallSetup::HandleConnectingL |
|
191 |
// ----------------------------------------------------------- |
|
192 |
// |
|
193 |
void CPhoneSingleAndCallSetup::HandleConnectingL( TInt aCallId ) |
|
194 |
{ |
|
195 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetup::HandleConnectingL()"); |
|
196 |
||
197 |
BeginUiUpdateLC(); |
|
198 |
||
199 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveGlobalNote ); |
|
200 |
||
201 |
// Re-enable global notes |
|
202 |
TPhoneCmdParamBoolean globalNotifierParam; |
|
203 |
globalNotifierParam.SetBoolean( EFalse ); |
|
204 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled, |
|
205 |
&globalNotifierParam ); |
|
206 |
||
74 | 207 |
iNumberEntryManager->RemoveNumberEntryIfVisibilityIsFalseL(); |
37 | 208 |
|
76 | 209 |
UpdateCallHeaderAndUiCommandsL( aCallId ); |
37 | 210 |
EndUiUpdate(); |
211 |
||
212 |
// Go to alerting state |
|
213 |
iStateMachine->ChangeState( EPhoneStateAlertingInSingle ); |
|
214 |
} |
|
215 |
||
216 |
// ----------------------------------------------------------- |
|
217 |
// CPhoneSingleAndCallSetup::HandleConnectedL |
|
218 |
// ----------------------------------------------------------- |
|
219 |
// |
|
220 |
void CPhoneSingleAndCallSetup::HandleConnectedL( TInt aCallId ) |
|
221 |
{ |
|
222 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
76 | 223 |
"CPhoneSingleAndCallSetup::HandleConnectedL()"); |
37 | 224 |
// Remove the number entry if it isn't DTMF dialer |
74 | 225 |
if ( !iNumberEntryManager->IsNumberEntryVisibleL() ) |
37 | 226 |
{ |
227 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry ); |
|
228 |
} |
|
229 |
||
76 | 230 |
UpdateCallHeaderAndUiCommandsL( aCallId ); |
37 | 231 |
|
232 |
iStateMachine->ChangeState( EPhoneStateTwoSingles ); |
|
233 |
||
234 |
} |
|
235 |
||
236 |
// ----------------------------------------------------------- |
|
237 |
// CPhoneSingleAndCallSetup::HandleIdleL |
|
238 |
// ----------------------------------------------------------- |
|
239 |
// |
|
240 |
void CPhoneSingleAndCallSetup::HandleIdleL( TInt aCallId ) |
|
241 |
{ |
|
242 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetup::HandleIdleL()"); |
|
243 |
||
244 |
BeginUiUpdateLC(); |
|
245 |
||
246 |
// Remove call |
|
247 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
248 |
||
249 |
// Find out do we have single or outgoing call left |
|
250 |
TPhoneCmdParamInteger activeCallCount; |
|
251 |
iViewCommandHandle->ExecuteCommandL( |
|
252 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount ); |
|
253 |
||
254 |
if( activeCallCount.Integer() ) |
|
255 |
{ |
|
74 | 256 |
iNumberEntryManager->SetVisibilityIfNumberEntryUsedL(ETrue); |
257 |
UpdateUiCommands(); |
|
65 | 258 |
iStateMachine->ChangeState( EPhoneStateSingle ); |
37 | 259 |
} |
260 |
else |
|
261 |
{ |
|
262 |
DisplayCallTerminationNoteL(); |
|
263 |
||
264 |
// Single call was terminated |
|
74 | 265 |
UpdateUiCommands(); |
37 | 266 |
SetToolbarButtonLoudspeakerEnabled(); |
65 | 267 |
iStateMachine->ChangeState( EPhoneStateCallSetup ); |
37 | 268 |
} |
269 |
EndUiUpdate(); |
|
270 |
} |
|
271 |
||
272 |
// ----------------------------------------------------------- |
|
273 |
// CPhoneSingleAndCallSetup::HandleCommandL |
|
274 |
// ----------------------------------------------------------- |
|
275 |
// |
|
276 |
TBool CPhoneSingleAndCallSetup::HandleCommandL( TInt aCommand ) |
|
277 |
{ |
|
278 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
279 |
"CPhoneSingleAndCallSetup::HandleCommandL()"); |
|
280 |
TBool commandStatus = ETrue; |
|
281 |
||
282 |
switch( aCommand ) |
|
283 |
{ |
|
284 |
case EPhoneInCallCmdEndThisOutgoingCall: |
|
285 |
{ |
|
286 |
// Fetch call's id from view |
|
78 | 287 |
TInt callId = PhoneCallUtil::CallIdByState( EPEStateDialing ); |
288 |
if ( callId > KErrNotFound ) |
|
37 | 289 |
{ |
290 |
// Release the call |
|
78 | 291 |
iStateMachine->SetCallId( callId ); |
37 | 292 |
iStateMachine->SendPhoneEngineMessage( |
293 |
MPEPhoneModel::EPEMessageRelease ); |
|
294 |
} |
|
295 |
else |
|
296 |
{ |
|
78 | 297 |
callId = PhoneCallUtil::CallIdByState( EPEStateDisconnecting ); |
298 |
if ( callId > KErrNotFound ) |
|
37 | 299 |
{ |
300 |
// Release the call |
|
78 | 301 |
iStateMachine->SetCallId( callId ); |
37 | 302 |
iStateMachine->SendPhoneEngineMessage( |
303 |
MPEPhoneModel::EPEMessageRelease ); |
|
304 |
} |
|
305 |
__PHONELOG( EOnlyFatal, EPhoneUIStates, |
|
306 |
"CPhoneSingleAndCallSetup::HandleCommandL EPhoneInCallCmdEndThisOutgoingCall has negative call id!" ); |
|
307 |
} |
|
308 |
} |
|
309 |
break; |
|
310 |
||
311 |
default: |
|
312 |
commandStatus = CPhoneStateCallSetup::HandleCommandL( aCommand ); |
|
313 |
break; |
|
314 |
} |
|
315 |
||
316 |
return commandStatus; |
|
317 |
} |
|
318 |
||
319 |
// End of File |
|
320 |