31
|
1 |
/*
|
39
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* WLAN Wizard Page: Scan processing.
|
|
16 |
*/
|
31
|
17 |
|
|
18 |
// System includes
|
39
|
19 |
#include <HbParameterLengthLimiter>
|
31
|
20 |
#include <HbMainWindow>
|
|
21 |
#include <HbDocumentLoader>
|
|
22 |
#include <HbWidget>
|
|
23 |
#include <HbLabel>
|
|
24 |
#include <HbProgressBar>
|
|
25 |
#include <cmmanagerdefines_shim.h>
|
|
26 |
#include <wlanqtutils.h>
|
|
27 |
#include <wlanqtutilsap.h>
|
|
28 |
|
|
29 |
// User includes
|
|
30 |
#include "wlanwizard_p.h"
|
|
31 |
#include "wlanwizardpagescanning.h"
|
|
32 |
#include "OstTraceDefinitions.h"
|
|
33 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
34 |
#include "wlanwizardpagescanningTraces.h"
|
|
35 |
#endif
|
|
36 |
|
39
|
37 |
// Local constants
|
|
38 |
|
31
|
39 |
/*!
|
39
|
40 |
* Constructor method for the scanning view object.
|
|
41 |
* @param [in] parent pointer to parent object.
|
31
|
42 |
*/
|
|
43 |
WlanWizardPageScanning::WlanWizardPageScanning(WlanWizardPrivate* parent) :
|
|
44 |
WlanWizardPageInternal(parent),
|
|
45 |
mWidget(NULL),
|
|
46 |
mLabel(NULL),
|
|
47 |
mLoader(NULL),
|
|
48 |
mNextPageId(WlanWizardPage::PageNone),
|
39
|
49 |
mScanResultsAvailable(false),
|
|
50 |
mScanStatus(WlanQtUtils::ScanStatusOk)
|
31
|
51 |
{
|
43
|
52 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY );
|
31
|
53 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
54 |
|
|
55 |
// Connect normal scan completion signal from wlanQtUtils to result
|
|
56 |
// handler. Connect here instead of initializePage, since this signal may
|
|
57 |
// need to be caught event if the window is not active.
|
39
|
58 |
bool ok = connect(
|
|
59 |
utils,
|
|
60 |
SIGNAL(wlanScanApReady(int)),
|
|
61 |
this,
|
|
62 |
SLOT(wlanScanResultPreCheck(int)));
|
|
63 |
|
|
64 |
Q_ASSERT(ok);
|
43
|
65 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT );
|
31
|
66 |
}
|
|
67 |
|
|
68 |
/*!
|
|
69 |
* Destructor. Loader widget is deleted.
|
|
70 |
* All document widgets are deleted by wlanwizard_p destructor.
|
|
71 |
*/
|
|
72 |
WlanWizardPageScanning::~WlanWizardPageScanning()
|
|
73 |
{
|
43
|
74 |
OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY );
|
31
|
75 |
delete mLoader;
|
43
|
76 |
OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT );
|
31
|
77 |
}
|
|
78 |
|
|
79 |
/*!
|
39
|
80 |
* Page initialization. If view is already loaded, does nothing. Inherited from
|
|
81 |
* WlanWizardPage.
|
|
82 |
* @return pointer to widget "occ_add_wlan_06".
|
31
|
83 |
*/
|
|
84 |
HbWidget* WlanWizardPageScanning::initializePage()
|
|
85 |
{
|
43
|
86 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY );
|
39
|
87 |
OstTrace0(
|
|
88 |
TRACE_NORMAL,
|
|
89 |
WLANWIZARDPAGESCANNING_INITIALIZEPAGE,
|
|
90 |
"WlanWizardPageScanning::initializePage");
|
31
|
91 |
|
|
92 |
// Next page id is reset with each initialization.
|
|
93 |
mNextPageId = WlanWizardPage::PageNone;
|
|
94 |
|
|
95 |
if (mWidget == NULL) {
|
|
96 |
mLoader = new HbDocumentLoader(mWizard->mainWindow());
|
|
97 |
|
|
98 |
bool ok;
|
|
99 |
|
|
100 |
mLoader->load(":/docml/occ_add_wlan_06.docml", &ok);
|
39
|
101 |
Q_ASSERT(ok);
|
31
|
102 |
|
|
103 |
// Initialize orientation
|
39
|
104 |
loadDocmlSection(mWizard->mainWindow()->orientation());
|
31
|
105 |
|
|
106 |
// Load widgets
|
|
107 |
mWidget = qobject_cast<HbWidget*> (mLoader->findWidget(
|
|
108 |
"occ_add_wlan_06"));
|
39
|
109 |
Q_ASSERT(mWidget != NULL);
|
31
|
110 |
|
|
111 |
mLabel = qobject_cast<HbLabel*> (mLoader->findWidget("dialog"));
|
39
|
112 |
Q_ASSERT(mLabel != NULL);
|
31
|
113 |
|
|
114 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
115 |
|
|
116 |
// Connect orientation signal from the main window to orientation
|
|
117 |
// loader.
|
39
|
118 |
ok = connect(
|
|
119 |
mWizard->mainWindow(),
|
|
120 |
SIGNAL(orientationChanged(Qt::Orientation)),
|
|
121 |
this,
|
|
122 |
SLOT(loadDocmlSection(Qt::Orientation)));
|
|
123 |
Q_ASSERT(ok);
|
31
|
124 |
|
|
125 |
// Connect direct scan completion signal from wlanQtUtils to result
|
|
126 |
// handler.
|
39
|
127 |
ok = connect(
|
|
128 |
utils,
|
|
129 |
SIGNAL(wlanScanDirectReady(int)),
|
|
130 |
this,
|
|
131 |
SLOT(wlanScanDirectReady(int)));
|
31
|
132 |
Q_ASSERT(ok);
|
|
133 |
}
|
|
134 |
|
39
|
135 |
mLabel->setPlainText(HbParameterLengthLimiter(
|
|
136 |
hbTrId("txt_occ_dialog_searching")).arg(mWizard->configuration(
|
|
137 |
WlanWizardPrivate::ConfSsid).toString()));
|
|
138 |
|
31
|
139 |
|
43
|
140 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_EXIT );
|
31
|
141 |
return mWidget;
|
|
142 |
}
|
|
143 |
|
|
144 |
/*!
|
|
145 |
* Sends the user to the next page.
|
39
|
146 |
* @param [out] removeFromStack is always true: this page is removed from the
|
|
147 |
* stacked widget after "Next" button is pressed.
|
|
148 |
* @return the id value of the next page.
|
31
|
149 |
*/
|
|
150 |
int WlanWizardPageScanning::nextId(bool &removeFromStack) const
|
|
151 |
{
|
43
|
152 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_NEXTID_ENTRY );
|
31
|
153 |
removeFromStack = true;
|
|
154 |
|
43
|
155 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_NEXTID_EXIT );
|
31
|
156 |
return mNextPageId;
|
|
157 |
}
|
|
158 |
|
|
159 |
/*!
|
39
|
160 |
* This function reimplements WlanWizardPage::previousTriggered. When going
|
|
161 |
* back from scanning view, the ongoing scan operation is also stopped. Since
|
|
162 |
* there is no need to react to following the acknowledgement signal from
|
|
163 |
* wlanQtUtils, the corresponding handler slots are disconnected before the
|
|
164 |
* opration and immediately connected again.
|
|
165 |
* @return one step backwards value.
|
|
166 |
*/
|
|
167 |
int WlanWizardPageScanning::previousTriggered()
|
|
168 |
{
|
43
|
169 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_ENTRY );
|
39
|
170 |
disconnect(this, SLOT(wlanScanDirectReady(int)));
|
|
171 |
disconnect(this, SLOT(wlanScanResultPreCheck(int)));
|
|
172 |
|
|
173 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
174 |
|
|
175 |
utils->stopWlanScan();
|
|
176 |
|
|
177 |
bool ok = connect(
|
|
178 |
utils,
|
|
179 |
SIGNAL(wlanScanApReady(int)),
|
|
180 |
this,
|
|
181 |
SLOT(wlanScanResultPreCheck(int)));
|
|
182 |
Q_ASSERT(ok);
|
|
183 |
|
|
184 |
ok = connect(
|
|
185 |
utils,
|
|
186 |
SIGNAL(wlanScanDirectReady(int)),
|
|
187 |
this,
|
|
188 |
SLOT(wlanScanDirectReady(int)));
|
|
189 |
Q_ASSERT(ok);
|
|
190 |
|
43
|
191 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_EXIT );
|
39
|
192 |
return OneStepBackwards;
|
|
193 |
|
|
194 |
}
|
|
195 |
|
|
196 |
/*!
|
|
197 |
* This method is overrides the default implementation from WlanWizardPage.
|
|
198 |
* It indicates whether the Next-button should be enabled or not. It also resets
|
|
199 |
* the ConfProcessSettings-configuration to false - meaning that if no scan
|
|
200 |
* results are available, no iap is created.
|
|
201 |
* @return always false - the scanning proceeds to next window
|
|
202 |
* automatically or not at all.
|
31
|
203 |
*/
|
|
204 |
bool WlanWizardPageScanning::showPage()
|
|
205 |
{
|
43
|
206 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SHOWPAGE_ENTRY );
|
39
|
207 |
mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, false);
|
43
|
208 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SHOWPAGE_EXIT );
|
31
|
209 |
return false;
|
|
210 |
}
|
|
211 |
|
|
212 |
/*!
|
39
|
213 |
* Reimplements the default function in WlanWizardPage. Indicates to the
|
|
214 |
* framework that startOperation() function must be executed.
|
|
215 |
* @return true
|
|
216 |
* @see WlanWizardPage
|
31
|
217 |
*/
|
|
218 |
bool WlanWizardPageScanning::requiresStartOperation()
|
|
219 |
{
|
43
|
220 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY );
|
|
221 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT );
|
31
|
222 |
return true;
|
|
223 |
}
|
|
224 |
|
|
225 |
/*!
|
|
226 |
* Wlan scan is performed as a "post-initialization" which is executed in a
|
39
|
227 |
* separate scheduler loop. If scan results are available, starts reading them.
|
31
|
228 |
*/
|
|
229 |
void WlanWizardPageScanning::startOperation()
|
|
230 |
{
|
43
|
231 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY );
|
31
|
232 |
OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION,
|
|
233 |
"WlanWizardPageScanning::startOperation - start AP scan if results"
|
|
234 |
" are available." );
|
|
235 |
|
|
236 |
if (mScanResultsAvailable) {
|
|
237 |
mScanResultsAvailable = false;
|
|
238 |
wlanScanApReady();
|
|
239 |
}
|
43
|
240 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT );
|
31
|
241 |
}
|
|
242 |
|
39
|
243 |
/*!
|
|
244 |
* Loads the document orientation information from occ_add_wlan_06.docml
|
|
245 |
* This is called each time phone orientation changes.
|
|
246 |
* @param [in] orientation indicates whether the phone is in portrait or
|
|
247 |
* landscape mode.
|
|
248 |
*/
|
|
249 |
void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation)
|
|
250 |
{
|
43
|
251 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY );
|
39
|
252 |
OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML,
|
|
253 |
"WlanWizardPageScanning::loadDocml - orientation ;orientation=%x",
|
|
254 |
( TUint )( orientation ) );
|
|
255 |
|
|
256 |
WlanWizardPageInternal::loadDocmlSection(
|
|
257 |
mLoader,
|
|
258 |
orientation,
|
|
259 |
":/docml/occ_add_wlan_06.docml",
|
|
260 |
"portrait_section",
|
|
261 |
"landscape_section");
|
43
|
262 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT );
|
39
|
263 |
}
|
|
264 |
|
|
265 |
/*!
|
|
266 |
* Checks whether the view is active. If it is, execute wlanScanApReady. If
|
|
267 |
* not, set mScanResultsAvailable to true.
|
|
268 |
* @param [in] scanStatus indicates whether the scan was succesful, cancelled of
|
|
269 |
* failed. The argument is saved to a member variable.
|
|
270 |
*/
|
|
271 |
void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus)
|
|
272 |
{
|
43
|
273 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY );
|
39
|
274 |
mScanStatus = scanStatus;
|
|
275 |
|
|
276 |
if (!mWidget) {
|
|
277 |
OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
|
|
278 |
"WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x",
|
|
279 |
this );
|
|
280 |
|
|
281 |
mScanResultsAvailable = true;
|
|
282 |
} else {
|
|
283 |
if (mWizard->isCurrentPage(mWidget)) {
|
|
284 |
OstTrace0( TRACE_BORDER,
|
|
285 |
DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
|
|
286 |
"WlanWizardPageScanning::wlanScanResultPreCheck go to results");
|
|
287 |
|
|
288 |
wlanScanApReady();
|
|
289 |
} else {
|
|
290 |
OstTrace0( TRACE_BORDER,
|
|
291 |
DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
|
|
292 |
"WlanWizardPageScanning::wlanScanResultPreCheck"
|
|
293 |
" not current widget" );
|
|
294 |
|
|
295 |
mScanResultsAvailable = true;
|
|
296 |
}
|
|
297 |
}
|
43
|
298 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT );
|
39
|
299 |
}
|
|
300 |
|
|
301 |
/*!
|
|
302 |
* Processes the direct scan results.
|
|
303 |
* @param [in] scanStatus indicates whether the scan was succesful, canceled or
|
|
304 |
* failed. In case the scan was not succesful, always proceed to manual wizard.
|
|
305 |
*/
|
|
306 |
void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus)
|
|
307 |
{
|
43
|
308 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY );
|
39
|
309 |
OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY,
|
|
310 |
"WlanWizardPageScanning::wlanScanDirectReady" );
|
|
311 |
|
|
312 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
313 |
|
|
314 |
Q_ASSERT(utils);
|
|
315 |
|
|
316 |
QList<WlanScanResult> filteredResults;
|
|
317 |
|
|
318 |
if (scanStatus == WlanQtUtils::ScanStatusOk) {
|
|
319 |
QList<QSharedPointer<WlanQtUtilsAp> > directScanResults;
|
|
320 |
// Read the directed scan results from Qt Utils
|
|
321 |
utils->availableWlanAps(directScanResults);
|
|
322 |
|
|
323 |
// Identify open and hidden networks.
|
|
324 |
getFinalScanResults(directScanResults, mWlanApList, filteredResults);
|
|
325 |
}
|
|
326 |
|
|
327 |
// Process the scan results. If scan status is not ok, feed an empty
|
|
328 |
// result table to the selection function.
|
|
329 |
selectNextPageActions(filteredResults);
|
43
|
330 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT );
|
39
|
331 |
}
|
|
332 |
|
|
333 |
/*!
|
|
334 |
* All wlan channels have been scanned for public networks. After processing the
|
|
335 |
* results a direct scan is initiated. This function also checks whether the
|
|
336 |
* scan was succesful, canceled or failed. In case the scan was not succesful,
|
|
337 |
* always proceed to manual wizard.
|
|
338 |
*/
|
|
339 |
void WlanWizardPageScanning::wlanScanApReady()
|
|
340 |
{
|
43
|
341 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY );
|
39
|
342 |
OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY,
|
|
343 |
"WlanWizardPageScanning::wlanScanApReady" );
|
|
344 |
|
|
345 |
if (mScanStatus == WlanQtUtils::ScanStatusOk) {
|
|
346 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
347 |
Q_ASSERT(utils);
|
|
348 |
|
|
349 |
QList<QSharedPointer<WlanQtUtilsAp> > openScanResults;
|
|
350 |
|
|
351 |
// Fetch the list of scan results.
|
|
352 |
utils->availableWlanAps(openScanResults);
|
|
353 |
|
|
354 |
// The name of the network that we are looking for.
|
|
355 |
QString ssid =
|
|
356 |
mWizard->configuration(WlanWizardPrivate::ConfSsid).toString();
|
|
357 |
|
|
358 |
// Store matching scan results.
|
|
359 |
getSsidMatchList(ssid, openScanResults);
|
|
360 |
|
|
361 |
// Next directed scan.
|
|
362 |
utils->scanWlanDirect(ssid);
|
|
363 |
}
|
|
364 |
else {
|
|
365 |
mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
|
|
366 |
mNextPageId = WlanWizardPageInternal::PageNetworkMode;
|
|
367 |
mWizard->nextPage();
|
|
368 |
}
|
43
|
369 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_EXIT );
|
39
|
370 |
}
|
|
371 |
|
|
372 |
/*!
|
|
373 |
* This function stores all the APs that match ssid parameter to mWlanApList
|
|
374 |
* member list.
|
|
375 |
* @param [in] ssid is the name of the network we are interested in.
|
|
376 |
* @param [in] matchList is the list of all APs that were revealed in the scan.
|
|
377 |
*/
|
|
378 |
void WlanWizardPageScanning::getSsidMatchList(
|
|
379 |
QString ssid,
|
|
380 |
const QList<QSharedPointer<WlanQtUtilsAp> > &matchList)
|
|
381 |
{
|
43
|
382 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY );
|
39
|
383 |
mWlanApList.clear();
|
|
384 |
QSharedPointer<WlanQtUtilsAp> item;
|
|
385 |
|
|
386 |
for (int i = 0; i < matchList.size(); i++) {
|
|
387 |
item = matchList.at(i);
|
|
388 |
if (item->value(WlanQtUtilsAp::ConfIdSsid).toString() == ssid) {
|
|
389 |
mWlanApList.append(item);
|
|
390 |
}
|
|
391 |
}
|
43
|
392 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT );
|
39
|
393 |
}
|
|
394 |
|
|
395 |
/*
|
|
396 |
* Find out which of the direct scan results are open networks by comparing
|
|
397 |
* result to open scan results. Return finalResults.
|
|
398 |
* @param [in] directScanResults are the results of a directed scan.
|
|
399 |
* @param [in] openScanResults are the results of a scan inquiring any APs.
|
|
400 |
* @param [out] finalResults is a list of APs with visibility flag included.
|
|
401 |
*/
|
|
402 |
void WlanWizardPageScanning::getFinalScanResults(
|
|
403 |
const QList<QSharedPointer<WlanQtUtilsAp> > &directScanResults,
|
|
404 |
const QList<QSharedPointer<WlanQtUtilsAp> > &openScanResults,
|
|
405 |
QList<WlanScanResult> &finalResults)
|
|
406 |
{
|
43
|
407 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY );
|
39
|
408 |
finalResults.clear();
|
|
409 |
|
|
410 |
// The key assumption of this algorithm is that both direct and public scan
|
|
411 |
// reveal the same set of AP:s with the exception of hidden AP:s.
|
|
412 |
// In other words: Direct scan result set is the whole set with each AP
|
|
413 |
// marked as hidden by default. If an AP has been revealed also by public
|
|
414 |
// scan, it is changed to visible.
|
|
415 |
for (int i = 0; i < directScanResults.size(); i++) {
|
|
416 |
WlanScanResult resultItem;
|
|
417 |
|
|
418 |
resultItem.scanResult = directScanResults.at(i);
|
|
419 |
|
|
420 |
// Initialize as hidden.
|
|
421 |
resultItem.networkHidden = true;
|
|
422 |
|
|
423 |
for (int j = 0; j < openScanResults.size(); j++) {
|
|
424 |
if (WlanQtUtilsAp::compare(
|
|
425 |
openScanResults.at(j).data(),
|
|
426 |
directScanResults.at(i).data()) == 0) {
|
|
427 |
// Mark open, if a public scan revealed the same AP
|
|
428 |
resultItem.networkHidden = false;
|
|
429 |
}
|
|
430 |
}
|
|
431 |
|
|
432 |
finalResults.append(resultItem);
|
|
433 |
}
|
43
|
434 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_EXIT );
|
39
|
435 |
}
|
|
436 |
|
|
437 |
/*!
|
|
438 |
* This function processes the scan results in case multiple results were
|
|
439 |
* acquired with matching SSIDs.
|
|
440 |
* @param [in] finalResults is the list of APs revealed by the last scans.
|
|
441 |
* @return the identifier of the next page.
|
|
442 |
*/
|
|
443 |
int WlanWizardPageScanning::processMultipleScanResults(
|
|
444 |
const QList<WlanScanResult> &finalResults)
|
|
445 |
{
|
43
|
446 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_ENTRY );
|
39
|
447 |
WlanWizardScanList networkOptions;
|
|
448 |
int nextPage;
|
|
449 |
|
|
450 |
// Build the list of results to be placed in the configuration.
|
|
451 |
networkOptions.build(finalResults);
|
|
452 |
|
|
453 |
QVariant tmp;
|
|
454 |
tmp.setValue(networkOptions);
|
|
455 |
|
|
456 |
mWizard->setConfiguration(
|
|
457 |
WlanWizardHelper::ConfAvailableNetworkOptions, tmp);
|
|
458 |
|
43
|
459 |
if (networkOptions.wpsSelected()) {
|
|
460 |
// In case all available network mode options support wps, go directly
|
|
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.
|
39
|
466 |
nextPage = WlanWizardPageInternal::PageNetworkMode;
|
|
467 |
} else {
|
|
468 |
// if only a single network mode option is available, the mode query
|
|
469 |
// may be skipped and the next page is set to security mode query.
|
|
470 |
WlanNetworkSetting setting = networkOptions.getNetModes().at(0);
|
|
471 |
mWizard->setConfiguration(WlanWizardHelper::ConfNetworkMode, setting.mode);
|
|
472 |
mWizard->setConfiguration(WlanWizardHelper::ConfHiddenWlan, setting.hidden);
|
43
|
473 |
mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported);
|
39
|
474 |
nextPage = WlanWizardPageInternal::PageNetworkSecurity;
|
|
475 |
}
|
|
476 |
|
43
|
477 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT );
|
39
|
478 |
return nextPage;
|
|
479 |
}
|
|
480 |
|
|
481 |
/*!
|
|
482 |
* This function decides what to do with the scan results.
|
|
483 |
* @param [in] finalResults is the list of APs revealed by the last scans.
|
|
484 |
*/
|
|
485 |
void WlanWizardPageScanning::selectNextPageActions(
|
|
486 |
const QList<WlanScanResult> &finalResults)
|
|
487 |
{
|
43
|
488 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY );
|
39
|
489 |
mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
|
|
490 |
|
|
491 |
if (finalResults.isEmpty()) {
|
|
492 |
// In case of no results at all were found.
|
|
493 |
mNextPageId = WlanWizardPageInternal::PageNetworkMode;
|
|
494 |
} else if (finalResults.size() == SingleResult) {
|
|
495 |
// In case there is only a single result.
|
|
496 |
WlanScanResult item = finalResults.first();
|
|
497 |
mNextPageId = mWizard->getNextPageId(
|
|
498 |
item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toString(),
|
|
499 |
item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(),
|
|
500 |
item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(),
|
|
501 |
item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(),
|
|
502 |
item.networkHidden,
|
|
503 |
item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool());
|
|
504 |
} else {
|
|
505 |
// In case more than one result is available.
|
|
506 |
mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, true);
|
|
507 |
mNextPageId = processMultipleScanResults(finalResults);
|
|
508 |
}
|
|
509 |
|
|
510 |
mWizard->nextPage();
|
43
|
511 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_EXIT );
|
39
|
512 |
}
|