65 mConMonWrapper(new WlanQtUtilsConMonWrapper(this)), |
65 mConMonWrapper(new WlanQtUtilsConMonWrapper(this)), |
66 mScanWrapper(new WlanQtUtilsScan(this)), |
66 mScanWrapper(new WlanQtUtilsScan(this)), |
67 mEsockWrapper(new WlanQtUtilsEsockWrapper(this)), |
67 mEsockWrapper(new WlanQtUtilsEsockWrapper(this)), |
68 mIctService(), |
68 mIctService(), |
69 mScanMode(ScanModeNone), |
69 mScanMode(ScanModeNone), |
|
70 mIapScanList(), |
70 mWlanScanList(), |
71 mWlanScanList(), |
71 mToBeTestedIapId(WlanQtUtils::IapIdNone), |
72 mToBeTestedIapId(WlanQtUtils::IapIdNone), |
72 mConnectingIapId(WlanQtUtils::IapIdNone), |
73 mConnectingIapId(WlanQtUtils::IapIdNone), |
73 mConnection() |
74 mConnection() |
74 { |
75 { |
75 OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_ENTRY, this); |
76 OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_ENTRY, this); |
76 |
77 |
77 // Make all connections. |
78 // Make all connections. |
78 bool connectStatus = connect( |
79 bool connectStatus = connect( |
|
80 mScanWrapper, |
|
81 SIGNAL(availableWlanIaps(QList< QSharedPointer<WlanQtUtilsIap> > &)), |
|
82 this, |
|
83 SLOT(updateAvailableWlanIaps(QList< QSharedPointer<WlanQtUtilsIap> > &))); |
|
84 Q_ASSERT(connectStatus); |
|
85 |
|
86 connectStatus = connect( |
79 mScanWrapper, |
87 mScanWrapper, |
80 SIGNAL(availableWlanAps(QList< QSharedPointer<WlanQtUtilsAp> >&)), |
88 SIGNAL(availableWlanAps(QList< QSharedPointer<WlanQtUtilsAp> >&)), |
81 this, |
89 this, |
82 SLOT(updateAvailableWlanAps(QList< QSharedPointer<WlanQtUtilsAp> >&))); |
90 SLOT(updateAvailableWlanAps(QList< QSharedPointer<WlanQtUtilsAp> >&))); |
83 Q_ASSERT(connectStatus); |
91 Q_ASSERT(connectStatus); |
143 OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_SCANWLANS_ENTRY, this); |
151 OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_SCANWLANS_ENTRY, this); |
144 |
152 |
145 // Scanning while there is an ongoing scan is not supported |
153 // Scanning while there is an ongoing scan is not supported |
146 Q_ASSERT(mScanMode == ScanModeNone); |
154 Q_ASSERT(mScanMode == ScanModeNone); |
147 |
155 |
148 // Just forward the request to wrapper, which triggers a broadcast WLAN scan |
156 // Starting with an IAP scan, and continuing with AP scan |
149 mScanMode = ScanModeAvailableWlans; |
157 mScanMode = ScanModeAvailableWlans; |
150 mScanWrapper->scanWlanAps(); |
158 mScanWrapper->scanWlanIaps(); |
151 |
159 |
152 OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this); |
160 OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this); |
153 } |
161 } |
154 |
162 |
155 /*! |
163 /*! |
223 |
231 |
224 // Read the list of configured IAPs |
232 // Read the list of configured IAPs |
225 QList< QSharedPointer<WlanQtUtilsIap> > configuredIapList; |
233 QList< QSharedPointer<WlanQtUtilsIap> > configuredIapList; |
226 mSettings->fetchIaps(configuredIapList); |
234 mSettings->fetchIaps(configuredIapList); |
227 |
235 |
228 // Match IAPs against WLAN scan results |
236 // Update the list of available IAPs |
229 foreach (QSharedPointer<WlanQtUtilsIap> iap, configuredIapList) { |
237 foreach (QSharedPointer<WlanQtUtilsIap> iapIter, mIapScanList) { |
230 foreach (QSharedPointer<WlanQtUtilsAp> scanAp, mWlanScanList) { |
238 int iapId = iapIter->value(WlanQtUtilsIap::ConfIdIapId).toInt(); |
231 if (WlanQtUtilsAp::compare(iap.data(), scanAp.data()) == 0) { |
239 QSharedPointer<WlanQtUtilsIap> iap(mSettings->fetchIap(iapId)); |
232 // IAP found, add it to caller's list of known IAPs |
240 if (iap) { |
233 // (signal strength needs to be updated manually since |
241 // Only add the IAP if we (still) have the settings for it |
234 // the IAP in our list does not have that information yet) |
242 iap->setValue( |
235 iap->setValue( |
243 WlanQtUtilsAp::ConfIdSignalStrength, |
236 WlanQtUtilsAp::ConfIdSignalStrength, |
244 iapIter->value(WlanQtUtilsAp::ConfIdSignalStrength)); |
237 scanAp->value(WlanQtUtilsAp::ConfIdSignalStrength)); |
245 wlanIapList.append(iap); |
238 wlanIapList.append(iap); |
|
239 break; |
|
240 } |
|
241 } |
246 } |
242 } |
247 } |
243 |
248 |
244 // Go through the scan results to find unknown APs |
249 // Go through the scan results to find unknown APs |
245 for (int i = 0; i < mWlanScanList.count(); i++) { |
250 for (int i = 0; i < mWlanScanList.count(); i++) { |
504 } |
509 } |
505 #endif |
510 #endif |
506 } |
511 } |
507 |
512 |
508 /*! |
513 /*! |
509 Slot for handling WLAN scan result event from wrapper. Results are |
514 Slot for handling WLAN IAP scan result event from wrapper. Results are |
|
515 stored in a member variable. |
|
516 |
|
517 @param [in] availableIaps Available WLAN IAP's found in scan. |
|
518 */ |
|
519 |
|
520 void WlanQtUtilsPrivate::updateAvailableWlanIaps( |
|
521 QList< QSharedPointer<WlanQtUtilsIap> > &availableIaps) |
|
522 { |
|
523 OstTraceFunctionEntry0(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANIAPS_ENTRY); |
|
524 |
|
525 // Store the new IAP list |
|
526 mIapScanList = availableIaps; |
|
527 |
|
528 // Continue with AP scan (which should come immediately from WLAN's scan cache) |
|
529 mScanWrapper->scanWlanAps(); |
|
530 |
|
531 OstTraceFunctionExit0(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANIAPS_EXIT); |
|
532 } |
|
533 |
|
534 /*! |
|
535 Slot for handling WLAN AP scan result event from wrapper. Results are |
510 stored in member variable (possible duplicates are removed). |
536 stored in member variable (possible duplicates are removed). |
511 |
537 |
512 @param [in] availableWlanList WLAN networks found in scan. |
538 @param [in] availableWlanList WLAN networks found in scan. |
513 */ |
539 */ |
514 |
540 |
517 { |
543 { |
518 OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_ENTRY, this); |
544 OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_ENTRY, this); |
519 |
545 |
520 // Old results are removed |
546 // Old results are removed |
521 mWlanScanList.clear(); |
547 mWlanScanList.clear(); |
|
548 |
522 // Copy available WLANs to scan result list (duplicates are removed) |
549 // Copy available WLANs to scan result list (duplicates are removed) |
523 for (int i = 0; i < availableWlanList.count(); i++) { |
550 for (int i = 0; i < availableWlanList.count(); i++) { |
524 bool duplicate = false; |
551 bool duplicate = false; |
525 for (int j = 0; j < mWlanScanList.count(); j++) { |
552 for (int j = 0; j < mWlanScanList.count(); j++) { |
526 if (WlanQtUtilsAp::compare( |
553 if (WlanQtUtilsAp::compare( |
535 } |
562 } |
536 } |
563 } |
537 |
564 |
538 // The information is forwarded to the client |
565 // The information is forwarded to the client |
539 reportScanResult(WlanQtUtils::ScanStatusOk); |
566 reportScanResult(WlanQtUtils::ScanStatusOk); |
540 |
567 |
541 // Scan is complete |
568 // Scan is complete |
542 mScanMode = ScanModeNone; |
569 mScanMode = ScanModeNone; |
543 |
570 |
544 OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_EXIT, this); |
571 OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_EXIT, this); |
545 } |
572 } |
546 |
573 |
547 /*! |
574 /*! |
548 Scan result handler. Reports the scanning result to the client. |
575 Scan result handler. Reports the scanning result to the client. |