author | hgs |
Mon, 04 Oct 2010 16:06:10 +0300 | |
changeset 76 | cfea66083b62 |
parent 74 | d1c62c765e48 |
child 78 | baacf668fe89 |
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 CPhoneSingleCall class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDES |
|
20 |
#include <eikmenub.h> |
|
21 |
#include <eikenv.h> |
|
22 |
#include <StringLoader.h> |
|
23 |
#include <featmgr.h> |
|
24 |
#include <pevirtualengine.h> |
|
25 |
#include <mpeengineinfo.h> |
|
26 |
#include <cpephonemodelif.h> |
|
27 |
#include <connect/sbdefs.h> |
|
28 |
#include <videotelcontrolmediatorapi.h> |
|
29 |
#include <MediatorDomainUIDs.h> |
|
30 |
#include <telephonyvariant.hrh> |
|
31 |
||
32 |
#include "cphonesinglecall.h" |
|
33 |
#include "tphonecmdparamstring.h" |
|
34 |
#include "tphonecmdparamboolean.h" |
|
35 |
#include "tphonecmdparamcallheaderdata.h" |
|
36 |
#include "mphonestatemachine.h" |
|
37 |
#include "tphonecmdparaminteger.h" |
|
38 |
#include "phoneviewcommanddefinitions.h" |
|
39 |
#include "phoneui.hrh" |
|
40 |
#include "cphonemainresourceresolver.h" |
|
41 |
#include "phonerssbase.h" |
|
42 |
#include "phonestatedefinitionsgsm.h" |
|
43 |
#include "tphonecmdparamglobalnote.h" |
|
44 |
#include "tphonecmdparamcallstatedata.h" |
|
45 |
#include "phonelogger.h" |
|
46 |
#include "cphonepubsubproxy.h" |
|
47 |
#include "cphonemediatorfactory.h" |
|
48 |
#include "cphonemediatorsender.h" |
|
49 |
#include "mphonestorage.h" |
|
50 |
#include "cphonecenrepproxy.h" |
|
51 |
||
52 |
// ================= MEMBER FUNCTIONS ======================= |
|
53 |
||
54 |
// C++ default constructor can NOT contain any code, that |
|
55 |
// might leave. |
|
56 |
// |
|
57 |
EXPORT_C CPhoneSingleCall::CPhoneSingleCall( |
|
58 |
MPhoneStateMachine* aStateMachine, |
|
59 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
60 |
MPhoneCustomization* aPhoneCustomization ) : |
|
61 |
CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
62 |
{ |
|
63 |
} |
|
64 |
||
65 |
// ----------------------------------------------------------- |
|
66 |
// CPhoneSingleCall::~CPhoneSingleCall() |
|
67 |
// ----------------------------------------------------------- |
|
68 |
// |
|
69 |
EXPORT_C CPhoneSingleCall::~CPhoneSingleCall() |
|
70 |
{ |
|
71 |
} |
|
72 |
||
73 |
// ----------------------------------------------------------- |
|
74 |
// CPhoneSingleCall::ConstructL() |
|
75 |
// ----------------------------------------------------------- |
|
76 |
// |
|
77 |
EXPORT_C void CPhoneSingleCall::ConstructL() |
|
78 |
{ |
|
79 |
CPhoneGsmInCall::ConstructL(); |
|
80 |
||
81 |
TPhoneCmdParamBoolean globalNotifierParam; |
|
82 |
globalNotifierParam.SetBoolean( EFalse ); |
|
83 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled, |
|
84 |
&globalNotifierParam ); |
|
65 | 85 |
|
37 | 86 |
TPhoneCmdParamCallStateData callStateData; |
87 |
callStateData.SetCallState( EPEStateConnected ); |
|
88 |
iViewCommandHandle->HandleCommandL( |
|
89 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
65 | 90 |
|
91 |
// No connected call, |
|
37 | 92 |
if( callStateData.CallId() == KErrNotFound ) |
93 |
{ |
|
65 | 94 |
//find the held call. |
95 |
callStateData.SetCallState( EPEStateHeld ); |
|
37 | 96 |
iViewCommandHandle->HandleCommandL( |
97 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
65 | 98 |
// No held call. |
37 | 99 |
if ( callStateData.CallId() == KErrNotFound ) |
100 |
{ |
|
65 | 101 |
// find the disconnected call. |
102 |
callStateData.SetCallState( EPEStateDisconnecting ); |
|
37 | 103 |
iViewCommandHandle->HandleCommandL( |
74 | 104 |
EPhoneViewGetCallIdByState, &callStateData ); |
37 | 105 |
} |
106 |
} |
|
74 | 107 |
iCallId = callStateData.CallId(); |
37 | 108 |
} |
109 |
||
110 |
// ----------------------------------------------------------- |
|
111 |
// CPhoneSingleCall::NewL() |
|
112 |
// Constructor |
|
113 |
// (other items were commented in a header). |
|
114 |
// ----------------------------------------------------------- |
|
115 |
// |
|
116 |
CPhoneSingleCall* CPhoneSingleCall::NewL( |
|
117 |
MPhoneStateMachine* aStateMachine, |
|
118 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
119 |
MPhoneCustomization* aPhoneCustomization ) |
|
120 |
{ |
|
121 |
CPhoneSingleCall* self = new( ELeave ) CPhoneSingleCall( |
|
122 |
aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
123 |
||
124 |
CleanupStack::PushL( self ); |
|
125 |
self->ConstructL(); |
|
126 |
CleanupStack::Pop( self ); |
|
127 |
||
128 |
return self; |
|
129 |
} |
|
130 |
||
131 |
// -------------------------------------------------------------- |
|
132 |
// CPhoneSingleCall::HandleKeyMessageL |
|
133 |
// -------------------------------------------------------------- |
|
134 |
// |
|
135 |
EXPORT_C void CPhoneSingleCall::HandleKeyMessageL( |
|
136 |
TPhoneKeyEventMessages aMessage, |
|
137 |
TKeyCode aCode ) |
|
138 |
{ |
|
139 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::HandleKeyMessageL()"); |
|
140 |
switch ( aCode ) |
|
141 |
{ |
|
65 | 142 |
case EKeyYes: // send-key |
74 | 143 |
if( iNumberEntryManager->IsNumberEntryUsedL() ) |
37 | 144 |
{ |
145 |
if ( IsVideoCallActiveL() ) |
|
146 |
{ |
|
147 |
HBufC *phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize ); |
|
148 |
TPtr ptr( phoneNumber->Des() ); |
|
149 |
TPhoneCmdParamString stringParam; |
|
150 |
stringParam.SetString( &ptr ); |
|
151 |
iViewCommandHandle->ExecuteCommand( |
|
152 |
EPhoneViewGetNumberFromEntry, |
|
153 |
&stringParam ); |
|
154 |
iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ) ; |
|
155 |
||
156 |
if ( iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() || |
|
157 |
phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength ) |
|
65 | 158 |
{ |
74 | 159 |
iNumberEntryManager->CallFromNumberEntryL(); |
37 | 160 |
} |
161 |
else |
|
162 |
{ |
|
163 |
iStateMachine->SendPhoneEngineMessage( |
|
164 |
MPEPhoneModel::EPEMessageCheckEmergencyNumber ); |
|
165 |
} |
|
166 |
CleanupStack::PopAndDestroy( phoneNumber ); |
|
167 |
} |
|
168 |
else |
|
169 |
{ |
|
74 | 170 |
iNumberEntryManager->CallFromNumberEntryL(); |
37 | 171 |
} |
172 |
} |
|
173 |
else |
|
174 |
{ |
|
65 | 175 |
ToggleHoldL(); |
37 | 176 |
} |
177 |
break; |
|
178 |
||
179 |
default: |
|
180 |
CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode ); |
|
181 |
break; |
|
182 |
} |
|
183 |
} |
|
184 |
||
185 |
// ----------------------------------------------------------- |
|
186 |
// CPhoneSingleCall::HandlePhoneEngineMessageL |
|
187 |
// ----------------------------------------------------------- |
|
188 |
// |
|
189 |
EXPORT_C void CPhoneSingleCall::HandlePhoneEngineMessageL( |
|
190 |
const TInt aMessage, |
|
191 |
TInt aCallId ) |
|
192 |
{ |
|
193 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::HandlePhoneEngineMessageL()"); |
|
194 |
switch ( aMessage ) |
|
195 |
{ |
|
196 |
case MEngineMonitor::EPEMessageHeld: |
|
197 |
case MEngineMonitor::EPEMessageConnected: |
|
76 | 198 |
UpdateCallHeaderAndUiCommandsL( aCallId ); |
37 | 199 |
break; |
200 |
||
201 |
case MEngineMonitor::EPEMessageIncoming: |
|
202 |
HandleIncomingL( aCallId ); |
|
203 |
break; |
|
204 |
||
205 |
case MEngineMonitor::EPEMessageDialing: |
|
74 | 206 |
HandleDialingL( aCallId ); |
37 | 207 |
break; |
208 |
||
209 |
/* Flow through */ |
|
210 |
case MEngineMonitor::EPEMessageRemoteTerminated: |
|
211 |
case MEngineMonitor::EPEMessageDisconnecting: |
|
212 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume ); |
|
213 |
CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
214 |
break; |
|
215 |
||
216 |
case MEngineMonitor::EPEMessageInValidEmergencyNumber: |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
217 |
SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue ); |
37 | 218 |
break; |
219 |
||
220 |
case MEngineMonitor::EPEMessageValidEmergencyNumber: |
|
221 |
DialVoiceCallL(); |
|
222 |
break; |
|
223 |
||
224 |
default: |
|
225 |
CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
226 |
break; |
|
227 |
} |
|
228 |
} |
|
229 |
||
230 |
// ----------------------------------------------------------- |
|
231 |
// CPhoneSingleCall::HandleCommandL |
|
232 |
// ----------------------------------------------------------- |
|
233 |
// |
|
234 |
EXPORT_C TBool CPhoneSingleCall::HandleCommandL( TInt aCommand ) |
|
235 |
{ |
|
236 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleCall::HandleCommandL()"); |
|
237 |
TBool commandStatus = ETrue; |
|
238 |
switch( aCommand ) |
|
239 |
{ |
|
240 |
/* Flow through */ |
|
241 |
case EPhoneInCallCmdHold: |
|
242 |
case EPhoneInCallCmdUnhold: |
|
243 |
ToggleHoldL(); |
|
244 |
break; |
|
245 |
||
246 |
/* Flow through */ |
|
65 | 247 |
case EPhoneInCallCmdNewCall: |
37 | 248 |
break; |
249 |
||
74 | 250 |
|
37 | 251 |
case EPhoneVideoSharing: |
252 |
case EPhoneVideoSharingOpt2: |
|
253 |
case EPhoneVideoSharingOpt3: |
|
254 |
{ |
|
255 |
TPhoneCmdParamInteger command; |
|
256 |
command.SetInteger( aCommand ); |
|
65 | 257 |
iViewCommandHandle->ExecuteCommandL( |
258 |
EPhoneViewSendAiwCommand, |
|
259 |
&command ); |
|
37 | 260 |
} |
65 | 261 |
break; |
37 | 262 |
|
263 |
default: |
|
264 |
commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand ); |
|
265 |
break; |
|
266 |
} |
|
267 |
return commandStatus; |
|
268 |
} |
|
269 |
||
270 |
// ----------------------------------------------------------- |
|
271 |
// CPhoneSingleCall::CallId |
|
272 |
// ----------------------------------------------------------- |
|
273 |
// |
|
274 |
EXPORT_C TInt CPhoneSingleCall::CallId() const |
|
275 |
{ |
|
276 |
return iCallId; |
|
277 |
} |
|
278 |
||
279 |
// ----------------------------------------------------------- |
|
280 |
// CPhoneSingleCall::ToggleHold |
|
281 |
// ----------------------------------------------------------- |
|
282 |
// |
|
283 |
void CPhoneSingleCall::ToggleHoldL() |
|
284 |
{ |
|
285 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
286 |
"CPhoneSingleCall::ToggleHoldL()"); |
|
287 |
||
288 |
TPECallControlCaps callControlCaps = |
|
289 |
iStateMachine->PhoneEngineInfo()->CallControlCaps( iCallId ); |
|
290 |
||
291 |
if ( callControlCaps & MCCECallObserver::ECCECapsHold ) |
|
292 |
{ |
|
293 |
iStateMachine->SetCallId( iCallId ); |
|
294 |
iStateMachine->SendPhoneEngineMessage( |
|
295 |
CPEPhoneModelIF::EPEMessageHold ); |
|
296 |
} |
|
297 |
else if ( callControlCaps & MCCECallObserver::ECCECapsResume ) |
|
298 |
{ |
|
299 |
iStateMachine->SetCallId( iCallId ); |
|
300 |
iStateMachine->SendPhoneEngineMessage( |
|
301 |
CPEPhoneModelIF::EPEMessageResume ); |
|
302 |
} |
|
303 |
else |
|
304 |
{ |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
305 |
SendGlobalInfoNoteL( EPhoneNoteTextNotAllowed, ETrue ); |
37 | 306 |
} |
307 |
} |
|
308 |
||
309 |
// ----------------------------------------------------------- |
|
310 |
// CPhoneSingleCall::HandleIncomingL |
|
311 |
// ----------------------------------------------------------- |
|
312 |
// |
|
313 |
void CPhoneSingleCall::HandleIncomingL( TInt aCallId ) |
|
314 |
{ |
|
315 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
316 |
"CPhoneSingleCall::HandleIncomingL()"); |
|
74 | 317 |
DisplayCallHeaderL( aCallId, ECheckIfNEUsedBeforeSettingVisibilityFalse ); |
318 |
iStateMachine->ChangeState( EPhoneStateWaitingInSingle ); |
|
37 | 319 |
} |
320 |
||
321 |
// ----------------------------------------------------------- |
|
74 | 322 |
// CPhoneSingleCall::HandleDialingL |
37 | 323 |
// ----------------------------------------------------------- |
324 |
// |
|
74 | 325 |
void CPhoneSingleCall::HandleDialingL( TInt aCallId ) |
37 | 326 |
{ |
327 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
74 | 328 |
"CPhoneSingleCall::HandleDialingL()"); |
329 |
DisplayCallHeaderL( aCallId, ESetNEVisibilityFalse); |
|
330 |
iStateMachine->ChangeState( EPhoneStateCallSetupInSingle ); |
|
37 | 331 |
} |
332 |
||
333 |
// End of File |