47 mLoader(NULL), |
51 mLoader(NULL), |
48 mNextPageId(WlanWizardPage::PageNone), |
52 mNextPageId(WlanWizardPage::PageNone), |
49 mScanResultsAvailable(false), |
53 mScanResultsAvailable(false), |
50 mScanStatus(WlanQtUtils::ScanStatusOk) |
54 mScanStatus(WlanQtUtils::ScanStatusOk) |
51 { |
55 { |
52 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY ); |
56 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY); |
|
57 |
53 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
58 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
54 |
59 |
55 // Connect normal scan completion signal from wlanQtUtils to result |
60 // Connect normal scan completion signal from wlanQtUtils to result |
56 // handler. Connect here instead of initializePage, since this signal may |
61 // handler. Connect here instead of initializePage, since this signal may |
57 // need to be caught event if the window is not active. |
62 // need to be caught event if the window is not active. |
58 bool ok = connect( |
63 bool ok = connect( |
59 utils, |
64 utils, |
60 SIGNAL(wlanScanApReady(int)), |
65 SIGNAL(wlanScanApReady(int)), |
61 this, |
66 this, |
62 SLOT(wlanScanResultPreCheck(int))); |
67 SLOT(wlanScanResultPreCheck(int))); |
63 |
|
64 Q_ASSERT(ok); |
68 Q_ASSERT(ok); |
65 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT ); |
69 |
|
70 OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT); |
66 } |
71 } |
67 |
72 |
68 /*! |
73 /*! |
69 * Destructor. Loader widget is deleted. |
74 * Destructor. Loader widget is deleted. |
70 * All document widgets are deleted by wlanwizard_p destructor. |
75 * All document widgets are deleted by wlanwizard_p destructor. |
71 */ |
76 */ |
72 WlanWizardPageScanning::~WlanWizardPageScanning() |
77 WlanWizardPageScanning::~WlanWizardPageScanning() |
73 { |
78 { |
74 OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY ); |
79 OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY); |
|
80 |
75 delete mLoader; |
81 delete mLoader; |
76 OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT ); |
82 |
|
83 OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT); |
77 } |
84 } |
78 |
85 |
79 /*! |
86 /*! |
80 * Page initialization. If view is already loaded, does nothing. Inherited from |
87 * Page initialization. If view is already loaded, does nothing. Inherited from |
81 * WlanWizardPage. |
88 * WlanWizardPage. |
82 * @return pointer to widget "occ_add_wlan_06". |
89 * @return pointer to widget "occ_add_wlan_06". |
83 */ |
90 */ |
84 HbWidget* WlanWizardPageScanning::initializePage() |
91 HbWidget* WlanWizardPageScanning::initializePage() |
85 { |
92 { |
86 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY ); |
93 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY); |
|
94 |
87 OstTrace0( |
95 OstTrace0( |
88 TRACE_NORMAL, |
96 TRACE_NORMAL, |
89 WLANWIZARDPAGESCANNING_INITIALIZEPAGE, |
97 WLANWIZARDPAGESCANNING_INITIALIZEPAGE, |
90 "WlanWizardPageScanning::initializePage"); |
98 "WlanWizardPageScanning::initializePage"); |
91 |
99 |
214 * @return true |
235 * @return true |
215 * @see WlanWizardPage |
236 * @see WlanWizardPage |
216 */ |
237 */ |
217 bool WlanWizardPageScanning::requiresStartOperation() |
238 bool WlanWizardPageScanning::requiresStartOperation() |
218 { |
239 { |
219 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY ); |
240 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY); |
220 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT ); |
241 OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT); |
221 return true; |
242 return true; |
222 } |
243 } |
223 |
244 |
224 /*! |
245 /*! |
225 * Wlan scan is performed as a "post-initialization" which is executed in a |
246 * Wlan scan is performed as a "post-initialization" which is executed in a |
226 * separate scheduler loop. If scan results are available, starts reading them. |
247 * separate scheduler loop. If scan results are available, starts reading them. |
227 */ |
248 */ |
228 void WlanWizardPageScanning::startOperation() |
249 void WlanWizardPageScanning::startOperation() |
229 { |
250 { |
230 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY ); |
251 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY); |
231 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION, |
252 |
|
253 OstTrace0( |
|
254 TRACE_NORMAL, |
|
255 WLANWIZARDPAGESCANNING_STARTOPERATION, |
232 "WlanWizardPageScanning::startOperation - start AP scan if results" |
256 "WlanWizardPageScanning::startOperation - start AP scan if results" |
233 " are available." ); |
257 " are available."); |
234 |
258 |
235 if (mScanResultsAvailable) { |
259 if (mScanResultsAvailable) { |
236 mScanResultsAvailable = false; |
260 mScanResultsAvailable = false; |
237 wlanScanApReady(); |
261 wlanScanApReady(); |
238 } |
262 } |
239 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT ); |
263 |
|
264 OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT); |
240 } |
265 } |
241 |
266 |
242 /*! |
267 /*! |
243 * Loads the document orientation information from occ_add_wlan_06.docml |
268 * Loads the document orientation information from occ_add_wlan_06.docml |
244 * This is called each time phone orientation changes. |
269 * This is called each time phone orientation changes. |
245 * @param [in] orientation indicates whether the phone is in portrait or |
270 * @param [in] orientation indicates whether the phone is in portrait or |
246 * landscape mode. |
271 * landscape mode. |
247 */ |
272 */ |
248 void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation) |
273 void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation) |
249 { |
274 { |
250 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY ); |
275 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY); |
251 OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML, |
276 |
|
277 OstTrace1( |
|
278 TRACE_NORMAL, |
|
279 WLANWIZARDPAGESCANNING_LOADDOCML, |
252 "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x", |
280 "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x", |
253 ( TUint )( orientation ) ); |
281 (TUint)orientation); |
254 |
282 |
255 WlanWizardPageInternal::loadDocmlSection( |
283 WlanWizardPageInternal::loadDocmlSection( |
256 mLoader, |
284 mLoader, |
257 orientation, |
285 orientation, |
258 ":/docml/occ_add_wlan_06.docml", |
286 ":/docml/occ_add_wlan_06.docml", |
259 "portrait_section", |
287 "portrait_section", |
260 "landscape_section"); |
288 "landscape_section"); |
261 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT ); |
289 |
|
290 OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT); |
262 } |
291 } |
263 |
292 |
264 /*! |
293 /*! |
265 * Checks whether the view is active. If it is, execute wlanScanApReady. If |
294 * Checks whether the view is active. If it is, execute wlanScanApReady. If |
266 * not, set mScanResultsAvailable to true. |
295 * not, set mScanResultsAvailable to true. |
267 * @param [in] scanStatus indicates whether the scan was succesful, cancelled of |
296 * @param [in] scanStatus indicates whether the scan was succesful, cancelled of |
268 * failed. The argument is saved to a member variable. |
297 * failed. The argument is saved to a member variable. |
269 */ |
298 */ |
270 void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus) |
299 void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus) |
271 { |
300 { |
272 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY ); |
301 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY); |
|
302 |
273 mScanStatus = scanStatus; |
303 mScanStatus = scanStatus; |
274 |
304 |
275 if (!mWidget) { |
305 if (!mWidget) { |
276 OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
306 OstTrace1( |
|
307 TRACE_BORDER, |
|
308 WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
277 "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x", |
309 "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x", |
278 this ); |
310 this); |
279 |
311 |
280 mScanResultsAvailable = true; |
312 mScanResultsAvailable = true; |
281 } else { |
313 } else { |
282 if (mWizard->isCurrentPage(mWidget)) { |
314 if (mWizard->isCurrentPage(mWidget)) { |
283 OstTrace0( TRACE_BORDER, |
315 OstTrace0( |
|
316 TRACE_BORDER, |
284 DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
317 DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
285 "WlanWizardPageScanning::wlanScanResultPreCheck go to results"); |
318 "WlanWizardPageScanning::wlanScanResultPreCheck go to results"); |
286 |
319 |
287 wlanScanApReady(); |
320 wlanScanApReady(); |
288 } else { |
321 } else { |
289 OstTrace0( TRACE_BORDER, |
322 OstTrace0( |
|
323 TRACE_BORDER, |
290 DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
324 DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, |
291 "WlanWizardPageScanning::wlanScanResultPreCheck" |
325 "WlanWizardPageScanning::wlanScanResultPreCheck" |
292 " not current widget" ); |
326 " not current widget"); |
293 |
327 |
294 mScanResultsAvailable = true; |
328 mScanResultsAvailable = true; |
295 } |
329 } |
296 } |
330 } |
297 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT ); |
331 |
|
332 OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT); |
298 } |
333 } |
299 |
334 |
300 /*! |
335 /*! |
301 * Processes the direct scan results. |
336 * Processes the direct scan results. |
302 * @param [in] scanStatus indicates whether the scan was succesful, canceled or |
337 * @param [in] scanStatus indicates whether the scan was succesful, canceled or |
303 * failed. In case the scan was not succesful, always proceed to manual wizard. |
338 * failed. In case the scan was not succesful, always proceed to manual wizard. |
304 */ |
339 */ |
305 void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus) |
340 void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus) |
306 { |
341 { |
307 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY ); |
342 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY); |
308 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY, |
343 |
309 "WlanWizardPageScanning::wlanScanDirectReady" ); |
344 OstTrace0( |
|
345 TRACE_NORMAL, |
|
346 WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY, |
|
347 "WlanWizardPageScanning::wlanScanDirectReady"); |
310 |
348 |
311 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
349 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
312 |
350 |
313 Q_ASSERT(utils); |
351 Q_ASSERT(utils); |
314 |
352 |
315 QList<WlanScanResult> filteredResults; |
353 QList<WlanScanResult> filteredResults; |
316 |
354 |
317 if (scanStatus == WlanQtUtils::ScanStatusOk) { |
355 if (scanStatus == WlanQtUtils::ScanStatusOk) { |
318 QList<QSharedPointer<WlanQtUtilsAp> > directScanResults; |
356 QList< QSharedPointer<WlanQtUtilsAp> > directScanResults; |
319 // Read the directed scan results from Qt Utils |
357 // Read the directed scan results from Qt Utils |
320 utils->availableWlanAps(directScanResults); |
358 utils->availableWlanAps(directScanResults); |
321 |
359 |
322 // Identify open and hidden networks. |
360 // Identify open and hidden networks. |
323 getFinalScanResults(directScanResults, mWlanApList, filteredResults); |
361 getFinalScanResults(directScanResults, mWlanApList, filteredResults); |
324 } |
362 } |
325 |
363 |
326 // Process the scan results. If scan status is not ok, feed an empty |
364 // Process the scan results. If scan status is not ok, feed an empty |
327 // result table to the selection function. |
365 // result table to the selection function. |
328 selectNextPageActions(filteredResults); |
366 selectNextPageActions(filteredResults); |
329 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT ); |
367 |
|
368 OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT); |
330 } |
369 } |
331 |
370 |
332 /*! |
371 /*! |
333 * All wlan channels have been scanned for public networks. After processing the |
372 * All wlan channels have been scanned for public networks. After processing the |
334 * results a direct scan is initiated. This function also checks whether the |
373 * results a direct scan is initiated. This function also checks whether the |
335 * scan was succesful, canceled or failed. In case the scan was not succesful, |
374 * scan was succesful, canceled or failed. In case the scan was not succesful, |
336 * always proceed to manual wizard. |
375 * always proceed to manual wizard. |
337 */ |
376 */ |
338 void WlanWizardPageScanning::wlanScanApReady() |
377 void WlanWizardPageScanning::wlanScanApReady() |
339 { |
378 { |
340 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY ); |
379 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY); |
341 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY, |
380 |
342 "WlanWizardPageScanning::wlanScanApReady" ); |
381 OstTrace0( |
|
382 TRACE_NORMAL, |
|
383 WLANWIZARDPAGESCANNING_WLANSCANAPREADY, |
|
384 "WlanWizardPageScanning::wlanScanApReady"); |
343 |
385 |
344 if (mScanStatus == WlanQtUtils::ScanStatusOk) { |
386 if (mScanStatus == WlanQtUtils::ScanStatusOk) { |
345 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
387 WlanQtUtils* utils = mWizard->wlanQtUtils(); |
346 Q_ASSERT(utils); |
388 Q_ASSERT(utils); |
347 |
389 |
471 mWizard->setConfiguration(WlanWizardHelper::ConfWlanScanSSID, setting.hidden); |
519 mWizard->setConfiguration(WlanWizardHelper::ConfWlanScanSSID, setting.hidden); |
472 mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported); |
520 mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported); |
473 nextPage = WlanWizardPageInternal::PageNetworkSecurity; |
521 nextPage = WlanWizardPageInternal::PageNetworkSecurity; |
474 } |
522 } |
475 |
523 |
476 OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT ); |
524 OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT); |
477 return nextPage; |
525 return nextPage; |
478 } |
526 } |
479 |
527 |
480 /*! |
528 /*! |
481 * This function decides what to do with the scan results. |
529 * This function decides what to do with the scan results. |
482 * @param [in] finalResults is the list of APs revealed by the last scans. |
530 * @param [in] finalResults is the list of APs revealed by the last scans. |
483 */ |
531 */ |
484 void WlanWizardPageScanning::selectNextPageActions( |
532 void WlanWizardPageScanning::selectNextPageActions( |
485 const QList<WlanScanResult> &finalResults) |
533 const QList<WlanScanResult> &finalResults) |
486 { |
534 { |
487 OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY ); |
535 OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY); |
|
536 |
488 mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions); |
537 mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions); |
489 |
538 |
490 if (finalResults.isEmpty()) { |
539 if (finalResults.isEmpty()) { |
491 // In case of no results at all were found. |
540 // In case of no results at all were found. |
492 mNextPageId = WlanWizardPageInternal::PageNetworkMode; |
541 mNextPageId = WlanWizardPageInternal::PageNetworkMode; |
493 } else if (finalResults.size() == SingleResult) { |
542 } else if (finalResults.size() == SingleResult) { |
494 // In case there is only a single result. |
543 // In case there is only a single result. |
495 WlanScanResult item = finalResults.first(); |
544 WlanScanResult item = finalResults.first(); |
496 mNextPageId = mWizard->getNextPageId( |
545 mNextPageId = mWizard->getNextPageId( |
497 item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toString(), |
546 item.scanResult->value(WlanQtUtilsAp::ConfIdName).toString(), |
|
547 item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toByteArray(), |
498 item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(), |
548 item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(), |
499 item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), |
549 item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), |
500 item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(), |
550 item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(), |
501 item.networkHidden, |
551 item.networkHidden, |
502 item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()); |
552 item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()); |