|
1 /* |
|
2 * Copyright (c) 2009-2010 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: |
|
15 * WLAN Qt Utilities WLAN IAP settings handling. |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 |
|
20 #include <QScopedPointer> |
|
21 #include <QSharedPointer> |
|
22 #include <QVariant> |
|
23 |
|
24 #include <cmmanager_shim.h> |
|
25 #include <cmdestination_shim.h> |
|
26 #include <cmconnectionmethod_shim.h> |
|
27 |
|
28 // User includes |
|
29 |
|
30 #include "wlanqtutils.h" |
|
31 #include "wlanqtutilsap.h" |
|
32 #include "wlanqtutilsiap.h" |
|
33 #include "wlanqtutilsiapsettings.h" |
|
34 |
|
35 #include "OstTraceDefinitions.h" |
|
36 #ifdef OST_TRACE_COMPILER_IN_USE |
|
37 #include "wlanqtutilsiapsettingsTraces.h" |
|
38 #endif |
|
39 |
|
40 /*! |
|
41 \class WlanQtUtilsIapSettings |
|
42 \brief WLAN IAP related settings handler. |
|
43 |
|
44 Provides functionality to manipulate WLAN IAPs via the CM Manager Shim |
|
45 interface. |
|
46 |
|
47 NOTE: Shim functions may throw exceptions that need to be catched in |
|
48 this class. |
|
49 */ |
|
50 |
|
51 // External function prototypes |
|
52 |
|
53 // Local constants |
|
54 |
|
55 //! IAP trace types |
|
56 #define WLANQTUTILS_IAP_TRACE_FETCH 1 |
|
57 #define WLANQTUTILS_IAP_TRACE_CREATE 2 |
|
58 #define WLANQTUTILS_IAP_TRACE_UPDATE 3 |
|
59 |
|
60 // WEP key lengths used to determine key format |
|
61 static const int WepHex64BitMaxLength = 10; |
|
62 static const int WepHex128BitMaxLength = 26; |
|
63 static const int WepAscii64BitMaxLength = 5; |
|
64 static const int WepAscii128BitMaxLength = 13; |
|
65 |
|
66 // ======== LOCAL FUNCTIONS ======== |
|
67 |
|
68 // ======== MEMBER FUNCTIONS ======== |
|
69 |
|
70 /*! |
|
71 Constructor. |
|
72 |
|
73 @param [in] parent Parent object. |
|
74 */ |
|
75 |
|
76 WlanQtUtilsIapSettings::WlanQtUtilsIapSettings(QObject *parent) : |
|
77 QObject(parent), |
|
78 mCmManager(new CmManagerShim()) |
|
79 { |
|
80 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_ENTRY); |
|
81 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_EXIT); |
|
82 } |
|
83 |
|
84 /*! |
|
85 Destructor. |
|
86 */ |
|
87 |
|
88 WlanQtUtilsIapSettings::~WlanQtUtilsIapSettings() |
|
89 { |
|
90 OstTraceFunctionEntry0(DUP1_WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_ENTRY); |
|
91 |
|
92 delete mCmManager; |
|
93 |
|
94 OstTraceFunctionExit0(DUP1_WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_EXIT); |
|
95 } |
|
96 |
|
97 /*! |
|
98 Fetch all WLAN IAPs. |
|
99 |
|
100 @param [out] iapList List of WLAN IAPs. |
|
101 */ |
|
102 |
|
103 void WlanQtUtilsIapSettings::fetchIaps( |
|
104 QList< QSharedPointer<WlanQtUtilsIap> > &iapList) const |
|
105 { |
|
106 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_FETCHIAPS_ENTRY); |
|
107 |
|
108 // Clear the list content first for safety |
|
109 iapList.clear(); |
|
110 |
|
111 QList<uint> iapIds; |
|
112 try { |
|
113 mCmManager->connectionMethod(iapIds, false); |
|
114 } catch (const std::exception &ex) { |
|
115 int error = qt_symbian_exception2Error(ex); |
|
116 OstTrace1( |
|
117 TRACE_NORMAL, |
|
118 WLANQTUTILSIAPSETTINGS_FETCHIAPS_EXCEPTION, |
|
119 "WlanQtUtilsIapSettings::fetchIaps exception;error=%d", |
|
120 error); |
|
121 } |
|
122 |
|
123 #ifdef OST_TRACE_COMPILER_IN_USE |
|
124 int iapCount = iapIds.count(); |
|
125 OstTrace1( |
|
126 TRACE_NORMAL, |
|
127 WLANQTUTILSIAPSETTINGS_FETCHIAPS_COUNT, |
|
128 "WlanQtUtilsIapSettings::fetchIaps;iapCount=%d", |
|
129 iapCount); |
|
130 #endif |
|
131 |
|
132 foreach (uint iapId, iapIds) { |
|
133 QSharedPointer<WlanQtUtilsIap> wlanIap = fetchIap(iapId); |
|
134 if (wlanIap) { |
|
135 iapList.append(wlanIap); |
|
136 } |
|
137 } |
|
138 |
|
139 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_FETCHIAPS_EXIT); |
|
140 } |
|
141 |
|
142 /*! |
|
143 Fetch WLAN IAP with the given ID |
|
144 |
|
145 @param [in] iapId ID of IAP to fetch. |
|
146 |
|
147 @return Found IAP, NULL if not found. |
|
148 */ |
|
149 |
|
150 QSharedPointer<WlanQtUtilsIap> WlanQtUtilsIapSettings::fetchIap(uint iapId) const |
|
151 { |
|
152 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_FETCHIAP_ENTRY); |
|
153 |
|
154 QSharedPointer<WlanQtUtilsIap> wlanIap; |
|
155 try { |
|
156 QScopedPointer<CmConnectionMethodShim> iap( |
|
157 mCmManager->connectionMethod(iapId)); |
|
158 if (iap && iap->getIntAttribute(CMManagerShim::CmBearerType) == |
|
159 KUidWlanBearerType) { |
|
160 |
|
161 // Get WLAN IAP parameters |
|
162 int netId = iap->getIntAttribute(CMManagerShim::CmNetworkId); |
|
163 QString name = iap->getStringAttribute(CMManagerShim::CmName); |
|
164 QString ssid = iap->getStringAttribute(CMManagerShim::WlanSSID); |
|
165 int connMode = iap->getIntAttribute(CMManagerShim::WlanConnectionMode); |
|
166 int secMode = iap->getIntAttribute( |
|
167 CMManagerShim::WlanSecurityMode); |
|
168 bool wpaPskUse = iap->getBoolAttribute( |
|
169 CMManagerShim::WlanEnableWpaPsk); |
|
170 |
|
171 // Create a WLAN Qt Utils IAP |
|
172 wlanIap = QSharedPointer<WlanQtUtilsIap>(new WlanQtUtilsIap()); |
|
173 wlanIap->setValue(WlanQtUtilsIap::ConfIdIapId, iapId); |
|
174 wlanIap->setValue(WlanQtUtilsIap::ConfIdNetworkId, netId); |
|
175 wlanIap->setValue(WlanQtUtilsIap::ConfIdName, name); |
|
176 wlanIap->setValue(WlanQtUtilsAp::ConfIdSsid, ssid); |
|
177 wlanIap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, connMode); |
|
178 wlanIap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); |
|
179 wlanIap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, wpaPskUse); |
|
180 |
|
181 // Trace the fetched IAP |
|
182 traceIap( |
|
183 wlanIap.data(), |
|
184 WLANQTUTILS_IAP_TRACE_FETCH, |
|
185 iapId); |
|
186 } |
|
187 } catch (const std::exception &ex) { |
|
188 int error = qt_symbian_exception2Error(ex); |
|
189 OstTrace1( |
|
190 TRACE_NORMAL, |
|
191 WLANQTUTILSIAPSETTINGS_FETCHIAP_EXCEPTION, |
|
192 "WlanQtUtilsIapSettings::fetchIap exception;error=%d", |
|
193 error); |
|
194 } |
|
195 |
|
196 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_FETCHIAP_EXIT); |
|
197 return wlanIap; |
|
198 } |
|
199 |
|
200 /*! |
|
201 Create a new WLAN IAP as an uncategorized IAP. |
|
202 |
|
203 @param [in] wlanAp Information about the WLAN AP. |
|
204 |
|
205 @return ID of the created IAP, IapIdNone in error cases. |
|
206 */ |
|
207 |
|
208 int WlanQtUtilsIapSettings::createIap(const WlanQtUtilsAp *wlanAp) |
|
209 { |
|
210 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_CREATEIAP_ENTRY); |
|
211 |
|
212 int iapId = WlanQtUtils::IapIdNone; |
|
213 |
|
214 try { |
|
215 // Create the new IAP |
|
216 QScopedPointer<CmConnectionMethodShim> iap( |
|
217 mCmManager->createConnectionMethod(KUidWlanBearerType)); |
|
218 storeSettings(wlanAp, iap.data()); |
|
219 iapId = iap->getIntAttribute(CMManagerShim::CmIapId); |
|
220 |
|
221 // Trace the created IAP |
|
222 traceIap( |
|
223 wlanAp, |
|
224 WLANQTUTILS_IAP_TRACE_CREATE, |
|
225 iapId); |
|
226 } catch (const std::exception &ex) { |
|
227 // Trace error cause and return failure (default value) to caller. |
|
228 int error = qt_symbian_exception2Error(ex); |
|
229 OstTrace1( |
|
230 TRACE_NORMAL, |
|
231 WLANQTUTILSIAPSETTINGS_CREATEIAP_EXCEPTION, |
|
232 "WlanQtUtilsIapSettings::createIap exception;error=%d", |
|
233 error); |
|
234 } |
|
235 |
|
236 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_CREATEIAP_EXIT); |
|
237 return iapId; |
|
238 } |
|
239 |
|
240 /*! |
|
241 Update the WLAN IAP given as parameter. All settings are stored to |
|
242 database (again) without checking whether they have actually changed |
|
243 or not. |
|
244 |
|
245 @param [in] iapId ID of IAP to update. |
|
246 @param [in] wlanAp Information about the WLAN AP. |
|
247 |
|
248 @return Was update succesful or not? |
|
249 */ |
|
250 |
|
251 bool WlanQtUtilsIapSettings::updateIap( |
|
252 int iapId, |
|
253 const WlanQtUtilsAp *wlanAp) |
|
254 { |
|
255 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_UPDATEIAP_ENTRY); |
|
256 |
|
257 bool success = false; |
|
258 |
|
259 try { |
|
260 QScopedPointer<CmConnectionMethodShim> iap( |
|
261 mCmManager->connectionMethod(iapId)); |
|
262 storeSettings(wlanAp, iap.data()); |
|
263 // Trace the updated IAP |
|
264 traceIap( |
|
265 wlanAp, |
|
266 WLANQTUTILS_IAP_TRACE_UPDATE, |
|
267 iapId); |
|
268 success = true; |
|
269 } catch (const std::exception &ex) { |
|
270 // Trace error cause and return failure (default value) to caller. |
|
271 int error = qt_symbian_exception2Error(ex); |
|
272 OstTrace1( |
|
273 TRACE_NORMAL, |
|
274 WLANQTUTILSIAPSETTINGS_UPDATEIAP_EXCEPTION, |
|
275 "WlanQtUtilsIapSettings::updateIap exception;error=%d", |
|
276 error); |
|
277 } |
|
278 |
|
279 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_UPDATEIAP_EXIT); |
|
280 return success; |
|
281 } |
|
282 |
|
283 /*! |
|
284 Delete the WLAN IAP given as parameter. |
|
285 |
|
286 @param [in] iapId ID of IAP to delete. |
|
287 */ |
|
288 |
|
289 void WlanQtUtilsIapSettings::deleteIap(int iapId) |
|
290 { |
|
291 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_DELETEIAP_ENTRY); |
|
292 |
|
293 try { |
|
294 QScopedPointer<CmConnectionMethodShim> iap( |
|
295 mCmManager->connectionMethod(iapId)); |
|
296 iap->deleteConnectionMethod(); |
|
297 } catch (const std::exception &ex) { |
|
298 // Just trace error cause. It is not fatal, if we are not able to |
|
299 // delete the IAP. No need to retry, since errors should be very |
|
300 // rare and user can delete the IAP later from Control Panel, if |
|
301 // needed. |
|
302 int error = qt_symbian_exception2Error(ex); |
|
303 OstTrace1( |
|
304 TRACE_NORMAL, |
|
305 WLANQTUTILSIAPSETTINGS_DELETEIAP_EXCEPTION, |
|
306 "WlanQtUtilsIapSettings::deleteIap exception;error=%d", |
|
307 error); |
|
308 } |
|
309 |
|
310 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_DELETEIAP_EXIT); |
|
311 } |
|
312 |
|
313 /*! |
|
314 Move IAP to the Internet SNAP. |
|
315 |
|
316 @param [in] iapId ID of the IAP to move. |
|
317 */ |
|
318 |
|
319 void WlanQtUtilsIapSettings::moveIapToInternetSnap(int iapId) |
|
320 { |
|
321 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_MOVEIAPTOINTERNETSNAP_ENTRY); |
|
322 |
|
323 // Read all destination (SNAP) IDs |
|
324 QList<uint> destinations; |
|
325 try { |
|
326 mCmManager->allDestinations(destinations); |
|
327 foreach (int destId, destinations) { |
|
328 QScopedPointer<CmDestinationShim> destination( |
|
329 mCmManager->destination(destId)); |
|
330 |
|
331 // Internet destination will always exist in the system. It has |
|
332 // SnapPurposeInternet set in its metadata. |
|
333 if (destination->metadata(CMManagerShim::SnapMetadataPurpose) |
|
334 == CMManagerShim::SnapPurposeInternet) { |
|
335 QScopedPointer<CmConnectionMethodShim> iap( |
|
336 mCmManager->connectionMethod(iapId)); |
|
337 destination->addConnectionMethod(iap.data()); |
|
338 destination->update(); |
|
339 break; |
|
340 } |
|
341 } |
|
342 } catch (const std::exception &ex) { |
|
343 int error = qt_symbian_exception2Error(ex); |
|
344 OstTrace1( |
|
345 TRACE_NORMAL, |
|
346 WLANQTUTILSIAPSETTINGS_MOVEIAPTOINTERNETSNAP_EXCEPTION, |
|
347 "WlanQtUtilsIapSettings::moveIapToInternetSnap exception;error=%d", |
|
348 error); |
|
349 } |
|
350 |
|
351 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_MOVEIAPTOINTERNETSNAP_EXIT); |
|
352 } |
|
353 |
|
354 /*! |
|
355 Set Hotspot metadata to the Hotspot IAP given as parameter. |
|
356 |
|
357 @param [in] iapId ID of IAP to set. |
|
358 */ |
|
359 |
|
360 void WlanQtUtilsIapSettings::setAsHotspotIap(int iapId) |
|
361 { |
|
362 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_SETASHOTSPOTIAP_ENTRY); |
|
363 |
|
364 try { |
|
365 QScopedPointer<CmConnectionMethodShim> iap( |
|
366 mCmManager->connectionMethod(iapId)); |
|
367 iap->setBoolAttribute(CMManagerShim::CmMetaHotSpot, true); |
|
368 iap->update(); |
|
369 } catch (const std::exception &ex) { |
|
370 // Just trace error cause. It is not fatal, if we are not able to |
|
371 // set IAP as hotspot IAP. No need to retry, since errors should be very |
|
372 // rare and it does not prevent connection opening of the hotspot IAP. |
|
373 int error = qt_symbian_exception2Error(ex); |
|
374 OstTrace1( |
|
375 TRACE_NORMAL, |
|
376 WLANQTUTILSIAPSETTINGS_SETASHOTSPOTIAP_EXCEPTION, |
|
377 "WlanQtUtilsIapSettings::setAsHotspotIap exception;error=%d", |
|
378 error); |
|
379 } |
|
380 |
|
381 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_SETASHOTSPOTIAP_EXIT); |
|
382 } |
|
383 |
|
384 /*! |
|
385 Stores the given Wlan AP settings to database using CM Manager Shim. |
|
386 |
|
387 @param [in] wlanAp WLAN AP settings to store. |
|
388 @param [in] iap WLAN IAP to store to. |
|
389 */ |
|
390 |
|
391 void WlanQtUtilsIapSettings::storeSettings( |
|
392 const WlanQtUtilsAp *wlanAp, |
|
393 CmConnectionMethodShim *iap) |
|
394 { |
|
395 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_STORESETTINGS_ENTRY); |
|
396 |
|
397 int secMode = wlanAp->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); |
|
398 QString ssid = wlanAp->value(WlanQtUtilsAp::ConfIdSsid).toString(); |
|
399 |
|
400 // Store general settings |
|
401 iap->setStringAttribute(CMManagerShim::CmName, ssid); |
|
402 iap->setStringAttribute(CMManagerShim::WlanSSID, ssid); |
|
403 iap->setIntAttribute(CMManagerShim::WlanSecurityMode, secMode); |
|
404 iap->setIntAttribute( |
|
405 CMManagerShim::WlanConnectionMode, |
|
406 wlanAp->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt()); |
|
407 iap->setBoolAttribute( |
|
408 CMManagerShim::CmHidden, |
|
409 wlanAp->value(WlanQtUtilsAp::ConfIdHidden).toBool()); |
|
410 iap->setBoolAttribute( |
|
411 CMManagerShim::WlanScanSSID, |
|
412 wlanAp->value(WlanQtUtilsAp::ConfIdWlanScanSSID).toBool()); |
|
413 |
|
414 // Store the WEP settings |
|
415 storeWepKey( |
|
416 wlanAp->value(WlanQtUtilsAp::ConfIdWepKey1).toString(), |
|
417 1, |
|
418 iap); |
|
419 storeWepKey( |
|
420 wlanAp->value(WlanQtUtilsAp::ConfIdWepKey2).toString(), |
|
421 2, |
|
422 iap); |
|
423 storeWepKey( |
|
424 wlanAp->value(WlanQtUtilsAp::ConfIdWepKey3).toString(), |
|
425 3, |
|
426 iap); |
|
427 storeWepKey( |
|
428 wlanAp->value(WlanQtUtilsAp::ConfIdWepKey4).toString(), |
|
429 4, |
|
430 iap); |
|
431 iap->setIntAttribute( |
|
432 CMManagerShim::WlanWepKeyIndex, |
|
433 wlanAp->value(WlanQtUtilsAp::ConfIdWepDefaultIndex).toInt()); |
|
434 |
|
435 // Store WPA PSK settings |
|
436 bool usePsk = wlanAp->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(); |
|
437 iap->setBoolAttribute(CMManagerShim::WlanEnableWpaPsk, usePsk); |
|
438 QString wpaKey(wlanAp->value(WlanQtUtilsAp::ConfIdWpaPsk).toString()); |
|
439 iap->setString8Attribute(CMManagerShim::WlanWpaPreSharedKey, wpaKey); |
|
440 |
|
441 // Write the settings. |
|
442 iap->update(); |
|
443 |
|
444 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_STORESETTINGS_EXIT); |
|
445 } |
|
446 |
|
447 /*! |
|
448 Stores the given valid WEP key to database using CM Manager Shim. If key |
|
449 is not used an empty key must be provided. |
|
450 |
|
451 @note This method MUST not be called for invalid WEP Keys and/or indexes. |
|
452 Wlanwizard validates keys, before accepting user input. |
|
453 |
|
454 @param [in] key Key to write. |
|
455 @param [in] index Key index. Valid range is [0,4]. |
|
456 @param [in] iap WLAN IAP to store the key into. |
|
457 */ |
|
458 |
|
459 void WlanQtUtilsIapSettings::storeWepKey( |
|
460 const QString &key, |
|
461 int index, |
|
462 CmConnectionMethodShim *iap) |
|
463 { |
|
464 OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_STOREWEPKEY_ENTRY); |
|
465 |
|
466 int length = key.length(); |
|
467 if (length == WepHex64BitMaxLength || length == WepHex128BitMaxLength) { |
|
468 // HEX |
|
469 iap->setString8Attribute(mapWepKeyIndexHex(index), key); |
|
470 } else if (length == WepAscii64BitMaxLength || length == WepAscii128BitMaxLength) { |
|
471 // ASCII |
|
472 iap->setString8Attribute(mapWepKeyIndexAscii(index), key); |
|
473 } else { |
|
474 // Length must always be a valid one or zero |
|
475 Q_ASSERT(length == 0); |
|
476 |
|
477 // Write default value. Note that the key is stored in the same data |
|
478 // field regardless of the format so writing only one key is enough. |
|
479 iap->setString8Attribute(mapWepKeyIndexHex(index), key); |
|
480 } |
|
481 |
|
482 OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_STOREWEPKEY_EXIT); |
|
483 } |
|
484 |
|
485 /*! |
|
486 Maps given Hex WEP key index into the corresponding CM Manager Connection |
|
487 Method attribute. |
|
488 |
|
489 @param [in] index Hex WEP key index [1,4]. |
|
490 |
|
491 @return Connection Method attribute. |
|
492 */ |
|
493 |
|
494 CMManagerShim::ConnectionMethodAttribute WlanQtUtilsIapSettings::mapWepKeyIndexHex( |
|
495 int index) |
|
496 { |
|
497 CMManagerShim::ConnectionMethodAttribute attribute = |
|
498 CMManagerShim::WlanWepKey1InHex; |
|
499 |
|
500 switch (index) { |
|
501 case 1: |
|
502 attribute = CMManagerShim::WlanWepKey1InHex; |
|
503 break; |
|
504 |
|
505 case 2: |
|
506 attribute = CMManagerShim::WlanWepKey2InHex; |
|
507 break; |
|
508 |
|
509 case 3: |
|
510 attribute = CMManagerShim::WlanWepKey3InHex; |
|
511 break; |
|
512 |
|
513 case 4: |
|
514 attribute = CMManagerShim::WlanWepKey4InHex; |
|
515 break; |
|
516 |
|
517 #ifndef QT_NO_DEBUG |
|
518 default: |
|
519 // Invalid key index detected |
|
520 Q_ASSERT(0); |
|
521 break; |
|
522 #endif |
|
523 } |
|
524 |
|
525 return attribute; |
|
526 } |
|
527 |
|
528 /*! |
|
529 Maps given Ascii WEP key index into the corresponding CM Manager Connection |
|
530 Method attribute. |
|
531 |
|
532 @param [in] index Ascii WEP key index [1,4]. |
|
533 |
|
534 @return Connection Method attribute. |
|
535 */ |
|
536 |
|
537 CMManagerShim::ConnectionMethodAttribute WlanQtUtilsIapSettings::mapWepKeyIndexAscii( |
|
538 int index) |
|
539 { |
|
540 CMManagerShim::ConnectionMethodAttribute attribute = |
|
541 CMManagerShim::WlanWepKey1InAscii; |
|
542 |
|
543 switch (index) { |
|
544 case 1: |
|
545 attribute = CMManagerShim::WlanWepKey1InAscii; |
|
546 break; |
|
547 |
|
548 case 2: |
|
549 attribute = CMManagerShim::WlanWepKey2InAscii; |
|
550 break; |
|
551 |
|
552 case 3: |
|
553 attribute = CMManagerShim::WlanWepKey3InAscii; |
|
554 break; |
|
555 |
|
556 case 4: |
|
557 attribute = CMManagerShim::WlanWepKey4InAscii; |
|
558 break; |
|
559 |
|
560 #ifndef QT_NO_DEBUG |
|
561 default: |
|
562 // Invalid key index detected |
|
563 Q_ASSERT(0); |
|
564 break; |
|
565 #endif |
|
566 } |
|
567 |
|
568 return attribute; |
|
569 } |
|
570 |
|
571 /* |
|
572 Traces given IAP (which is taken in as an AP). |
|
573 |
|
574 @param [in] ap IAP to trace. |
|
575 @param [in] traceType Trace type (WLANQTUTILS_IAP_TRACE_*). |
|
576 @param [in] iapId IAP ID. |
|
577 */ |
|
578 |
|
579 void WlanQtUtilsIapSettings::traceIap( |
|
580 const WlanQtUtilsAp *ap, |
|
581 int traceType, |
|
582 uint iapId) const |
|
583 { |
|
584 #ifndef OST_TRACE_COMPILER_IN_USE |
|
585 Q_UNUSED(ap); |
|
586 Q_UNUSED(traceType); |
|
587 Q_UNUSED(iapId); |
|
588 #else |
|
589 QString ssid_string(ap->value(WlanQtUtilsAp::ConfIdSsid).toString()); |
|
590 TPtrC16 ssid(ssid_string.utf16(), ssid_string.length()); |
|
591 int secMode = ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); |
|
592 int connMode = ap->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(); |
|
593 bool useWpaPsk = ap->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(); |
|
594 |
|
595 switch (traceType) { |
|
596 case WLANQTUTILS_IAP_TRACE_FETCH: |
|
597 OstTraceExt5( |
|
598 TRACE_NORMAL, |
|
599 WLANQTUTILSIAPSETTINGS_TRACEIAP_FETCH, |
|
600 "WlanQtUtilsIapSettings::traceIap Fetched;iapId=%u;ssid=%S;secMode=%{WlanSecMode};useWpaPsk=%u;connMode=%{WlanConnMode}", |
|
601 iapId, |
|
602 ssid, |
|
603 secMode, |
|
604 useWpaPsk, |
|
605 connMode); |
|
606 break; |
|
607 |
|
608 case WLANQTUTILS_IAP_TRACE_CREATE: |
|
609 OstTraceExt5( |
|
610 TRACE_NORMAL, |
|
611 WLANQTUTILSIAPSETTINGS_TRACEIAP_CREATE, |
|
612 "WlanQtUtilsIapSettings::traceIap Created;iapId=%u;ssid=%S;secMode=%{WlanSecMode};useWpaPsk=%u;connMode=%{WlanConnMode}", |
|
613 iapId, |
|
614 ssid, |
|
615 secMode, |
|
616 useWpaPsk, |
|
617 connMode); |
|
618 break; |
|
619 |
|
620 case WLANQTUTILS_IAP_TRACE_UPDATE: |
|
621 OstTraceExt5( |
|
622 TRACE_NORMAL, |
|
623 WLANQTUTILSIAPSETTINGS_TRACEIAP_UPDATE, |
|
624 "WlanQtUtilsIapSettings::traceIap Updated;iapId=%u;ssid=%S;secMode=%{WlanSecMode};useWpaPsk=%u;connMode=%{WlanConnMode}", |
|
625 iapId, |
|
626 ssid, |
|
627 secMode, |
|
628 useWpaPsk, |
|
629 connMode); |
|
630 break; |
|
631 } |
|
632 #endif |
|
633 } |