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 CPhoneStateIdleVoIP class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <mpeengineinfo.h>
|
|
21 |
#include "pevirtualengine.h"
|
|
22 |
#include <featmgr.h>
|
|
23 |
|
|
24 |
#include "cphonestateidlevoip.h"
|
|
25 |
#include "phoneappvoipcommands.hrh"
|
|
26 |
#include "phonerssvoip.h"
|
|
27 |
#include "tphonecmdparaminteger.h"
|
|
28 |
#include "cphonemainresourceresolver.h"
|
|
29 |
#include "mphonestatemachine.h"
|
|
30 |
#include "cphonelogger.h"
|
|
31 |
#include "phoneui.pan"
|
|
32 |
#include "cphonecustomizationvoip.h"
|
|
33 |
#include "cphonecenrepproxy.h"
|
|
34 |
#include "cphonestateutilsvoip.h"
|
|
35 |
#include "cphonestatemachinevoip.h"
|
|
36 |
|
|
37 |
// CONSTANTS
|
|
38 |
|
|
39 |
// ================= MEMBER FUNCTIONS =======================
|
|
40 |
|
|
41 |
// C++ default constructor can NOT contain any code, that
|
|
42 |
// might leave.
|
|
43 |
//
|
|
44 |
CPhoneStateIdleVoIP::CPhoneStateIdleVoIP(
|
|
45 |
MPhoneStateMachine& aStateMachine,
|
|
46 |
MPhoneViewCommandHandle& aViewCommandHandle,
|
|
47 |
MPhoneCustomization& aCustomization ) :
|
|
48 |
CPhoneIdle( &aStateMachine, &aViewCommandHandle, &aCustomization )
|
|
49 |
{
|
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
// -----------------------------------------------------------
|
|
54 |
// CPhoneStateIdleVoIP::~CPhoneStateIdleVoIP()
|
|
55 |
// Destructor
|
|
56 |
// (other items were commented in a header).
|
|
57 |
// -----------------------------------------------------------
|
|
58 |
//
|
|
59 |
CPhoneStateIdleVoIP::~CPhoneStateIdleVoIP()
|
|
60 |
{
|
|
61 |
}
|
|
62 |
|
|
63 |
|
|
64 |
// -----------------------------------------------------------
|
|
65 |
// CPhoneStateIdleVoIP::ConstructL()
|
|
66 |
// Constructor
|
|
67 |
// (other items were commented in a header).
|
|
68 |
// -----------------------------------------------------------
|
|
69 |
//
|
|
70 |
void CPhoneStateIdleVoIP::ConstructL()
|
|
71 |
{
|
|
72 |
CPhoneIdle::ConstructL();
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
// -----------------------------------------------------------
|
|
77 |
// CPhoneStateIdleVoIP::NewL()
|
|
78 |
// Constructor
|
|
79 |
// (other items were commented in a header).
|
|
80 |
// -----------------------------------------------------------
|
|
81 |
//
|
|
82 |
CPhoneStateIdleVoIP* CPhoneStateIdleVoIP::NewL(
|
|
83 |
MPhoneStateMachine& aStateMachine,
|
|
84 |
MPhoneViewCommandHandle& aViewCommandHandle,
|
|
85 |
MPhoneCustomization& aCustomization )
|
|
86 |
{
|
|
87 |
CPhoneStateIdleVoIP* self = new (ELeave) CPhoneStateIdleVoIP(
|
|
88 |
aStateMachine, aViewCommandHandle, aCustomization );
|
|
89 |
|
|
90 |
CleanupStack::PushL( self );
|
|
91 |
self->ConstructL();
|
|
92 |
CleanupStack::Pop( self );
|
|
93 |
|
|
94 |
return self;
|
|
95 |
}
|
|
96 |
|
|
97 |
|
|
98 |
// -----------------------------------------------------------
|
|
99 |
// CPhoneStateIdleVoIP::HandlePhoneEngineMessageL
|
|
100 |
// -----------------------------------------------------------
|
|
101 |
//
|
|
102 |
void CPhoneStateIdleVoIP::HandlePhoneEngineMessageL(
|
|
103 |
const TInt aMessage,
|
|
104 |
TInt aCallId )
|
|
105 |
{
|
|
106 |
switch ( aMessage )
|
|
107 |
{
|
|
108 |
default:
|
|
109 |
CPhoneIdle::HandlePhoneEngineMessageL( aMessage, aCallId );
|
|
110 |
break;
|
|
111 |
}
|
|
112 |
}
|
|
113 |
|
|
114 |
|
|
115 |
// -----------------------------------------------------------
|
|
116 |
// CPhoneStateIdleVoIP::HandleCommandL
|
|
117 |
// -----------------------------------------------------------
|
|
118 |
//
|
|
119 |
TBool CPhoneStateIdleVoIP::HandleCommandL( TInt aCommand )
|
|
120 |
{
|
|
121 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneStateIdleVoIP::HandleCommandL() ");
|
|
122 |
|
|
123 |
TBool commandStatus( ETrue );
|
|
124 |
|
|
125 |
switch( aCommand )
|
|
126 |
{
|
|
127 |
case EPhoneNumberAcqCmdInternetCall:
|
|
128 |
{
|
|
129 |
StateUtils().SelectServiceAndDialL();
|
|
130 |
}
|
|
131 |
break;
|
|
132 |
|
|
133 |
default:
|
|
134 |
commandStatus = CPhoneIdle::HandleCommandL( aCommand );
|
|
135 |
break;
|
|
136 |
}
|
|
137 |
|
|
138 |
return commandStatus;
|
|
139 |
}
|
|
140 |
|
|
141 |
|
|
142 |
// -----------------------------------------------------------
|
|
143 |
// CPhoneStateIdleVoIP::HandleSendCommandL
|
|
144 |
// -----------------------------------------------------------
|
|
145 |
//
|
|
146 |
void CPhoneStateIdleVoIP::HandleSendCommandL()
|
|
147 |
{
|
|
148 |
__LOGMETHODSTARTEND(
|
|
149 |
PhoneUIVoIPExtension, "CPhoneStateIdleVoIP::HandleSendCommandL()" );
|
|
150 |
|
|
151 |
HBufC* phoneNumber = PhoneNumberFromEntryLC();
|
|
152 |
|
|
153 |
if ( !IsSimOk() || IsEmergencyNumber( *phoneNumber ) )
|
|
154 |
{
|
|
155 |
CPhoneIdle::HandleSendCommandL();
|
|
156 |
}
|
|
157 |
else
|
|
158 |
{
|
|
159 |
TUint serviceId( 0 );
|
|
160 |
CPhoneStateUtilsVoip& utils = StateUtils();
|
|
161 |
if ( utils.IsVoipPreferredCall( serviceId ) &&
|
|
162 |
!iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() )
|
|
163 |
{
|
|
164 |
utils.SelectServiceAndDialL( KNullDesC, serviceId );
|
|
165 |
}
|
|
166 |
else
|
|
167 |
{
|
|
168 |
if ( utils.IsVoipNumber() )
|
|
169 |
{
|
|
170 |
utils.SelectServiceAndDialL();
|
|
171 |
}
|
|
172 |
else
|
|
173 |
{
|
|
174 |
CPhoneIdle::HandleSendCommandL();
|
|
175 |
}
|
|
176 |
}
|
|
177 |
}
|
|
178 |
|
|
179 |
CleanupStack::PopAndDestroy( phoneNumber );
|
|
180 |
}
|
|
181 |
|
|
182 |
|
|
183 |
// -----------------------------------------------------------
|
|
184 |
// CPhoneStateIdleVoIP::HandleDialingL
|
|
185 |
// -----------------------------------------------------------
|
|
186 |
//
|
|
187 |
void CPhoneStateIdleVoIP::HandleDialingL( TInt aCallId )
|
|
188 |
{
|
|
189 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneStateIdleVoIP::HandleDialingL( ) ");
|
|
190 |
|
|
191 |
if( iStateMachine->PhoneEngineInfo()->CallType( aCallId ) == EPECallTypeVoIP )
|
|
192 |
{
|
|
193 |
SetCallHeaderType( EPECallTypeVoIP );
|
|
194 |
}
|
|
195 |
|
|
196 |
CPhoneIdle::HandleDialingL( aCallId );
|
|
197 |
}
|
|
198 |
|
|
199 |
|
|
200 |
// -----------------------------------------------------------
|
|
201 |
// CPhoneStateIdleVoIP::DialL
|
|
202 |
// -----------------------------------------------------------
|
|
203 |
//
|
|
204 |
void CPhoneStateIdleVoIP::DialL(
|
|
205 |
const TDesC& aNumber,
|
|
206 |
TPhoneNumberType aNumberType,
|
|
207 |
TDialInitiationMethod aDialMethod )
|
|
208 |
{
|
|
209 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension,
|
|
210 |
"CPhoneStateIdleVoIP::DialL( ) ");
|
|
211 |
if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
|
|
212 |
{
|
|
213 |
CPhoneStateUtilsVoip& utils = StateUtils();
|
|
214 |
|
|
215 |
// When speed dialling to voice mailbox, service id comes from vmbx
|
|
216 |
TUint serviceId = iStateMachine->PhoneEngineInfo()->ServiceIdCommand();
|
|
217 |
|
|
218 |
if ( serviceId != KUnknownService && EPhoneNumberTypeNotFound != aNumberType )
|
|
219 |
{
|
|
220 |
if ( EPhoneNumberTypeVoip == aNumberType )
|
|
221 |
{
|
|
222 |
utils.DialVoIPL( aNumber, serviceId );
|
|
223 |
}
|
|
224 |
else
|
|
225 |
{
|
|
226 |
CPhoneIdle::DialL( aNumber, aNumberType, aDialMethod );
|
|
227 |
}
|
|
228 |
}
|
|
229 |
else if( utils.IsVoipPreferredCall( serviceId ) )
|
|
230 |
{
|
|
231 |
// Because IsVoipPreferredCall assumes that Send key is pressed,
|
|
232 |
// we only use serviceId given by it when dial method is SendCommand
|
|
233 |
if ( EDialMethodSendCommand == aDialMethod )
|
|
234 |
{
|
|
235 |
utils.SelectServiceAndDialL( aNumber, serviceId );
|
|
236 |
}
|
|
237 |
else
|
|
238 |
{
|
|
239 |
// One key dialing is done based on number type even
|
|
240 |
// if VoIP is preferred call.
|
|
241 |
CPhoneIdle::DialL( aNumber, aNumberType, aDialMethod );
|
|
242 |
}
|
|
243 |
}
|
|
244 |
else
|
|
245 |
{
|
|
246 |
if ( EPhoneNumberTypeVoip == aNumberType )
|
|
247 |
{
|
|
248 |
utils.SelectServiceAndDialL( aNumber );
|
|
249 |
}
|
|
250 |
else
|
|
251 |
{
|
|
252 |
CPhoneIdle::DialL( aNumber, aNumberType, aDialMethod );
|
|
253 |
}
|
|
254 |
}
|
|
255 |
}
|
|
256 |
else
|
|
257 |
{
|
|
258 |
CPhoneIdle::DialL( aNumber, aNumberType, aDialMethod );
|
|
259 |
}
|
|
260 |
}
|
|
261 |
|
|
262 |
|
|
263 |
// -----------------------------------------------------------
|
|
264 |
// CPhoneStateIdleVoip::IsEmergencyNumber()
|
|
265 |
// -----------------------------------------------------------
|
|
266 |
//
|
|
267 |
TBool CPhoneStateIdleVoIP::IsEmergencyNumber( const TDesC& aNumber )
|
|
268 |
{
|
|
269 |
__LOGMETHODSTARTEND( PhoneUIVoIPExtension,
|
|
270 |
"CPhoneStateIdleVoIP::IsEmergencyNumber" );
|
|
271 |
|
|
272 |
return StateUtils().IsEmergencyNumber( aNumber );
|
|
273 |
}
|
|
274 |
|
|
275 |
|
|
276 |
// -----------------------------------------------------------
|
|
277 |
// CPhoneStateIdleVoIP::StateUtils
|
|
278 |
// -----------------------------------------------------------
|
|
279 |
//
|
|
280 |
CPhoneStateUtilsVoip& CPhoneStateIdleVoIP::StateUtils()
|
|
281 |
{
|
|
282 |
return static_cast<CPhoneStateMachineVoIP&>(
|
|
283 |
*iStateMachine ).StateUtils();
|
|
284 |
}
|
|
285 |
|
|
286 |
// End of File
|