47 mLoader(NULL), |
47 mLoader(NULL), |
48 mNextPageId(WlanWizardPage::PageNone), |
48 mNextPageId(WlanWizardPage::PageNone), |
49 mScanResultsAvailable(false), |
49 mScanResultsAvailable(false), |
50 mScanStatus(WlanQtUtils::ScanStatusOk) |
50 mScanStatus(WlanQtUtils::ScanStatusOk) |
51 { |
51 { |
|
52 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY ); |
52 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
53 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
53 |
54 |
54 // Connect normal scan completion signal from wlanQtUtils to result |
55 // Connect normal scan completion signal from wlanQtUtils to result |
55 // handler. Connect here instead of initializePage, since this signal may |
56 // handler. Connect here instead of initializePage, since this signal may |
56 // need to be caught event if the window is not active. |
57 // need to be caught event if the window is not active. |
59 SIGNAL(wlanScanApReady(int)), |
60 SIGNAL(wlanScanApReady(int)), |
60 this, |
61 this, |
61 SLOT(wlanScanResultPreCheck(int))); |
62 SLOT(wlanScanResultPreCheck(int))); |
62 |
63 |
63 Q_ASSERT(ok); |
64 Q_ASSERT(ok); |
|
65 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT ); |
64 } |
66 } |
65 |
67 |
66 /*! |
68 /*! |
67 * Destructor. Loader widget is deleted. |
69 * Destructor. Loader widget is deleted. |
68 * All document widgets are deleted by wlanwizard_p destructor. |
70 * All document widgets are deleted by wlanwizard_p destructor. |
69 */ |
71 */ |
70 WlanWizardPageScanning::~WlanWizardPageScanning() |
72 WlanWizardPageScanning::~WlanWizardPageScanning() |
71 { |
73 { |
|
74 OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY ); |
72 delete mLoader; |
75 delete mLoader; |
|
76 OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT ); |
73 } |
77 } |
74 |
78 |
75 /*! |
79 /*! |
76 * Page initialization. If view is already loaded, does nothing. Inherited from |
80 * Page initialization. If view is already loaded, does nothing. Inherited from |
77 * WlanWizardPage. |
81 * WlanWizardPage. |
78 * @return pointer to widget "occ_add_wlan_06". |
82 * @return pointer to widget "occ_add_wlan_06". |
79 */ |
83 */ |
80 HbWidget* WlanWizardPageScanning::initializePage() |
84 HbWidget* WlanWizardPageScanning::initializePage() |
81 { |
85 { |
|
86 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY ); |
82 OstTrace0( |
87 OstTrace0( |
83 TRACE_NORMAL, |
88 TRACE_NORMAL, |
84 WLANWIZARDPAGESCANNING_INITIALIZEPAGE, |
89 WLANWIZARDPAGESCANNING_INITIALIZEPAGE, |
85 "WlanWizardPageScanning::initializePage"); |
90 "WlanWizardPageScanning::initializePage"); |
86 |
91 |
203 * @return true |
215 * @return true |
204 * @see WlanWizardPage |
216 * @see WlanWizardPage |
205 */ |
217 */ |
206 bool WlanWizardPageScanning::requiresStartOperation() |
218 bool WlanWizardPageScanning::requiresStartOperation() |
207 { |
219 { |
|
220 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY ); |
|
221 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT ); |
208 return true; |
222 return true; |
209 } |
223 } |
210 |
224 |
211 /*! |
225 /*! |
212 * Wlan scan is performed as a "post-initialization" which is executed in a |
226 * Wlan scan is performed as a "post-initialization" which is executed in a |
213 * separate scheduler loop. If scan results are available, starts reading them. |
227 * separate scheduler loop. If scan results are available, starts reading them. |
214 */ |
228 */ |
215 void WlanWizardPageScanning::startOperation() |
229 void WlanWizardPageScanning::startOperation() |
216 { |
230 { |
|
231 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY ); |
217 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION, |
232 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION, |
218 "WlanWizardPageScanning::startOperation - start AP scan if results" |
233 "WlanWizardPageScanning::startOperation - start AP scan if results" |
219 " are available." ); |
234 " are available." ); |
220 |
235 |
221 if (mScanResultsAvailable) { |
236 if (mScanResultsAvailable) { |
222 mScanResultsAvailable = false; |
237 mScanResultsAvailable = false; |
223 wlanScanApReady(); |
238 wlanScanApReady(); |
224 } |
239 } |
|
240 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT ); |
225 } |
241 } |
226 |
242 |
227 /*! |
243 /*! |
228 * Loads the document orientation information from occ_add_wlan_06.docml |
244 * Loads the document orientation information from occ_add_wlan_06.docml |
229 * This is called each time phone orientation changes. |
245 * This is called each time phone orientation changes. |
230 * @param [in] orientation indicates whether the phone is in portrait or |
246 * @param [in] orientation indicates whether the phone is in portrait or |
231 * landscape mode. |
247 * landscape mode. |
232 */ |
248 */ |
233 void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation) |
249 void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation) |
234 { |
250 { |
|
251 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY ); |
235 OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML, |
252 OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML, |
236 "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x", |
253 "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x", |
237 ( TUint )( orientation ) ); |
254 ( TUint )( orientation ) ); |
238 |
255 |
239 WlanWizardPageInternal::loadDocmlSection( |
256 WlanWizardPageInternal::loadDocmlSection( |
240 mLoader, |
257 mLoader, |
241 orientation, |
258 orientation, |
242 ":/docml/occ_add_wlan_06.docml", |
259 ":/docml/occ_add_wlan_06.docml", |
243 "portrait_section", |
260 "portrait_section", |
244 "landscape_section"); |
261 "landscape_section"); |
|
262 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT ); |
245 } |
263 } |
246 |
264 |
247 /*! |
265 /*! |
248 * Checks whether the view is active. If it is, execute wlanScanApReady. If |
266 * Checks whether the view is active. If it is, execute wlanScanApReady. If |
249 * not, set mScanResultsAvailable to true. |
267 * not, set mScanResultsAvailable to true. |
250 * @param [in] scanStatus indicates whether the scan was succesful, cancelled of |
268 * @param [in] scanStatus indicates whether the scan was succesful, cancelled of |
251 * failed. The argument is saved to a member variable. |
269 * failed. The argument is saved to a member variable. |
252 */ |
270 */ |
253 void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus) |
271 void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus) |
254 { |
272 { |
|
273 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY ); |
255 mScanStatus = scanStatus; |
274 mScanStatus = scanStatus; |
256 |
275 |
257 if (!mWidget) { |
276 if (!mWidget) { |
258 OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
277 OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
259 "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x", |
278 "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x", |
274 " not current widget" ); |
293 " not current widget" ); |
275 |
294 |
276 mScanResultsAvailable = true; |
295 mScanResultsAvailable = true; |
277 } |
296 } |
278 } |
297 } |
|
298 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT ); |
279 } |
299 } |
280 |
300 |
281 /*! |
301 /*! |
282 * Processes the direct scan results. |
302 * Processes the direct scan results. |
283 * @param [in] scanStatus indicates whether the scan was succesful, canceled or |
303 * @param [in] scanStatus indicates whether the scan was succesful, canceled or |
284 * failed. In case the scan was not succesful, always proceed to manual wizard. |
304 * failed. In case the scan was not succesful, always proceed to manual wizard. |
285 */ |
305 */ |
286 void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus) |
306 void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus) |
287 { |
307 { |
|
308 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY ); |
288 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY, |
309 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY, |
289 "WlanWizardPageScanning::wlanScanDirectReady" ); |
310 "WlanWizardPageScanning::wlanScanDirectReady" ); |
290 |
311 |
291 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
312 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
292 |
313 |
304 } |
325 } |
305 |
326 |
306 // Process the scan results. If scan status is not ok, feed an empty |
327 // Process the scan results. If scan status is not ok, feed an empty |
307 // result table to the selection function. |
328 // result table to the selection function. |
308 selectNextPageActions(filteredResults); |
329 selectNextPageActions(filteredResults); |
|
330 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT ); |
309 } |
331 } |
310 |
332 |
311 /*! |
333 /*! |
312 * All wlan channels have been scanned for public networks. After processing the |
334 * All wlan channels have been scanned for public networks. After processing the |
313 * results a direct scan is initiated. This function also checks whether the |
335 * results a direct scan is initiated. This function also checks whether the |
314 * scan was succesful, canceled or failed. In case the scan was not succesful, |
336 * scan was succesful, canceled or failed. In case the scan was not succesful, |
315 * always proceed to manual wizard. |
337 * always proceed to manual wizard. |
316 */ |
338 */ |
317 void WlanWizardPageScanning::wlanScanApReady() |
339 void WlanWizardPageScanning::wlanScanApReady() |
318 { |
340 { |
|
341 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY ); |
319 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY, |
342 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY, |
320 "WlanWizardPageScanning::wlanScanApReady" ); |
343 "WlanWizardPageScanning::wlanScanApReady" ); |
321 |
344 |
322 if (mScanStatus == WlanQtUtils::ScanStatusOk) { |
345 if (mScanStatus == WlanQtUtils::ScanStatusOk) { |
323 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
346 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
353 */ |
377 */ |
354 void WlanWizardPageScanning::getSsidMatchList( |
378 void WlanWizardPageScanning::getSsidMatchList( |
355 QString ssid, |
379 QString ssid, |
356 const QList<QSharedPointer<WlanQtUtilsAp> > &matchList) |
380 const QList<QSharedPointer<WlanQtUtilsAp> > &matchList) |
357 { |
381 { |
|
382 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY ); |
358 mWlanApList.clear(); |
383 mWlanApList.clear(); |
359 QSharedPointer<WlanQtUtilsAp> item; |
384 QSharedPointer<WlanQtUtilsAp> item; |
360 |
385 |
361 for (int i = 0; i < matchList.size(); i++) { |
386 for (int i = 0; i < matchList.size(); i++) { |
362 item = matchList.at(i); |
387 item = matchList.at(i); |
363 if (item->value(WlanQtUtilsAp::ConfIdSsid).toString() == ssid) { |
388 if (item->value(WlanQtUtilsAp::ConfIdSsid).toString() == ssid) { |
364 mWlanApList.append(item); |
389 mWlanApList.append(item); |
365 } |
390 } |
366 } |
391 } |
|
392 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT ); |
367 } |
393 } |
368 |
394 |
369 /* |
395 /* |
370 * Find out which of the direct scan results are open networks by comparing |
396 * Find out which of the direct scan results are open networks by comparing |
371 * result to open scan results. Return finalResults. |
397 * result to open scan results. Return finalResults. |
376 void WlanWizardPageScanning::getFinalScanResults( |
402 void WlanWizardPageScanning::getFinalScanResults( |
377 const QList<QSharedPointer<WlanQtUtilsAp> > &directScanResults, |
403 const QList<QSharedPointer<WlanQtUtilsAp> > &directScanResults, |
378 const QList<QSharedPointer<WlanQtUtilsAp> > &openScanResults, |
404 const QList<QSharedPointer<WlanQtUtilsAp> > &openScanResults, |
379 QList<WlanScanResult> &finalResults) |
405 QList<WlanScanResult> &finalResults) |
380 { |
406 { |
|
407 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY ); |
381 finalResults.clear(); |
408 finalResults.clear(); |
382 |
409 |
383 // The key assumption of this algorithm is that both direct and public scan |
410 // The key assumption of this algorithm is that both direct and public scan |
384 // reveal the same set of AP:s with the exception of hidden AP:s. |
411 // reveal the same set of AP:s with the exception of hidden AP:s. |
385 // In other words: Direct scan result set is the whole set with each AP |
412 // In other words: Direct scan result set is the whole set with each AP |
425 tmp.setValue(networkOptions); |
454 tmp.setValue(networkOptions); |
426 |
455 |
427 mWizard->setConfiguration( |
456 mWizard->setConfiguration( |
428 WlanWizardHelper::ConfAvailableNetworkOptions, tmp); |
457 WlanWizardHelper::ConfAvailableNetworkOptions, tmp); |
429 |
458 |
430 // If there are more than one network mode choices, go to manual selection |
459 if (networkOptions.wpsSelected()) { |
431 // of network mode. |
460 // In case all available network mode options support wps, go directly |
432 if (networkOptions.netModes() > SingleResult) { |
461 // to wps-wizard. |
|
462 nextPage = WlanWizardPageInternal::PageWpsStart; |
|
463 } else if (networkOptions.netModes() > SingleResult) { |
|
464 // If there are more than one network mode choices, go to manual selection |
|
465 // of network mode. |
433 nextPage = WlanWizardPageInternal::PageNetworkMode; |
466 nextPage = WlanWizardPageInternal::PageNetworkMode; |
434 } else { |
467 } else { |
435 // if only a single network mode option is available, the mode query |
468 // if only a single network mode option is available, the mode query |
436 // may be skipped and the next page is set to security mode query. |
469 // may be skipped and the next page is set to security mode query. |
437 WlanNetworkSetting setting = networkOptions.getNetModes().at(0); |
470 WlanNetworkSetting setting = networkOptions.getNetModes().at(0); |
438 mWizard->setConfiguration(WlanWizardHelper::ConfNetworkMode, setting.mode); |
471 mWizard->setConfiguration(WlanWizardHelper::ConfNetworkMode, setting.mode); |
439 mWizard->setConfiguration(WlanWizardHelper::ConfHiddenWlan, setting.hidden); |
472 mWizard->setConfiguration(WlanWizardHelper::ConfHiddenWlan, setting.hidden); |
|
473 mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported); |
440 nextPage = WlanWizardPageInternal::PageNetworkSecurity; |
474 nextPage = WlanWizardPageInternal::PageNetworkSecurity; |
441 } |
475 } |
442 |
476 |
|
477 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT ); |
443 return nextPage; |
478 return nextPage; |
444 } |
479 } |
445 |
480 |
446 /*! |
481 /*! |
447 * This function decides what to do with the scan results. |
482 * This function decides what to do with the scan results. |
448 * @param [in] finalResults is the list of APs revealed by the last scans. |
483 * @param [in] finalResults is the list of APs revealed by the last scans. |
449 */ |
484 */ |
450 void WlanWizardPageScanning::selectNextPageActions( |
485 void WlanWizardPageScanning::selectNextPageActions( |
451 const QList<WlanScanResult> &finalResults) |
486 const QList<WlanScanResult> &finalResults) |
452 { |
487 { |
|
488 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY ); |
453 mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions); |
489 mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions); |
454 |
490 |
455 if (finalResults.isEmpty()) { |
491 if (finalResults.isEmpty()) { |
456 // In case of no results at all were found. |
492 // In case of no results at all were found. |
457 mNextPageId = WlanWizardPageInternal::PageNetworkMode; |
493 mNextPageId = WlanWizardPageInternal::PageNetworkMode; |