136 // class WlanQtUtilsWlanScanResult |
137 // class WlanQtUtilsWlanScanResult |
137 // --------------------------------------------------------- |
138 // --------------------------------------------------------- |
138 |
139 |
139 WlanQtUtilsWlanScan::WlanQtUtilsWlanScan() : |
140 WlanQtUtilsWlanScan::WlanQtUtilsWlanScan() : |
140 mScanResultIterator(0), |
141 mScanResultIterator(0), |
141 mWlanScanResultList(), |
142 mWlanScanIapResultList(), |
142 mCompleteWlanScan(true), |
143 mWlanScanApResultList(), |
143 mScanRetValue(KErrNone) |
144 mCompleteWlanIapScan(true), |
|
145 mCompleteWlanApScan(true), |
|
146 mIapScanRetValue(KErrNone), |
|
147 mApScanRetValue(KErrNone) |
144 { |
148 { |
145 } |
149 } |
146 |
150 |
147 WlanQtUtilsWlanScan::~WlanQtUtilsWlanScan() |
151 WlanQtUtilsWlanScan::~WlanQtUtilsWlanScan() |
148 { |
152 { |
149 clearWlanScanResultList(); |
153 clearWlanScanIapResultList(); |
|
154 clearWlanScanApResultList(); |
150 } |
155 } |
151 |
156 |
152 void WlanQtUtilsWlanScan::initialize() |
157 void WlanQtUtilsWlanScan::initialize() |
153 { |
158 { |
154 clearWlanScanResultList(); |
159 clearWlanScanIapResultList(); |
155 mCompleteWlanScan = true; |
160 clearWlanScanApResultList(); |
156 mScanRetValue = KErrNone; |
161 mCompleteWlanIapScan = true; |
157 } |
162 mCompleteWlanApScan = true; |
158 |
163 mIapScanRetValue = KErrNone; |
159 void WlanQtUtilsWlanScan::createDefaultWlanScanResultList(int numberOfWlanAps) |
164 mApScanRetValue = KErrNone; |
160 { |
165 } |
161 clearWlanScanResultList(); |
166 |
|
167 void WlanQtUtilsWlanScan::createDefaultWlanScanIapResultList(int numberOfWlanIaps) |
|
168 { |
|
169 clearWlanScanIapResultList(); |
|
170 |
|
171 for (int i = 0; i < numberOfWlanIaps; i++) { |
|
172 QSharedPointer<WlanQtUtilsIap> iap(new WlanQtUtilsIap()); |
|
173 iap->setValue(WlanQtUtilsIap::ConfIdIapId, i); |
|
174 iap->setValue(WlanQtUtilsIap::ConfIdName, "TestWlanAp" + QString::number(i + 1)); |
|
175 // ConfIdNetworkId? |
|
176 iap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); |
|
177 iap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); |
|
178 iap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); |
|
179 iap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); |
|
180 iap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); |
|
181 mWlanScanIapResultList.append(iap); |
|
182 } |
|
183 } |
|
184 |
|
185 void WlanQtUtilsWlanScan::clearWlanScanIapResultList() |
|
186 { |
|
187 mWlanScanIapResultList.clear(); |
|
188 } |
|
189 |
|
190 void WlanQtUtilsWlanScan::verifyWlanScanIapResultList( |
|
191 QList< QSharedPointer<WlanQtUtilsIap> > wlanIapList) |
|
192 { |
|
193 QCOMPARE(wlanIapList.count(), mWlanScanIapResultList.count()); |
|
194 |
|
195 for (int i = 0; i < mWlanScanIapResultList.count(); i++) { |
|
196 QCOMPARE( |
|
197 wlanIapList[i]->value(WlanQtUtilsIap::ConfIdIapId), |
|
198 mWlanScanIapResultList[i]->value(WlanQtUtilsIap::ConfIdIapId)); |
|
199 QCOMPARE( |
|
200 wlanIapList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), |
|
201 mWlanScanIapResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); |
|
202 //QCOMPARE( |
|
203 // wlanIapList[i]->value(WlanQtUtilsAp::ConfIdSsid), |
|
204 // mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); |
|
205 } |
|
206 } |
|
207 |
|
208 |
|
209 void WlanQtUtilsWlanScan::createDefaultWlanScanApResultList(int numberOfWlanAps) |
|
210 { |
|
211 clearWlanScanApResultList(); |
|
212 |
162 for (int i = 0; i < numberOfWlanAps; i++) { |
213 for (int i = 0; i < numberOfWlanAps; i++) { |
163 QSharedPointer<WlanQtUtilsAp> ap(new WlanQtUtilsAp()); |
214 QSharedPointer<WlanQtUtilsAp> ap(new WlanQtUtilsAp()); |
164 ap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); |
215 ap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); |
165 ap->setValue(WlanQtUtilsAp::ConfIdBssid, QByteArray("123456")); |
216 ap->setValue(WlanQtUtilsAp::ConfIdBssid, QByteArray("123456")); |
166 ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); |
217 ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); |
167 ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); |
218 ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); |
168 ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); |
219 ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); |
169 ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); |
220 ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); |
170 ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); |
221 ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); |
171 mWlanScanResultList.append(ap); |
222 mWlanScanApResultList.append(ap); |
172 } |
223 } |
173 } |
224 } |
174 |
225 |
175 void WlanQtUtilsWlanScan::clearWlanScanResultList() |
226 void WlanQtUtilsWlanScan::clearWlanScanApResultList() |
176 { |
227 { |
177 mWlanScanResultList.clear(); |
228 mWlanScanApResultList.clear(); |
178 } |
229 } |
179 |
230 |
180 void WlanQtUtilsWlanScan::verifyWlanScanResultList( |
231 void WlanQtUtilsWlanScan::verifyWlanScanApResultList( |
181 QList< QSharedPointer<WlanQtUtilsAp> > wlanApList) |
232 QList< QSharedPointer<WlanQtUtilsAp> > wlanApList) |
182 { |
233 { |
183 QCOMPARE(wlanApList.count(), mWlanScanResultList.count()); |
234 QCOMPARE(wlanApList.count(), mWlanScanApResultList.count()); |
184 |
235 |
185 for (int i = 0; i < mWlanScanResultList.count(); i++) { |
236 for (int i = 0; i < mWlanScanApResultList.count(); i++) { |
186 QCOMPARE( |
237 QCOMPARE( |
187 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSsid), |
238 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSsid), |
188 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); |
239 mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); |
189 QCOMPARE( |
240 QCOMPARE( |
190 wlanApList[i]->value(WlanQtUtilsAp::ConfIdBssid), |
241 wlanApList[i]->value(WlanQtUtilsAp::ConfIdBssid), |
191 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdBssid)); |
242 mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdBssid)); |
192 QCOMPARE( |
243 QCOMPARE( |
193 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), |
244 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), |
194 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); |
245 mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); |
195 QCOMPARE( |
246 QCOMPARE( |
196 wlanApList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode), |
247 wlanApList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode), |
197 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); |
248 mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); |
198 QCOMPARE( |
249 QCOMPARE( |
199 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode), |
250 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode), |
200 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); |
251 mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); |
201 QCOMPARE( |
252 QCOMPARE( |
202 wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse), |
253 wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse), |
203 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); |
254 mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); |
204 QCOMPARE( |
255 QCOMPARE( |
205 wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported), |
256 wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported), |
206 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported)); |
257 mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported)); |
207 } |
258 } |
208 } |
259 } |
209 |
260 |
210 // --------------------------------------------------------- |
261 // --------------------------------------------------------- |
211 // class WlanQtUtilsCtxConnMon |
262 // class WlanQtUtilsCtxConnMon |