|
1 /* |
|
2 * Copyright (c) 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 "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 */ |
|
16 |
|
17 #include "wlanqtutilswlanap.h" |
|
18 #include "wlanqtutilswlaniap.h" |
|
19 #include "wlanqtutilsactiveconn.h" |
|
20 #include "wlanqtutilscmmwrapper.h" |
|
21 #include "wlanqtutilsconmonwrapper.h" |
|
22 #include "wlanqtutilsesockwrapper.h" |
|
23 #include "wlanqtutilsconntestwrapper.h" |
|
24 |
|
25 #include "wlanqtutils.h" |
|
26 #include "wlanqtutils_p.h" |
|
27 |
|
28 #ifdef WLANQTUTILS_NO_OST_TRACES_FLAG |
|
29 #include <opensystemtrace.h> |
|
30 #else |
|
31 #include "OstTraceDefinitions.h" |
|
32 #endif |
|
33 #ifdef OST_TRACE_COMPILER_IN_USE |
|
34 #include "wlanqtutils_pTraces.h" |
|
35 #endif |
|
36 |
|
37 |
|
38 WlanQtUtilsPrivate::WlanQtUtilsPrivate(WlanQtUtils *publicPtr) : |
|
39 q_ptr(publicPtr), |
|
40 wlanScanList_(), |
|
41 wlanIapList_(), |
|
42 toBeTestedIapId_(WlanQtUtilsInvalidIapId), |
|
43 connectingIapId_(WlanQtUtilsInvalidIapId), |
|
44 activeConnection_(NULL) |
|
45 { |
|
46 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_ENTRY, this ); |
|
47 |
|
48 // Let's allocate memory for wrapper objects. |
|
49 // Engine is set as a parent for wrapper objects. |
|
50 cmmWrapper_ = new CmmWrapper(this); |
|
51 conMonWrapper_ = new ConMonWrapper(this); |
|
52 esockWrapper_ = new EsockWrapper(this); |
|
53 connTestWrapper_ = new ConnTestWrapper(this); |
|
54 |
|
55 // Make all connections. |
|
56 // Todo: having these as signals from the wrappers doesn't bring much benefit |
|
57 // -> could be optimized as normal callbacks |
|
58 connect( |
|
59 conMonWrapper_, |
|
60 SIGNAL(availableWlanApsFromWrapper(QList<WlanQtUtilsWlanAp *>&)), |
|
61 this, |
|
62 SLOT(updateAvailableWlanAps(QList<WlanQtUtilsWlanAp *>&))); |
|
63 |
|
64 connect( |
|
65 esockWrapper_, |
|
66 SIGNAL(connectionStatusFromWrapper(bool)), |
|
67 this, |
|
68 SLOT(updateConnectionStatus(bool))); |
|
69 |
|
70 connect( |
|
71 connTestWrapper_, |
|
72 SIGNAL(connectivityTestResult(bool)), |
|
73 this, |
|
74 SLOT(updateConnectivityTestResult(bool))); |
|
75 |
|
76 connect( |
|
77 conMonWrapper_, |
|
78 SIGNAL(connCreatedEventFromWrapper(uint)), |
|
79 this, |
|
80 SLOT(addActiveConnection(uint))); |
|
81 |
|
82 connect( |
|
83 conMonWrapper_, |
|
84 SIGNAL(connDeletedEventFromWrapper(uint)), |
|
85 this, |
|
86 SLOT(removeActiveConnection(uint))); |
|
87 |
|
88 connect( |
|
89 conMonWrapper_, |
|
90 SIGNAL(connStatusEventFromWrapper(uint, WlanQtUtilsConnectionStatus)), |
|
91 this, |
|
92 SLOT(updateActiveConnection(uint, WlanQtUtilsConnectionStatus))); |
|
93 |
|
94 // Fetch the initial IAP configuration |
|
95 fetchIaps(); |
|
96 |
|
97 // Retrieve initial status of active connections and update IAPs, if needed. |
|
98 activeConnection_ = conMonWrapper_->activeConnection(); |
|
99 if (activeConnection_ != NULL) { |
|
100 updateIapConnectionStatuses(activeConnection_->iapId(), activeConnection_->connectionStatus()); |
|
101 } |
|
102 |
|
103 // TODO: error handling |
|
104 |
|
105 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_EXIT, this ); |
|
106 } |
|
107 |
|
108 WlanQtUtilsPrivate::~WlanQtUtilsPrivate() |
|
109 { |
|
110 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_ENTRY, this ); |
|
111 |
|
112 // Delete WLAN scan list |
|
113 for (int i = 0; i < wlanScanList_.count(); i++) { |
|
114 delete wlanScanList_[i]; |
|
115 } |
|
116 wlanScanList_.clear(); |
|
117 |
|
118 delete activeConnection_; |
|
119 |
|
120 delete cmmWrapper_; |
|
121 delete conMonWrapper_; |
|
122 delete esockWrapper_; |
|
123 delete connTestWrapper_; |
|
124 |
|
125 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_EXIT, this ); |
|
126 } |
|
127 |
|
128 void WlanQtUtilsPrivate::availableWlanAps( |
|
129 QList<WlanQtUtilsWlanIap *> &wlanIapList, |
|
130 QList<WlanQtUtilsWlanAp *> &wlanApList) |
|
131 { |
|
132 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_ENTRY, this ); |
|
133 |
|
134 wlanIapList.clear(); |
|
135 wlanApList.clear(); |
|
136 |
|
137 // Add possible connected or connecting IAP as the first item in the list |
|
138 int activeIapId = WlanQtUtilsInvalidIapId; |
|
139 if (activeConnection_ != NULL) { |
|
140 activeIapId = activeConnection_->iapId(); |
|
141 } else if (connectingIapId_ != WlanQtUtilsInvalidIapId) { |
|
142 activeIapId = connectingIapId_; |
|
143 } |
|
144 if (wlanIapList_.contains(activeIapId)) { |
|
145 wlanIapList_[activeIapId]->setSignalStrength(WlanQtUtilsWlanSignalStrengthMax); |
|
146 wlanIapList_[activeIapId]->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); |
|
147 wlanIapList.append(wlanIapList_[activeIapId]); |
|
148 } |
|
149 |
|
150 // Todo: IAPs with same SSID and security mode? probably we want to show only one of them? |
|
151 |
|
152 // Match IAPs against WLAN scan results |
|
153 foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { |
|
154 foreach (WlanQtUtilsWlanAp *scanAp, wlanScanList_) { |
|
155 // Todo: security mode check |
|
156 if (iap->ssid() == scanAp->ssid()) { |
|
157 // IAP found, add it to caller's list of known IAPs (signal strength needs to be |
|
158 // updated manually since the IAP in our list does not have that information yet) |
|
159 iap->setSignalStrength(scanAp->signalStrength()); |
|
160 if (iap->id() != activeIapId) { |
|
161 wlanIapList.append(iap); |
|
162 } // else: connected IAP, added as the first item in the list already |
|
163 break; |
|
164 } |
|
165 } |
|
166 } |
|
167 |
|
168 // Go through the scan results to find unknown APs |
|
169 for (int i = 0; i < wlanScanList_.count(); i++) { |
|
170 // Skip networks with empty SSID (hidden networks are handled by UI currently) |
|
171 if (wlanScanList_[i]->ssid().isEmpty() == FALSE) { |
|
172 // Check whether an IAP with these parameters exists in any SNAP (in which case this |
|
173 // network should not be shown as available in this SNAP) |
|
174 if (wlanIapExists(wlanScanList_[i]->ssid(), wlanScanList_[i]->securityMode()) == false) { |
|
175 // No IAP found in any SNAP, copy the AP to caller's list of unknown APs |
|
176 wlanApList.append(wlanScanList_[i]); |
|
177 } |
|
178 } |
|
179 } |
|
180 |
|
181 // Sort APs by their SSIDs. |
|
182 QMap<QString, WlanQtUtilsWlanAp *> wlanApMap; |
|
183 // Loop the AP list copying the keys (lower case SSID) and elements |
|
184 // into the map. |
|
185 for (int i = 0; i < wlanApList.count(); i++ ) { |
|
186 wlanApMap.insertMulti(wlanApList[i]->ssid().toLower(), wlanApList[i]); |
|
187 } |
|
188 wlanApList = wlanApMap.values(); |
|
189 |
|
190 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_EXIT, this ); |
|
191 } |
|
192 |
|
193 int WlanQtUtilsPrivate::createWlanIap(const WlanQtUtilsWlanAp *wlanAp) |
|
194 { |
|
195 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CREATEWLANIAP_ENTRY, this ); |
|
196 |
|
197 // Create the new IAP. Store its ID, because we need to run ICT for it later |
|
198 WlanQtUtilsWlanIap *newIap = cmmWrapper_->createWlanIap(wlanAp); |
|
199 toBeTestedIapId_ = newIap->id(); |
|
200 wlanIapList_.insert(newIap->id(), newIap); |
|
201 |
|
202 OstTrace1( |
|
203 TRACE_API, |
|
204 WLANQTUTILSPRIVATE_CREATEWLANIAP, |
|
205 "WlanQtUtilsPrivate::createWlanIap;New IAP ID=%d", toBeTestedIapId_ ); |
|
206 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CREATEWLANIAP_EXIT, this ); |
|
207 return toBeTestedIapId_; |
|
208 } |
|
209 |
|
210 void WlanQtUtilsPrivate::connectIap(int iapId) |
|
211 { |
|
212 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CONNECTIAP_ENTRY, this ); |
|
213 OstTrace1( TRACE_API, WLANQTUTILSPRIVATE_CONNECTIAP, "WlanQtUtilsPrivate::connectIap;IAP ID=%d", iapId ); |
|
214 |
|
215 Q_ASSERT(activeConnection_ == NULL); |
|
216 connectingIapId_ = iapId; |
|
217 esockWrapper_->connectIap(iapId); |
|
218 |
|
219 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CONNECTIAP_EXIT, this ); |
|
220 } |
|
221 |
|
222 void WlanQtUtilsPrivate::disconnectIap(int iapId) |
|
223 { |
|
224 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_DISCONNECTIAP_ENTRY, this ); |
|
225 OstTrace1( TRACE_API, WLANQTUTILSPRIVATE_DISCONNECTIAP, "WlanQtUtilsPrivate::disconnectIap;IAP ID=%d", iapId ); |
|
226 |
|
227 Q_ASSERT(activeConnection_ != NULL); |
|
228 Q_ASSERT(activeConnection_->iapId() == iapId); |
|
229 Q_ASSERT(wlanIapList_.contains(iapId)); |
|
230 |
|
231 // Todo: IAP may have been opened by someone else... how to know when to disconnect RConnection? |
|
232 esockWrapper_->disconnectIap(); |
|
233 |
|
234 // In order to close connection even if there are other users for the IAP, close also via ConMon |
|
235 conMonWrapper_->disconnectIap(iapId); |
|
236 // Change status of the IAP to non-connected |
|
237 wlanIapList_[iapId]->setConnectionStatus(WlanQtUtilsConnectionStatusDisconnected); |
|
238 |
|
239 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_DISCONNECTIAP_EXIT, this ); |
|
240 } |
|
241 |
|
242 WlanQtUtilsIap *WlanQtUtilsPrivate::iap(int iapId) const |
|
243 { |
|
244 if (wlanIapList_.contains(iapId)) { |
|
245 return wlanIapList_.value(iapId); |
|
246 } |
|
247 // else: no match |
|
248 return NULL; |
|
249 } |
|
250 |
|
251 bool WlanQtUtilsPrivate::masterWlan() const |
|
252 { |
|
253 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_MASTERWLAN_ENTRY, this ); |
|
254 |
|
255 // TODO: Add actual implementation, this is just temporary dummy for testing wlanentryplugin! |
|
256 |
|
257 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_MASTERWLAN_EXIT, this ); |
|
258 return true; |
|
259 } |
|
260 |
|
261 void WlanQtUtilsPrivate::setMasterWlan(bool enabled) |
|
262 { |
|
263 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_SETMASTERWLAN_ENTRY, this ); |
|
264 |
|
265 // TODO: Add actual implementation. |
|
266 (void)enabled; |
|
267 |
|
268 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_SETMASTERWLAN_EXIT, this ); |
|
269 } |
|
270 |
|
271 int WlanQtUtilsPrivate::connectedWlanId() const |
|
272 { |
|
273 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CONNECTEDWLANID_ENTRY, this ); |
|
274 |
|
275 int retVal = WlanQtUtilsInvalidIapId; |
|
276 if (activeConnection_ != NULL) { |
|
277 retVal = activeConnection_->iapId(); |
|
278 } |
|
279 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CONNECTEDWLANID_EXIT, this ); |
|
280 return retVal; |
|
281 } |
|
282 |
|
283 void WlanQtUtilsPrivate::scanWlans() |
|
284 { |
|
285 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_SCANWLANS_ENTRY, this ); |
|
286 |
|
287 // Just forward the request to wrapper, which triggers a single WLAN scan |
|
288 conMonWrapper_->scanAvailableWlanAPs(); |
|
289 |
|
290 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this ); |
|
291 } |
|
292 |
|
293 void WlanQtUtilsPrivate::updateAvailableWlanAps(QList<WlanQtUtilsWlanAp *> &availableWlanList) |
|
294 { |
|
295 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_ENTRY, this ); |
|
296 |
|
297 // Old results are removed |
|
298 wlanScanList_.clear(); |
|
299 // Copy available WLAN's to engine's scan result list (duplicates are removed) |
|
300 for (int i = 0; i < availableWlanList.count(); i++) { |
|
301 bool duplicate = false; |
|
302 for (int j = 0; j < wlanScanList_.count(); j++) { |
|
303 if (availableWlanList[i]->ssid() == wlanScanList_[j]->ssid() |
|
304 && availableWlanList[i]->securityMode() == wlanScanList_[j]->securityMode()) { |
|
305 duplicate = true; |
|
306 break; |
|
307 } |
|
308 } |
|
309 if (duplicate == false) { |
|
310 wlanScanList_.append(availableWlanList[i]); |
|
311 } |
|
312 // Todo: else deallocate? |
|
313 } |
|
314 |
|
315 // the information is forwarded to the UI |
|
316 emit q_ptr->wlanScanReady(); |
|
317 |
|
318 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_EXIT, this ); |
|
319 } |
|
320 |
|
321 void WlanQtUtilsPrivate::updateConnectionStatus(bool isOpened) |
|
322 { |
|
323 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_ENTRY, this ); |
|
324 OstTrace1( |
|
325 TRACE_API, |
|
326 WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS, |
|
327 "WlanQtUtilsPrivate::updateConnectionStatus;isOpened=%d", isOpened ); |
|
328 |
|
329 if (isOpened == false) { |
|
330 // Opening failed, update connection statuses, but don't inform UI about |
|
331 // connection closing here. It is done always in removeActiveConnection(). |
|
332 if (activeConnection_ != NULL) { |
|
333 activeConnection_->setConnectionStatus(WlanQtUtilsConnectionStatusDisconnected); |
|
334 } |
|
335 updateIapConnectionStatuses(connectingIapId_, WlanQtUtilsConnectionStatusDisconnected); |
|
336 } else { |
|
337 // Opening succeeded, update connection statuses and inform UI |
|
338 if (activeConnection_ != NULL) { |
|
339 activeConnection_->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); |
|
340 } |
|
341 updateIapConnectionStatuses(connectingIapId_, WlanQtUtilsConnectionStatusConnected); |
|
342 emit q_ptr->wlanNetworkOpened(connectingIapId_); |
|
343 |
|
344 // Start ICT, if needed |
|
345 if (connectingIapId_ == toBeTestedIapId_) { |
|
346 WlanQtUtilsIap *iap = WlanQtUtilsPrivate::iap(toBeTestedIapId_); |
|
347 connTestWrapper_->startConnectivityTest(toBeTestedIapId_, iap->networkId()); |
|
348 } |
|
349 } |
|
350 // IAP is no more in connecting state |
|
351 connectingIapId_ = WlanQtUtilsInvalidIapId; |
|
352 |
|
353 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_EXIT, this ); |
|
354 } |
|
355 |
|
356 void WlanQtUtilsPrivate::updateConnectivityTestResult(bool result) |
|
357 { |
|
358 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT_ENTRY, this ); |
|
359 OstTrace1( |
|
360 TRACE_API, |
|
361 WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT, |
|
362 "WlanQtUtilsPrivate::updateConnectivityTestResult;result=%d", result ); |
|
363 |
|
364 if (result == true) { |
|
365 // Move the tested IAP to Internet SNAP since the test passed |
|
366 Q_ASSERT(toBeTestedIapId_ != WlanQtUtilsInvalidIapId); |
|
367 cmmWrapper_->moveIapToInternetSnap(toBeTestedIapId_); |
|
368 } // else: do nothing, IAP remains to be uncategorized |
|
369 else |
|
370 { |
|
371 // TODO: Remove this. This is needed now since the connectivity test fails |
|
372 // and thus the IAP is not shown correctly. |
|
373 cmmWrapper_->moveIapToInternetSnap(toBeTestedIapId_); |
|
374 |
|
375 } |
|
376 // This IAP is now tested |
|
377 toBeTestedIapId_ = WlanQtUtilsInvalidIapId; |
|
378 |
|
379 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT_EXIT, this ); |
|
380 } |
|
381 |
|
382 void WlanQtUtilsPrivate::addActiveConnection(uint connectionId) |
|
383 { |
|
384 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_ENTRY, this ); |
|
385 OstTrace1( |
|
386 TRACE_API, |
|
387 WLANQTUTILSPRIVATE_ADDACTIVECONNECTION, |
|
388 "WlanQtUtilsPrivate::addActiveConnection;connectionId=%u", connectionId ); |
|
389 |
|
390 Q_ASSERT(activeConnection_ == NULL); |
|
391 activeConnection_ = conMonWrapper_->connectionInfo(connectionId); |
|
392 Q_ASSERT(wlanIapList_.contains(activeConnection_->iapId())); |
|
393 updateIapConnectionStatuses(activeConnection_->iapId(), activeConnection_->connectionStatus()); |
|
394 |
|
395 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_EXIT, this ); |
|
396 } |
|
397 |
|
398 void WlanQtUtilsPrivate::removeActiveConnection(uint connectionId) |
|
399 { |
|
400 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_ENTRY, this ); |
|
401 OstTrace1( |
|
402 TRACE_API, |
|
403 WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION, |
|
404 "WlanQtUtilsPrivate::removeActiveConnection;connectionId=%u", connectionId ); |
|
405 |
|
406 Q_ASSERT(activeConnection_ != NULL); |
|
407 if (activeConnection_->connectionId() == connectionId) { |
|
408 // Connection is closed, update connection statuses and inform UI. |
|
409 // wlanNetworkClosed is sent from here (and only from here), because, in some cases, |
|
410 // connection may be removed without any connection status updates. |
|
411 int closedIapId = activeConnection_->iapId(); |
|
412 updateIapConnectionStatuses(activeConnection_->iapId(), WlanQtUtilsConnectionStatusDisconnected); |
|
413 delete activeConnection_; |
|
414 activeConnection_ = NULL; |
|
415 emit q_ptr->wlanNetworkClosed(closedIapId); |
|
416 } |
|
417 |
|
418 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_EXIT, this ); |
|
419 } |
|
420 |
|
421 void WlanQtUtilsPrivate::updateActiveConnection(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus) |
|
422 { |
|
423 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_ENTRY, this ); |
|
424 OstTraceExt2( |
|
425 TRACE_API, |
|
426 WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION, |
|
427 "WlanQtUtilsPrivate::updateActiveConnection;connectionId=%u;connectionStatus=%u", connectionId, connectionStatus ); |
|
428 |
|
429 Q_ASSERT(activeConnection_ != NULL); |
|
430 if (activeConnection_->connectionId() == connectionId |
|
431 && activeConnection_->connectionStatus() != connectionStatus) { |
|
432 // Update connection statuses and inform UI, if necessary |
|
433 activeConnection_->setConnectionStatus(connectionStatus); |
|
434 updateIapConnectionStatuses(activeConnection_->iapId(), connectionStatus); |
|
435 if (connectionStatus == WlanQtUtilsConnectionStatusConnected) { |
|
436 emit q_ptr->wlanNetworkOpened(activeConnection_->iapId()); |
|
437 } |
|
438 // Do not inform UI about connection closing here. It is done always in |
|
439 // removeActiveConnection(), because that may occur without any connection status updates. |
|
440 } // else: connection status did not change |
|
441 |
|
442 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_EXIT, this ); |
|
443 } |
|
444 |
|
445 int WlanQtUtilsPrivate::fetchIaps() |
|
446 { |
|
447 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_FETCHIAPS_ENTRY, this ); |
|
448 |
|
449 QList<WlanQtUtilsIap *> list; |
|
450 int error = 0; |
|
451 // Read the IAP list and store WLAN IAPs in our internal map data structure |
|
452 error = cmmWrapper_->fetchIaps(list); |
|
453 foreach (WlanQtUtilsIap *iap, list) { |
|
454 if (iap->bearerType() == WlanQtUtilsBearerTypeWlan) { |
|
455 // Notice that insertMulti not used, because IAP IDs should be unique |
|
456 wlanIapList_.insert(iap->id(), qobject_cast<WlanQtUtilsWlanIap *>(iap)); |
|
457 } |
|
458 } |
|
459 |
|
460 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_FETCHIAPS_EXIT, this ); |
|
461 return error; |
|
462 } |
|
463 |
|
464 bool WlanQtUtilsPrivate::wlanIapExists(QString ssid, WlanQtUtilsWlanSecMode secMode) |
|
465 { |
|
466 foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { |
|
467 // todo: secmode |
|
468 (void)secMode; |
|
469 if (iap->ssid() == ssid) { |
|
470 return true; |
|
471 } |
|
472 } |
|
473 |
|
474 return false; |
|
475 } |
|
476 |
|
477 void WlanQtUtilsPrivate::updateIapConnectionStatuses(int iapId, WlanQtUtilsConnectionStatus status) |
|
478 { |
|
479 OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEIAPCONNECTIONSTATUSES_ENTRY, this ); |
|
480 |
|
481 const WlanQtUtilsWlanIap *referenceIap = qobject_cast<WlanQtUtilsWlanIap *>(iap(iapId)); |
|
482 foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { |
|
483 // todo: security mode checking |
|
484 if (iap->id() == referenceIap->id() || iap->ssid() == referenceIap->ssid()) { |
|
485 iap->setConnectionStatus(status); |
|
486 } |
|
487 } |
|
488 |
|
489 OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEIAPCONNECTIONSTATUSES_EXIT, this ); |
|
490 } |