1 /* |
|
2 * Copyright (c) 2007-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 header for TWsfAiController |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef T_WSFAICONTROLLER_H |
|
19 #define T_WSFAICONTROLLER_H |
|
20 |
|
21 // EXTERNAL INCLUDES |
|
22 #include <e32def.h> |
|
23 #include <e32property.h> |
|
24 #include <eikenv.h> |
|
25 |
|
26 // INTERNAL INCLUDES |
|
27 #include "wsfwlaninfo.h" |
|
28 #include "wsfstatechangeobserver.h" |
|
29 #include "wsfmodelobserver.h" |
|
30 |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CWsfModel; |
|
34 class CWsfAiModel; |
|
35 class MWsfAiUiObserver; |
|
36 class TWsfWlanInfo; |
|
37 class CWsfWlanInfoArray; |
|
38 class CWsfDbObserver; |
|
39 class CWsfActiveWrappers; |
|
40 |
|
41 |
|
42 /** |
|
43 * The controller class of the component. All functionality is reached |
|
44 * through this class and all needed events are observed by this. |
|
45 * |
|
46 * @lib wsfaiplugin.lib |
|
47 * @since S60 v5.0 |
|
48 */ |
|
49 |
|
50 NONSHARABLE_CLASS( TWsfAiController ): public MWsfStateChangeObserver, |
|
51 public MWsfModelObserver |
|
52 { |
|
53 public: // Constructors |
|
54 |
|
55 /** |
|
56 * Default C++ constructor |
|
57 * @since S60 5.0 |
|
58 */ |
|
59 TWsfAiController(); |
|
60 |
|
61 public: // New methods |
|
62 |
|
63 /** |
|
64 * DeInitialization for this class |
|
65 */ |
|
66 void DeInitializeL(); |
|
67 |
|
68 /** |
|
69 * PreInitialization for this class (set the models references) |
|
70 * @since S60 5.0 |
|
71 * @param aModel applicaton level model reference |
|
72 * @param aAiModel model reference of AiPlugin |
|
73 * @param aActiveWrappers reference of wrappers holder |
|
74 */ |
|
75 void InitializeL( CEikonEnv* aEnv, CWsfModel* aModel, |
|
76 CWsfAiModel* aAiModel, CWsfDbObserver* aObserver, |
|
77 CWsfActiveWrappers* aActiveWrappers ); |
|
78 |
|
79 /** |
|
80 * Set the UI for the controller |
|
81 * @since S60 5.0 |
|
82 * @param aUi reference to AiPlugin UI control |
|
83 */ |
|
84 void SetUi( MWsfAiUiObserver& aUi ); |
|
85 |
|
86 |
|
87 /** |
|
88 * Handles keypresses coming from container |
|
89 * @since S60 5.0 |
|
90 */ |
|
91 void HandleSelectionKeyL(); |
|
92 |
|
93 /** |
|
94 * Start the sequential scanning for wlans |
|
95 * @since S60 5.0 |
|
96 */ |
|
97 void EnableScanL(); |
|
98 |
|
99 /** |
|
100 * Stop the sequential scanning for wlans |
|
101 * @since S60 5.0 |
|
102 */ |
|
103 void DisableScanL(); |
|
104 |
|
105 /** |
|
106 * Start initial refresh |
|
107 * to the AI model |
|
108 * @since S60 5.0 |
|
109 */ |
|
110 void StartupRefresh(); |
|
111 |
|
112 /** |
|
113 * Propagates the network data from the engine |
|
114 * to the AI model |
|
115 * @since S60 5.2 |
|
116 */ |
|
117 void StartupRefreshDataReadyL(); |
|
118 |
|
119 /** |
|
120 * Refreshes the refreshing icon |
|
121 * @since S60 5.0 |
|
122 */ |
|
123 void RefreshRefreshingL(); |
|
124 |
|
125 /** |
|
126 * Refreshes the connecting icon |
|
127 * @since S60 5.2 |
|
128 */ |
|
129 void RefreshConnectingL(); |
|
130 |
|
131 /** |
|
132 * Propagates the network data from the engine |
|
133 * to the AI model |
|
134 * @since S60 5.2 |
|
135 */ |
|
136 void WlanListDataReadyL(); |
|
137 |
|
138 /** |
|
139 * Connect to the given wlan |
|
140 * @since S60 5.2 |
|
141 * @param aInfo Wlaninfo to connect with |
|
142 * @param aConnectOnly ETrue if we are only connecting, |
|
143 * EFalse if we should also launch the browser |
|
144 * @param aTestAccessPoint ETrue if ICT is executed, |
|
145 * EFalse if ICT is not executed |
|
146 */ |
|
147 void ConnectL( TWsfWlanInfo& aInfo, TBool aConnectOnly, |
|
148 TBool aTestAccessPoint ); |
|
149 |
|
150 |
|
151 public: // From MWsfStateChangeObserver |
|
152 |
|
153 /** |
|
154 * The current wlan data has changed and it is ready to be retrieved |
|
155 * @since S60 5.0 |
|
156 */ |
|
157 void WlanListChangedL(); |
|
158 |
|
159 /** |
|
160 * Engine error occured |
|
161 * @since S60 5.0 |
|
162 * @param aError System wide error code |
|
163 */ |
|
164 void NotifyEngineError( TInt aError ); |
|
165 |
|
166 /** |
|
167 * Scanning has been disabled |
|
168 * @since S60 5.0 |
|
169 */ |
|
170 void ScanDisabledL(); |
|
171 |
|
172 /** |
|
173 * Scanning has been enabled |
|
174 * @since S60 5.0 |
|
175 */ |
|
176 void ScanEnabledL(); |
|
177 |
|
178 /** |
|
179 * A WLAN connection has been established |
|
180 * @since S60 5.0 |
|
181 */ |
|
182 void WlanConnectionActivatedL(); |
|
183 |
|
184 /** |
|
185 * A WLAN connection has been closed |
|
186 * @since S60 5.0 |
|
187 */ |
|
188 void WlanConnectionClosedL(); |
|
189 |
|
190 /** |
|
191 * Connection creation process finished |
|
192 * @since S60 5.2 |
|
193 * @param aError System wide error code |
|
194 */ |
|
195 void ConnectionCreationProcessFinishedL( TInt aError ); |
|
196 |
|
197 |
|
198 public: //From MWsfModelObserver |
|
199 |
|
200 /** |
|
201 * Called if the launch has been completed successfully |
|
202 * @since S60 5.0 |
|
203 */ |
|
204 void BrowserLaunchCompleteL(); |
|
205 |
|
206 /** |
|
207 * Called if the browser launch failed for some reason |
|
208 * @since S60 5.0 |
|
209 * @param aError error code |
|
210 */ |
|
211 void BrowserLaunchFailed( TInt aError ); |
|
212 |
|
213 /** |
|
214 * Called when the previously launched browser exits |
|
215 * @since S60 5.0 |
|
216 */ |
|
217 void BrowserExitL(); |
|
218 |
|
219 /** |
|
220 * Notification that connection is going to be created |
|
221 * @since S60 5.0 |
|
222 * @param aIapId The IAP id of the connection being created |
|
223 */ |
|
224 void ConnectingL( TUint32 aIapId ); |
|
225 |
|
226 /** |
|
227 * Notification that the connection creation process ended |
|
228 * @since S60 5.0 |
|
229 * @param aResult The result of the connection creation |
|
230 */ |
|
231 void ConnectingFinishedL( TInt aResult ); |
|
232 |
|
233 private: |
|
234 |
|
235 /* |
|
236 * Start web browsing with the given wlaninfo |
|
237 * @since S60 5.0 |
|
238 * @param aInfo Wlaninfo to connect with |
|
239 */ |
|
240 void StartBrowsingL( TWsfWlanInfo& aInfo ); |
|
241 |
|
242 /* |
|
243 * Start web browser with the given wlaninfo |
|
244 * @since S60 5.2 |
|
245 * @param aInfo Wlaninfo to connect with |
|
246 */ |
|
247 void StartWebBrowserL( TWsfWlanInfo& aInfo ); |
|
248 |
|
249 /** |
|
250 * Cleanup function to release connecting state |
|
251 * @param aPtr Pointer for this class |
|
252 */ |
|
253 static void CleanUpConnectingL( TAny* aPtr ); |
|
254 |
|
255 /* |
|
256 * Brings browser to the foreground |
|
257 * @since S60 5.0 |
|
258 */ |
|
259 void ContinueBrowsingL(); |
|
260 |
|
261 /* |
|
262 * Launches a listquerydialog which holds all available wlans. |
|
263 * @since S60 5.0 |
|
264 * @param aInfo The wlaninfo resulting from the selection if |
|
265 * no error/cancellation occured |
|
266 * @return ETrue if a valid network was selected, EFalse otherwise |
|
267 */ |
|
268 TBool LaunchSearchDialogL( TWsfWlanInfo& aInfo ); |
|
269 |
|
270 /* |
|
271 * Trapped routine of LaunchSearchDialogL |
|
272 * @param - aSelectedItem which list item was selected |
|
273 * @return - ETrue if connection should be made, otherwise EFalse |
|
274 */ |
|
275 TBool DoLaunchSearchDialogL( TInt& aSelectedItem ); |
|
276 |
|
277 /* |
|
278 * Refreshes the current ui when the ui changes |
|
279 */ |
|
280 void RefreshUiL(); |
|
281 |
|
282 /** |
|
283 * Handle error event |
|
284 * @since S60 5.0 |
|
285 * @param aError System wide error code |
|
286 */ |
|
287 void DoHandleEngineErrorL( TInt aError ); |
|
288 |
|
289 /** |
|
290 * Checks whether the browser is using the currently active WLAN |
|
291 * connection (if any) |
|
292 * @since S60 5.0 |
|
293 * @return ETrue if there is a WLAN connection and browser is using it, |
|
294 * EFalse otherwise |
|
295 */ |
|
296 TBool IsWlanUsedByBrowserL(); |
|
297 |
|
298 /** |
|
299 * Handle MSK if not connected |
|
300 * @since S60 5.0 |
|
301 */ |
|
302 void HandleMskIfOfflineL(); |
|
303 |
|
304 /** |
|
305 * Handle MSK if connected to a WLAN |
|
306 * @since S60 5.0 |
|
307 */ |
|
308 void HandleMskIfConnectedL(); |
|
309 |
|
310 /** |
|
311 * Handle MSK if connecting to a WLAN |
|
312 * @since S60 5.0 |
|
313 */ |
|
314 void HandleMskIfConnectingL(); |
|
315 |
|
316 /** |
|
317 * Handle MSK if connected and browser is using the connection |
|
318 * @since S60 5.0 |
|
319 */ |
|
320 void HandleMskIfBrowsingL(); |
|
321 |
|
322 |
|
323 private: // data |
|
324 |
|
325 /** |
|
326 * Handle to Eikon environment. |
|
327 * Own. |
|
328 */ |
|
329 CEikonEnv* iEnv; |
|
330 |
|
331 /** |
|
332 * Cache of the used info |
|
333 */ |
|
334 TWsfWlanInfo iUsedInfo; |
|
335 |
|
336 /** |
|
337 * Reference to Wlan array |
|
338 */ |
|
339 CWsfWlanInfoArray* iInfoArray; |
|
340 |
|
341 /** |
|
342 * Reference to Model |
|
343 */ |
|
344 CWsfModel* iModel; |
|
345 |
|
346 /** |
|
347 * Reference to Active Idle plugin's Model |
|
348 */ |
|
349 CWsfAiModel* iAiModel; |
|
350 |
|
351 /** |
|
352 * A pointer to active idle plugin ui control observer instance |
|
353 */ |
|
354 MWsfAiUiObserver* iUi; |
|
355 |
|
356 /** |
|
357 * Cache of the connected WLAN data |
|
358 */ |
|
359 TWsfWlanInfo iConnectedWlan; |
|
360 |
|
361 /** |
|
362 * The Database change observer |
|
363 */ |
|
364 CWsfDbObserver* iDbObserver; |
|
365 |
|
366 /** |
|
367 * Indicates whether Connect or Start Web browsing was selected |
|
368 */ |
|
369 TBool iConnectOnly; |
|
370 |
|
371 /** |
|
372 * A pointer to CWsfActiveWrappers |
|
373 */ |
|
374 CWsfActiveWrappers* iActiveWrappers; |
|
375 |
|
376 }; |
|
377 |
|
378 #endif // T_WSFAICONTROLLER_H |
|
379 |
|
380 // End of file |
|