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