|
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 CPhoneAlerting class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <pevirtualengine.h> |
|
21 #include <mpeengineinfo.h> |
|
22 #include <mpeclientinformation.h> |
|
23 #include <MediatorDomainUIDs.h> |
|
24 #include <videotelcontrolmediatorapi.h> |
|
25 #include "cphonealerting.h" |
|
26 #include "mphonestatemachine.h" |
|
27 #include "tphonecmdparamboolean.h" |
|
28 #include "tphonecmdparaminteger.h" |
|
29 #include "tphonecmdparamcallstatedata.h" |
|
30 #include "phoneviewcommanddefinitions.h" |
|
31 #include "phoneui.hrh" |
|
32 #include "cphonemainresourceresolver.h" |
|
33 #include "phonerssbase.h" |
|
34 #include "phonestatedefinitionsgsm.h" |
|
35 #include "phonelogger.h" |
|
36 #include "phoneconstants.h" |
|
37 #include "cphonemediatorfactory.h" |
|
38 #include "cphonemediatorsender.h" |
|
39 |
|
40 |
|
41 // ================= MEMBER FUNCTIONS ======================= |
|
42 |
|
43 // C++ default constructor can NOT contain any code, that |
|
44 // might leave. |
|
45 // |
|
46 EXPORT_C CPhoneAlerting::CPhoneAlerting( |
|
47 MPhoneStateMachine* aStateMachine, |
|
48 MPhoneViewCommandHandle* aViewCommandHandle, |
|
49 MPhoneCustomization* aPhoneCustomization ) : |
|
50 CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization ), |
|
51 iIncomingCallId( KErrNotFound ) |
|
52 { |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------- |
|
56 // CPhoneAlerting::~CPhoneAlerting() |
|
57 // Destructor |
|
58 // (other items were commented in a header). |
|
59 // ----------------------------------------------------------- |
|
60 // |
|
61 EXPORT_C CPhoneAlerting::~CPhoneAlerting() |
|
62 { |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------- |
|
66 // CPhoneAlerting::ConstructL() |
|
67 // Constructor |
|
68 // (other items were commented in a header). |
|
69 // ----------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C void CPhoneAlerting::ConstructL() |
|
72 { |
|
73 CPhoneGsmInCall::ConstructL(); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------- |
|
77 // CPhoneAlerting::NewL() |
|
78 // Constructor |
|
79 // (other items were commented in a header). |
|
80 // ----------------------------------------------------------- |
|
81 // |
|
82 CPhoneAlerting* CPhoneAlerting::NewL( |
|
83 MPhoneStateMachine* aStateMachine, |
|
84 MPhoneViewCommandHandle* aViewCommandHandle, |
|
85 MPhoneCustomization* aPhoneCustomization ) |
|
86 { |
|
87 CPhoneAlerting* self = new( ELeave ) CPhoneAlerting( |
|
88 aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
89 |
|
90 CleanupStack::PushL( self ); |
|
91 self->ConstructL(); |
|
92 CleanupStack::Pop( self ); |
|
93 |
|
94 return self; |
|
95 } |
|
96 |
|
97 // -------------------------------------------------------------- |
|
98 // CPhoneAlerting::HandleKeyMessageL |
|
99 // -------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C void CPhoneAlerting::HandleKeyMessageL( |
|
102 TPhoneKeyEventMessages aMessage, |
|
103 TKeyCode aCode ) |
|
104 { |
|
105 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
106 "CPhoneAlerting::HandleKeyMessageL()"); |
|
107 switch ( aCode ) |
|
108 { |
|
109 // send-key |
|
110 case EKeyYes: |
|
111 if ( IsNumberEntryUsedL() ) |
|
112 { |
|
113 // send a manual control sequence |
|
114 CallFromNumberEntryL(); |
|
115 } |
|
116 else |
|
117 { |
|
118 // Show not allowed note |
|
119 SendGlobalErrorNoteL( |
|
120 EPhoneNoteTextNotAllowed ); |
|
121 } |
|
122 break; |
|
123 |
|
124 // end-key |
|
125 case EKeyNo: |
|
126 // handle long press |
|
127 if ( aMessage == EPhoneKeyLongPress ) |
|
128 { |
|
129 // Close all connections |
|
130 iStateMachine->SendPhoneEngineMessage( |
|
131 MPEPhoneModel::EPEMessageTerminateAllConnections ); |
|
132 |
|
133 if ( IsNumberEntryUsedL() ) |
|
134 { |
|
135 BeginTransEffectLC( ENumberEntryClose ); |
|
136 // Remove number entry from screen |
|
137 iViewCommandHandle->ExecuteCommandL( |
|
138 EPhoneViewRemoveNumberEntry ); |
|
139 EndTransEffect(); |
|
140 // Do state-specific operation when number entry is cleared |
|
141 HandleNumberEntryClearedL(); |
|
142 } |
|
143 if ( !TopAppIsDisplayedL() ) |
|
144 { |
|
145 // Bring app to foreground |
|
146 TPhoneCmdParamInteger uidParam; |
|
147 uidParam.SetInteger( KUidPhoneApplication.iUid ); |
|
148 iViewCommandHandle->ExecuteCommandL( |
|
149 EPhoneViewBringAppToForeground, &uidParam ); |
|
150 } |
|
151 } |
|
152 else |
|
153 { |
|
154 // handle end key |
|
155 DisconnectOutgoingCallL(); |
|
156 } |
|
157 break; |
|
158 |
|
159 default: |
|
160 // do base operation |
|
161 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode ); |
|
162 break; |
|
163 } |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------- |
|
167 // CPhoneAlerting::HandlePhoneEngineMessageL |
|
168 // ----------------------------------------------------------- |
|
169 // |
|
170 EXPORT_C void CPhoneAlerting::HandlePhoneEngineMessageL( |
|
171 const TInt aMessage, |
|
172 TInt aCallId ) |
|
173 { |
|
174 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
175 "CPhoneAlerting::HandlePhoneEngineMessageL()"); |
|
176 |
|
177 switch ( aMessage ) |
|
178 { |
|
179 case MEngineMonitor::EPEMessageConnected: |
|
180 HandleConnectedL( aCallId ); |
|
181 break; |
|
182 |
|
183 case MEngineMonitor::EPEMessageDisconnecting: |
|
184 HandleDisconnectingL( aCallId ); |
|
185 break; |
|
186 |
|
187 case MEngineMonitor::EPEMessageRemoteTerminated: |
|
188 iViewCommandHandle->ExecuteCommandL( |
|
189 EPhoneViewHideNaviPaneAudioVolume ); |
|
190 CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
191 break; |
|
192 |
|
193 case MEngineMonitor::EPEMessageIncoming: |
|
194 { |
|
195 // If incoming message is received in alerting state, teardown of |
|
196 // alerting call must be ongoing. Handling of the incoming call is |
|
197 // buffered until first call teardown is completed. |
|
198 iIncomingCallId = aCallId; |
|
199 } |
|
200 break; |
|
201 |
|
202 case MEngineMonitor::EPEMessageIdle: |
|
203 { |
|
204 if ( KErrNotFound < iIncomingCallId ) |
|
205 { |
|
206 TInt incomingCallId = iIncomingCallId; |
|
207 iIncomingCallId = KErrNotFound; |
|
208 |
|
209 if ( aCallId != incomingCallId ) |
|
210 { |
|
211 CPhoneGsmInCall::HandlePhoneEngineMessageL( |
|
212 aMessage, aCallId ); |
|
213 |
|
214 // Simulate incoming event which was received while |
|
215 // teardown of first call was ongoing. |
|
216 iStateMachine->State()->HandlePhoneEngineMessageL( |
|
217 MEngineMonitor::EPEMessageIncoming, incomingCallId ); |
|
218 } |
|
219 |
|
220 return; |
|
221 } |
|
222 } |
|
223 break; |
|
224 |
|
225 default: |
|
226 break; |
|
227 } |
|
228 |
|
229 CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------- |
|
233 // CPhoneAlerting::HandleConnectedL |
|
234 // ----------------------------------------------------------- |
|
235 // |
|
236 EXPORT_C void CPhoneAlerting::HandleConnectedL( TInt aCallId ) |
|
237 { |
|
238 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
239 "CPhoneAlerting::HandleConnectedL()"); |
|
240 // Keep Phone in the foreground |
|
241 TPhoneCmdParamBoolean booleanParam; |
|
242 booleanParam.SetBoolean( EFalse ); |
|
243 iViewCommandHandle->ExecuteCommandL( |
|
244 EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam ); |
|
245 |
|
246 // Close menu bar, if it is displayed |
|
247 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
248 |
|
249 BeginUiUpdateLC(); |
|
250 |
|
251 // Update the single call |
|
252 UpdateSingleActiveCallL( aCallId ); |
|
253 |
|
254 SetTouchPaneButtons( EPhoneIncallButtons ); |
|
255 |
|
256 SetToolbarDimming( EFalse ); |
|
257 |
|
258 EndUiUpdate(); |
|
259 |
|
260 HandleColpNoteL( aCallId ); |
|
261 |
|
262 // Go to single state |
|
263 UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
264 iStateMachine->ChangeState( EPhoneStateSingle ); |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------- |
|
268 // CPhoneAlerting::OpenMenuBarL |
|
269 // ----------------------------------------------------------- |
|
270 // |
|
271 EXPORT_C void CPhoneAlerting::OpenMenuBarL() |
|
272 { |
|
273 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
274 "CPhoneAlerting::OpenMenuBarL()"); |
|
275 TInt resourceId; |
|
276 |
|
277 if ( iOnScreenDialer && IsDTMFEditorVisibleL() ) |
|
278 { |
|
279 resourceId = EPhoneDtmfDialerMenubar; |
|
280 } |
|
281 else if ( IsNumberEntryVisibleL() ) |
|
282 { |
|
283 resourceId = EPhoneAlertingCallMenubarWithNumberEntry; |
|
284 } |
|
285 // Use different resources for alerting data, video and cs call |
|
286 else if( IsVideoCallAlertingL() ) |
|
287 { |
|
288 resourceId = EPhoneAlertingVideoCallMenubar; |
|
289 } |
|
290 else |
|
291 { |
|
292 resourceId = EPhoneAlertingCallMenubar; |
|
293 } |
|
294 |
|
295 TPhoneCmdParamInteger integerParam; |
|
296 integerParam.SetInteger( |
|
297 CPhoneMainResourceResolver::Instance()-> |
|
298 ResolveResourceID( resourceId ) ); |
|
299 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, |
|
300 &integerParam ); |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------- |
|
304 // CPhoneAlerting::HandleCommandL |
|
305 // ----------------------------------------------------------- |
|
306 // |
|
307 EXPORT_C TBool CPhoneAlerting::HandleCommandL( TInt aCommand ) |
|
308 { |
|
309 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
310 "CPhoneAlerting::HandleCommandL()" ); |
|
311 TBool commandStatus = ETrue; |
|
312 |
|
313 switch( aCommand ) |
|
314 { |
|
315 case EPhoneInCallCmdHelp: |
|
316 { |
|
317 TPtrC contextName; |
|
318 if ( IsVideoCallAlertingL() ) |
|
319 { |
|
320 contextName.Set( KINCAL_HLP_VIDEOCALL() ); |
|
321 } |
|
322 else |
|
323 { |
|
324 contextName.Set( KINCAL_HLP_CALL_HANDLING() ); |
|
325 } |
|
326 iViewCommandHandle->ExecuteCommandL( |
|
327 EPhoneViewLaunchHelpApplication, 0, contextName ); |
|
328 } |
|
329 break; |
|
330 default: |
|
331 commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand ); |
|
332 break; |
|
333 } |
|
334 return commandStatus; |
|
335 } |
|
336 |
|
337 // ----------------------------------------------------------- |
|
338 // CPhoneAlerting::IsVideoCallAlertingL |
|
339 // ----------------------------------------------------------- |
|
340 // |
|
341 TBool CPhoneAlerting::IsVideoCallAlertingL() |
|
342 { |
|
343 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
344 "CPhoneAlerting::IsVideoCallAlerting()" ); |
|
345 TBool retVal = EFalse; |
|
346 // Fetch active call's id from view |
|
347 TPhoneCmdParamCallStateData callStateData; |
|
348 callStateData.SetCallState( EPEStateConnecting ); |
|
349 iViewCommandHandle->HandleCommandL( |
|
350 EPhoneViewGetCallIdByState, &callStateData ); |
|
351 |
|
352 if ( callStateData.CallId() > KErrNotFound ) |
|
353 { |
|
354 retVal = IsVideoCall( callStateData.CallId() ); |
|
355 } |
|
356 |
|
357 return retVal; |
|
358 } |
|
359 |
|
360 // ----------------------------------------------------------- |
|
361 // CPhoneAlerting::CheckIfShowTerminationNote |
|
362 // ----------------------------------------------------------- |
|
363 // |
|
364 EXPORT_C TBool CPhoneAlerting::CheckIfShowCallTerminationNote( ) |
|
365 { |
|
366 // Alerting state does not need call termination since |
|
367 // call has not begun. |
|
368 return EFalse; |
|
369 } |
|
370 |
|
371 // ----------------------------------------------------------- |
|
372 // CPhoneAlerting::HandleDisconnectingL |
|
373 // ----------------------------------------------------------- |
|
374 // |
|
375 EXPORT_C void CPhoneAlerting::HandleDisconnectingL( TInt aCallId ) |
|
376 { |
|
377 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
378 "CPhoneAlerting::HandleDisconnectingL()" ); |
|
379 |
|
380 if ( iStateMachine->PhoneEngineInfo()->CallOrigin( aCallId ) == EPECallOriginSAT ) |
|
381 { |
|
382 // User has hangup alerting SAT call, complete sat request |
|
383 CompleteSatRequestL( aCallId ); |
|
384 } |
|
385 |
|
386 CPhoneGsmInCall::HandleDisconnectingL( aCallId ); |
|
387 } |
|
388 |
|
389 |
|
390 |
|
391 // End of File |