1 /* |
|
2 * Copyright (c) 2006 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: Declaration of WLAN interface implementation for WLAN plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef WLAN_PLUGIN_H |
|
19 #define WLAN_PLUGIN_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <cmpluginlanbase.h> |
|
23 #include <cmpluginwlandef.h> |
|
24 #include <e32base.h> |
|
25 #include <eikdoc.h> |
|
26 #include <apparc.h> |
|
27 #include <eikenv.h> |
|
28 #include <wlanmgmtcommon.h> |
|
29 #include <wifiprotreturn.h> |
|
30 |
|
31 // FORWARD DECLARATION |
|
32 class CCDWlanServiceRecord; |
|
33 class CWEPSecuritySettings; |
|
34 class CWEPSecuritySettingsUi; |
|
35 class CWPASecuritySettings; |
|
36 class CWPASecuritySettingsUi; |
|
37 class RConeResourceLoader; |
|
38 class CConnectionUiUtilities; |
|
39 class CCmPluginWlanDataArray; |
|
40 class CAknWaitDialog; |
|
41 |
|
42 class CWAPISecuritySettings; |
|
43 class CWAPISecuritySettingsUi; |
|
44 |
|
45 /** |
|
46 * WPA Mode |
|
47 */ |
|
48 enum TWpaMode |
|
49 { |
|
50 EWpaModeUndefined = -1, |
|
51 EWpaModeEap, |
|
52 EWpaModePreSharedKey |
|
53 }; |
|
54 |
|
55 /** |
|
56 * WLAN Plugin IF implementation class |
|
57 * |
|
58 * ?more_complete_description |
|
59 * |
|
60 * @since S60 3.2 |
|
61 */ |
|
62 NONSHARABLE_CLASS( CCmPluginWlan ) : public CCmPluginLanBase |
|
63 { |
|
64 |
|
65 public: // Constructors and destructor |
|
66 |
|
67 /** |
|
68 * Two phased constructor |
|
69 * |
|
70 * @since S60 3.2 |
|
71 * @param aInitParam |
|
72 * @return The created object. |
|
73 */ |
|
74 static CCmPluginWlan* NewL( TCmPluginInitParam* aInitParam ); |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CCmPluginWlan(); |
|
80 |
|
81 virtual CCmPluginBaseEng* CreateInstanceL( TCmPluginInitParam& aInitParam ) const; |
|
82 |
|
83 public: // from base class |
|
84 |
|
85 /** |
|
86 * From CCmPluginBaseEng |
|
87 * Gets the value for a TUint32 attribute |
|
88 * |
|
89 * @since S60 3.2 |
|
90 * @param aAttribute Identifies the attribute to be retrived |
|
91 * @return the requested TUint32 value |
|
92 */ |
|
93 TUint32 GetIntAttributeL( const TUint32 aAttribute ) const; |
|
94 |
|
95 /** |
|
96 * From CCmPluginBaseEng |
|
97 * Gets the value for a TBool attribute |
|
98 * |
|
99 * @since S60 3.2 |
|
100 * @param aAttribute Identifies the attribute to be retrived |
|
101 * @return the requested TBool value |
|
102 */ |
|
103 TBool GetBoolAttributeL( const TUint32 aAttribute ) const; |
|
104 |
|
105 /** |
|
106 * From CCmPluginBaseEng |
|
107 * Gets the value for a TDes16 attribute |
|
108 * |
|
109 * @since S60 3.2 |
|
110 * @param aAttribute Identifies the attribute to be retrived |
|
111 * @return the requested string value |
|
112 */ |
|
113 HBufC* GetStringAttributeL( const TUint32 aAttribute ) const; |
|
114 |
|
115 /** |
|
116 * From CCmPluginBaseEng |
|
117 * Sets the value for a TInt attribute |
|
118 * |
|
119 * @since S60 3.2 |
|
120 * @param aAttribute Identifies the attribute to be set. |
|
121 * @param aValue The value to be set |
|
122 */ |
|
123 void SetIntAttributeL( const TUint32 aAttribute, TUint32 aValue ); |
|
124 |
|
125 /** |
|
126 * * From CCmPluginBaseEng |
|
127 * Sets the value for a TBool attribute |
|
128 * |
|
129 * @since S60 3.2 |
|
130 * @param aAttribute Identifies the attribute to be set. |
|
131 * @param aValue The value to be set |
|
132 */ |
|
133 void SetBoolAttributeL( const TUint32 aAttribute, TBool aValue ); |
|
134 |
|
135 /** |
|
136 * From CCmPluginBaseEng |
|
137 * Sets the value for a TDesC attribute |
|
138 * |
|
139 * @since S60 3.2 |
|
140 * @param aAttribute Identifies the attribute to be set. |
|
141 * @param aValue The value to be set |
|
142 */ |
|
143 void SetStringAttributeL( const TUint32 aAttribute, const TDesC16& aValue ); |
|
144 |
|
145 /** |
|
146 * From CCmPluginBaseEng |
|
147 * Checks if the plug-in can handle the given AP. |
|
148 * |
|
149 * @since S60 3.2 |
|
150 * @param aIapId |
|
151 * @return ETrue if plug-in can handle the IAP |
|
152 */ |
|
153 TBool CanHandleIapIdL( TUint32 aIapId ) const; |
|
154 |
|
155 /** |
|
156 * From CCmPluginBaseEng |
|
157 * Checks if the plug-in can handle the given AP |
|
158 * |
|
159 * @since S60 3.2 |
|
160 * @param aIapRecord IAP record to be checked |
|
161 * @return ETrue if plug-in can handle the IAP |
|
162 */ |
|
163 TBool CanHandleIapIdL( CommsDat::CCDIAPRecord *aIapRecord ) const; |
|
164 |
|
165 /** |
|
166 * From CCmPluginBaseEng |
|
167 * Launches the WLAN settings dialog |
|
168 * |
|
169 * @since S60 3.2 |
|
170 * @return soft key selection |
|
171 */ |
|
172 TInt RunSettingsL(); |
|
173 |
|
174 /** |
|
175 * From CCmPluginBaseEng |
|
176 * see base class definition |
|
177 * |
|
178 * @since S60 3.2 |
|
179 */ |
|
180 TBool InitializeWithUiL( TBool aManuallyConfigure ); |
|
181 |
|
182 /** |
|
183 * From CCmPluginBaseEng |
|
184 * see base class definition |
|
185 * |
|
186 * @since S60 3.2 |
|
187 */ |
|
188 void LoadServiceSettingL(); |
|
189 |
|
190 /** |
|
191 * From CCmPluginBaseEng |
|
192 * see base class definition |
|
193 * |
|
194 * @since S60 3.2 |
|
195 */ |
|
196 void AdditionalReset(); |
|
197 |
|
198 public: // New functions |
|
199 /** |
|
200 * Edits the security settings for the current connection method |
|
201 * |
|
202 * @since S60 3.2 |
|
203 * @param aEikonEnv Eikon environment to use |
|
204 * @return exit reason |
|
205 */ |
|
206 TInt EditSecuritySettingsL( CEikonEnv& aEikonEnv ); |
|
207 |
|
208 /** |
|
209 * Returns the security settings validity for the current connection method |
|
210 * |
|
211 * @since S60 3.2 |
|
212 * @return Validity of the current security settings |
|
213 */ |
|
214 TBool AreSecuritySettingsValidL(); |
|
215 |
|
216 /** |
|
217 * Loads the security settings for the current connection method |
|
218 * |
|
219 * @since S60 3.2 |
|
220 */ |
|
221 void LoadSecuritySettingsL(); |
|
222 |
|
223 protected: |
|
224 |
|
225 /** |
|
226 * From CCmPluginBaseEng |
|
227 * see base class definition |
|
228 * |
|
229 * @since S60 3.2 |
|
230 */ |
|
231 virtual void BearerRecordIdLC( HBufC* &aBearerName, |
|
232 TUint32& aRecordId ); |
|
233 |
|
234 |
|
235 /** |
|
236 * Copy data of the connection method that is not |
|
237 * added to the conversion table. (e.g. bearer specific |
|
238 * flags) |
|
239 * |
|
240 * @param aDestInst copy attributes into this plugin instance |
|
241 */ |
|
242 void CopyAdditionalDataL( CCmPluginBaseEng& aDestInst ) const; |
|
243 |
|
244 |
|
245 private: // construction |
|
246 |
|
247 /** |
|
248 * Constructor |
|
249 * |
|
250 * @since S60 3.2 |
|
251 */ |
|
252 CCmPluginWlan( TCmPluginInitParam* aInitParam ); |
|
253 |
|
254 /** |
|
255 * Second phase constructor |
|
256 * |
|
257 * @since S60 3.2 |
|
258 */ |
|
259 void ConstructL(); |
|
260 |
|
261 private: // from base class |
|
262 |
|
263 /** |
|
264 * From CCmPluginBaseEng |
|
265 * Updates additional records, in this case, the WLAN records. |
|
266 * |
|
267 * @since S60 3.2 |
|
268 */ |
|
269 void UpdateAdditionalRecordsL(); |
|
270 |
|
271 /** |
|
272 * From CCmPluginBaseEng |
|
273 * Deletes additional records, in this case, the WLAN records |
|
274 * |
|
275 * @since S60 3.2 |
|
276 */ |
|
277 void DeleteAdditionalRecordsL(); |
|
278 |
|
279 /** |
|
280 * From CCmPluginBaseEng |
|
281 * Loads additional records, in this case, the WLAN records |
|
282 * |
|
283 * @since S60 3.2 |
|
284 */ |
|
285 void LoadAdditionalRecordsL(); |
|
286 |
|
287 /** |
|
288 * From CCmPluginBaseEng |
|
289 * Creates a new service record for this bearer |
|
290 * |
|
291 * @since S60 3.2 |
|
292 */ |
|
293 void CreateNewServiceRecordL(); |
|
294 |
|
295 /** |
|
296 * From CCmPluginBaseEng |
|
297 * Creates the WLAN service record used by this WLAN |
|
298 * |
|
299 * @since S60 3.2 |
|
300 */ |
|
301 |
|
302 void CreateWlanServiceRecordL(); |
|
303 |
|
304 /** |
|
305 * From CCmPluginBaseEng |
|
306 */ |
|
307 virtual void PrepareToUpdateRecordsL(); |
|
308 |
|
309 /** |
|
310 * Appends uids of connection methods - which were also created during connection method |
|
311 * creation - to the array given as parameter |
|
312 * @param aIapIds the array the additonal cm uids are appended to |
|
313 */ |
|
314 virtual void GetAdditionalUids( RArray<TUint32>& aIapIds ); |
|
315 |
|
316 private: // new functions |
|
317 |
|
318 /** |
|
319 * Updates the security settings for the current WLAN connection method |
|
320 * |
|
321 * @since S60 3.2 |
|
322 */ |
|
323 void UpdateSecuritySettingsL(); |
|
324 |
|
325 /** |
|
326 * Allocates a string specified by aResId and replaces %N in the |
|
327 * resource with aInt |
|
328 * |
|
329 * @since S60 3.2 |
|
330 * @param aResId Resource ID to be read from resource file. |
|
331 * @param aInt Integer that will replace %N in the string. |
|
332 * @return String read from resource file, specified by aResId, |
|
333 * containing aInt. |
|
334 */ |
|
335 HBufC* ReadResourceL( TInt aResId, TInt aInt ) const; |
|
336 |
|
337 /** |
|
338 * The UI for manually configuring a WLAN connection method |
|
339 * |
|
340 * @since S60 3.2 |
|
341 * @return ETrue if the configuration was successful |
|
342 */ |
|
343 TBool ManuallyConfigureL(); |
|
344 |
|
345 /** |
|
346 * Continuing with Manual configuration from step 4 |
|
347 * called from ManuallyConfigureL or AutomaticallyConfigureL in case the |
|
348 * specicfied network was not found (reverting to fully manual setup) |
|
349 * |
|
350 * @since S60 3.2 |
|
351 * @param TBool aAskNWModeAndSec if set to ETrue, NW mode and Security |
|
352 * mode dialogs are shown. If EFalse, these values are taken from |
|
353 * the corresponding parameters of this function |
|
354 * @param TWlanNetMode& aNwMode NW mode used if aAskNWModeAndSec is EFalse |
|
355 * @param TWlanConnectionExtentedSecurityMode& aSecurityMode |
|
356 * Security mode used if aAskNWModeAndSec is EFalse |
|
357 * @param TWpaMode& aWpaMode WPA mode |
|
358 * @return ETrue if the configuration was successful |
|
359 */ |
|
360 TBool ProceedWithManualL( TBool aAskNWModeAndSec, |
|
361 CMManager::TWlanNetMode aNwMode = CMManager::EInfra, |
|
362 TWlanConnectionExtentedSecurityMode aSecurityMode = EWlanConnectionExtentedSecurityModeOpen, |
|
363 TWpaMode aWpaMode = EWpaModeUndefined ); |
|
364 /** |
|
365 * The UI for automatically configuring a WLAN connection method |
|
366 * |
|
367 * @since S60 3.2 |
|
368 * @return ETrue if the configuration was successful |
|
369 */ |
|
370 TBool AutomaticallyConfigureL(); |
|
371 |
|
372 /* |
|
373 * Loads a specific resource, leaves the resource loader on the |
|
374 * cleanup stack |
|
375 * |
|
376 * @since S60 3.2 |
|
377 * @param aResourceLoader |
|
378 */ |
|
379 void LoadResourceLC( RConeResourceLoader& aResourceLoader ) const; |
|
380 |
|
381 /* |
|
382 * Prompt for the Network Name of the new WLAN connection method |
|
383 * sets the network name and SSID settings |
|
384 * |
|
385 * @since S60 3.2 |
|
386 * @param |
|
387 * @return ETrue if a selection was made, EFalse if cancelled |
|
388 */ |
|
389 TBool ShowNWNameQueryL( TDes& aName ); |
|
390 |
|
391 /* |
|
392 * Scans for a WLAN network by a given SSID |
|
393 * initially makes a broadcast scan and if not found a direct scan. |
|
394 * Sets the scan ssid setting |
|
395 * |
|
396 * @since S60 3.2 |
|
397 * @param aSsid the SSID to scan for |
|
398 * @return ETrue if a network has been found with the SSID |
|
399 */ |
|
400 TBool ScanForWlanNwL( TWlanSsid& aSsid, |
|
401 CMManager::TWlanNetMode& aNetworkMode, |
|
402 TWlanConnectionExtentedSecurityMode& aSecurityMode, |
|
403 TBool& aProtectedSetupSupported ); |
|
404 |
|
405 /* |
|
406 * Selection list for Network Mode |
|
407 * |
|
408 * @since S60 3.2 |
|
409 * @param aNWMode (return value) network mode selected |
|
410 * @return ETrue if a selection was made, EFalse if cancelled |
|
411 */ |
|
412 TBool SelectNWModeL( CMManager::TWlanNetMode& aNWMode ); |
|
413 |
|
414 /* |
|
415 * Displays a user selection dialog of Security Modes |
|
416 * |
|
417 * @since S60 3.2 |
|
418 * @param aNwMode which network mode was selected |
|
419 * @param aSecurityMode returns the selection |
|
420 * @return ETrue if a selection was made, EFalse if cancelled |
|
421 */ |
|
422 TBool ShowNWSecurityDlgL( CMManager::TWlanNetMode aNwMode, |
|
423 TWlanConnectionExtentedSecurityMode& aSecurityMode ); |
|
424 |
|
425 /* |
|
426 * Triggers the WEP key input query |
|
427 * |
|
428 * @since S60 3.2 |
|
429 * @return ETrue if a selection was made, EFalse if cancelled |
|
430 */ |
|
431 TBool EnterWEPKeyL(); |
|
432 |
|
433 /* |
|
434 * Triggers the pre-shared key for WPA WLAN query |
|
435 * |
|
436 * @since S60 3.2 |
|
437 * @return ETrue if a selection was made, EFalse if cancelled |
|
438 */ |
|
439 TBool EnterWpaPreSharedKeyL(); |
|
440 |
|
441 /* |
|
442 * Shows the WPA/WPA2 mode dialog |
|
443 * |
|
444 * @since S60 3.2 |
|
445 * @param aWpaMode return value |
|
446 * @return ETrue if selection made |
|
447 */ |
|
448 TBool SelectWpaModeDialogL( TWpaMode& aWpaMode ); |
|
449 |
|
450 /** |
|
451 * Reloads internal security settings modules according to the changes |
|
452 * @since S60 3.2 |
|
453 */ |
|
454 void UpdateSecurityModeL(); |
|
455 |
|
456 |
|
457 /** |
|
458 * Called from another CM-s CopyAdditionalDataL, on the passed |
|
459 * copied CM, and marks this as a copy of the original CM which |
|
460 * has an IAP ID of aBaseIapID |
|
461 * |
|
462 * @since S60 3.2 |
|
463 */ |
|
464 void SetAsCopyOf( TUint32 aBaseIapID ); |
|
465 |
|
466 /** |
|
467 * Deletes the security settings related to this connection method. |
|
468 * |
|
469 * @since S60 3.2 |
|
470 */ |
|
471 void DeleteSecuritySettingsL(); |
|
472 |
|
473 |
|
474 /** |
|
475 * Set the EWlanIpDNSAddrFromServer according to the |
|
476 * current name server values. |
|
477 * |
|
478 * @since S60 3.2 |
|
479 */ |
|
480 void SetDnsIpFromServerL(); |
|
481 |
|
482 |
|
483 /** |
|
484 * Set the EWlanIp6DNSAddrFromServer according to the |
|
485 * current name server values. |
|
486 * |
|
487 * @since S60 3.2 |
|
488 */ |
|
489 void SetDns6IpFromServerL(); |
|
490 |
|
491 |
|
492 /** |
|
493 * Checks for coveradge and number of WLAN connections available |
|
494 * @since S60 3.2 |
|
495 * @return The number of available WLAN network connections |
|
496 */ |
|
497 TInt CheckNetworkCoverageL() const; |
|
498 |
|
499 |
|
500 /** |
|
501 * Converts security mode from TWlanConnectionSecurityMode to |
|
502 * TWlanSecMode |
|
503 * @since S60 3.2 |
|
504 * @return The security mode as TWlanSecMode |
|
505 */ |
|
506 CMManager::TWlanSecMode ConvertConnectionSecurityModeToSecModeL( |
|
507 TWlanConnectionExtentedSecurityMode aSecurityMode ); |
|
508 |
|
509 |
|
510 /** |
|
511 * Converts security mode from TWlanSecMode to |
|
512 * TWlanConnectionSecurityMode |
|
513 * @since S60 3.2 |
|
514 * @return The security mode as TWlanConnectionSecurityMode |
|
515 */ |
|
516 TWlanConnectionExtentedSecurityMode ConvertSecModeToConnectionSecurityModeL( |
|
517 CMManager::TWlanSecMode aSecMode ); |
|
518 |
|
519 /** |
|
520 * Destroy wait dialog |
|
521 */ |
|
522 void DestroyWaitDialog(); |
|
523 |
|
524 |
|
525 /** |
|
526 * Sets the daemon name. Starts DHCP if set. |
|
527 * |
|
528 * @since S60 3.2 |
|
529 */ |
|
530 void SetDaemonNameL(); |
|
531 |
|
532 |
|
533 /** |
|
534 * Converts the possible WLAN connection states from TWlanConnectionMode |
|
535 * to TWlanNetMode. |
|
536 * @since S60 3.2 |
|
537 * @return The WLAN connection mode as TWlanNetMode |
|
538 */ |
|
539 CMManager::TWlanNetMode ConvertWLANConnectionStatesL( |
|
540 TWlanConnectionMode aConnectionMode ); |
|
541 |
|
542 WiFiProt::TWiFiReturn ProtectedSetupL(TWlanSsid& aSsid ); |
|
543 |
|
544 /* |
|
545 * Triggers the pre-shared key for WAPI WLAN query |
|
546 * |
|
547 * @since S60 5.1 |
|
548 * @return ETrue if a selection was made, EFalse if cancelled |
|
549 */ |
|
550 TBool EnterWAPIPreSharedKeyL(); |
|
551 |
|
552 private: // Data |
|
553 |
|
554 /** |
|
555 * WLan service record |
|
556 * Own |
|
557 */ |
|
558 CCDWlanServiceRecord* iWlanServiceRecord; // owned |
|
559 |
|
560 /** |
|
561 * WLAN table id |
|
562 */ |
|
563 CommsDat::TMDBElementId iWlanTableId; |
|
564 |
|
565 /** |
|
566 * WEP settings data |
|
567 * Own |
|
568 */ |
|
569 CWEPSecuritySettings* iWepSecSettings; |
|
570 |
|
571 /** |
|
572 * WPA settings data |
|
573 * Own |
|
574 */ |
|
575 CWPASecuritySettings* iWpaSecSettings; |
|
576 |
|
577 /** |
|
578 * Number of networks |
|
579 */ |
|
580 TInt iWlanNetworks; |
|
581 |
|
582 /** |
|
583 * Connection UI utilities pointer |
|
584 * Own |
|
585 */ |
|
586 CConnectionUiUtilities* iConnUiUtils; // owned |
|
587 |
|
588 /** |
|
589 * Signals that this connection method is a copy of another WLAN CM. |
|
590 */ |
|
591 TBool iIsCopy; |
|
592 |
|
593 /** |
|
594 * The IAP ID of the CM from which this copy had been made. |
|
595 */ |
|
596 TUint32 iCopiedFromIapId; |
|
597 |
|
598 /** |
|
599 * "Searching WLAN networks" wait dialog. |
|
600 */ |
|
601 CAknWaitDialog* iWaitDialog; |
|
602 |
|
603 RArray<TUint32> iAdditionalCmsCreated; |
|
604 |
|
605 /** |
|
606 * Asked from the Feature manager at the constructor phase |
|
607 */ |
|
608 TBool iIsWAPISupported; |
|
609 |
|
610 /** |
|
611 * WAPI settings data |
|
612 * Own |
|
613 */ |
|
614 CWAPISecuritySettings* iWAPISecSettings; |
|
615 }; |
|
616 |
|
617 #endif // WLAN_PLUGIN_H |
|