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 CPhoneConferenceAndSingle class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <StringLoader.h>
|
|
21 |
#include <cpephonemodelif.h>
|
|
22 |
#include <mpeengineinfo.h>
|
|
23 |
#include <featmgr.h>
|
|
24 |
#include "cphoneconferenceandsingle.h"
|
|
25 |
#include "mphonestatemachine.h"
|
|
26 |
#include "phoneviewcommanddefinitions.h"
|
|
27 |
#include "tphonecmdparamcallheaderdata.h"
|
|
28 |
#include "tphonecmdparamstring.h"
|
|
29 |
#include "phonestatedefinitionsgsm.h"
|
|
30 |
#include "phonelogger.h"
|
|
31 |
#include "tphonecmdparamboolean.h"
|
|
32 |
#include "tphonecmdparaminteger.h"
|
|
33 |
#include "tphonecmdparamcallstatedata.h"
|
|
34 |
#include "cphonemainresourceresolver.h"
|
|
35 |
#include "phonerssbase.h"
|
|
36 |
#include "tphonecmdparamglobalnote.h"
|
|
37 |
#include "phoneui.hrh"
|
|
38 |
|
|
39 |
// ================= MEMBER FUNCTIONS =======================
|
|
40 |
|
|
41 |
// C++ default constructor can NOT contain any code, that
|
|
42 |
// might leave.
|
|
43 |
//
|
|
44 |
CPhoneConferenceAndSingle::CPhoneConferenceAndSingle(
|
|
45 |
MPhoneStateMachine* aStateMachine,
|
|
46 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
47 |
MPhoneCustomization* aPhoneCustomization ) :
|
|
48 |
CPhoneConference( aStateMachine, aViewCommandHandle, aPhoneCustomization )
|
|
49 |
{
|
|
50 |
}
|
|
51 |
|
|
52 |
// -----------------------------------------------------------
|
|
53 |
// CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle()
|
|
54 |
// Destructor
|
|
55 |
// (other items were commented in a header).
|
|
56 |
// -----------------------------------------------------------
|
|
57 |
//
|
|
58 |
CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle()
|
|
59 |
{
|
|
60 |
}
|
|
61 |
|
|
62 |
// -----------------------------------------------------------
|
|
63 |
// CPhoneConferenceAndSingle::ConstructL()
|
|
64 |
// Constructor
|
|
65 |
// (other items were commented in a header).
|
|
66 |
// -----------------------------------------------------------
|
|
67 |
//
|
|
68 |
void CPhoneConferenceAndSingle::ConstructL()
|
|
69 |
{
|
|
70 |
CPhoneConference::ConstructL();
|
|
71 |
}
|
|
72 |
|
|
73 |
// -----------------------------------------------------------
|
|
74 |
// CPhoneConferenceAndSingle::NewL()
|
|
75 |
// Constructor
|
|
76 |
// (other items were commented in a header).
|
|
77 |
// -----------------------------------------------------------
|
|
78 |
//
|
|
79 |
CPhoneConferenceAndSingle* CPhoneConferenceAndSingle::NewL(
|
|
80 |
MPhoneStateMachine* aStateMachine,
|
|
81 |
MPhoneViewCommandHandle* aViewCommandHandle,
|
|
82 |
MPhoneCustomization* aPhoneCustomization )
|
|
83 |
{
|
|
84 |
CPhoneConferenceAndSingle* self = new( ELeave ) CPhoneConferenceAndSingle(
|
|
85 |
aStateMachine, aViewCommandHandle, aPhoneCustomization );
|
|
86 |
|
|
87 |
CleanupStack::PushL( self );
|
|
88 |
self->ConstructL();
|
|
89 |
CleanupStack::Pop( self );
|
|
90 |
|
|
91 |
return self;
|
|
92 |
}
|
|
93 |
|
|
94 |
// -----------------------------------------------------------
|
|
95 |
// CPhoneConferenceAndSingle::HandlePhoneEngineMessageL
|
|
96 |
// -----------------------------------------------------------
|
|
97 |
//
|
|
98 |
void CPhoneConferenceAndSingle::HandlePhoneEngineMessageL(
|
|
99 |
const TInt aMessage,
|
|
100 |
TInt aCallId )
|
|
101 |
{
|
|
102 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingle::HandlePhoneEngineMessageL()");
|
|
103 |
switch ( aMessage )
|
|
104 |
{
|
|
105 |
case MEngineMonitor::EPEMessageConnectedConference:
|
|
106 |
case MEngineMonitor::EPEMessageHeldConference:
|
76
|
107 |
case MEngineMonitor::EPEMessageHeld:
|
37
|
108 |
case MEngineMonitor::EPEMessageConnected:
|
76
|
109 |
UpdateCallHeaderAndUiCommandsL( aCallId );
|
37
|
110 |
break;
|
|
111 |
|
65
|
112 |
case MEngineMonitor::EPEMessageInValidEmergencyNumber:
|
|
113 |
SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
|
37
|
114 |
break;
|
|
115 |
|
|
116 |
case MEngineMonitor::EPEMessageValidEmergencyNumber:
|
|
117 |
DialVoiceCallL();
|
|
118 |
break;
|
|
119 |
|
|
120 |
case MEngineMonitor::EPEMessageAddedConferenceMember:
|
|
121 |
HandleAddedConferenceMemberL( aCallId );
|
|
122 |
break;
|
|
123 |
|
|
124 |
default:
|
|
125 |
CPhoneConference::HandlePhoneEngineMessageL( aMessage,
|
|
126 |
aCallId );
|
|
127 |
break;
|
|
128 |
}
|
|
129 |
}
|
|
130 |
|
|
131 |
// -----------------------------------------------------------
|
|
132 |
// CPhoneConferenceAndSingle:HandleCommandL
|
|
133 |
// -----------------------------------------------------------
|
|
134 |
//
|
|
135 |
TBool CPhoneConferenceAndSingle::HandleCommandL( TInt aCommand )
|
|
136 |
{
|
|
137 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleCommandL");
|
|
138 |
TBool commandStatus = ETrue;
|
|
139 |
switch( aCommand )
|
|
140 |
{
|
|
141 |
case EPhoneNumberAcqCmdCall:
|
|
142 |
case EPhoneNumberAcqCmdSendCommand:
|
|
143 |
HandleSendL();
|
|
144 |
break;
|
|
145 |
|
|
146 |
case EAknSoftkeyCancel:
|
|
147 |
commandStatus = CPhoneConference::HandleCommandL( aCommand );
|
74
|
148 |
UpdateUiCommands();
|
37
|
149 |
break;
|
|
150 |
|
|
151 |
case EPhoneInCallCmdJoin:
|
|
152 |
iStateMachine->SendPhoneEngineMessage(
|
|
153 |
CPEPhoneModelIF::EPEMessageAddConferenceMember );
|
|
154 |
break;
|
|
155 |
|
|
156 |
case EPhoneInCallCmdParticipants:
|
|
157 |
break;
|
|
158 |
|
|
159 |
default:
|
|
160 |
commandStatus = CPhoneConference::HandleCommandL( aCommand );
|
|
161 |
break;
|
|
162 |
}
|
|
163 |
return commandStatus;
|
|
164 |
}
|
|
165 |
|
|
166 |
// -----------------------------------------------------------
|
|
167 |
// CPhoneConferenceAndSingle::HandleAddedConferenceMemberL
|
|
168 |
// -----------------------------------------------------------
|
|
169 |
//
|
76
|
170 |
void CPhoneConferenceAndSingle::HandleAddedConferenceMemberL( TInt /*aCallId*/ )
|
37
|
171 |
{
|
|
172 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleAddedConferenceMemberL");
|
|
173 |
BeginUiUpdateLC();
|
|
174 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference );
|
76
|
175 |
UpdateConferenceSecurityStatusL();
|
74
|
176 |
UpdateUiCommands();
|
37
|
177 |
EndUiUpdate();
|
65
|
178 |
iStateMachine->ChangeState( EPhoneStateConference );
|
37
|
179 |
}
|
|
180 |
|
|
181 |
// -----------------------------------------------------------
|
|
182 |
// CPhoneConferenceAndSingle::HandleIncomingL
|
|
183 |
// -----------------------------------------------------------
|
|
184 |
//
|
|
185 |
void CPhoneConferenceAndSingle::HandleIncomingL( TInt aCallId )
|
|
186 |
{
|
|
187 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
188 |
"CPhoneConferenceAndSingle::HandleIncomingL");
|
74
|
189 |
DisplayCallHeaderL( aCallId, ECheckIfNEUsedBeforeSettingVisibilityFalse );
|
65
|
190 |
iStateMachine->ChangeState( EPhoneStateConferenceAndSingleAndWaiting );
|
37
|
191 |
}
|
|
192 |
|
|
193 |
// -----------------------------------------------------------
|
|
194 |
// CPhoneConferenceAndSingle::HandleIdleL
|
|
195 |
// -----------------------------------------------------------
|
|
196 |
//
|
|
197 |
void CPhoneConferenceAndSingle::HandleIdleL( TInt aCallId )
|
|
198 |
{
|
|
199 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
200 |
"CPhoneConferenceAndSingle::HandleIdleL");
|
|
201 |
TPhoneCmdParamBoolean conferenceExistsForCallId;
|
|
202 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference,
|
|
203 |
aCallId, &conferenceExistsForCallId );
|
|
204 |
|
|
205 |
if( conferenceExistsForCallId.Boolean() )
|
|
206 |
{
|
|
207 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveFromConference,
|
65
|
208 |
aCallId );
|
37
|
209 |
}
|
|
210 |
else
|
65
|
211 |
{
|
37
|
212 |
BeginUiUpdateLC();
|
|
213 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
|
74
|
214 |
UpdateUiCommands();
|
37
|
215 |
EndUiUpdate();
|
|
216 |
iStateMachine->ChangeState( EPhoneStateConference );
|
|
217 |
}
|
|
218 |
}
|
|
219 |
|
|
220 |
// -----------------------------------------------------------
|
|
221 |
// CPhoneConferenceAndSingle::HandleConferenceIdleL
|
|
222 |
// -----------------------------------------------------------
|
|
223 |
//
|
|
224 |
void CPhoneConferenceAndSingle::HandleConferenceIdleL()
|
|
225 |
{
|
|
226 |
__LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConferenceIdleL");
|
|
227 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveConferenceBubble );
|
|
228 |
TPhoneCmdParamInteger intParam;
|
|
229 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCountOfActiveCalls,
|
|
230 |
&intParam );
|
|
231 |
|
|
232 |
switch( intParam.Integer() )
|
|
233 |
{
|
|
234 |
case EOneActiveCall:
|
|
235 |
MakeStateTransitionToSingleL();
|
|
236 |
break;
|
|
237 |
|
|
238 |
case ETwoActiveCalls: // Fall through
|
|
239 |
default:
|
|
240 |
MakeStateTransitionToTwoSinglesL();
|
|
241 |
break;
|
|
242 |
}
|
|
243 |
}
|
|
244 |
|
|
245 |
// --------------------------------------------------------------
|
|
246 |
// CPhoneConferenceAndSingle::HandleKeyMessageL
|
|
247 |
// --------------------------------------------------------------
|
|
248 |
//
|
|
249 |
void CPhoneConferenceAndSingle::HandleKeyMessageL(
|
|
250 |
TPhoneKeyEventMessages aMessage,
|
|
251 |
TKeyCode aCode )
|
|
252 |
{
|
|
253 |
__LOGMETHODSTARTEND( EPhoneUIStates,
|
|
254 |
"CPhoneConferenceAndSingle::HandleKeyMessageL()");
|
|
255 |
switch ( aCode )
|
|
256 |
{
|
65
|
257 |
case EKeyYes: // send-key
|
74
|
258 |
if( iNumberEntryManager->IsNumberEntryVisibleL() )
|
37
|
259 |
{
|
|
260 |
HandleSendL();
|
|
261 |
}
|
|
262 |
else
|
|
263 |
{
|
|
264 |
iStateMachine->SendPhoneEngineMessage(
|
65
|
265 |
CPEPhoneModelIF::EPEMessageSwap );
|
37
|
266 |
}
|
|
267 |
break;
|
|
268 |
|
|
269 |
default:
|
|
270 |
CPhoneConference::HandleKeyMessageL( aMessage, aCode );
|
|
271 |
break;
|
|
272 |
}
|
|
273 |
}
|
|
274 |
|
|
275 |
// --------------------------------------------------------------
|
|
276 |
// CPhoneConferenceAndSingle::HandleSendL
|
|
277 |
// --------------------------------------------------------------
|
|
278 |
//
|
|
279 |
void CPhoneConferenceAndSingle::HandleSendL()
|
|
280 |
{
|
|
281 |
HBufC *phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize );
|
|
282 |
TPtr ptr( phoneNumber->Des() );
|
|
283 |
TPhoneCmdParamString stringParam;
|
|
284 |
stringParam.SetString( &ptr );
|
|
285 |
iViewCommandHandle->ExecuteCommand(
|
|
286 |
EPhoneViewGetNumberFromEntry,
|
|
287 |
&stringParam );
|
|
288 |
iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ) ;
|
|
289 |
|
|
290 |
if ( iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() ||
|
|
291 |
phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
|
65
|
292 |
{
|
74
|
293 |
iNumberEntryManager->CallFromNumberEntryL();
|
37
|
294 |
}
|
|
295 |
else
|
|
296 |
{
|
|
297 |
iStateMachine->SendPhoneEngineMessage(
|
|
298 |
MPEPhoneModel::EPEMessageCheckEmergencyNumber );
|
|
299 |
}
|
|
300 |
CleanupStack::PopAndDestroy( phoneNumber );
|
|
301 |
}
|
|
302 |
|
|
303 |
// End of File
|