37
|
1 |
/*
|
|
2 |
* Copyright (c) 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: Class takes care of CBA's.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "cphonecbamanager.h"
|
|
19 |
|
|
20 |
#include "mpeengineinfo.h"
|
|
21 |
#include "mphoneviewcommandhandle.h"
|
|
22 |
#include "mphonestatemachine.h"
|
|
23 |
|
|
24 |
#include <featmgr.h>
|
|
25 |
|
|
26 |
#include "phonerssbase.h"
|
|
27 |
#include "phoneui.pan"
|
|
28 |
#include "phonelogger.h"
|
|
29 |
|
|
30 |
#include "cphonestate.h"
|
|
31 |
#include "cphonecenrepproxy.h"
|
|
32 |
#include "cphonemainresourceresolver.h"
|
|
33 |
|
|
34 |
#include "telephonyvariant.hrh"
|
|
35 |
#include "phoneui.hrh"
|
|
36 |
|
|
37 |
#include "tphonecmdparamboolean.h"
|
|
38 |
#include "tphonecmdparaminteger.h"
|
|
39 |
#include "tphonecmdparamcallstatedata.h"
|
|
40 |
|
|
41 |
|
|
42 |
// ======== MEMBER FUNCTIONS ========
|
|
43 |
|
|
44 |
// ---------------------------------------------------------------------------
|
|
45 |
// CPhoneCbaManager::CPhoneCbaManager
|
|
46 |
// ---------------------------------------------------------------------------
|
|
47 |
//
|
|
48 |
CPhoneCbaManager::CPhoneCbaManager(
|
|
49 |
CPhoneState* aState,
|
|
50 |
MPhoneViewCommandHandle& aViewCommandHandle,
|
|
51 |
MPhoneStateMachine& aStateMachine )
|
|
52 |
: iState ( aState ),
|
|
53 |
iViewCommandHandle ( aViewCommandHandle ),
|
|
54 |
iStateMachine ( aStateMachine )
|
|
55 |
{
|
|
56 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneCbaManager::CPhoneCbaManager() ");
|
|
57 |
}
|
|
58 |
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
// CPhoneCbaManager::NewL
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
CPhoneCbaManager* CPhoneCbaManager::NewL(
|
|
64 |
CPhoneState* aState,
|
|
65 |
MPhoneViewCommandHandle& aViewCommandHandle,
|
|
66 |
MPhoneStateMachine& aStateMachine )
|
|
67 |
{
|
|
68 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneCbaManager::NewL() ");
|
|
69 |
return new (ELeave) CPhoneCbaManager( aState, aViewCommandHandle, aStateMachine );
|
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
// CPhoneCbaManager::~CPhoneCbaManager
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
CPhoneCbaManager::~CPhoneCbaManager()
|
|
77 |
{
|
|
78 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneCbaManager::~CPhoneCbaManager() ");
|
|
79 |
}
|
|
80 |
|
|
81 |
// ======== LOCAL FUNCTIONS ========
|
|
82 |
|
|
83 |
// -----------------------------------------------------------
|
|
84 |
// CPhoneCbaManager::UpdateInCallCbaL
|
|
85 |
// -----------------------------------------------------------
|
|
86 |
//
|
|
87 |
void CPhoneCbaManager::UpdateInCallCbaL()
|
|
88 |
{
|
|
89 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::UpdateInCallCbaL() ");
|
|
90 |
UpdateCbaL( EPhoneCallHandlingInCallCBA );
|
|
91 |
}
|
|
92 |
|
|
93 |
// -----------------------------------------------------------
|
|
94 |
// CPhoneCbaManager::UpdateCbaL
|
|
95 |
// -----------------------------------------------------------
|
|
96 |
//
|
|
97 |
EXPORT_C void CPhoneCbaManager::UpdateCbaL( TInt aResource )
|
|
98 |
{
|
|
99 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::UpdateCbaL() ");
|
|
100 |
__ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(),
|
|
101 |
Panic( EPhoneCtrlInvariant ) );
|
|
102 |
TInt resourceId = aResource;
|
|
103 |
TPhoneCmdParamBoolean hold;
|
|
104 |
iViewCommandHandle.ExecuteCommandL( EPhoneViewGetHoldFlag, &hold );
|
|
105 |
|
|
106 |
const TBool coverHideSendEndKey =
|
|
107 |
CPhoneCenRepProxy::Instance()->IsTelephonyFeatureSupported(
|
|
108 |
KTelephonyLVFlagCoverHideSendEndKey );
|
|
109 |
|
|
110 |
const TPEAudioOutput audioOutput =
|
|
111 |
iStateMachine.PhoneEngineInfo()->AudioOutput();
|
|
112 |
|
|
113 |
TBool btAvailable = iStateMachine.PhoneEngineInfo()->AudioOutputAvailable(
|
|
114 |
EPEBTAudioAccessory );
|
|
115 |
|
|
116 |
// Call setup cases
|
|
117 |
if ( EPhoneCallHandlingCallSetupCBA == aResource )
|
|
118 |
{
|
|
119 |
if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling) )
|
|
120 |
{
|
|
121 |
if ( audioOutput == EPELoudspeaker )
|
|
122 |
{
|
|
123 |
resourceId = EPhoneCallHandlingCallSetupToHandsetCBA;
|
|
124 |
}
|
|
125 |
else if ( audioOutput == EPEHandset )
|
|
126 |
{
|
|
127 |
resourceId = EPhoneCallHandlingCallSetupToIhfCBA;
|
|
128 |
}
|
|
129 |
}
|
|
130 |
}
|
|
131 |
|
|
132 |
// Is numberentry visible
|
|
133 |
else if ( iState->IsNumberEntryUsedL() )
|
|
134 |
{
|
|
135 |
if ( iState->IsAutoLockOn() || !(iState->IsSimOk()) )
|
|
136 |
{
|
|
137 |
resourceId = EPhoneEmptyBackCBA;
|
|
138 |
}
|
|
139 |
else
|
|
140 |
{
|
|
141 |
TBool dtmfEditorVisible = iViewCommandHandle.HandleCommandL(
|
|
142 |
EPhoneViewIsDTMFEditorVisible ) ==
|
|
143 |
EPhoneViewResponseSuccess;
|
|
144 |
TPhoneCmdParamInteger activeCallCount;
|
|
145 |
iViewCommandHandle.ExecuteCommandL(
|
|
146 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount );
|
|
147 |
|
|
148 |
TPhoneCmdParamCallStateData callStateData;
|
|
149 |
callStateData.SetCallState( EPEStateRinging );
|
|
150 |
iViewCommandHandle.HandleCommandL(
|
|
151 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
152 |
|
|
153 |
TInt incomingCall = callStateData.CallId();
|
|
154 |
|
|
155 |
if( dtmfEditorVisible )
|
|
156 |
{
|
|
157 |
resourceId = EPhoneDtmfDialerCBA;
|
|
158 |
}
|
|
159 |
else if( activeCallCount.Integer() == ENoActiveCalls )
|
|
160 |
{
|
|
161 |
resourceId = EPhoneNumberAcqCBA;
|
|
162 |
}
|
|
163 |
else if ( activeCallCount.Integer() > ENoActiveCalls &&
|
|
164 |
incomingCall > KErrNotFound )
|
|
165 |
{
|
|
166 |
resourceId = EPhoneCallHandlingCallWaitingCBA;
|
|
167 |
}
|
|
168 |
else
|
|
169 |
{
|
|
170 |
resourceId = EPhoneInCallNumberAcqCBA;
|
|
171 |
}
|
|
172 |
}
|
|
173 |
}
|
|
174 |
|
|
175 |
// Check is Audio muted
|
|
176 |
else if ( iStateMachine.PhoneEngineInfo()->AudioMute() )
|
|
177 |
{
|
|
178 |
resourceId = EPhoneCallHandlingInCallUnmuteCBA;
|
|
179 |
}
|
|
180 |
|
|
181 |
// Multicall swap
|
|
182 |
else if ( EPhoneCallHandlingNewCallSwapCBA == aResource )
|
|
183 |
{
|
|
184 |
resourceId = EPhoneCallHandlingNewCallSwapCBA;
|
|
185 |
}
|
|
186 |
|
|
187 |
// Call waiting cases
|
|
188 |
else if ( EPhoneCallHandlingCallWaitingCBA == aResource )
|
|
189 |
{
|
|
190 |
resourceId = EPhoneCallHandlingCallWaitingCBA;
|
|
191 |
if ( iState->IsSwivelClosed() )
|
|
192 |
{
|
|
193 |
TPhoneCmdParamInteger activeCallCount;
|
|
194 |
iViewCommandHandle.ExecuteCommandL(
|
|
195 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount );
|
|
196 |
if( activeCallCount.Integer() == EOneActiveCall )
|
|
197 |
{
|
|
198 |
resourceId = EPhoneCallHandlingWaitingAnswerSwivelClosedCBA;
|
|
199 |
}
|
|
200 |
else if( activeCallCount.Integer() == ETwoActiveCalls )
|
|
201 |
{
|
|
202 |
resourceId = EPhoneCallHandlingWaitingReplaceSwivelClosedCBA;
|
|
203 |
}
|
|
204 |
}
|
|
205 |
}
|
|
206 |
|
|
207 |
// Check is call in hold
|
|
208 |
else if ( hold.Boolean() )
|
|
209 |
{
|
|
210 |
resourceId = EPhoneCallHandlingInCallUnholdCBA;
|
|
211 |
}
|
|
212 |
|
|
213 |
// Is BT accessory connected
|
|
214 |
else if ( audioOutput == EPEBTAudioAccessory &&
|
|
215 |
IsVoiceCallAlertingOrActiveL() &&
|
|
216 |
!coverHideSendEndKey )
|
|
217 |
{
|
|
218 |
resourceId = EPhoneCallHandlingInCallHandsetCBA;
|
|
219 |
}
|
|
220 |
|
|
221 |
else if ( audioOutput == EPEWiredAudioAccessory ||
|
|
222 |
coverHideSendEndKey || iState->IsSwivelClosed() )
|
|
223 |
{
|
|
224 |
resourceId = EPhoneCallHandlingInCallNoIhfCBA;
|
|
225 |
}
|
|
226 |
|
|
227 |
// Check BT availability
|
|
228 |
else if ( audioOutput == EPELoudspeaker )
|
|
229 |
{
|
|
230 |
if ( btAvailable )
|
|
231 |
{
|
|
232 |
resourceId = EPhoneCallHandlingInCallBtaaCBA;
|
|
233 |
}
|
|
234 |
else
|
|
235 |
{
|
|
236 |
resourceId = EPhoneCallHandlingInCallHandsetCBA;
|
|
237 |
}
|
|
238 |
}
|
|
239 |
else if ( audioOutput == EPEHandset && btAvailable )
|
|
240 |
{
|
|
241 |
resourceId = EPhoneCallHandlingInCallBtaaCBA;
|
|
242 |
}
|
|
243 |
|
|
244 |
SetCbaL( resourceId );
|
|
245 |
}
|
|
246 |
|
|
247 |
// -----------------------------------------------------------
|
|
248 |
// CPhoneCbaManager::UpdateIncomingCbaL
|
|
249 |
// -----------------------------------------------------------
|
|
250 |
//
|
|
251 |
EXPORT_C void CPhoneCbaManager::UpdateIncomingCbaL( TInt aCallId )
|
|
252 |
{
|
|
253 |
__LOGMETHODSTARTEND(EPhoneControl,"CPhoneCbaManager::UpdateIncomingCbaL()" );
|
|
254 |
|
|
255 |
const TBool coverHideSendEndKey =
|
|
256 |
CPhoneCenRepProxy::Instance()->IsTelephonyFeatureSupported(
|
|
257 |
KTelephonyLVFlagCoverHideSendEndKey );
|
|
258 |
|
|
259 |
const TProfileRingingType ringingType =
|
|
260 |
iStateMachine.PhoneEngineInfo()->RingingType();
|
|
261 |
|
|
262 |
const TBool callIsAlerting =
|
|
263 |
!(( ringingType == EProfileRingingTypeSilent ) ||
|
|
264 |
( ringingType == EProfileRingingTypeBeepOnce ));
|
|
265 |
|
|
266 |
// Update soft reject flag
|
|
267 |
TBool softRejectActivated( ETrue );
|
|
268 |
// VoIP calls do not support sms sending
|
|
269 |
if ( iStateMachine.PhoneEngineInfo()->CallType( aCallId ) == EPECallTypeVoIP
|
|
270 |
|| iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() == 0 )
|
|
271 |
{
|
|
272 |
softRejectActivated = EFalse;
|
|
273 |
}
|
|
274 |
TPhoneCmdParamBoolean softRejectParam;
|
|
275 |
softRejectParam.SetBoolean( softRejectActivated );
|
|
276 |
iViewCommandHandle.ExecuteCommandL( EPhoneViewSetSoftRejectFlag,
|
|
277 |
&softRejectParam );
|
|
278 |
|
|
279 |
TInt incomingCbaResourceId;
|
|
280 |
|
|
281 |
if ( iState->IsSwivelClosed() )
|
|
282 |
{
|
|
283 |
if ( !callIsAlerting || iRingtoneSilenced )
|
|
284 |
{
|
|
285 |
incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSwivelClosedCBA;
|
|
286 |
}
|
|
287 |
else
|
|
288 |
{
|
|
289 |
incomingCbaResourceId = EPhoneCallHandlingIncomingSwivelClosedCBA;
|
|
290 |
}
|
|
291 |
}
|
|
292 |
|
|
293 |
else if ( coverHideSendEndKey )
|
|
294 |
{
|
|
295 |
if ( callIsAlerting )
|
|
296 |
{
|
|
297 |
// Set CBA to Options..Silence
|
|
298 |
incomingCbaResourceId = EPhoneCallHandlingIncomingSliderCBA;
|
|
299 |
}
|
|
300 |
else if ( softRejectActivated )
|
|
301 |
{
|
|
302 |
// Set CBA for soft reject
|
|
303 |
incomingCbaResourceId = EPhoneCallHandlingIncomingSoftRejectSliderCBA;
|
|
304 |
}
|
|
305 |
else
|
|
306 |
{
|
|
307 |
// Set CBA to Options..Reject
|
|
308 |
incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSliderCBA;
|
|
309 |
}
|
|
310 |
}
|
|
311 |
|
|
312 |
else
|
|
313 |
{
|
|
314 |
if ( callIsAlerting )
|
|
315 |
{
|
|
316 |
incomingCbaResourceId = GetIncomingCallSilenceCBA( softRejectActivated );
|
|
317 |
}
|
|
318 |
else if ( softRejectActivated )
|
|
319 |
{
|
|
320 |
// Set CBA for soft reject
|
|
321 |
incomingCbaResourceId = EPhoneCallHandlingIncomingSoftRejectCBA;
|
|
322 |
}
|
|
323 |
else
|
|
324 |
{
|
|
325 |
incomingCbaResourceId = EPhoneCallHandlingIncomingRejectCBA;
|
|
326 |
}
|
|
327 |
}
|
|
328 |
|
|
329 |
SetCbaL( incomingCbaResourceId );
|
|
330 |
}
|
|
331 |
|
|
332 |
// -----------------------------------------------------------
|
|
333 |
// CPhoneCbaManager::SetCbaL
|
|
334 |
// -----------------------------------------------------------
|
|
335 |
//
|
|
336 |
EXPORT_C void CPhoneCbaManager::SetCbaL( TInt aResource )
|
|
337 |
{
|
|
338 |
__LOGMETHODSTARTEND(EPhoneControl,"CPhoneCbaManager::SetCbaL()" );
|
|
339 |
|
|
340 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
341 |
"CPhoneCbaManager::SetCbaL : %d",aResource );
|
|
342 |
|
|
343 |
TPhoneCmdParamInteger integerParam;
|
|
344 |
integerParam.SetInteger(
|
|
345 |
CPhoneMainResourceResolver::Instance()->ResolveResourceID(
|
|
346 |
aResource ) );
|
|
347 |
iViewCommandHandle.ExecuteCommandL( EPhoneViewUpdateCba,
|
|
348 |
&integerParam );
|
|
349 |
}
|
|
350 |
|
|
351 |
// -----------------------------------------------------------
|
|
352 |
// CPhoneCbaManager::UpdateCbaSwivelStateChangedL
|
|
353 |
// -----------------------------------------------------------
|
|
354 |
//
|
|
355 |
void CPhoneCbaManager::UpdateCbaSwivelStateChangedL()
|
|
356 |
{
|
|
357 |
__LOGMETHODSTARTEND(EPhoneControl,"CPhoneCbaManager::UpdateCbaSwivelStateChangedL()" );
|
|
358 |
|
|
359 |
TPhoneCmdParamCallStateData callStateData;
|
|
360 |
callStateData.SetCallState( EPEStateRinging );
|
|
361 |
iViewCommandHandle.HandleCommandL(
|
|
362 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
363 |
TInt incomingCall = callStateData.CallId();
|
|
364 |
|
|
365 |
TPhoneCmdParamInteger activeCallCount;
|
|
366 |
iViewCommandHandle.ExecuteCommandL(
|
|
367 |
EPhoneViewGetCountOfActiveCalls, &activeCallCount );
|
|
368 |
|
|
369 |
if ( incomingCall > KErrNotFound )
|
|
370 |
{
|
|
371 |
if( activeCallCount.Integer() == ENoActiveCalls )
|
|
372 |
{
|
|
373 |
UpdateIncomingCbaL( incomingCall );
|
|
374 |
}
|
|
375 |
else
|
|
376 |
{
|
|
377 |
UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
|
|
378 |
}
|
|
379 |
}
|
|
380 |
else if ( activeCallCount.Integer() != ENoActiveCalls )
|
|
381 |
{
|
|
382 |
UpdateInCallCbaL();
|
|
383 |
}
|
|
384 |
}
|
|
385 |
|
|
386 |
// -----------------------------------------------------------
|
|
387 |
// CPhoneCbaManager::IsVoiceCallAlertingOrActiveL
|
|
388 |
// -----------------------------------------------------------
|
|
389 |
//
|
|
390 |
TBool CPhoneCbaManager::IsVoiceCallAlertingOrActiveL()
|
|
391 |
{
|
|
392 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
393 |
"CPhoneCbaManager::IsVoiceCallAlertingOrActiveL()" );
|
|
394 |
TBool retVal = EFalse;
|
|
395 |
|
|
396 |
// Fetch alerting call's id from view
|
|
397 |
TPhoneCmdParamCallStateData callStateData;
|
|
398 |
callStateData.SetCallState( EPEStateConnecting );
|
|
399 |
iViewCommandHandle.HandleCommandL(
|
|
400 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
401 |
|
|
402 |
if ( callStateData.CallId() > KErrNotFound )
|
|
403 |
{
|
|
404 |
TPECallType type = iStateMachine.PhoneEngineInfo()->CallType(
|
|
405 |
callStateData.CallId() );
|
|
406 |
|
|
407 |
if ( EPECallTypeCSVoice == type || EPECallTypeVoIP == type )
|
|
408 |
{
|
|
409 |
retVal = ETrue;
|
|
410 |
}
|
|
411 |
}
|
|
412 |
else
|
|
413 |
{
|
|
414 |
// Fetch active call's id from view
|
|
415 |
TPhoneCmdParamCallStateData callStateData;
|
|
416 |
callStateData.SetCallState( EPEStateConnected );
|
|
417 |
iViewCommandHandle.HandleCommandL(
|
|
418 |
EPhoneViewGetCallIdByState, &callStateData );
|
|
419 |
|
|
420 |
if ( callStateData.CallId() > KErrNotFound )
|
|
421 |
{
|
|
422 |
TPECallType type = iStateMachine.PhoneEngineInfo()->CallType(
|
|
423 |
callStateData.CallId() );
|
|
424 |
|
|
425 |
if ( EPECallTypeCSVoice == type || EPECallTypeVoIP == type )
|
|
426 |
{
|
|
427 |
retVal = ETrue;
|
|
428 |
}
|
|
429 |
}
|
|
430 |
}
|
|
431 |
return retVal;
|
|
432 |
}
|
|
433 |
|
|
434 |
// -----------------------------------------------------------
|
|
435 |
// CPhoneCbaManager::SetRingtoneSilencedStatus
|
|
436 |
// -----------------------------------------------------------
|
|
437 |
//
|
|
438 |
void CPhoneCbaManager::SetRingtoneSilencedStatus( const TBool aSilencedStatus )
|
|
439 |
{
|
|
440 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::SetRingtoneSilencedStatus ()" );
|
|
441 |
// Set the internal TBool variable
|
|
442 |
iRingtoneSilenced = aSilencedStatus;
|
|
443 |
__PHONELOG1(
|
|
444 |
EBasic,
|
|
445 |
EPhoneControl,
|
|
446 |
"CPhoneCbaManager::SetRingtoneSilencedStatus - iRingtoneSilenced =%d",
|
|
447 |
iRingtoneSilenced );
|
|
448 |
}
|
|
449 |
|
|
450 |
// -----------------------------------------------------------
|
|
451 |
// CPhoneCbaManager::GetIncomingCallSilenceCBA
|
|
452 |
// -----------------------------------------------------------
|
|
453 |
//
|
|
454 |
TInt CPhoneCbaManager::GetIncomingCallSilenceCBA(
|
|
455 |
const TBool /*aSoftRejectActivated*/ )
|
|
456 |
{
|
|
457 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::GetIncomingCallSilenceCBA ()" );
|
|
458 |
TInt ret = EPhoneCallHandlingIncomingCBA;
|
|
459 |
return ret;
|
|
460 |
}
|
|
461 |
|
|
462 |
// ======== LOCAL FUNCTIONS ========
|
|
463 |
|
|
464 |
|