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(
|
49
|
136 |
"txt_occ_dialog_searching").arg(mWizard->configuration(
|
39
|
137 |
WlanWizardPrivate::ConfSsid).toString()));
|
|
138 |
|
43
|
139 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_EXIT );
|
31
|
140 |
return mWidget;
|
|
141 |
}
|
|
142 |
|
|
143 |
/*!
|
|
144 |
* Sends the user to the next page.
|
39
|
145 |
* @param [out] removeFromStack is always true: this page is removed from the
|
|
146 |
* stacked widget after "Next" button is pressed.
|
|
147 |
* @return the id value of the next page.
|
31
|
148 |
*/
|
|
149 |
int WlanWizardPageScanning::nextId(bool &removeFromStack) const
|
|
150 |
{
|
43
|
151 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_NEXTID_ENTRY );
|
31
|
152 |
removeFromStack = true;
|
|
153 |
|
43
|
154 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_NEXTID_EXIT );
|
31
|
155 |
return mNextPageId;
|
|
156 |
}
|
|
157 |
|
|
158 |
/*!
|
39
|
159 |
* This function reimplements WlanWizardPage::previousTriggered. When going
|
|
160 |
* back from scanning view, the ongoing scan operation is also stopped. Since
|
|
161 |
* there is no need to react to following the acknowledgement signal from
|
|
162 |
* wlanQtUtils, the corresponding handler slots are disconnected before the
|
|
163 |
* opration and immediately connected again.
|
|
164 |
* @return one step backwards value.
|
|
165 |
*/
|
|
166 |
int WlanWizardPageScanning::previousTriggered()
|
|
167 |
{
|
43
|
168 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_ENTRY );
|
39
|
169 |
disconnect(this, SLOT(wlanScanDirectReady(int)));
|
|
170 |
disconnect(this, SLOT(wlanScanResultPreCheck(int)));
|
|
171 |
|
|
172 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
173 |
|
|
174 |
utils->stopWlanScan();
|
|
175 |
|
|
176 |
bool ok = connect(
|
|
177 |
utils,
|
|
178 |
SIGNAL(wlanScanApReady(int)),
|
|
179 |
this,
|
|
180 |
SLOT(wlanScanResultPreCheck(int)));
|
|
181 |
Q_ASSERT(ok);
|
|
182 |
|
|
183 |
ok = connect(
|
|
184 |
utils,
|
|
185 |
SIGNAL(wlanScanDirectReady(int)),
|
|
186 |
this,
|
|
187 |
SLOT(wlanScanDirectReady(int)));
|
|
188 |
Q_ASSERT(ok);
|
|
189 |
|
43
|
190 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_EXIT );
|
39
|
191 |
return OneStepBackwards;
|
|
192 |
|
|
193 |
}
|
|
194 |
|
|
195 |
/*!
|
|
196 |
* This method is overrides the default implementation from WlanWizardPage.
|
|
197 |
* It indicates whether the Next-button should be enabled or not. It also resets
|
|
198 |
* the ConfProcessSettings-configuration to false - meaning that if no scan
|
|
199 |
* results are available, no iap is created.
|
|
200 |
* @return always false - the scanning proceeds to next window
|
|
201 |
* automatically or not at all.
|
31
|
202 |
*/
|
|
203 |
bool WlanWizardPageScanning::showPage()
|
|
204 |
{
|
43
|
205 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SHOWPAGE_ENTRY );
|
39
|
206 |
mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, false);
|
43
|
207 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SHOWPAGE_EXIT );
|
31
|
208 |
return false;
|
|
209 |
}
|
|
210 |
|
|
211 |
/*!
|
39
|
212 |
* Reimplements the default function in WlanWizardPage. Indicates to the
|
|
213 |
* framework that startOperation() function must be executed.
|
|
214 |
* @return true
|
|
215 |
* @see WlanWizardPage
|
31
|
216 |
*/
|
|
217 |
bool WlanWizardPageScanning::requiresStartOperation()
|
|
218 |
{
|
43
|
219 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY );
|
|
220 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT );
|
31
|
221 |
return true;
|
|
222 |
}
|
|
223 |
|
|
224 |
/*!
|
|
225 |
* Wlan scan is performed as a "post-initialization" which is executed in a
|
39
|
226 |
* separate scheduler loop. If scan results are available, starts reading them.
|
31
|
227 |
*/
|
|
228 |
void WlanWizardPageScanning::startOperation()
|
|
229 |
{
|
43
|
230 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY );
|
31
|
231 |
OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION,
|
|
232 |
"WlanWizardPageScanning::startOperation - start AP scan if results"
|
|
233 |
" are available." );
|
|
234 |
|
|
235 |
if (mScanResultsAvailable) {
|
|
236 |
mScanResultsAvailable = false;
|
|
237 |
wlanScanApReady();
|
|
238 |
}
|
43
|
239 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT );
|
31
|
240 |
}
|
|
241 |
|
39
|
242 |
/*!
|
|
243 |
* Loads the document orientation information from occ_add_wlan_06.docml
|
|
244 |
* This is called each time phone orientation changes.
|
|
245 |
* @param [in] orientation indicates whether the phone is in portrait or
|
|
246 |
* landscape mode.
|
|
247 |
*/
|
|
248 |
void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation)
|
|
249 |
{
|
43
|
250 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY );
|
39
|
251 |
OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML,
|
|
252 |
"WlanWizardPageScanning::loadDocml - orientation ;orientation=%x",
|
|
253 |
( TUint )( orientation ) );
|
|
254 |
|
|
255 |
WlanWizardPageInternal::loadDocmlSection(
|
|
256 |
mLoader,
|
|
257 |
orientation,
|
|
258 |
":/docml/occ_add_wlan_06.docml",
|
|
259 |
"portrait_section",
|
|
260 |
"landscape_section");
|
43
|
261 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT );
|
39
|
262 |
}
|
|
263 |
|
|
264 |
/*!
|
|
265 |
* Checks whether the view is active. If it is, execute wlanScanApReady. If
|
|
266 |
* not, set mScanResultsAvailable to true.
|
|
267 |
* @param [in] scanStatus indicates whether the scan was succesful, cancelled of
|
|
268 |
* failed. The argument is saved to a member variable.
|
|
269 |
*/
|
|
270 |
void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus)
|
|
271 |
{
|
43
|
272 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY );
|
39
|
273 |
mScanStatus = scanStatus;
|
|
274 |
|
|
275 |
if (!mWidget) {
|
|
276 |
OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
|
|
277 |
"WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x",
|
|
278 |
this );
|
|
279 |
|
|
280 |
mScanResultsAvailable = true;
|
|
281 |
} else {
|
|
282 |
if (mWizard->isCurrentPage(mWidget)) {
|
|
283 |
OstTrace0( TRACE_BORDER,
|
|
284 |
DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
|
|
285 |
"WlanWizardPageScanning::wlanScanResultPreCheck go to results");
|
|
286 |
|
|
287 |
wlanScanApReady();
|
|
288 |
} else {
|
|
289 |
OstTrace0( TRACE_BORDER,
|
|
290 |
DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
|
|
291 |
"WlanWizardPageScanning::wlanScanResultPreCheck"
|
|
292 |
" not current widget" );
|
|
293 |
|
|
294 |
mScanResultsAvailable = true;
|
|
295 |
}
|
|
296 |
}
|
43
|
297 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT );
|
39
|
298 |
}
|
|
299 |
|
|
300 |
/*!
|
|
301 |
* Processes the direct scan results.
|
|
302 |
* @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.
|
|
304 |
*/
|
|
305 |
void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus)
|
|
306 |
{
|
43
|
307 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY );
|
39
|
308 |
OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY,
|
|
309 |
"WlanWizardPageScanning::wlanScanDirectReady" );
|
|
310 |
|
|
311 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
312 |
|
|
313 |
Q_ASSERT(utils);
|
|
314 |
|
|
315 |
QList<WlanScanResult> filteredResults;
|
|
316 |
|
|
317 |
if (scanStatus == WlanQtUtils::ScanStatusOk) {
|
|
318 |
QList<QSharedPointer<WlanQtUtilsAp> > directScanResults;
|
|
319 |
// Read the directed scan results from Qt Utils
|
|
320 |
utils->availableWlanAps(directScanResults);
|
|
321 |
|
|
322 |
// Identify open and hidden networks.
|
|
323 |
getFinalScanResults(directScanResults, mWlanApList, filteredResults);
|
|
324 |
}
|
|
325 |
|
|
326 |
// Process the scan results. If scan status is not ok, feed an empty
|
|
327 |
// result table to the selection function.
|
|
328 |
selectNextPageActions(filteredResults);
|
43
|
329 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT );
|
39
|
330 |
}
|
|
331 |
|
|
332 |
/*!
|
|
333 |
* 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
|
|
335 |
* scan was succesful, canceled or failed. In case the scan was not succesful,
|
|
336 |
* always proceed to manual wizard.
|
|
337 |
*/
|
|
338 |
void WlanWizardPageScanning::wlanScanApReady()
|
|
339 |
{
|
43
|
340 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY );
|
39
|
341 |
OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY,
|
|
342 |
"WlanWizardPageScanning::wlanScanApReady" );
|
|
343 |
|
|
344 |
if (mScanStatus == WlanQtUtils::ScanStatusOk) {
|
|
345 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
346 |
Q_ASSERT(utils);
|
|
347 |
|
|
348 |
QList<QSharedPointer<WlanQtUtilsAp> > openScanResults;
|
|
349 |
|
|
350 |
// Fetch the list of scan results.
|
|
351 |
utils->availableWlanAps(openScanResults);
|
|
352 |
|
|
353 |
// The name of the network that we are looking for.
|
|
354 |
QString ssid =
|
|
355 |
mWizard->configuration(WlanWizardPrivate::ConfSsid).toString();
|
|
356 |
|
|
357 |
// Store matching scan results.
|
|
358 |
getSsidMatchList(ssid, openScanResults);
|
|
359 |
|
|
360 |
// Next directed scan.
|
|
361 |
utils->scanWlanDirect(ssid);
|
|
362 |
}
|
|
363 |
else {
|
|
364 |
mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
|
|
365 |
mNextPageId = WlanWizardPageInternal::PageNetworkMode;
|
|
366 |
mWizard->nextPage();
|
|
367 |
}
|
43
|
368 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_EXIT );
|
39
|
369 |
}
|
|
370 |
|
|
371 |
/*!
|
|
372 |
* This function stores all the APs that match ssid parameter to mWlanApList
|
|
373 |
* member list.
|
|
374 |
* @param [in] ssid is the name of the network we are interested in.
|
|
375 |
* @param [in] matchList is the list of all APs that were revealed in the scan.
|
|
376 |
*/
|
|
377 |
void WlanWizardPageScanning::getSsidMatchList(
|
|
378 |
QString ssid,
|
|
379 |
const QList<QSharedPointer<WlanQtUtilsAp> > &matchList)
|
|
380 |
{
|
43
|
381 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY );
|
39
|
382 |
mWlanApList.clear();
|
|
383 |
QSharedPointer<WlanQtUtilsAp> item;
|
|
384 |
|
|
385 |
for (int i = 0; i < matchList.size(); i++) {
|
|
386 |
item = matchList.at(i);
|
|
387 |
if (item->value(WlanQtUtilsAp::ConfIdSsid).toString() == ssid) {
|
|
388 |
mWlanApList.append(item);
|
|
389 |
}
|
|
390 |
}
|
43
|
391 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT );
|
39
|
392 |
}
|
|
393 |
|
|
394 |
/*
|
|
395 |
* Find out which of the direct scan results are open networks by comparing
|
|
396 |
* result to open scan results. Return finalResults.
|
|
397 |
* @param [in] directScanResults are the results of a directed scan.
|
|
398 |
* @param [in] openScanResults are the results of a scan inquiring any APs.
|
|
399 |
* @param [out] finalResults is a list of APs with visibility flag included.
|
|
400 |
*/
|
|
401 |
void WlanWizardPageScanning::getFinalScanResults(
|
|
402 |
const QList<QSharedPointer<WlanQtUtilsAp> > &directScanResults,
|
|
403 |
const QList<QSharedPointer<WlanQtUtilsAp> > &openScanResults,
|
|
404 |
QList<WlanScanResult> &finalResults)
|
|
405 |
{
|
43
|
406 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY );
|
39
|
407 |
finalResults.clear();
|
|
408 |
|
|
409 |
// The key assumption of this algorithm is that both direct and public scan
|
|
410 |
// reveal the same set of AP:s with the exception of hidden AP:s.
|
|
411 |
// In other words: Direct scan result set is the whole set with each AP
|
|
412 |
// marked as hidden by default. If an AP has been revealed also by public
|
|
413 |
// scan, it is changed to visible.
|
|
414 |
for (int i = 0; i < directScanResults.size(); i++) {
|
|
415 |
WlanScanResult resultItem;
|
|
416 |
|
|
417 |
resultItem.scanResult = directScanResults.at(i);
|
|
418 |
|
|
419 |
// Initialize as hidden.
|
|
420 |
resultItem.networkHidden = true;
|
|
421 |
|
|
422 |
for (int j = 0; j < openScanResults.size(); j++) {
|
|
423 |
if (WlanQtUtilsAp::compare(
|
|
424 |
openScanResults.at(j).data(),
|
|
425 |
directScanResults.at(i).data()) == 0) {
|
|
426 |
// Mark open, if a public scan revealed the same AP
|
|
427 |
resultItem.networkHidden = false;
|
|
428 |
}
|
|
429 |
}
|
|
430 |
|
|
431 |
finalResults.append(resultItem);
|
|
432 |
}
|
43
|
433 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_EXIT );
|
39
|
434 |
}
|
|
435 |
|
|
436 |
/*!
|
|
437 |
* This function processes the scan results in case multiple results were
|
|
438 |
* acquired with matching SSIDs.
|
|
439 |
* @param [in] finalResults is the list of APs revealed by the last scans.
|
|
440 |
* @return the identifier of the next page.
|
|
441 |
*/
|
|
442 |
int WlanWizardPageScanning::processMultipleScanResults(
|
|
443 |
const QList<WlanScanResult> &finalResults)
|
|
444 |
{
|
43
|
445 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_ENTRY );
|
39
|
446 |
WlanWizardScanList networkOptions;
|
|
447 |
int nextPage;
|
|
448 |
|
|
449 |
// Build the list of results to be placed in the configuration.
|
|
450 |
networkOptions.build(finalResults);
|
|
451 |
|
|
452 |
QVariant tmp;
|
|
453 |
tmp.setValue(networkOptions);
|
|
454 |
|
|
455 |
mWizard->setConfiguration(
|
|
456 |
WlanWizardHelper::ConfAvailableNetworkOptions, tmp);
|
|
457 |
|
43
|
458 |
if (networkOptions.wpsSelected()) {
|
|
459 |
// In case all available network mode options support wps, go directly
|
|
460 |
// to wps-wizard.
|
|
461 |
nextPage = WlanWizardPageInternal::PageWpsStart;
|
|
462 |
} else if (networkOptions.netModes() > SingleResult) {
|
|
463 |
// If there are more than one network mode choices, go to manual selection
|
|
464 |
// of network mode.
|
39
|
465 |
nextPage = WlanWizardPageInternal::PageNetworkMode;
|
|
466 |
} else {
|
|
467 |
// if only a single network mode option is available, the mode query
|
|
468 |
// may be skipped and the next page is set to security mode query.
|
|
469 |
WlanNetworkSetting setting = networkOptions.getNetModes().at(0);
|
|
470 |
mWizard->setConfiguration(WlanWizardHelper::ConfNetworkMode, setting.mode);
|
|
471 |
mWizard->setConfiguration(WlanWizardHelper::ConfHiddenWlan, setting.hidden);
|
43
|
472 |
mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported);
|
39
|
473 |
nextPage = WlanWizardPageInternal::PageNetworkSecurity;
|
|
474 |
}
|
|
475 |
|
43
|
476 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT );
|
39
|
477 |
return nextPage;
|
|
478 |
}
|
|
479 |
|
|
480 |
/*!
|
|
481 |
* This function decides what to do with the scan results.
|
|
482 |
* @param [in] finalResults is the list of APs revealed by the last scans.
|
|
483 |
*/
|
|
484 |
void WlanWizardPageScanning::selectNextPageActions(
|
|
485 |
const QList<WlanScanResult> &finalResults)
|
|
486 |
{
|
43
|
487 |
OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY );
|
39
|
488 |
mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
|
|
489 |
|
|
490 |
if (finalResults.isEmpty()) {
|
|
491 |
// In case of no results at all were found.
|
|
492 |
mNextPageId = WlanWizardPageInternal::PageNetworkMode;
|
|
493 |
} else if (finalResults.size() == SingleResult) {
|
|
494 |
// In case there is only a single result.
|
|
495 |
WlanScanResult item = finalResults.first();
|
|
496 |
mNextPageId = mWizard->getNextPageId(
|
|
497 |
item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toString(),
|
|
498 |
item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(),
|
|
499 |
item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(),
|
|
500 |
item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(),
|
|
501 |
item.networkHidden,
|
|
502 |
item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool());
|
|
503 |
} else {
|
|
504 |
// In case more than one result is available.
|
|
505 |
mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, true);
|
|
506 |
mNextPageId = processMultipleScanResults(finalResults);
|
|
507 |
}
|
|
508 |
|
|
509 |
mWizard->nextPage();
|
43
|
510 |
OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_EXIT );
|
39
|
511 |
}
|