|
1 /* |
|
2 * Copyright (c) 2001-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 the License "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: Declares the main handler CWEPSecuritySettings, UI CWEPSecuritySettingsUI and public API for the WEP Security Settings. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WEPSECURITYSETTINGSUI_H |
|
20 #define WEPSECURITYSETTINGSUI_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 #include <metadatabase.h> |
|
27 using namespace CommsDat; |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CEikonEnv; |
|
31 class CWEPSecuritySettingsUi; |
|
32 class CWEPSecuritySettingsUiImpl; |
|
33 class CWEPSecuritySettingsImpl; |
|
34 class CCommsDatabase; |
|
35 |
|
36 |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /* |
|
40 * WEP Security Settings. Enables loading, saving and editing the settings |
|
41 * (editing via CWEPSecuritySettingsUi). |
|
42 * Proxy around the real implementation in CWEPSecuritySettingsUiImpl. |
|
43 * No details of the actual data are exposed. |
|
44 */ |
|
45 NONSHARABLE_CLASS( CWEPSecuritySettings ) : public CBase |
|
46 { |
|
47 |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. Leaves on failure. |
|
52 * @return The constructed CWEPSecuritySettings object. |
|
53 */ |
|
54 IMPORT_C static CWEPSecuritySettings* NewL(); |
|
55 |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 IMPORT_C ~CWEPSecuritySettings(); |
|
61 |
|
62 |
|
63 public: // Types |
|
64 |
|
65 enum TEvent // Events happening during edit. |
|
66 { |
|
67 ENone = 0x0000, // Nothing happened. |
|
68 EModified = 0x0001, // Data changed. |
|
69 EValid = 0x0010, // All data entererd are valid, they |
|
70 // can be saved |
|
71 EExitReq = 0x0020, // Exit option requested, also caller |
|
72 // app should close |
|
73 EShutDownReq = 0x0040 // ShutDown was requested |
|
74 }; |
|
75 |
|
76 |
|
77 // Members to be showed in the setting pages |
|
78 enum TWepMember |
|
79 { |
|
80 EWepKeyInUse, // To set key in use |
|
81 EWepAuthentication, // To set authentication type |
|
82 EWepKeyConfiguration, // To open the other settings (the three below) |
|
83 |
|
84 EWepKeyLength, // To set the length of the key |
|
85 EWepKeyFormat, // To choose the format of the key |
|
86 EWepKeyData // To set the key |
|
87 }; |
|
88 |
|
89 |
|
90 // Enumeration of the possible keys in use |
|
91 enum TWEPKeyInUse |
|
92 { |
|
93 EKeyNumber1, // Key number 1 |
|
94 EKeyNumber2, // Key number 2 |
|
95 EKeyNumber3, // Key number 3 |
|
96 EKeyNumber4 // Key number 4 |
|
97 }; |
|
98 |
|
99 |
|
100 // Enumeration of the possible authentication types |
|
101 enum TWEPAuthentication |
|
102 { |
|
103 EAuthOpen, // Open authentication |
|
104 EAuthShared // Shared authentication |
|
105 }; |
|
106 |
|
107 |
|
108 // Possible lengths of the keys |
|
109 enum TWEPKeyLength |
|
110 { |
|
111 E40Bits, // 40 bits |
|
112 E104Bits, // 104 bits |
|
113 E232Bits // 232 bits |
|
114 }; |
|
115 |
|
116 |
|
117 // Possible formats of the keys |
|
118 enum TWEPKeyFormat |
|
119 { |
|
120 EAscii, // Ascii format |
|
121 EHexadecimal // Hex format |
|
122 }; |
|
123 |
|
124 public: // New methods |
|
125 |
|
126 /** |
|
127 * Load from database. |
|
128 * @param aIapId Wlan Service Table Id of the IAP to be loaded |
|
129 * @param aCommsDb Comms database. |
|
130 */ |
|
131 IMPORT_C void LoadL( TUint32 aIapId, CCommsDatabase& aCommsDb ); |
|
132 |
|
133 /** |
|
134 * Edit the settings. |
|
135 * @param aUi UI to be used. |
|
136 * @param aTitle Title Pane text to display during edit. |
|
137 * @return Exit reason. |
|
138 */ |
|
139 IMPORT_C TInt EditL( CWEPSecuritySettingsUi& aUi, |
|
140 const TDesC& aTitle ); |
|
141 |
|
142 /** |
|
143 * Save to database. |
|
144 * @param aIapId Wlan Service Table Id of the IAP to be saved |
|
145 * @param aCommsDb Comms database. |
|
146 */ |
|
147 IMPORT_C void SaveL( TUint32 aIapId, CCommsDatabase& aCommsDb ) const; |
|
148 |
|
149 /** |
|
150 * Tells if the settings are valid and can be saved |
|
151 * @return ETrue if all the compulsory settings have been entered |
|
152 */ |
|
153 IMPORT_C TBool IsValid() const; |
|
154 |
|
155 /** |
|
156 * Sets the new data of the key |
|
157 * @param aElement Index of the element whose data has to be set. |
|
158 * @param aKeyData The new value for data of the key. |
|
159 * @param aHex ETrue if data is in Ascii format |
|
160 * @return KErrNone if successful, or an error code |
|
161 */ |
|
162 IMPORT_C TInt SetKeyDataL( const TInt aElement, const TDesC& aKeyData, |
|
163 const TBool aHex ); |
|
164 |
|
165 /** |
|
166 * Load from database. |
|
167 * @param aIapId Wlan Service Table Id of the IAP to be loaded |
|
168 * @param aSession Session to CommsDat. |
|
169 */ |
|
170 IMPORT_C void LoadL( TUint32 aIapId, CMDBSession& aSession ); |
|
171 |
|
172 /** |
|
173 * Save to database. |
|
174 * @param aIapId Wlan Service Table Id of the IAP to be saved |
|
175 * @param aSession Session to CommsDat. |
|
176 */ |
|
177 IMPORT_C void SaveL( TUint32 aIapId, CMDBSession& aSession ) const; |
|
178 |
|
179 /** |
|
180 * Sets the index of the key to use. |
|
181 * @param aKey The key to be used for authentication. |
|
182 */ |
|
183 IMPORT_C void SetKeyInUse( TWEPKeyInUse aKey ); |
|
184 |
|
185 /** |
|
186 * Sets the authentication type. |
|
187 * @param aAuthentication The authentication type. |
|
188 */ |
|
189 IMPORT_C void SetAuthentication( TWEPAuthentication aAuthentication ); |
|
190 |
|
191 |
|
192 private: // Data |
|
193 |
|
194 // Implementation. Owned. |
|
195 CWEPSecuritySettingsImpl* iImpl; |
|
196 |
|
197 }; |
|
198 |
|
199 |
|
200 |
|
201 /** |
|
202 * User interface to edit WEP Security Settings. |
|
203 * Proxy around the real implementation in CWEPSecuritySettingsUiImpl. |
|
204 */ |
|
205 NONSHARABLE_CLASS( CWEPSecuritySettingsUi ) : public CBase |
|
206 { |
|
207 |
|
208 public: // Constructors and destructor |
|
209 |
|
210 /** |
|
211 * Two-phased constructor. Leaves on failure. |
|
212 * @param aEikEnv Eikon environment. |
|
213 * @return The constructed CWEPSecuritySettingsUi object. |
|
214 */ |
|
215 IMPORT_C static CWEPSecuritySettingsUi* NewL( CEikonEnv& aEikEnv ); |
|
216 |
|
217 /** |
|
218 * Destructor. |
|
219 */ |
|
220 IMPORT_C virtual ~CWEPSecuritySettingsUi(); |
|
221 |
|
222 public: // New methods |
|
223 |
|
224 /** |
|
225 * Component Validation Test. |
|
226 * @return KErrNone. |
|
227 */ |
|
228 IMPORT_C static TInt Cvt(); |
|
229 |
|
230 private: // Friends |
|
231 |
|
232 friend class CWEPSecuritySettings; |
|
233 |
|
234 private: // Data |
|
235 |
|
236 // Implementation. Owned. |
|
237 CWEPSecuritySettingsUiImpl* iImpl; |
|
238 |
|
239 }; |
|
240 #endif |
|
241 |
|
242 |
|
243 // End of File |