|
1 /* |
|
2 * Copyright (c) 2002-2009 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: States for WLAN Agent's state machine |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 19 % |
|
20 */ |
|
21 |
|
22 #ifndef _WLANSTATES_H_ |
|
23 #define _WLANSTATES_H_ |
|
24 |
|
25 #include <comms-infras/cagentsmbase.h> |
|
26 #include "rwlmserver.h" |
|
27 #include "wlanmgmtcommon.h" |
|
28 #include "wlanagthotspotclient.h" |
|
29 |
|
30 // WLAN uids |
|
31 |
|
32 // ID of SelectWLan dialog |
|
33 const TUid KUidSelectWLanDlg = { 0x10207373 }; |
|
34 |
|
35 // ID of OfflineWlanNote dialog |
|
36 const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 }; |
|
37 |
|
38 // ID of OfflineWlanDisabledNote dialog |
|
39 const TUid KUidCOfflineWlanDisabledNoteDlg = { 0x101FD672 }; |
|
40 |
|
41 // ID of Easy Wep dialog |
|
42 const TUid KUidEasyWepDlg = { 0x101FD673 }; |
|
43 |
|
44 // ID of Easy Wpa dialog |
|
45 const TUid KUidEasyWpaDlg = { 0x101FD674 }; |
|
46 |
|
47 // ID of WLANNetworkUnavailableNote dialog |
|
48 const TUid KUidWLANNetworkUnavailableNoteDlg = { 0x101FD67F }; |
|
49 |
|
50 // ID of Connecting Note dialog |
|
51 const TUid KUidConnectingNoteDlg = { 0x101FD681 }; |
|
52 |
|
53 const TInt KEasyWepQuery256BitMaxLength = 58; |
|
54 |
|
55 // Values of TWlanagtProgress are limited by the following (from nifvar.h): |
|
56 //const TInt KMinAgtProgress = 2500; |
|
57 //const TInt KConnectionOpen = 3500; // From an Agent |
|
58 //const TInt KConnectionClosed = 4500; // From an Agent |
|
59 //const TInt KMaxAgtProgress = 5500; |
|
60 enum TWlanagtProgress |
|
61 { |
|
62 EModeCheck = 3000, |
|
63 EEasyConn = 3020, |
|
64 EEasyWpa = 3022, |
|
65 EEasyWep = 3024, |
|
66 EAttemptingToJoin = 3030, |
|
67 EOpeningConnection = 3040, |
|
68 EDisconnecting = 4000 |
|
69 }; |
|
70 |
|
71 class CWlanSM; |
|
72 class ScanInfo; |
|
73 |
|
74 /** |
|
75 * CWlanStateBase is the baseclass of all the WLAN Agent concrete states |
|
76 * |
|
77 * @lib wlanagt.agt |
|
78 * @since S60 v3.0 |
|
79 */ |
|
80 NONSHARABLE_CLASS( CWlanStateBase ) : public CAgentStateBase, public MWLMNotify |
|
81 { |
|
82 public: |
|
83 |
|
84 /** |
|
85 * constructor |
|
86 * |
|
87 * @since S60 v3.0 |
|
88 * @param aWlanSM pointer to WLAN Agent's statemachine framework |
|
89 * @param aWLMServer reference to WLAN Engine client interface |
|
90 */ |
|
91 CWlanStateBase( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); |
|
92 |
|
93 public: // From CAgentStateBase |
|
94 |
|
95 /** |
|
96 * StartState is called by the framework after new state has been instantiated |
|
97 * |
|
98 * @since S60 v3.0 |
|
99 */ |
|
100 virtual void StartState(); |
|
101 |
|
102 public: // From MWLMNotify |
|
103 |
|
104 /** |
|
105 * ConnectionStateChanged notification is received when change |
|
106 * in connection state occurs |
|
107 * |
|
108 * @since S60 v3.0 |
|
109 */ |
|
110 virtual void ConnectionStateChanged( TWlanConnectionState aNewState ); |
|
111 |
|
112 protected: |
|
113 /** pointer to agent's statemachine */ |
|
114 CWlanSM* iWlanSM; |
|
115 /** reference to WLAN Engine client interface */ |
|
116 RWLMServer& iWLMServer; |
|
117 }; |
|
118 |
|
119 |
|
120 /** |
|
121 * CWlanStartState is used when starting a connection |
|
122 * |
|
123 * @lib wlanagt.agt |
|
124 * @since S60 v3.0 |
|
125 */ |
|
126 NONSHARABLE_CLASS( CWlanStartState ) : public CWlanStateBase |
|
127 { |
|
128 enum TNextState |
|
129 { |
|
130 EWlanAgtNextStateUnknown, |
|
131 EWlanAgtNextStateJoin, |
|
132 EWlanAgtNextStateOpen, |
|
133 EWlanAgtNextStateEasyConn |
|
134 }; |
|
135 |
|
136 public: |
|
137 |
|
138 /** |
|
139 * constructor |
|
140 * |
|
141 * @since S60 v3.0 |
|
142 * @param aWlanSM pointer to WLAN Agent's statemachine framework |
|
143 * @param aWLMServer reference to WLAN Engine client interface |
|
144 */ |
|
145 CWlanStartState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); |
|
146 |
|
147 public: // From CAgentStateBase |
|
148 |
|
149 /** |
|
150 * NextStateL |
|
151 * |
|
152 * @since S60 v3.0 |
|
153 * @param aContinue specifies whether to continue normally or not |
|
154 * @return instance of the state that is entered next |
|
155 * (depends on the aContinue parameter) |
|
156 */ |
|
157 virtual CAgentStateBase* NextStateL( TBool aContinue ); |
|
158 |
|
159 protected: // From CActive |
|
160 |
|
161 /** |
|
162 * RunL |
|
163 * |
|
164 * @since S60 v3.0 |
|
165 */ |
|
166 virtual void RunL(); |
|
167 |
|
168 /** |
|
169 * DoCancel |
|
170 * |
|
171 * @since S60 v3.0 |
|
172 */ |
|
173 virtual void DoCancel(); |
|
174 |
|
175 private: |
|
176 /** |
|
177 * PrepareEasyWlanParamsL |
|
178 * |
|
179 * @since S60 v3.2 |
|
180 */ |
|
181 void PrepareEasyWlanParamsL(); |
|
182 |
|
183 private: |
|
184 /** specifies the next state */ |
|
185 TNextState iNextState; |
|
186 }; |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 /** |
|
194 * CWlanJoinState handles the connection attempt to WlanEngine |
|
195 * |
|
196 * @lib wlanagt.agt |
|
197 * @since S60 v3.0 |
|
198 */ |
|
199 NONSHARABLE_CLASS( CWlanJoinState ): public CWlanStateBase |
|
200 { |
|
201 |
|
202 enum TActiveObjectContext |
|
203 { |
|
204 EHotSpotInProgress, |
|
205 EHotSpotFailure, |
|
206 EHotSpotNormalAP, |
|
207 EHotSpotWLMServerHS, |
|
208 EHotSpotWLMServerNormal |
|
209 }; |
|
210 |
|
211 public: |
|
212 |
|
213 /** |
|
214 * constructor |
|
215 * |
|
216 * @since S60 v3.0 |
|
217 * @param aWlanSM pointer to WLAN Agent's statemachine framework |
|
218 * @param aWLMServer reference to WLAN Engine client interface |
|
219 */ |
|
220 CWlanJoinState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); |
|
221 |
|
222 // Destructor |
|
223 ~CWlanJoinState(); |
|
224 |
|
225 // From CAgentStateBase |
|
226 /** |
|
227 * StartState is called by the framework after new state has been instantiated |
|
228 * |
|
229 * @since S60 v3.0 |
|
230 */ |
|
231 virtual void StartState(); |
|
232 |
|
233 /** |
|
234 * NextStateL |
|
235 * |
|
236 * @since S60 v3.0 |
|
237 * @param aContinue specifies whether to continue normally or not |
|
238 * @return instance of the state that is entered next |
|
239 * (depends on the aContinue parameter) |
|
240 */ |
|
241 virtual CAgentStateBase* NextStateL( TBool aContinue ); |
|
242 |
|
243 |
|
244 protected: // From CActive |
|
245 |
|
246 /** |
|
247 * RunL |
|
248 * |
|
249 * @since S60 v3.0 |
|
250 */ |
|
251 virtual void RunL(); |
|
252 |
|
253 /** |
|
254 * DoCancel |
|
255 * |
|
256 * @since S60 v3.0 |
|
257 */ |
|
258 virtual void DoCancel(); |
|
259 |
|
260 private: |
|
261 |
|
262 /** |
|
263 * DoStartStateL |
|
264 * |
|
265 * @since S60 v3.0 |
|
266 */ |
|
267 void DoStartStateL(); |
|
268 |
|
269 private: |
|
270 |
|
271 //indicates the Active Object context of the state |
|
272 TActiveObjectContext iContext; |
|
273 |
|
274 // pointer to ECOM plug-in instance |
|
275 CWlanAgtHotSpotClient *iAgtHotSpotClient; |
|
276 }; |
|
277 |
|
278 /** |
|
279 * CWlanOpenState is active when there is an active connection |
|
280 * |
|
281 * @lib wlanagt.agt |
|
282 * @since S60 v3.0 |
|
283 */ |
|
284 NONSHARABLE_CLASS( CWlanOpenState ): public CWlanStateBase |
|
285 { |
|
286 enum TSubState |
|
287 { |
|
288 EWlanOpenSubStateOpening, |
|
289 EWlanOpenSubStateOpened, |
|
290 EWlanOpenSubStateRenewingDHCP |
|
291 }; |
|
292 |
|
293 public: |
|
294 |
|
295 /** |
|
296 * constructor |
|
297 * |
|
298 * @since S60 v3.0 |
|
299 * @param aWlanSM pointer to WLAN Agent's statemachine framework |
|
300 * @param aWLMServer reference to WLAN Engine client interface |
|
301 */ |
|
302 CWlanOpenState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); |
|
303 |
|
304 /** |
|
305 * destructor |
|
306 * |
|
307 * @since S60 v3.0 |
|
308 */ |
|
309 virtual ~CWlanOpenState(); |
|
310 |
|
311 public: // From CAgentStateBase |
|
312 /** |
|
313 * StartState is called by the framework after new state has been instantiated |
|
314 * |
|
315 * @since S60 v3.0 |
|
316 */ |
|
317 virtual void StartState(); |
|
318 |
|
319 /** |
|
320 * NextStateL |
|
321 * |
|
322 * @since S60 v3.0 |
|
323 * @param aContinue specifies whether to continue normally or not |
|
324 * @return instance of the state that is entered next |
|
325 * (depends on the aContinue parameter) |
|
326 */ |
|
327 virtual CAgentStateBase* NextStateL( TBool aContinue ); |
|
328 |
|
329 public: // From MWLMNotify |
|
330 /** |
|
331 * ConnectionStateChanged notification tells about chnages in the connection state |
|
332 * |
|
333 * @since S60 v3.0 |
|
334 * @param aNewState specifies the new state |
|
335 */ |
|
336 virtual void ConnectionStateChanged( TWlanConnectionState aNewState ); |
|
337 |
|
338 protected: // From CActive |
|
339 |
|
340 /** |
|
341 * RunL |
|
342 * |
|
343 * @since S60 v3.0 |
|
344 */ |
|
345 virtual void RunL(); |
|
346 |
|
347 /** |
|
348 * DoCancel |
|
349 * |
|
350 * @since S60 v3.0 |
|
351 */ |
|
352 virtual void DoCancel(); |
|
353 |
|
354 private: |
|
355 |
|
356 /** |
|
357 * DoStartStateL |
|
358 * |
|
359 * @since S60 v3.0 |
|
360 */ |
|
361 void DoStartStateL(); |
|
362 |
|
363 /** |
|
364 * DisconnectCb |
|
365 * |
|
366 * @since S60 v3.0 |
|
367 * @param aThisPtr pointer to 'this' |
|
368 */ |
|
369 static TInt DisconnectCb( TAny* aThisPtr ); |
|
370 |
|
371 private: |
|
372 /** substate of the connection */ |
|
373 TSubState iSubState; |
|
374 /** callback pointer */ |
|
375 CAsyncCallBack* iDisconnectCb; |
|
376 //Interfce to Notifier |
|
377 //RNotifier iNotifier; |
|
378 }; |
|
379 |
|
380 /** |
|
381 * CWlanDisconnectState initiaes disconnection towards WlanEngine |
|
382 * |
|
383 * @lib wlanagt.agt |
|
384 * @since S60 v3.0 |
|
385 */ |
|
386 NONSHARABLE_CLASS( CWlanDisconnectState ): public CWlanStateBase |
|
387 { |
|
388 public: |
|
389 |
|
390 /** |
|
391 * constructor |
|
392 * |
|
393 * @since S60 v3.0 |
|
394 * @param aWlanSM pointer to WLAN Agent's statemachine framework |
|
395 * @param aWLMServer reference to WLAN Engine client interface |
|
396 */ |
|
397 CWlanDisconnectState(CWlanSM* aWlanSM, RWLMServer& aWLMServer); |
|
398 |
|
399 /** |
|
400 * destructor |
|
401 * |
|
402 * @since S60 v3.0 |
|
403 */ |
|
404 virtual ~CWlanDisconnectState(); |
|
405 |
|
406 // From CAgentStateBase |
|
407 // |
|
408 /* StartState is called by the framework after new state has been instantiated |
|
409 * |
|
410 * @since S60 v3.0 |
|
411 */ |
|
412 virtual void StartState(); |
|
413 |
|
414 /** |
|
415 * NextStateL |
|
416 * |
|
417 * @since S60 v3.0 |
|
418 * @param aContinue specifies whether to continue normally or not |
|
419 * @return instance of the state that is entered next |
|
420 * (depends on the aContinue parameter) |
|
421 */ |
|
422 virtual CAgentStateBase* NextStateL(TBool aContinue); |
|
423 |
|
424 protected: // From CActive |
|
425 |
|
426 /** |
|
427 * RunL |
|
428 * |
|
429 * @since S60 v3.0 |
|
430 */ |
|
431 virtual void RunL(); |
|
432 |
|
433 /** |
|
434 * DoCancel |
|
435 * |
|
436 * @since S60 v3.0 |
|
437 */ |
|
438 virtual void DoCancel(); |
|
439 |
|
440 private: |
|
441 |
|
442 /** pointer to ECOM plug-in instance */ |
|
443 CWlanAgtHotSpotClient *iAgtHotSpotClient; |
|
444 }; |
|
445 |
|
446 /** |
|
447 * CWlanErrorState is a "Dummy state" used when the CWlanSM cannot |
|
448 * be constructed properly. |
|
449 * |
|
450 * @lib wlanagt.agt |
|
451 * @since S60 v3.0 |
|
452 */ |
|
453 NONSHARABLE_CLASS( CWlanErrorState ): public CAgentStateBase |
|
454 { |
|
455 public: |
|
456 |
|
457 /** |
|
458 * constructor |
|
459 * |
|
460 * @since S60 v3.0 |
|
461 * @param aWlanSM pointer to WLAN Agent's statemachine framework |
|
462 * @param aWLMServer reference to WLAN Engine client interface |
|
463 */ |
|
464 CWlanErrorState( CWlanSM* aWlanSM, TInt aError ); |
|
465 |
|
466 // From CAgentStateBase |
|
467 /** |
|
468 * StartState is called by the framework after new state has been instantiated |
|
469 * |
|
470 * @since S60 v3.0 |
|
471 */ |
|
472 virtual void StartState(); |
|
473 |
|
474 /** |
|
475 * NextStateL |
|
476 * |
|
477 * @since S60 v3.0 |
|
478 * @param aContinue specifies whether to continue normally or not |
|
479 * @return instance of the state that is entered next |
|
480 * (depends on the aContinue parameter) |
|
481 */ |
|
482 virtual CAgentStateBase* NextStateL(TBool aContinue); |
|
483 |
|
484 protected: // From CActive |
|
485 |
|
486 /** |
|
487 * RunL |
|
488 * |
|
489 * @since S60 v3.0 |
|
490 */ |
|
491 virtual void RunL(); |
|
492 |
|
493 /** |
|
494 * DoCancel |
|
495 * |
|
496 * @since S60 v3.0 |
|
497 */ |
|
498 virtual void DoCancel(); |
|
499 |
|
500 protected: |
|
501 /** pointer to WLAN agent's state machine */ |
|
502 CWlanSM* iWlanSM; |
|
503 |
|
504 private: |
|
505 /** error code */ |
|
506 TInt iError; |
|
507 }; |
|
508 |
|
509 /** |
|
510 * CWlanWaitConnectionState is used for waiting previous connection to close down. |
|
511 * |
|
512 * @lib wlanagt.agt |
|
513 * @since S60 v3.0 |
|
514 */ |
|
515 NONSHARABLE_CLASS( CWlanWaitConnectionState ): public CWlanStateBase |
|
516 { |
|
517 public: |
|
518 |
|
519 /** |
|
520 * constructor |
|
521 * |
|
522 * @since S60 v3.0 |
|
523 * @param aWlanSM pointer to WLAN Agent's statemachine framework |
|
524 * @param aWLMServer reference to WLAN Engine client interface |
|
525 */ |
|
526 CWlanWaitConnectionState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); |
|
527 |
|
528 /** |
|
529 * destructor |
|
530 * |
|
531 * @since S60 v3.0 |
|
532 */ |
|
533 virtual ~CWlanWaitConnectionState(); |
|
534 |
|
535 public: // From CAgentStateBase |
|
536 |
|
537 /** |
|
538 * StartState is called by the framework after new state has been instantiated |
|
539 * |
|
540 * @since S60 v3.0 |
|
541 */ |
|
542 void StartState(); |
|
543 |
|
544 /** |
|
545 * NextStateL |
|
546 * |
|
547 * @since S60 v3.0 |
|
548 * @param aContinue specifies whether to continue normally or not |
|
549 * @return instance of the state that is entered next |
|
550 * (depends on the aContinue parameter) |
|
551 */ |
|
552 CAgentStateBase* NextStateL(TBool aContinue); |
|
553 |
|
554 protected: // From CActive |
|
555 |
|
556 /** |
|
557 * RunL |
|
558 * |
|
559 * @since S60 v3.0 |
|
560 */ |
|
561 void RunL(); |
|
562 |
|
563 /** |
|
564 * DoCancel |
|
565 * |
|
566 * @since S60 v3.0 |
|
567 */ |
|
568 void DoCancel(); |
|
569 |
|
570 private: |
|
571 /** Timer for waiting */ |
|
572 RTimer iTimer; |
|
573 }; |
|
574 |
|
575 #endif // _WLANSTATES_H_ |