39
|
1 |
/*
|
|
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 Login engine class implementation
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <QObject>
|
|
21 |
#include <QString>
|
|
22 |
#include <QUrl>
|
|
23 |
#include <HbMessagebox>
|
|
24 |
#include <HbAction>
|
|
25 |
#include <qnetworkconfigmanager.h>
|
|
26 |
#include <qnetworkconfiguration.h>
|
|
27 |
#include <qnetworksession.h>
|
61
|
28 |
#include <apgtask.h>
|
39
|
29 |
|
|
30 |
//User includes
|
|
31 |
#include "wlanloginengine.h"
|
|
32 |
#include "wlanloginapplication.h"
|
|
33 |
#include "wlanloginmainwindow.h"
|
|
34 |
#include "ictsqtwrapper.h"
|
|
35 |
#include "wlanloginnetworkaccessmanager.h"
|
|
36 |
|
|
37 |
#include "OstTraceDefinitions.h"
|
|
38 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
39 |
#include "wlanloginengineTraces.h"
|
|
40 |
#endif
|
|
41 |
|
|
42 |
/*!
|
|
43 |
\class WlanLoginEngine
|
|
44 |
\brief WLAN Login engine class implementation.
|
|
45 |
*/
|
|
46 |
|
|
47 |
// External function prototypes
|
|
48 |
|
|
49 |
// Local constants
|
43
|
50 |
const QString iapIdentifierPrefix = "I_";
|
39
|
51 |
|
|
52 |
// ======== LOCAL FUNCTIONS ========
|
|
53 |
|
|
54 |
// ======== MEMBER FUNCTIONS ========
|
|
55 |
|
|
56 |
/*!
|
|
57 |
Constructor.
|
|
58 |
*/
|
|
59 |
WlanLoginEngine::WlanLoginEngine(QObject *parent):
|
|
60 |
QObject(parent),
|
|
61 |
mEngineState(WaitingForStart),
|
53
|
62 |
mStartRequestCompleted(false),
|
39
|
63 |
mNetConfigurationManager(new QNetworkConfigurationManager(this)),
|
|
64 |
mNetworkAccessManager(new WlanLoginNetworkAccessManager(this)),
|
|
65 |
mNetworkSession(NULL),
|
|
66 |
mIctsWrapper(NULL),
|
|
67 |
mIctsFirstRun(true),
|
|
68 |
mIap(0),
|
|
69 |
mNetId(0),
|
|
70 |
mRedirectionUrl(QUrl(""))
|
|
71 |
{
|
|
72 |
OstTraceFunctionEntry0(WLANLOGINENGINE_WLANLOGINENGINE_ENTRY);
|
|
73 |
|
|
74 |
bool connectStatus = connect(
|
|
75 |
mNetConfigurationManager,
|
|
76 |
SIGNAL(updateCompleted()),
|
|
77 |
this,
|
|
78 |
SLOT(handleUpdateCompleted()));
|
|
79 |
Q_ASSERT(connectStatus == true);
|
|
80 |
|
|
81 |
OstTraceFunctionExit0(WLANLOGINENGINE_WLANLOGINENGINE_EXIT);
|
|
82 |
}
|
|
83 |
|
|
84 |
|
|
85 |
/*!
|
|
86 |
Destructor.
|
|
87 |
*/
|
|
88 |
WlanLoginEngine::~WlanLoginEngine()
|
|
89 |
{
|
|
90 |
OstTraceFunctionEntry0(WLANLOGINENGINE_DESTRUCTOR_ENTRY);
|
43
|
91 |
|
|
92 |
if (mNetworkSession) {
|
|
93 |
mNetworkSession->close();
|
|
94 |
}
|
39
|
95 |
|
|
96 |
OstTraceFunctionExit0(WLANLOGINENGINE_DESTRUCTOR_EXIT);
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
/*!
|
|
101 |
Function that returns pointer to network access manager.
|
|
102 |
|
|
103 |
@return Pointer to WlanLoginNetworkAccessManager
|
|
104 |
*/
|
|
105 |
WlanLoginNetworkAccessManager* WlanLoginEngine::networkAccessManager() const
|
|
106 |
{
|
53
|
107 |
OstTraceFunctionEntry0(WLANLOGINENGINE_NETWORKACCESSMANAGER_ENTRY);
|
|
108 |
OstTraceFunctionExit0(WLANLOGINENGINE_NETWORKACCESSMANAGER_EXIT);
|
|
109 |
|
39
|
110 |
return mNetworkAccessManager;
|
53
|
111 |
|
39
|
112 |
}
|
|
113 |
|
|
114 |
|
|
115 |
/*!
|
|
116 |
Function that returns current state of the engine.
|
|
117 |
|
|
118 |
@return engine state
|
|
119 |
*/
|
|
120 |
WlanLoginEngine::EngineState WlanLoginEngine::engineState()
|
|
121 |
{
|
53
|
122 |
OstTraceFunctionEntry0(WLANLOGINENGINE_ENGINESTATE_ENTRY);
|
|
123 |
OstTraceFunctionExit0(WLANLOGINENGINE_ENGINESTATE_EXIT);
|
|
124 |
|
|
125 |
return mEngineState;
|
39
|
126 |
}
|
|
127 |
|
|
128 |
|
|
129 |
/*!
|
|
130 |
Function that sets the current state of the engine.
|
|
131 |
|
|
132 |
@param [in] newState New state of the engine to be set
|
|
133 |
*/
|
|
134 |
void WlanLoginEngine::setEngineState(WlanLoginEngine::EngineState newState)
|
|
135 |
{
|
53
|
136 |
OstTraceFunctionEntry0(WLANLOGINENGINE_SETENGINESTATE_ENTRY);
|
|
137 |
|
39
|
138 |
mEngineState = newState;
|
53
|
139 |
OstTrace1(
|
|
140 |
TRACE_NORMAL,
|
|
141 |
WLANLOGINENGINE_SETENGINESTATE_STATE_TRACE,
|
|
142 |
"WlanLoginEngine::setEngineState;mEngineState=%d",
|
|
143 |
mEngineState);
|
|
144 |
|
|
145 |
OstTraceFunctionExit0(WLANLOGINENGINE_SETENGINESTATE_EXIT);
|
39
|
146 |
}
|
|
147 |
|
61
|
148 |
/*!
|
|
149 |
Function that brings WLAN Sniffer to foreground
|
|
150 |
|
|
151 |
@param [in] newState New state of the engine to be set
|
|
152 |
*/
|
|
153 |
bool WlanLoginEngine::bringSnifferToForeground()
|
|
154 |
{
|
|
155 |
OstTraceFunctionEntry0(WLANLOGINENGINE_BRINGSNIFFERTOFOREGROUND_ENTRY);
|
|
156 |
|
|
157 |
bool retVal = false;
|
|
158 |
RWsSession wsSession;
|
|
159 |
|
|
160 |
if(KErrNone != wsSession.Connect()){
|
|
161 |
OstTrace0(TRACE_NORMAL,
|
|
162 |
WLANLOGINENGINE_BRINGSNIFFERTOFOREGROUND_WS_SESSION_FAILED,
|
|
163 |
"WARNING: Session could not be opened to Window server");
|
|
164 |
|
|
165 |
} else {
|
|
166 |
TApaTaskList taskList(wsSession);
|
|
167 |
//Find WLAN Sniffer's task by using it's UID as reference
|
|
168 |
TApaTask task = taskList.FindApp(TUid::Uid(0x10281CAA));
|
|
169 |
|
|
170 |
if(task.Exists())
|
|
171 |
{
|
|
172 |
task.BringToForeground();
|
|
173 |
retVal = true;
|
|
174 |
} else {
|
|
175 |
OstTrace0(TRACE_NORMAL,
|
|
176 |
WLANLOGINENGINE_BRINGSNIFFERTOFOREGROUND_TASK_NOT_FOUND,
|
|
177 |
"WARNING: WLAN Sniffer was not found from the task list");
|
|
178 |
}
|
|
179 |
wsSession.Close();
|
|
180 |
}
|
|
181 |
OstTraceFunctionExit0(WLANLOGINENGINE_BRINGSNIFFERTOFOREGROUND_EXIT);
|
|
182 |
|
|
183 |
return retVal;
|
|
184 |
}
|
|
185 |
|
39
|
186 |
|
|
187 |
/*!
|
|
188 |
This slot handles startLogin signal from Qt Highway service provider
|
|
189 |
|
|
190 |
@param [in] iapId Internet access point ID for a connection that we should attach to'
|
|
191 |
@param [in] netId Network Id for the connection to be used
|
|
192 |
@param [in] redirectionUrl The URL that we were redirected to by the first internet connectivity test
|
|
193 |
|
|
194 |
*/
|
|
195 |
void WlanLoginEngine::handleStartLogin(int iapId, int netId, QUrl redirectionUrl)
|
|
196 |
{
|
|
197 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTARTLOGIN_ENTRY);
|
|
198 |
|
|
199 |
mIap = iapId;
|
|
200 |
OstTrace1(
|
|
201 |
TRACE_NORMAL,
|
|
202 |
WLANLOGINENGINE_HANDLESTARTLOGIN_IAP_TRACE,
|
|
203 |
"WlanLoginEngine::handleStartLogin;mIap=%d",
|
|
204 |
mIap);
|
|
205 |
|
|
206 |
mNetId = netId;
|
|
207 |
OstTrace1(
|
|
208 |
TRACE_NORMAL,
|
|
209 |
WLANLOGINENGINE_HANDLESTARTLOGIN_NETID_TRACE,
|
|
210 |
"WlanLoginEngine::handleStartLogin;mNetId=%d",
|
|
211 |
mNetId);
|
|
212 |
|
|
213 |
mRedirectionUrl = redirectionUrl;
|
|
214 |
|
|
215 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
216 |
QString url = mRedirectionUrl.toString();
|
|
217 |
TPtrC tmp(url.utf16(),url.length() );
|
|
218 |
|
|
219 |
OstTraceExt1(
|
|
220 |
TRACE_NORMAL,
|
|
221 |
WLANLOGINENGINE_HANDLESTARTLOGIN_URL_TRACE,
|
|
222 |
"WlanLoginEngine::handleStartLogin;mRedirectionUrl=%S",
|
|
223 |
tmp);
|
|
224 |
#endif
|
|
225 |
|
|
226 |
//Create ICTS instance as we know needed parameters now
|
|
227 |
mIctsWrapper = new IctsWrapper(mIap, mNetId, this);
|
|
228 |
|
|
229 |
bool connectStatus = connect(
|
|
230 |
mIctsWrapper,
|
|
231 |
SIGNAL(connectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl)),
|
|
232 |
this,
|
|
233 |
SLOT(handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl)));
|
|
234 |
Q_ASSERT(connectStatus == true);
|
|
235 |
|
|
236 |
//Update network configurations as only states of the cellular IAP's are reliable
|
|
237 |
//after creating network configuration manager
|
|
238 |
|
|
239 |
setEngineState(UpdatingNetworkConfigurations);
|
|
240 |
mNetConfigurationManager->updateConfigurations();
|
|
241 |
|
|
242 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTARTLOGIN_EXIT);
|
|
243 |
}
|
|
244 |
|
|
245 |
/*!
|
|
246 |
This slot handles stopLogin signal from Qt Highway service provider
|
|
247 |
|
|
248 |
*/
|
|
249 |
void WlanLoginEngine::handleStopLogin()
|
|
250 |
{
|
|
251 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTOPLOGIN_ENTRY);
|
|
252 |
|
|
253 |
// Exit application
|
|
254 |
qApp->quit();
|
|
255 |
|
|
256 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTOPLOGIN_EXIT);
|
|
257 |
}
|
|
258 |
|
|
259 |
|
|
260 |
/*!
|
|
261 |
This slot handles updateCompleted signal from QNetworkConfigManager
|
|
262 |
|
|
263 |
*/
|
|
264 |
void WlanLoginEngine::handleUpdateCompleted()
|
|
265 |
{
|
|
266 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEUPDATECOMPLETED_ENTRY);
|
|
267 |
|
|
268 |
//States of the available configurations are now updated and
|
|
269 |
//we can open the network session to provided IAP
|
|
270 |
|
53
|
271 |
//Check that cancel has not been pressed
|
|
272 |
if (engineState() != WaitingForStopRequest) {
|
|
273 |
openSession();
|
|
274 |
}
|
|
275 |
|
39
|
276 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLEUPDATECOMPLETED_EXIT);
|
|
277 |
}
|
|
278 |
|
|
279 |
/*!
|
|
280 |
This function handles opening of the network session to the specified IAP.
|
|
281 |
If IAP is not already in connected state, function completes service request
|
|
282 |
with connection dropped status and show a message box to user.
|
|
283 |
|
|
284 |
*/
|
|
285 |
void WlanLoginEngine::openSession()
|
|
286 |
{
|
|
287 |
OstTraceFunctionEntry0(WLANLOGINENGINE_OPENSESSION_ENTRY);
|
|
288 |
|
|
289 |
setEngineState(WlanLoginEngine::OpeningNetworkSession);
|
|
290 |
|
|
291 |
//Get configuration that matches the provided IAP
|
43
|
292 |
//Note that identifier must be given in format I_ + IAP ID
|
|
293 |
QNetworkConfiguration netConfiguration = mNetConfigurationManager->configurationFromIdentifier(iapIdentifierPrefix + QString::number(mIap));
|
39
|
294 |
|
|
295 |
OstTrace1(
|
|
296 |
TRACE_NORMAL,
|
|
297 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_IDENTIFIER_TRACE,
|
|
298 |
"WlanLoginEngine::openSession;netConfiguration identifier=%d",
|
|
299 |
netConfiguration.identifier().toInt());
|
|
300 |
|
|
301 |
OstTrace1(TRACE_NORMAL,
|
|
302 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_STATE_TRACE,
|
|
303 |
"WlanLoginEngine::openSession;netConfiguration state=%d",
|
|
304 |
netConfiguration.state());
|
|
305 |
|
|
306 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
307 |
QString string = netConfiguration.name();
|
|
308 |
TPtrC tmp(string.utf16(),string.length() );
|
|
309 |
|
|
310 |
OstTraceExt1(
|
|
311 |
TRACE_NORMAL,
|
|
312 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_NAME_TRACE,
|
|
313 |
"WlanLoginEngine::openSession;netConfiguration name=%S",
|
|
314 |
tmp );
|
|
315 |
|
|
316 |
string = netConfiguration.bearerName();
|
|
317 |
tmp.Set(string.utf16(),string.length());
|
|
318 |
|
|
319 |
OstTraceExt1(
|
|
320 |
TRACE_NORMAL,
|
|
321 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_BEARER_NAME_TRACE,
|
|
322 |
"WlanLoginEngine::openSession;netConfiguration bearerName=%S",
|
|
323 |
tmp );
|
|
324 |
#endif
|
|
325 |
|
|
326 |
//Check that configuration state is active before opening session
|
|
327 |
//Otherwise show disconnected message box
|
|
328 |
|
|
329 |
if (netConfiguration.state() == QNetworkConfiguration::Active)
|
|
330 |
{
|
|
331 |
//Create network session to IAP that was provided in startup
|
|
332 |
mNetworkSession = new QNetworkSession(netConfiguration, this);
|
|
333 |
|
|
334 |
bool connectStatus = connect(
|
|
335 |
mNetworkSession,
|
|
336 |
SIGNAL(opened()),
|
|
337 |
this,
|
|
338 |
SLOT(handleSessionOpened()));
|
|
339 |
Q_ASSERT(connectStatus == true);
|
|
340 |
|
|
341 |
connectStatus = connect(
|
|
342 |
mNetworkSession,
|
|
343 |
SIGNAL(stateChanged(QNetworkSession::State)),
|
|
344 |
this,
|
|
345 |
SLOT(handleSessionStateChanged(QNetworkSession::State)));
|
|
346 |
Q_ASSERT(connectStatus == true);
|
|
347 |
|
|
348 |
connectStatus = connect(
|
|
349 |
mNetworkSession,
|
|
350 |
SIGNAL(error(QNetworkSession::SessionError)),
|
|
351 |
this,
|
|
352 |
SLOT(handleSessionError(QNetworkSession::SessionError)));
|
|
353 |
Q_ASSERT(connectStatus == true);
|
|
354 |
|
|
355 |
mNetworkSession->open();
|
|
356 |
} else {
|
|
357 |
showConnectionDroppedMessageBox();
|
|
358 |
}
|
|
359 |
|
|
360 |
OstTraceFunctionExit0(WLANLOGINENGINE_OPENSESSION_EXIT);
|
|
361 |
}
|
|
362 |
|
|
363 |
|
|
364 |
/*!
|
|
365 |
This function handles sessionOpened signal from QNetworkSession. It informs view that
|
|
366 |
connection is ready to be used.
|
|
367 |
|
|
368 |
*/
|
|
369 |
void WlanLoginEngine::handleSessionOpened()
|
|
370 |
{
|
|
371 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONOPENED_ENTRY);
|
|
372 |
|
53
|
373 |
//Check that cancel has not been pressed
|
|
374 |
if (engineState() != WaitingForStopRequest) {
|
|
375 |
setEngineState(NetworkSessionOpened);
|
|
376 |
//Send indication to view that connection is ready
|
|
377 |
emit connectionReady(mRedirectionUrl);
|
|
378 |
}
|
39
|
379 |
|
|
380 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONOPENED_EXIT);
|
|
381 |
}
|
|
382 |
|
|
383 |
|
|
384 |
/*!
|
|
385 |
This function handles sessionStateChanged signal from QNetworkSession.
|
|
386 |
@param [in] newState New state of the session
|
|
387 |
*/
|
|
388 |
void WlanLoginEngine::handleSessionStateChanged(QNetworkSession::State newState)
|
|
389 |
{
|
|
390 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_ENTRY);
|
|
391 |
|
|
392 |
OstTrace1(
|
|
393 |
TRACE_NORMAL,
|
|
394 |
WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_STATE_TRACE,
|
|
395 |
"WlanLoginEngine::handleSessionStateChanged;newState=%d",
|
|
396 |
newState );
|
|
397 |
|
|
398 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_EXIT);
|
|
399 |
}
|
|
400 |
|
|
401 |
|
|
402 |
/*!
|
|
403 |
This function handles sessionError signal from QNetworkSession
|
|
404 |
@param [in] error session error
|
|
405 |
*/
|
|
406 |
void WlanLoginEngine::handleSessionError(QNetworkSession::SessionError error)
|
|
407 |
{
|
|
408 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONERROR_ENTRY);
|
|
409 |
|
|
410 |
OstTrace1(
|
|
411 |
TRACE_NORMAL,
|
|
412 |
WLANLOGINENGINE_SESSION_ERROR_TRACE,
|
|
413 |
"WlanLoginEngine::handleSessionError;error=%d",
|
|
414 |
error);
|
|
415 |
|
|
416 |
switch (engineState()) {
|
|
417 |
case OpeningNetworkSession:
|
|
418 |
showConnectionDroppedMessageBox();
|
|
419 |
break;
|
|
420 |
|
|
421 |
case NetworkSessionOpened:
|
53
|
422 |
case IctsOk:
|
|
423 |
case IctsFailed:
|
39
|
424 |
if (error == QNetworkSession::SessionAbortedError ) {
|
|
425 |
showConnectionDroppedMessageBox();
|
|
426 |
}
|
|
427 |
break;
|
|
428 |
|
|
429 |
case RunningIcts:
|
|
430 |
if (error == QNetworkSession::SessionAbortedError ) {
|
|
431 |
stopIcts();
|
|
432 |
showConnectionDroppedMessageBox();
|
|
433 |
}
|
|
434 |
break;
|
|
435 |
|
|
436 |
default:
|
|
437 |
break;
|
|
438 |
}
|
|
439 |
|
|
440 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONERROR_EXIT);
|
|
441 |
}
|
|
442 |
|
|
443 |
/*!
|
|
444 |
This function handles startIcts signal and starts connectivity test in polling mode
|
|
445 |
|
|
446 |
*/
|
|
447 |
void WlanLoginEngine::handleStartIcts()
|
|
448 |
{
|
|
449 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTARTICTS_ENTRY);
|
|
450 |
|
|
451 |
if (!mIctsWrapper->isPolling()) {
|
|
452 |
setEngineState(RunningIcts);
|
|
453 |
mIctsWrapper->startPolling(totalPollingTime, pollingInterval);
|
|
454 |
}
|
|
455 |
|
|
456 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTARTICTS_EXIT);
|
|
457 |
}
|
|
458 |
|
|
459 |
/*!
|
|
460 |
This function stops internet connectivity test
|
|
461 |
|
|
462 |
*/
|
|
463 |
void WlanLoginEngine::stopIcts()
|
|
464 |
{
|
|
465 |
OstTraceFunctionEntry0(WLANLOGINENGINE_STOPICTS_ENTRY);
|
|
466 |
|
|
467 |
if (mIctsWrapper->isPolling()) {
|
|
468 |
mIctsWrapper->stopPolling();
|
|
469 |
}
|
|
470 |
|
|
471 |
OstTraceFunctionExit0(WLANLOGINENGINE_STOPICTS_EXIT);
|
|
472 |
}
|
|
473 |
|
|
474 |
/*!
|
|
475 |
This slot handles connectivityTestResult signal from ICTS wrapper
|
|
476 |
@param [in] result Result of the internet connectivity test
|
|
477 |
@param [in] redirectionUrl The URL that we are being redirected, valid only if result is HttpAuthenticationNeeded
|
|
478 |
*/
|
|
479 |
|
|
480 |
void WlanLoginEngine::handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl)
|
|
481 |
{
|
|
482 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_ENTRY);
|
|
483 |
|
|
484 |
Q_UNUSED(redirectUrl);
|
|
485 |
|
|
486 |
mIctsFirstRun = false;
|
|
487 |
|
|
488 |
if (result == IctsWrapper::ConnectionOk){
|
53
|
489 |
setEngineState(IctsOk);
|
39
|
490 |
emit ictsOk();
|
53
|
491 |
} else {
|
|
492 |
setEngineState(IctsFailed);
|
39
|
493 |
}
|
|
494 |
|
|
495 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_EXIT);
|
|
496 |
}
|
|
497 |
|
|
498 |
/*!
|
|
499 |
This slot handles cancelTriggered signal from the view
|
|
500 |
|
|
501 |
*/
|
|
502 |
void WlanLoginEngine::handleCancelTriggered()
|
|
503 |
{
|
|
504 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_ENTRY);
|
|
505 |
|
53
|
506 |
//Check if Qt Highway request is completed
|
61
|
507 |
if (mStartRequestCompleted == false) {
|
53
|
508 |
|
61
|
509 |
if (!bringSnifferToForeground()) {
|
|
510 |
//WLAN Sniffer was not found so make exit as there is nobody to close us
|
|
511 |
qApp->exit();
|
|
512 |
}
|
|
513 |
|
53
|
514 |
switch (engineState()) {
|
|
515 |
|
|
516 |
case UpdatingNetworkConfigurations:
|
|
517 |
case OpeningNetworkSession:
|
|
518 |
case NetworkSessionOpened:
|
|
519 |
setEngineState(WaitingForStopRequest);
|
|
520 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel);
|
|
521 |
break;
|
|
522 |
|
|
523 |
case RunningIcts:
|
|
524 |
stopIcts();
|
|
525 |
setEngineState(WaitingForStopRequest);
|
|
526 |
if (mIctsFirstRun) {
|
|
527 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel);
|
|
528 |
} else {
|
|
529 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed);
|
|
530 |
}
|
|
531 |
break;
|
|
532 |
|
|
533 |
case IctsFailed:
|
|
534 |
setEngineState(WaitingForStopRequest);
|
|
535 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed);
|
|
536 |
break;
|
|
537 |
|
|
538 |
default:
|
|
539 |
break;
|
|
540 |
}
|
39
|
541 |
} else {
|
53
|
542 |
//Check race condition
|
|
543 |
if(engineState() != WaitingForStopRequest) {
|
|
544 |
qApp->exit();
|
|
545 |
}
|
39
|
546 |
}
|
|
547 |
|
|
548 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_EXIT);
|
|
549 |
}
|
|
550 |
|
|
551 |
/*!
|
|
552 |
This slot handles nextTriggered signal from the view
|
|
553 |
|
|
554 |
*/
|
|
555 |
void WlanLoginEngine::handleNextTriggered()
|
|
556 |
{
|
|
557 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_ENTRY);
|
53
|
558 |
|
61
|
559 |
if (mStartRequestCompleted == false ) {
|
|
560 |
if (bringSnifferToForeground()) {
|
|
561 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusNext);
|
|
562 |
} else {
|
|
563 |
qApp->exit();
|
|
564 |
}
|
|
565 |
} else {
|
|
566 |
//put application to background:
|
|
567 |
WlanLoginApplication* app = static_cast<WlanLoginApplication *>(this->parent());
|
|
568 |
app->mainWindow()->lower();
|
53
|
569 |
}
|
39
|
570 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_EXIT);
|
|
571 |
}
|
|
572 |
|
61
|
573 |
|
39
|
574 |
/*!
|
|
575 |
This function shows connection dropped message box to the user
|
|
576 |
|
|
577 |
*/
|
|
578 |
void WlanLoginEngine::showConnectionDroppedMessageBox()
|
|
579 |
{
|
|
580 |
OstTraceFunctionEntry0(WLANLOGINENGINE_SHOWCONNECTIONDROPPEDMESSAGEBOX_ENTRY);
|
|
581 |
|
|
582 |
HbMessageBox *messageBox = new HbMessageBox(hbTrId("txt_occ_info_wlan_connection_closed_login_applica"));
|
|
583 |
messageBox->setAttribute(Qt::WA_DeleteOnClose);
|
|
584 |
messageBox->setTimeout(messageBoxTimeout);
|
|
585 |
messageBox->open(this,SLOT(connectionDroppedMessageBoxClosed(HbAction*)));
|
|
586 |
|
|
587 |
OstTraceFunctionExit0(WLANLOGINENGINE_SHOWCONNECTIONDROPPEDMESSAGEBOX_EXIT);
|
|
588 |
}
|
|
589 |
|
|
590 |
void WlanLoginEngine::connectionDroppedMessageBoxClosed(HbAction* action)
|
|
591 |
{
|
|
592 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_ENTRY);
|
|
593 |
|
|
594 |
Q_UNUSED(action);
|
|
595 |
|
53
|
596 |
if (mStartRequestCompleted == false ) {
|
39
|
597 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusConnectionDropped);
|
|
598 |
|
|
599 |
} else {
|
|
600 |
//If Qt Highway service request is already completed when connection drops, we have to make exit by our own
|
|
601 |
qApp->exit();
|
|
602 |
}
|
|
603 |
|
53
|
604 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_EXIT);
|
39
|
605 |
}
|
|
606 |
|
|
607 |
/*!
|
|
608 |
This function completes Qt Highway service request
|
|
609 |
@param [in] status completeing status of the service request
|
|
610 |
*/
|
|
611 |
void WlanLoginEngine::emitCompleteServiceRequest(WlanLoginService::WlanLoginStatus status )
|
|
612 |
{
|
|
613 |
OstTraceFunctionEntry0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_ENTRY);
|
|
614 |
|
53
|
615 |
mStartRequestCompleted = true;
|
39
|
616 |
OstTrace1(
|
|
617 |
TRACE_BORDER,
|
|
618 |
WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EMIT_TRACE,
|
|
619 |
"WlanLoginEngine::emitCompleteServiceRequest with status:;status=%d",
|
|
620 |
status);
|
|
621 |
emit completeServiceRequest(status);
|
|
622 |
|
|
623 |
OstTraceFunctionExit0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EXIT);
|
|
624 |
}
|