|
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: Concrete application state classes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef T_VTUIAPPSTATES_H |
|
20 #define T_VTUIAPPSTATES_H |
|
21 |
|
22 #include "tvtuiappstatebase.h" |
|
23 #include <babitflags.h> |
|
24 #include <vtengcommands.h> |
|
25 |
|
26 class CAknQueryDialog; |
|
27 |
|
28 /** |
|
29 * Initial application state. Responsible for startup phase 1 and |
|
30 * startup phase 2 (see EVtUiAppUiStartup in CVtUiAppUi.cpp). |
|
31 * Certain other state changes are required for phase 2 and history |
|
32 * of their reception is handled with precondition flags. |
|
33 * |
|
34 * @since S60 v3.2 |
|
35 */ |
|
36 class TVtUiStateStarting : public TVtUiAppStateBase |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * returns singleton instance of TVtUiStateStarting |
|
41 * @param aCtx state context |
|
42 * @param aUiStates UI states |
|
43 * @return singleton |
|
44 */ |
|
45 static TVtUiStateStarting* InstanceL( |
|
46 MVtUiStateContext& aCtx, |
|
47 TVtUiStates& aUiStates ); |
|
48 |
|
49 public: // from TVtUiAppStateBase |
|
50 |
|
51 /** @see TVtUiAppStateBase */ |
|
52 virtual void AppUiStartupPhase1DoneL(); |
|
53 |
|
54 /** @see TVtUiAppStateBase */ |
|
55 virtual void AppUiStartupPhase2DoneL(); |
|
56 |
|
57 /** @see TVtUiAppStateBase */ |
|
58 virtual TEventResponse HandleVtEventL( TInt aEvent ); |
|
59 |
|
60 /** @see TVtUiAppStateBase */ |
|
61 virtual TEventResponse HandleCommandL( const TInt aCommand ); |
|
62 |
|
63 /** @see TVtUiAppStateBase */ |
|
64 virtual TBool HandleForegroundChangedL( TBool aIsForeground ); |
|
65 |
|
66 private: // from TVtUiAppStateBase |
|
67 |
|
68 /** @see TVtUiAppStateBase */ |
|
69 virtual void OpenL(); |
|
70 |
|
71 /** @see TVtUiAppStateBase */ |
|
72 virtual void Close(); |
|
73 |
|
74 private: // new methods |
|
75 |
|
76 void CheckSessionStateL(); |
|
77 static TInt AsynchOpen( TAny* aAny ); |
|
78 |
|
79 void DoOpenL(); |
|
80 |
|
81 /** Preconditions that must be passed in order to proceed |
|
82 * to Phase 2 in startup. |
|
83 */ |
|
84 enum TPreconditions |
|
85 { |
|
86 /** waiting for CLI from engine*/ |
|
87 EWaitingCLI, |
|
88 /** waiting for phase1 to complete */ |
|
89 EWaitingPhase1ToComplete, |
|
90 /** waiting for engine to get proper state */ |
|
91 EWaitingSessionState |
|
92 }; |
|
93 |
|
94 /** |
|
95 * Clears precondition passed as argument and checks if any |
|
96 * preconditions hold and if not proceeds to phase 2 of startup. |
|
97 */ |
|
98 void CheckPhase2StartupL( const TPreconditions aClearCondition ); |
|
99 |
|
100 void HandleCLIReceivedL(); |
|
101 |
|
102 private: // constructors and destructors |
|
103 |
|
104 // c++ constructor |
|
105 TVtUiStateStarting( |
|
106 MVtUiStateContext& aCtx, |
|
107 TVtUiStates& aUiStates ); |
|
108 |
|
109 // Destructor |
|
110 virtual ~TVtUiStateStarting(); |
|
111 |
|
112 private: // data members |
|
113 |
|
114 // Precondition for state change to running |
|
115 TBitFlags8 iPreconditions; |
|
116 |
|
117 // Singleton |
|
118 static TVtUiStateStarting* iInstance; |
|
119 |
|
120 // Starts phase1 startup in state state context. Needed because |
|
121 // initial state is opened from within state context construction. |
|
122 CAsyncCallBack* iStartCallback; |
|
123 }; |
|
124 |
|
125 /** |
|
126 * Application state that is active in normal operation. |
|
127 * |
|
128 * @since S60 v3.2 |
|
129 */ |
|
130 class TVtUiStateRunning : public TVtUiAppStateBase |
|
131 { |
|
132 public: |
|
133 /** |
|
134 * returns singleton instance of TVtUiStateRunning |
|
135 * @param aCtx state context |
|
136 * @param aUiStates UI states |
|
137 * @return singleton |
|
138 */ |
|
139 static TVtUiStateRunning* InstanceL( |
|
140 MVtUiStateContext& aCtx, |
|
141 TVtUiStates& aUiStates ); |
|
142 |
|
143 public: // from TVtUiAppStateBase |
|
144 |
|
145 /** @see TVtUiAppStateBase */ |
|
146 virtual TEventResponse HandleVtEventL( TInt aEvent ); |
|
147 |
|
148 /** @see TVtUiAppStateBase */ |
|
149 virtual TEventResponse HandleCommandL( const TInt aCommand ); |
|
150 |
|
151 /** @see TVtUiAppStateBase */ |
|
152 virtual TBool HandleForegroundChangedL( TBool aIsForeground ); |
|
153 |
|
154 /** @see TVtUiAppStateBase */ |
|
155 virtual TBool PreHandleForegroundChangedL( TBool aIsForeground ); |
|
156 /** @see TVtUiAppStateBase */ |
|
157 virtual void HandleLayoutChangedL(); |
|
158 |
|
159 /** @see TVtUiAppStateBase */ |
|
160 virtual void StartDtmfTone( const TChar& aTone ); |
|
161 |
|
162 /** @see TVtUiAppStateBase */ |
|
163 virtual void StopDtmfTone(); |
|
164 |
|
165 /** @see TVtUiAppStateBase */ |
|
166 virtual void OpenL(); |
|
167 |
|
168 private: // from TVtUiAppStateBase |
|
169 /** @see TVtUiAppStateBase */ |
|
170 virtual void Close(); |
|
171 |
|
172 private: // constructors and destructors |
|
173 |
|
174 // c++ constructor |
|
175 TVtUiStateRunning( |
|
176 MVtUiStateContext& aCtx, |
|
177 TVtUiStates& aUiStates ); |
|
178 |
|
179 // Destructor |
|
180 virtual ~TVtUiStateRunning(); |
|
181 |
|
182 private: // new functions |
|
183 |
|
184 /** Requests call handling subsystem to initiate a voice call. |
|
185 * Starts shutdown of the application. |
|
186 */ |
|
187 void CreateVoiceCallL(); |
|
188 |
|
189 /** Dials emergency call and starts shutdown */ |
|
190 void DialEmergencyCallL(); |
|
191 |
|
192 void ShutdownWithEngineCommandL( const TInt aCommand ); |
|
193 |
|
194 private: // data members |
|
195 // singleton |
|
196 static TVtUiStateRunning* iInstance; |
|
197 // Create voice call query instance |
|
198 CAknQueryDialog* iCreateVoiceCallDlg; |
|
199 }; |
|
200 |
|
201 /** |
|
202 * Application state that is active during shutdown. |
|
203 * |
|
204 * @since S60 v3.2 |
|
205 */ |
|
206 class TVtUiStateResetting : public TVtUiAppStateBase |
|
207 { |
|
208 public: |
|
209 /** |
|
210 * returns singleton instance of TVtUiStateResetting |
|
211 * @param aCtx state context |
|
212 * @param aUiStates UI states |
|
213 * @param aCommand engine command to send when resetting state activates |
|
214 * @return singleton |
|
215 */ |
|
216 static TVtUiStateResetting* InstanceL( |
|
217 MVtUiStateContext& aCtx, |
|
218 TVtUiStates& aUiStates, |
|
219 const TVtEngCommandId aCommand = KVtEngCommandNone ); |
|
220 |
|
221 public: // from TVtUiAppStateBase |
|
222 |
|
223 /** @see TVtUiAppStateBase */ |
|
224 virtual void AppUiStartupFailedL(); |
|
225 |
|
226 /** @see TVtUiAppStateBase */ |
|
227 virtual void ShutdownDoneL(); |
|
228 |
|
229 /** @see TVtUiAppStateBase */ |
|
230 virtual TEventResponse HandleVTCommandPerformedL( |
|
231 TVtEngCommandId aCommand, |
|
232 const TInt aError ); |
|
233 |
|
234 /** @see TVtUiAppStateBase */ |
|
235 virtual TEventResponse HandleVtEventL( TInt aEvent ); |
|
236 |
|
237 /** @see TVtUiAppStateBase */ |
|
238 virtual TEventResponse HandleCommandL( const TInt aCommand ); |
|
239 |
|
240 /** @see TVtUiAppStateBase */ |
|
241 virtual TBool HandleForegroundChangedL( TBool aIsForeground ); |
|
242 |
|
243 /** @see TVtUiAppStateBase */ |
|
244 virtual void HandleLayoutChangedL(); |
|
245 |
|
246 private: // from TVtUiAppStateBase |
|
247 |
|
248 /** @see TVtUiAppStateBase */ |
|
249 virtual void OpenL(); |
|
250 |
|
251 /** @see TVtUiAppStateBase */ |
|
252 virtual void Close(); |
|
253 |
|
254 private: // constructors and destructors |
|
255 |
|
256 // c++ constructor |
|
257 TVtUiStateResetting( |
|
258 MVtUiStateContext& aCtx, |
|
259 TVtUiStates& aUiStates, |
|
260 const TVtEngCommandId aCommand = KVtEngCommandNone ); |
|
261 |
|
262 // Destructor |
|
263 virtual ~TVtUiStateResetting(); |
|
264 |
|
265 private: // data members |
|
266 |
|
267 // Singleton |
|
268 static TVtUiStateResetting* iInstance; |
|
269 |
|
270 // Used in user originated shutdown (end active call/switch to voice) |
|
271 TVtEngCommandId iCommand; |
|
272 }; |
|
273 |
|
274 #endif // T_VTUIAPPSTATES_H |