134 |
134 |
135 // --------------------------------------------------------- |
135 // --------------------------------------------------------- |
136 // class WlanQtUtilsWlanScanResult |
136 // class WlanQtUtilsWlanScanResult |
137 // --------------------------------------------------------- |
137 // --------------------------------------------------------- |
138 |
138 |
139 WlanQtUtilsWlanScanResult::WlanQtUtilsWlanScanResult() : |
139 WlanQtUtilsWlanScan::WlanQtUtilsWlanScan() : |
140 wlanScanResultList_(), |
140 mScanResultIterator(0), |
141 completeWlanScan_(true), |
141 mWlanScanResultList(), |
142 scanRetValue_(KErrNone) |
142 mCompleteWlanScan(true), |
143 { |
143 mScanRetValue(KErrNone) |
144 } |
144 { |
145 |
145 } |
146 WlanQtUtilsWlanScanResult::~WlanQtUtilsWlanScanResult() |
146 |
|
147 WlanQtUtilsWlanScan::~WlanQtUtilsWlanScan() |
147 { |
148 { |
148 clearWlanScanResultList(); |
149 clearWlanScanResultList(); |
149 } |
150 } |
150 |
151 |
151 void WlanQtUtilsWlanScanResult::initialize() |
152 void WlanQtUtilsWlanScan::initialize() |
152 { |
153 { |
153 clearWlanScanResultList(); |
154 clearWlanScanResultList(); |
154 completeWlanScan_ = true; |
155 mCompleteWlanScan = true; |
155 scanRetValue_ = KErrNone; |
156 mScanRetValue = KErrNone; |
156 } |
157 } |
157 |
158 |
158 void WlanQtUtilsWlanScanResult::createDefaultWlanScanResultList(int numberOfWlanAps) |
159 void WlanQtUtilsWlanScan::createDefaultWlanScanResultList(int numberOfWlanAps) |
159 { |
160 { |
160 clearWlanScanResultList(); |
161 clearWlanScanResultList(); |
161 for (int i = 0; i < numberOfWlanAps; i++) { |
162 for (int i = 0; i < numberOfWlanAps; i++) { |
162 WlanQtUtilsAp *ap = new WlanQtUtilsAp(); |
163 QSharedPointer<WlanQtUtilsAp> ap(new WlanQtUtilsAp()); |
163 ap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); |
164 ap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); |
|
165 ap->setValue(WlanQtUtilsAp::ConfIdBssid, QByteArray("123456")); |
164 ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); |
166 ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); |
165 ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); |
167 ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); |
166 ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); |
168 ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); |
167 ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); |
169 ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); |
168 // TODO: Create constructor to WlanQtUtilsWlanAp which takes all member variables as parameter. |
170 ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); |
169 wlanScanResultList_.append(ap); |
171 mWlanScanResultList.append(ap); |
170 } |
172 } |
171 } |
173 } |
172 |
174 |
173 void WlanQtUtilsWlanScanResult::clearWlanScanResultList() |
175 void WlanQtUtilsWlanScan::clearWlanScanResultList() |
174 { |
176 { |
175 Q_FOREACH(WlanQtUtilsAp* ap, wlanScanResultList_) |
177 mWlanScanResultList.clear(); |
176 { |
178 } |
177 delete ap; |
179 |
178 } |
180 void WlanQtUtilsWlanScan::verifyWlanScanResultList( |
179 wlanScanResultList_.clear(); |
181 QList< QSharedPointer<WlanQtUtilsAp> > wlanApList) |
180 } |
182 { |
181 |
183 QCOMPARE(wlanApList.count(), mWlanScanResultList.count()); |
182 void WlanQtUtilsWlanScanResult::verifyWlanScanResultList( |
184 |
183 QList<QSharedPointer<WlanQtUtilsAp> > wlanApList) |
185 for (int i = 0; i < mWlanScanResultList.count(); i++) { |
184 { |
186 QCOMPARE( |
185 QCOMPARE(wlanApList.count(), wlanScanResultList_.count()); |
187 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSsid), |
186 |
188 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); |
187 for (int i = 0; i < wlanScanResultList_.count(); i++) { |
189 QCOMPARE( |
188 QCOMPARE(wlanApList[i]->value(WlanQtUtilsAp::ConfIdSsid), |
190 wlanApList[i]->value(WlanQtUtilsAp::ConfIdBssid), |
189 wlanScanResultList_[i]->value(WlanQtUtilsAp::ConfIdSsid)); |
191 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdBssid)); |
190 QCOMPARE(wlanApList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), |
192 QCOMPARE( |
191 wlanScanResultList_[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); |
193 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), |
192 QCOMPARE(wlanApList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode), |
194 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); |
193 wlanScanResultList_[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); |
195 QCOMPARE( |
194 QCOMPARE(wlanApList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode), |
196 wlanApList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode), |
195 wlanScanResultList_[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); |
197 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); |
196 QCOMPARE(wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse), |
198 QCOMPARE( |
197 wlanScanResultList_[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); |
199 wlanApList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode), |
|
200 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); |
|
201 QCOMPARE( |
|
202 wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse), |
|
203 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); |
|
204 QCOMPARE( |
|
205 wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported), |
|
206 mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported)); |
198 } |
207 } |
199 } |
208 } |
200 |
209 |
201 // --------------------------------------------------------- |
210 // --------------------------------------------------------- |
202 // class WlanQtUtilsCtxConnMon |
211 // class WlanQtUtilsCtxConnMon |
203 // --------------------------------------------------------- |
212 // --------------------------------------------------------- |
204 |
213 |
205 WlanQtUtilsCtxConnMon::WlanQtUtilsCtxConnMon() : |
214 WlanQtUtilsCtxConnMon::WlanQtUtilsCtxConnMon() : |
206 wlanScanResult_() |
215 activeConnections_() |
207 { |
216 { |
208 } |
217 } |
209 |
218 |
210 WlanQtUtilsCtxConnMon::~WlanQtUtilsCtxConnMon() |
219 WlanQtUtilsCtxConnMon::~WlanQtUtilsCtxConnMon() |
211 { |
220 { |
212 } |
221 } |
213 |
222 |
214 void WlanQtUtilsCtxConnMon::initialize() |
223 void WlanQtUtilsCtxConnMon::initialize() |
215 { |
224 { |
216 wlanScanResult_.initialize(); |
|
217 activeConnections_.initialize(); |
225 activeConnections_.initialize(); |
218 } |
226 } |
219 |
227 |
220 // --------------------------------------------------------- |
228 // --------------------------------------------------------- |
221 // class WlanQtUtilsCtxIct |
229 // class WlanQtUtilsCtxIct |