author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 09:48:26 +0300 | |
changeset 56 | 5bcb308bd24d |
parent 37 | ba76fc04e6c2 |
child 65 | 2a5d4ab426d3 |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2007 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 CPhoneStateSingleVoIP class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDES |
|
20 |
#include <StringLoader.h> |
|
21 |
#include <avkon.rsg> |
|
22 |
#include <mpeengineinfo.h> |
|
23 |
#include "cphonestatesinglevoip.h" |
|
24 |
#include "phonelogger.h" |
|
25 |
#include "cphonecustomizationvoip.h" |
|
26 |
||
27 |
#include "phoneappvoipcommands.hrh" |
|
28 |
#include "tphonecmdparaminteger.h" |
|
29 |
#include "tphonecmdparamboolean.h" |
|
30 |
#include "tphonecmdparamstring.h" |
|
31 |
#include "cphonemainresourceresolver.h" |
|
32 |
#include "phonerssvoip.h" |
|
33 |
||
34 |
#include "tphonecmdparamselector.h" |
|
35 |
#include "mphonestatemachine.h" |
|
36 |
#include "tphonecmdparamcustomdialer.h" |
|
37 |
#include "cphonetransferdialercontroller.h" |
|
38 |
#include "tphonecmdparamquery.h" |
|
39 |
#include "tphonecmdparamglobalnote.h" |
|
40 |
#include "cphonestateutilsvoip.h" |
|
41 |
#include "cphonestatemachinevoip.h" |
|
42 |
||
43 |
// ================= MEMBER FUNCTIONS ======================= |
|
44 |
||
45 |
// C++ default constructor can NOT contain any code, that |
|
46 |
// might leave. |
|
47 |
// |
|
48 |
CPhoneStateSingleVoIP::CPhoneStateSingleVoIP( |
|
49 |
MPhoneStateMachine& aStateMachine, |
|
50 |
MPhoneViewCommandHandle& aViewCommandHandle, |
|
51 |
MPhoneCustomization& aCustomization ) : |
|
52 |
CPhoneSingleCall( &aStateMachine, &aViewCommandHandle, &aCustomization ) |
|
53 |
{ |
|
54 |
} |
|
55 |
||
56 |
// ----------------------------------------------------------- |
|
57 |
// CPhoneStateSingleVoIP::~CPhoneStateSingleVoIP() |
|
58 |
// Destructor |
|
59 |
// (other items were commented in a header). |
|
60 |
// ----------------------------------------------------------- |
|
61 |
||
62 |
CPhoneStateSingleVoIP::~CPhoneStateSingleVoIP() |
|
63 |
{ |
|
64 |
} |
|
65 |
||
66 |
// ----------------------------------------------------------- |
|
67 |
// CPhoneStateSingleVoIP::ConstructL() |
|
68 |
// Constructor |
|
69 |
// (other items were commented in a header). |
|
70 |
// ----------------------------------------------------------- |
|
71 |
// |
|
72 |
void CPhoneStateSingleVoIP::ConstructL() |
|
73 |
{ |
|
74 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
75 |
"CPhoneStateSingleVoIP::ConstructL()" ) |
|
76 |
CPhoneSingleCall::ConstructL(); |
|
77 |
} |
|
78 |
||
79 |
// ----------------------------------------------------------- |
|
80 |
// CPhoneStateSingleVoIP::NewL() |
|
81 |
// Constructor |
|
82 |
// (other items were commented in a header). |
|
83 |
// ----------------------------------------------------------- |
|
84 |
// |
|
85 |
CPhoneStateSingleVoIP* CPhoneStateSingleVoIP::NewL( |
|
86 |
MPhoneStateMachine& aStateMachine, |
|
87 |
MPhoneViewCommandHandle& aViewCommandHandle, |
|
88 |
MPhoneCustomization& aCustomization ) |
|
89 |
{ |
|
90 |
CPhoneStateSingleVoIP* self = new (ELeave) |
|
91 |
CPhoneStateSingleVoIP( aStateMachine, aViewCommandHandle, aCustomization ); |
|
92 |
||
93 |
CleanupStack::PushL( self ); |
|
94 |
self->ConstructL(); |
|
95 |
CleanupStack::Pop( self ); |
|
96 |
||
97 |
return self; |
|
98 |
} |
|
99 |
||
100 |
// ----------------------------------------------------------- |
|
101 |
// CPhoneStateSingleVoIP::HandlePhoneEngineMessageL |
|
102 |
// ----------------------------------------------------------- |
|
103 |
// |
|
104 |
void CPhoneStateSingleVoIP::HandlePhoneEngineMessageL( |
|
105 |
const TInt aMessage, |
|
106 |
TInt aCallId ) |
|
107 |
{ |
|
108 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
109 |
"CPhoneStateSingleVoIP::HandlePhoneEngineMessageL() ") |
|
110 |
switch ( aMessage ) |
|
111 |
{ |
|
112 |
case MEngineMonitor::EPEMessageUnattendedTransferRequest: |
|
113 |
LaunchUnattendedTransferAcceptanceQueryL(); |
|
114 |
break; |
|
115 |
default: |
|
116 |
CPhoneSingleCall::HandlePhoneEngineMessageL( |
|
117 |
aMessage, aCallId ); |
|
118 |
break; |
|
119 |
} |
|
120 |
} |
|
121 |
||
122 |
// ----------------------------------------------------------- |
|
123 |
// CPhoneStateSingleVoIP::HandleCommandL |
|
124 |
// ----------------------------------------------------------- |
|
125 |
// |
|
126 |
TBool CPhoneStateSingleVoIP::HandleCommandL( TInt aCommand ) |
|
127 |
{ |
|
128 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
129 |
"CPhoneStateSingleVoIP::HandleCommandL()" ) |
|
130 |
||
131 |
TBool commandStatus( ETrue ); |
|
132 |
||
133 |
switch( aCommand ) |
|
134 |
{ |
|
135 |
case EPhoneNumberAcqCmdInternetCall: |
|
136 |
StateUtils().SelectServiceAndDialL(); |
|
137 |
break; |
|
138 |
||
139 |
case EPhoneNumberAcqCmdSendCommand: |
|
140 |
StartCallingL(); |
|
141 |
break; |
|
142 |
||
143 |
case EPhoneCmdAcceptUnattendedTransfer: |
|
144 |
HandleUnattendedTransferRequestResponseL( ETrue ); |
|
145 |
break; |
|
146 |
||
147 |
case EPhoneCmdRejectUnattendedTransfer: |
|
148 |
HandleUnattendedTransferRequestResponseL( EFalse ); |
|
149 |
break; |
|
150 |
default: |
|
151 |
commandStatus = CPhoneSingleCall::HandleCommandL( aCommand ); |
|
152 |
break; |
|
153 |
} |
|
154 |
||
155 |
return commandStatus; |
|
156 |
} |
|
157 |
||
158 |
// ----------------------------------------------------------- |
|
159 |
// CPhoneStateIdleVoIP::HandleKeyMessageL |
|
160 |
// ----------------------------------------------------------- |
|
161 |
// |
|
162 |
void CPhoneStateSingleVoIP::HandleKeyMessageL( |
|
163 |
TPhoneKeyEventMessages aMessage, |
|
164 |
TKeyCode aKeyCode ) |
|
165 |
{ |
|
166 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
167 |
"CPhoneStateSingleVoIP::HandleKeyMessageL()" ) |
|
168 |
switch ( aKeyCode ) |
|
169 |
{ |
|
170 |
// send-key |
|
171 |
case EKeyYes: |
|
172 |
{ |
|
173 |
TPhoneCmdParamInteger numberEntryCountParam; |
|
174 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount, |
|
175 |
&numberEntryCountParam ); |
|
176 |
TInt neLength( numberEntryCountParam.Integer() ); |
|
177 |
||
178 |
if( IsNumberEntryVisibleL() && neLength ) |
|
179 |
{ |
|
180 |
if ( IsOnScreenDialerSupported() && |
|
56
5bcb308bd24d
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
181 |
IsCustomizedDialerVisibleL() ) |
37 | 182 |
{ |
183 |
return; |
|
184 |
} |
|
185 |
||
186 |
StartCallingL(); |
|
187 |
} |
|
188 |
else |
|
189 |
{ |
|
190 |
//Calls ToggleHoldL, if number entry isn't used. |
|
191 |
CPhoneSingleCall::HandleKeyMessageL( aMessage, aKeyCode ); |
|
192 |
} |
|
193 |
} |
|
194 |
break; |
|
195 |
||
196 |
default: |
|
197 |
CPhoneSingleCall::HandleKeyMessageL( aMessage, aKeyCode ); |
|
198 |
break; |
|
199 |
} |
|
200 |
} |
|
201 |
||
202 |
// ----------------------------------------------------------- |
|
203 |
// CPhoneStateSingleVoIP::StartCallingL |
|
204 |
// ----------------------------------------------------------- |
|
205 |
// |
|
206 |
void CPhoneStateSingleVoIP::StartCallingL() |
|
207 |
{ |
|
208 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
209 |
"CPhoneStateSingleVoIP::StartCallingL()" ) |
|
210 |
||
211 |
TUint serviceId( 0 ); |
|
212 |
CPhoneStateUtilsVoip& utililty = StateUtils(); |
|
213 |
if ( utililty.IsVoipPreferredCall( serviceId ) ) |
|
214 |
{ |
|
215 |
utililty.SelectServiceAndDialL( KNullDesC, serviceId ); |
|
216 |
} |
|
217 |
else |
|
218 |
{ |
|
219 |
if ( utililty.IsVoipNumber() ) |
|
220 |
{ |
|
221 |
utililty.SelectServiceAndDialL(); |
|
222 |
} |
|
223 |
else |
|
224 |
{ |
|
225 |
if ( IsNumberEntryUsedL() ) |
|
226 |
{ |
|
227 |
// handle send key short press |
|
228 |
HBufC* phoneNumber = PhoneNumberFromEntryLC(); |
|
229 |
||
230 |
if ( !IsSimOk() ) |
|
231 |
{ |
|
232 |
iStateMachine->PhoneEngineInfo()->SetPhoneNumber( |
|
233 |
*phoneNumber ) ; |
|
234 |
iStateMachine->SendPhoneEngineMessage( |
|
235 |
MPEPhoneModel::EPEMessageCheckEmergencyNumber ); |
|
236 |
CleanupStack::PopAndDestroy( phoneNumber ); |
|
237 |
return; |
|
238 |
} |
|
239 |
||
240 |
// call the number |
|
241 |
iStateMachine->PhoneEngineInfo()->SetPhoneNumber( |
|
242 |
*phoneNumber ); |
|
243 |
DialVoiceCallL(); |
|
244 |
||
245 |
CleanupStack::PopAndDestroy( phoneNumber ); |
|
246 |
} |
|
247 |
} |
|
248 |
} |
|
249 |
} |
|
250 |
||
251 |
// ----------------------------------------------------------- |
|
252 |
// CPhoneStateSingleVoIP::LaunchUnattendedTransferAcceptanceQueryL |
|
253 |
// Dialog is constructed based on S60 In-Call Operations UI Specification, |
|
254 |
// Section 2.26. |
|
255 |
// ----------------------------------------------------------- |
|
256 |
// |
|
257 |
void CPhoneStateSingleVoIP::LaunchUnattendedTransferAcceptanceQueryL() |
|
258 |
{ |
|
259 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
260 |
"CPhoneStateSingleVoIP::LaunchUnattendedTransferAcceptanceQueryL() ") |
|
261 |
||
262 |
TPhoneCmdParamQuery queryParam; |
|
263 |
queryParam.SetQueryType( EPhoneGlobalMsgQuery ); |
|
264 |
queryParam.SetCommandParamId( |
|
265 |
TPhoneCommandParam::EPhoneParamIdUnattendedTransferAcceptanceQuery ); |
|
266 |
||
267 |
HBufC* msgHeader = |
|
268 |
StringLoader::LoadLC( CPhoneMainResourceResolver::Instance()-> |
|
269 |
ResolveResourceID( |
|
270 |
EPhoneVoIPUnattendedTransferAcceptanceQueryHeader ) ); |
|
271 |
queryParam.SetQueryPrompt( *msgHeader ); |
|
272 |
||
273 |
RBuf queryText; |
|
274 |
CleanupClosePushL( queryText ); |
|
275 |
ResolveUnattendedTransferAcceptanceQueryDialogTextL( queryText ); |
|
276 |
queryParam.SetDataText( &queryText ); |
|
277 |
||
278 |
queryParam.SetDefaultCba( R_AVKON_SOFTKEYS_ACCEPT_REJECT ); |
|
279 |
||
280 |
const TInt KAcceptTransferQueryTimeoutInSec = 7; |
|
281 |
queryParam.SetTimeOut( KAcceptTransferQueryTimeoutInSec ); |
|
282 |
||
283 |
queryParam.SetTone( EAvkonSIDDefaultSound ); |
|
284 |
||
285 |
// configure custom command mappings for user responses |
|
286 |
queryParam.SetCbaCommandMapping( |
|
287 |
EAknSoftkeyYes, EPhoneCmdAcceptUnattendedTransfer ); |
|
288 |
queryParam.SetCbaCommandMapping( |
|
289 |
EAknSoftkeyOk, EPhoneCmdAcceptUnattendedTransfer ); |
|
290 |
queryParam.SetCbaCommandMapping( |
|
291 |
EAknSoftkeyNo, EPhoneCmdRejectUnattendedTransfer ); |
|
292 |
queryParam.SetCbaCommandMapping( |
|
293 |
EAknSoftkeyCancel, EPhoneCmdRejectUnattendedTransfer ); |
|
294 |
queryParam.SetCustomCommandForTimeOut( EPhoneCmdRejectUnattendedTransfer ); |
|
295 |
||
296 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery, &queryParam ); |
|
297 |
||
298 |
CleanupStack::PopAndDestroy( &queryText ); |
|
299 |
CleanupStack::PopAndDestroy( msgHeader ); |
|
300 |
} |
|
301 |
||
302 |
||
303 |
// ----------------------------------------------------------- |
|
304 |
// CPhoneStateSingleVoIP::ResolveUnattendedTransferAcceptanceQueryDialogTextL |
|
305 |
// ----------------------------------------------------------- |
|
306 |
// |
|
307 |
void CPhoneStateSingleVoIP::ResolveUnattendedTransferAcceptanceQueryDialogTextL( |
|
308 |
RBuf& aQueryText ) const |
|
309 |
{ |
|
310 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
311 |
"CPhoneStateSingleVoIP::ResolveUnattendedTransferAcceptanceQueryDialogTextL") |
|
312 |
||
313 |
aQueryText.Close(); |
|
314 |
||
315 |
MPEEngineInfo* info = iStateMachine->PhoneEngineInfo(); |
|
316 |
const TPEPhoneNumber& transferorAddr = info->RemotePhoneNumber( CallId() ); |
|
317 |
const TPEPhoneNumber& transferTarget = |
|
318 |
info->UnattendedTransferTarget( CallId() ); |
|
319 |
||
320 |
if ( KNullDesC() == transferorAddr ) |
|
321 |
{ |
|
322 |
// transfer initiator is anonymous |
|
323 |
aQueryText.Assign( StringLoader::LoadL( |
|
324 |
CPhoneMainResourceResolver::Instance()->ResolveResourceID( |
|
325 |
EPhoneVoIPUnattendedTransferAcceptanceQueryAnonymous ), |
|
326 |
transferTarget ) ); |
|
327 |
} |
|
328 |
else |
|
329 |
{ |
|
330 |
const TInt KGranularity = 2; |
|
331 |
CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( KGranularity ); |
|
332 |
CleanupStack::PushL( array ); |
|
333 |
array->AppendL( transferorAddr ); |
|
334 |
array->AppendL( transferTarget ); |
|
335 |
aQueryText.Assign( StringLoader::LoadL( |
|
336 |
CPhoneMainResourceResolver::Instance()->ResolveResourceID( |
|
337 |
EPhoneVoIPUnattendedTransferAcceptanceQueryIdentified ), |
|
338 |
*array ) ); |
|
339 |
CleanupStack::PopAndDestroy( array ); |
|
340 |
} |
|
341 |
} |
|
342 |
||
343 |
||
344 |
// ----------------------------------------------------------- |
|
345 |
// CPhoneStateSingleVoIP::HandleUnattendedTransferRequestResponseL |
|
346 |
// ----------------------------------------------------------- |
|
347 |
// |
|
348 |
void CPhoneStateSingleVoIP::HandleUnattendedTransferRequestResponseL( |
|
349 |
TBool aRequestAccepted ) |
|
350 |
{ |
|
351 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
352 |
"CPhoneStateSingleVoIP::HandleUnattendedTransferRequestResponseL" ) |
|
353 |
||
354 |
iStateMachine->SetCallId( CallId() ); |
|
355 |
||
356 |
if ( aRequestAccepted ) |
|
357 |
{ |
|
358 |
iStateMachine->SendPhoneEngineMessage( |
|
359 |
MPEPhoneModel::EPEMessageAcceptUnattendedTransfer ); |
|
360 |
MPEEngineInfo* info = iStateMachine->PhoneEngineInfo(); |
|
361 |
const TPEPhoneNumber& transferTarget = |
|
362 |
info->UnattendedTransferTarget( CallId() ); |
|
363 |
||
364 |
TUint32 serviceId = iStateMachine->PhoneEngineInfo()-> |
|
365 |
ServiceId( CallId() ); |
|
366 |
StateUtils().SelectServiceAndDialL( transferTarget, serviceId ); |
|
367 |
} |
|
368 |
else |
|
369 |
{ |
|
370 |
iStateMachine->SendPhoneEngineMessage( |
|
371 |
MPEPhoneModel::EPEMessageRejectUnattendedTransfer ); |
|
372 |
} |
|
373 |
} |
|
374 |
||
375 |
||
376 |
// ----------------------------------------------------------- |
|
377 |
// CPhoneStateSingleVoIP::StateUtils |
|
378 |
// ----------------------------------------------------------- |
|
379 |
// |
|
380 |
CPhoneStateUtilsVoip& CPhoneStateSingleVoIP::StateUtils() |
|
381 |
{ |
|
382 |
return static_cast<CPhoneStateMachineVoIP&>( |
|
383 |
*iStateMachine ).StateUtils(); |
|
384 |
} |
|
385 |
||
386 |
// End of File |