|
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: waiting details application state |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "tvtuistates.h" |
|
20 #include "tvtuiappstates.h" |
|
21 #include "mvtuistatecontext.h" |
|
22 #include "cvtuiappshutter.h" |
|
23 #include <cvtlogger.h> |
|
24 #include <vtengevents.h> |
|
25 |
|
26 TVtUiStateResetting* TVtUiStateResetting::iInstance = NULL; |
|
27 |
|
28 // c++ constructor |
|
29 TVtUiStateResetting::TVtUiStateResetting( |
|
30 MVtUiStateContext& aCtx, |
|
31 TVtUiStates& aUiStates, |
|
32 const TVtEngCommandId aCommand ) |
|
33 : TVtUiAppStateBase( aCtx, aUiStates ), |
|
34 iCommand( aCommand ) |
|
35 { |
|
36 __VTPRINT2( DEBUG_GEN, "TVtUiStateResetting.ctr iCommand=%d", iCommand ) |
|
37 } |
|
38 |
|
39 // Destructor |
|
40 TVtUiStateResetting::~TVtUiStateResetting() |
|
41 { |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // TVtUiStateResetting:: |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 TVtUiStateResetting* TVtUiStateResetting::InstanceL( |
|
49 MVtUiStateContext& aCtx, |
|
50 TVtUiStates& aUiStates, |
|
51 const TVtEngCommandId aCommand ) |
|
52 { |
|
53 __VTPRINTENTER( "TVtUiStateResetting.InstanceL" ) |
|
54 if ( iInstance == NULL ) |
|
55 { |
|
56 iInstance = new ( ELeave ) TVtUiStateResetting( |
|
57 aCtx, aUiStates, aCommand ); |
|
58 } |
|
59 else if ( aCommand != KVtEngCommandNone ) |
|
60 { // if call ending is UI originated, command is given |
|
61 iInstance->iCommand = aCommand; |
|
62 __VTPRINT2( DEBUG_GEN, "TVtUiStateResetting.InstanceL iCommand=%d", |
|
63 iInstance->iCommand ) |
|
64 } |
|
65 __VTPRINTEXIT( "TVtUiStateResetting.InstanceL" ) |
|
66 return iInstance; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // TVtUiStateResetting::ShutdownDoneL |
|
71 // AppUi has finished its own shutdown steps. Notify app shutter that it may |
|
72 // proceed. |
|
73 // |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void TVtUiStateResetting::ShutdownDoneL() |
|
77 { |
|
78 __VTPRINTENTER( "TVtUiStateResetting.ShutdownDone" ) |
|
79 CVtUiAppShutter* shutter = CVtUiAppShutter::InstanceL( *this ); |
|
80 if ( shutter ) |
|
81 { |
|
82 shutter->StartShutdown(); |
|
83 } |
|
84 __VTPRINTEXIT( "TVtUiStateResetting.ShutdownDone" ) |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // TVtUiStateResetting::AppUiStartupFailedL |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void TVtUiStateResetting::AppUiStartupFailedL() |
|
92 { |
|
93 __VTPRINTENTER( "TVtUiStateResetting.AppUiStartupFailedL" ) |
|
94 // no-op (overrides default behavior) |
|
95 __VTPRINTEXIT( "TVtUiStateResetting.AppUiStartupFailedL" ) |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // TVtUiStateResetting::HandleVTCommandPerformedL |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 TVtUiAppStateBase::TEventResponse TVtUiStateResetting::HandleVTCommandPerformedL |
|
103 ( |
|
104 TVtEngCommandId aCommand, |
|
105 const TInt /*aError*/ ) |
|
106 { |
|
107 __VTPRINTENTER( "TVtUiStateResetting.HandleVTCommandPerformedL" ) |
|
108 // By default responses to commands are ignored while resetting |
|
109 TEventResponse handled = EEventHandled; |
|
110 switch ( aCommand ) |
|
111 { |
|
112 case KVtEngResetEngine: |
|
113 // Allow UI to process reset command response |
|
114 handled = EEventNotHandled; |
|
115 break; |
|
116 case KVtEngTerminateSession: |
|
117 case KVtEngSwitchToVoice: |
|
118 // |
|
119 iCtx.ShutdownL(); |
|
120 break; |
|
121 default: |
|
122 break; |
|
123 } |
|
124 __VTPRINTEXIT( "TVtUiStateResetting.HandleVTCommandPerformedL" ) |
|
125 return handled; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // TVtUiStateResetting::HandleVtEventL |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 TVtUiAppStateBase::TEventResponse TVtUiStateResetting::HandleVtEventL( |
|
133 const TInt aEvent ) |
|
134 { |
|
135 __VTPRINTENTER( "TVtUiStateResetting.HandleVtEventL" ) |
|
136 TEventResponse handled = EEventHandled; |
|
137 switch ( aEvent ) |
|
138 { |
|
139 // While resetting appUi should not handle these events. |
|
140 case KVtEngSourceChanged: |
|
141 case KVtEngCameraChanged: |
|
142 case KVtEngSourceCapsChanged: |
|
143 case KVtEngSessionStateChanged: |
|
144 case KVtEngDurationSettingChanged: |
|
145 case KVtEngAudioOutputVolumeChanged: |
|
146 case KVtEngAudioRoutingAvailabilityChanged: |
|
147 case KVtEngAudioRoutingChanged: |
|
148 case KVtEngAudioMuted: |
|
149 case KVtEngAudioUnmuted: |
|
150 case KVtEngRemoteVideoStopped: |
|
151 case KVtEngSessionWaitingCallActive: |
|
152 case KVtEngSessionWaitingCallInactive: |
|
153 break; |
|
154 default: |
|
155 // allow appUi to handle other events |
|
156 handled = EEventNotHandled; |
|
157 break; |
|
158 } |
|
159 __VTPRINTEXIT( "TVtUiStateResetting.HandleVtEventL" ) |
|
160 return handled; |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // TVtUiStateResetting::HandleCommandL |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 TVtUiAppStateBase::TEventResponse TVtUiStateResetting::HandleCommandL( |
|
168 const TInt /*aCommand*/ ) |
|
169 { |
|
170 __VTPRINTENTER( "TVtUiStateResetting.HandleCommandL" ) |
|
171 /* All commands ignored while resetting. CAknAppUi::Exit() is called |
|
172 when shutdown is completed with asistance of CVtUiAppShutter */ |
|
173 __VTPRINTEXIT( "TVtUiStateResetting.HandleCommandL" ) |
|
174 return EEventHandled; |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // TVtUiStateResetting::HandleForegroundChangedL |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 TBool TVtUiStateResetting::HandleForegroundChangedL( |
|
182 const TBool /*aIsForeground*/ ) |
|
183 { |
|
184 __VTPRINTENTER( "TVtUiStateResetting.HandleForegroundChangedL" ) |
|
185 __VTPRINTEXIT( "TVtUiStateResetting.HandleForegroundChangedL" ) |
|
186 // not on "foreground" while resetting |
|
187 return EFalse; |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // TVtUiStateResetting::HandleLayoutChangedL |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 void TVtUiStateResetting::HandleLayoutChangedL() |
|
195 { |
|
196 __VTPRINTENTER( "TVtUiStateResetting.HandleLayoutChangedL" ) |
|
197 // no-op (overrides default behavior) |
|
198 __VTPRINTEXIT( "TVtUiStateResetting.HandleLayoutChangedL" ) |
|
199 } |
|
200 |
|
201 // ----------------------------------------------------------------------------- |
|
202 // TVtUiStateResetting::OpenL |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 void TVtUiStateResetting::OpenL() |
|
206 { |
|
207 __VTPRINTENTER( "TVtUiStateResetting.OpenL" ) |
|
208 SetExecState( TVtUiStates::EExecStateResetting ); |
|
209 iCtx.StopDtmfTone(); |
|
210 iCtx.ChangeApplicationFocus( EFalse ); |
|
211 |
|
212 if ( iCommand != KVtEngCommandNone ) |
|
213 { |
|
214 // Command is either KVtEngTerminateSession or KVtEngSwitchToVoice |
|
215 // Need to wait for callback before ShutdownL can be called on context. |
|
216 iCtx.DoExecuteCmdL( iCommand, NULL ); |
|
217 } |
|
218 else |
|
219 { |
|
220 // This branch is executed when resetting state is opened due |
|
221 // to emergency call or state change to one causing shutdown. |
|
222 // No need to wait for any callbacks (emergency call callback |
|
223 // handled by CVtUiAppShutter). |
|
224 iCtx.ShutdownL(); |
|
225 } |
|
226 __VTPRINTEXIT( "TVtUiStateResetting.OpenL" ) |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // TVtUiStateResetting::Close |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 void TVtUiStateResetting::Close() |
|
234 { |
|
235 __VTPRINTENTER( "TVtUiStateResetting.Close" ) |
|
236 SetExecState( TVtUiStates::EExecStateFinalized ); |
|
237 if ( TVtUiStateResetting::iInstance ) |
|
238 { |
|
239 delete TVtUiStateResetting::iInstance; |
|
240 TVtUiStateResetting::iInstance = NULL; |
|
241 } |
|
242 __VTPRINTEXIT( "TVtUiStateResetting.Close" ) |
|
243 } |