|
1 /* |
|
2 * Copyright (c) 2007-2007 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 TWsfWlanInfo |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef T_WSFWLANINFO_H |
|
21 #define T_WSFWLANINFO_H |
|
22 |
|
23 // EXTERNAL INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <cmpluginwlandef.h> |
|
26 #include <wlanmgmtcommon.h> |
|
27 |
|
28 |
|
29 // ENUMS |
|
30 |
|
31 /** |
|
32 * Signal strength categories for UI |
|
33 */ |
|
34 enum TWsfWlanSignalStrengthLevel |
|
35 { |
|
36 ENoSignal, |
|
37 EPoor, |
|
38 EAverage, |
|
39 EExcelent |
|
40 }; |
|
41 |
|
42 |
|
43 /** |
|
44 * Connection status |
|
45 */ |
|
46 enum TWsfWlanConnectionState |
|
47 { |
|
48 ENotConnected, |
|
49 EConnecting, |
|
50 EConnected |
|
51 }; |
|
52 |
|
53 |
|
54 /** |
|
55 * Signal strength category boundaries in dB (absolute value). |
|
56 * Smaller value means better signal. |
|
57 */ |
|
58 enum TWsfWlanSignalStrength |
|
59 { |
|
60 EWlanSignalStrengthMax = 60, |
|
61 EWlanSignalStrengthGood = 74, |
|
62 EWlanSignalStrengthLow = 87, |
|
63 EWlanSignalStrengthMin = 100, |
|
64 EWlanSignalUnavailable = 9999 |
|
65 }; |
|
66 |
|
67 |
|
68 /** |
|
69 * Flags for different types of networks |
|
70 */ |
|
71 enum TWsfBrandDataDefs |
|
72 { |
|
73 EBrandedItem = 0xFF, |
|
74 EBlackListItem = 0x01, |
|
75 EUserSortListItem = 0x02, |
|
76 EFonSsid = 0x04, |
|
77 EUsesPresharedKey = 0x08 |
|
78 }; |
|
79 |
|
80 |
|
81 /** |
|
82 * Maximal length of IAP name that the class should be able to store |
|
83 */ |
|
84 const TInt KWlanMaxAccessPointNameLength = 50; |
|
85 |
|
86 |
|
87 // FORWARD DECLARATIONS |
|
88 class RReadStream; |
|
89 class RWriteStream; |
|
90 |
|
91 |
|
92 // CLASS DEFINITION |
|
93 /** |
|
94 * Class to encapsulate network parameters |
|
95 * |
|
96 * TWsfWlanInfo serves for transferring the WLAN network related data |
|
97 * between the different submodules of Wlan Sniffer. |
|
98 * |
|
99 * @lib wsfwlaninfo.lib |
|
100 * @since S60 5.0 |
|
101 */ |
|
102 NONSHARABLE_CLASS( TWsfWlanInfo ) |
|
103 { |
|
104 public: // Constructors |
|
105 |
|
106 IMPORT_C TWsfWlanInfo(); |
|
107 |
|
108 /** |
|
109 * Constructor. |
|
110 * |
|
111 * @since S60 5.0 |
|
112 * @param aSsid SSID of the WLAN network |
|
113 * @param aStrengthLevel Signal strength in dB (absolute value) |
|
114 * @param aSecurityMode Network security mode |
|
115 * @param aVisibility ETrue for public networks, EFalse for hidden ones |
|
116 * @param aNetMode Network mode (infrastructure or adhoc) |
|
117 * @param aIapId IAP id if known, zero otherwise. |
|
118 * @param aCoverage Number of APs with the same SSID |
|
119 * @param aTransferRate Maximal transfer rate reported by the AP |
|
120 */ |
|
121 IMPORT_C TWsfWlanInfo( TDesC8& aSsid, |
|
122 TUint16 aStrengthLevel, |
|
123 CMManager::TWlanSecMode aSecurityMode, |
|
124 TInt aVisibility, |
|
125 CMManager::TWlanNetMode aNetMode, |
|
126 TUint32 aIapId, |
|
127 TUint8 aCoverage, |
|
128 TUint32 aTransferRate ); |
|
129 |
|
130 public: // New methods |
|
131 |
|
132 /** |
|
133 * Gets WLAN name (Ssid) as unicode format |
|
134 * @since S60 5.0 |
|
135 * @return Ssid as unicode format |
|
136 */ |
|
137 IMPORT_C HBufC* GetSsidAsUnicodeLC(); |
|
138 |
|
139 /** |
|
140 * Gets WLAN name (Ssid) as unicode format |
|
141 * @since S60 5.0 |
|
142 * @return Ssid as unicode format |
|
143 */ |
|
144 IMPORT_C static HBufC* GetSsidAsUnicodeLC( const TWlanSsid& aSsid ); |
|
145 |
|
146 /** |
|
147 * Gets WLAN name (Ssid) as 8-bit format |
|
148 * @since S60 5.0 |
|
149 * @return Ssid as 8-bit format |
|
150 */ |
|
151 IMPORT_C HBufC8* GetSsidAsUtf8LC(); |
|
152 |
|
153 /** |
|
154 * Serializes data from the stream |
|
155 * @since S60 5.0 |
|
156 * @param aStream Stream from where data is serialized |
|
157 */ |
|
158 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
159 |
|
160 /** |
|
161 * Serializes data to the stream |
|
162 * @since S60 5.0 |
|
163 * @param aStream Stream where data will be serialized |
|
164 */ |
|
165 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
166 |
|
167 /** |
|
168 * Get signal strength as enumeration |
|
169 * @since S60 5.0 |
|
170 * @return Signal stregth as enumeration |
|
171 */ |
|
172 IMPORT_C TWsfWlanSignalStrengthLevel SignalStrength(); |
|
173 |
|
174 /** |
|
175 * Get signal strength as percentage |
|
176 * @since S60 5.0 |
|
177 * @return Signal stregth as percentage |
|
178 */ |
|
179 IMPORT_C TInt SignalStrengthPercentage(); |
|
180 |
|
181 /** |
|
182 * Gets WLAN IAP name as unicode format |
|
183 * @since S60 5.0 |
|
184 * @return Ssid as unicode format |
|
185 */ |
|
186 IMPORT_C HBufC* GetIapNameAsUnicodeLC(); |
|
187 |
|
188 /** |
|
189 * Gets WLAN IAP name as 8-bit format |
|
190 * @since S60 5.0 |
|
191 * @return Ssid as 8-bit format |
|
192 */ |
|
193 IMPORT_C HBufC8* GetIapNameAsUtf8LC(); |
|
194 |
|
195 /** |
|
196 * Get WLAN connection state |
|
197 * @since S60 5.0 |
|
198 * @return ETrue if connected |
|
199 */ |
|
200 inline TBool Connected() const; |
|
201 |
|
202 /** |
|
203 * Get WLAN connection state |
|
204 * @since S60 5.2 |
|
205 * @return TWsfWlanConnectionState |
|
206 */ |
|
207 inline TWsfWlanConnectionState ConnectionStatus() const; |
|
208 |
|
209 /** |
|
210 * Get WLAN Known state |
|
211 * @since S60 5.0 |
|
212 * @return ETrue if access point has been defined |
|
213 */ |
|
214 inline TBool Known() const; |
|
215 |
|
216 /** |
|
217 * Get WLAN visibility state |
|
218 * @since S60 5.0 |
|
219 * @return ETrue if WLAN is hidden |
|
220 */ |
|
221 inline TBool Hidden() const; |
|
222 |
|
223 /** |
|
224 * Get WLAN security state |
|
225 * @since S60 5.0 |
|
226 * @return ETrue if WLAN is secured. |
|
227 */ |
|
228 inline TBool Secure() const; |
|
229 |
|
230 /** |
|
231 * Set the brand id for entry |
|
232 * @since S60 5.0 |
|
233 * @param aBrandId The brand id. |
|
234 */ |
|
235 inline void SetBrand( const TInt8 aBrandId ); |
|
236 |
|
237 /** |
|
238 * Get brand id |
|
239 * @since S60 5.0 |
|
240 * @return 8-bit value representing brand id |
|
241 */ |
|
242 inline TInt8 BrandId() const; |
|
243 |
|
244 /** |
|
245 * Set blacklist entry flag |
|
246 * @since S60 5.0 |
|
247 * @param aBlackListEntry ETrue if the network is blacklisted. |
|
248 */ |
|
249 inline void SetBlackListEntry( const TBool aBlackListEntry ); |
|
250 |
|
251 /** |
|
252 * Get blacklist flag |
|
253 * @since S60 5.0 |
|
254 * @return ETrue if the entry is marked as black list entry |
|
255 */ |
|
256 inline TBool BlackListEntry() const; |
|
257 |
|
258 /** |
|
259 * Get Fon entry flag |
|
260 * @since S60 5.0 |
|
261 * @return ETrue if the network is recognised as FON. |
|
262 */ |
|
263 inline TBool FonSsid() const; |
|
264 |
|
265 /** |
|
266 * Set Fon flag |
|
267 * @since S60 5.0 |
|
268 * @param aFonSsid ETrue if the entry is a Fon list entry |
|
269 */ |
|
270 inline void SetFonSsid( const TBool aFonSsid ); |
|
271 |
|
272 /** |
|
273 * Query preshared key flag in WPA and 802.1x security modes. |
|
274 * Note that the result is undefined in case of other security modes. |
|
275 * @since S60 5.0 |
|
276 * @return ETrue, if preshared key is used. |
|
277 */ |
|
278 inline TBool UsesPreSharedKey() const; |
|
279 |
|
280 /** |
|
281 * Set preshared key flag for WPA and 802.1x security modes. |
|
282 * @since S60 5.0 |
|
283 * @param aUsePresharedKey ETrue if the network uses preshared key |
|
284 */ |
|
285 inline void SetUsesPreSharedKey( const TBool aUsePresharedKey ); |
|
286 |
|
287 /** |
|
288 * Set the priority for entry |
|
289 * @since S60 5.1 |
|
290 * @param aPriority The priority id. |
|
291 */ |
|
292 inline void SetPriority( const TUint8 aPriority ); |
|
293 |
|
294 /** |
|
295 * Get priority |
|
296 * @since S60 5.1 |
|
297 * @return 8-bit value representing priority |
|
298 */ |
|
299 inline TUint8 Priority() const; |
|
300 |
|
301 /** |
|
302 * Get WLAN security mode |
|
303 * @since S60 5.2 |
|
304 * @return WLAN security mode |
|
305 */ |
|
306 inline CMManager::TWlanSecMode SecurityMode() const; |
|
307 |
|
308 |
|
309 public: // Data |
|
310 |
|
311 // Network name (unknown: SSID, known: IAP name) |
|
312 TWlanSsid iSsid; |
|
313 |
|
314 // Network strength |
|
315 TUint16 iStrengthLevel; |
|
316 |
|
317 //Network encryption |
|
318 CMManager::TWlanSecMode iSecurityMode; |
|
319 |
|
320 //Network visibility |
|
321 TBool iVisibility; |
|
322 |
|
323 //Network capability |
|
324 CMManager::TWlanNetMode iNetMode; |
|
325 |
|
326 //Internet Access Point Id. 0 if the IAP has not been defined. |
|
327 TUint32 iIapId; |
|
328 |
|
329 // Available WLAN hotspots in this WLAN network |
|
330 TUint8 iCoverage; |
|
331 |
|
332 // Transferrate |
|
333 TUint32 iTransferRate; |
|
334 |
|
335 // Connection state |
|
336 TWsfWlanConnectionState iConnectionState; |
|
337 |
|
338 // filter flags |
|
339 TUint8 iFilterFlags; |
|
340 |
|
341 //brand id |
|
342 TUint8 iBrandId; |
|
343 |
|
344 // The name of the WLAN IAP |
|
345 TBuf8<KWlanMaxAccessPointNameLength> iNetworkName; |
|
346 |
|
347 //UI priority for known networks |
|
348 TUint8 iPriority; |
|
349 }; |
|
350 |
|
351 |
|
352 #include "wsfwlaninfo.inl" |
|
353 |
|
354 |
|
355 #endif // T_WSFWLANINFO_H |
|
356 |
|
357 // End of file |