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