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 Wizard Plugin API: Service required from the wizard plugin.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef WLANWIZARDSCANLIST_H_
|
|
20 |
#define WLANWIZARDSCANLIST_H_
|
|
21 |
|
|
22 |
// System includes
|
|
23 |
#include <QList>
|
|
24 |
#include <QHash>
|
|
25 |
#include <QMetaType>
|
|
26 |
#include <QString>
|
|
27 |
#include <QSharedPointer>
|
|
28 |
|
|
29 |
/*!
|
|
30 |
@addtogroup group_wlan_wizard
|
|
31 |
@{
|
|
32 |
*/
|
|
33 |
|
|
34 |
// User includes
|
|
35 |
|
|
36 |
// Forward declarations
|
|
37 |
class WlanQtUtilsAp;
|
|
38 |
|
|
39 |
// External data types
|
|
40 |
/*!
|
|
41 |
* Data structure with scan results and access point visibility information.
|
|
42 |
*/
|
|
43 |
class WlanScanResult
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
QSharedPointer<WlanQtUtilsAp> scanResult;
|
|
47 |
bool networkHidden;
|
|
48 |
};
|
|
49 |
|
|
50 |
/*!
|
|
51 |
* Data structure containing security setting information and wizard page
|
|
52 |
* navigation information.
|
|
53 |
*/
|
|
54 |
class WlanSecuritySetting
|
|
55 |
{
|
|
56 |
public:
|
43
|
57 |
//! Enumerated value defined by CMManagerShim::WlanSecMode
|
39
|
58 |
int mode;
|
43
|
59 |
|
|
60 |
//! true, if passkey is required, false otherwise
|
39
|
61 |
bool usePsk;
|
43
|
62 |
|
|
63 |
/*!
|
|
64 |
* Identifier of the next page associated with this security mode.
|
|
65 |
* Page ids are defined in WlanWizardPageInternal::WlanPageIds
|
|
66 |
*/
|
39
|
67 |
int nextPageId;
|
|
68 |
|
|
69 |
bool operator==(const WlanSecuritySetting& setting) const {
|
|
70 |
return (mode == setting.mode &&
|
|
71 |
usePsk == setting.usePsk &&
|
|
72 |
nextPageId == setting.nextPageId);
|
|
73 |
}
|
|
74 |
};
|
|
75 |
|
|
76 |
/*!
|
|
77 |
* Data structure containing network mode, visibility and wireless protection
|
|
78 |
* setup suppport information.
|
|
79 |
*/
|
|
80 |
class WlanNetworkSetting
|
|
81 |
{
|
|
82 |
public:
|
43
|
83 |
//! Enumerated value defined by CMManagerShim::WlanConnMode
|
39
|
84 |
int mode;
|
43
|
85 |
|
|
86 |
//! true, if hidden, false otherwise
|
39
|
87 |
bool hidden;
|
43
|
88 |
|
|
89 |
//! true, if supported, false otherwise
|
39
|
90 |
bool wpsSupported;
|
|
91 |
|
|
92 |
bool operator==(const WlanNetworkSetting& setting) const {
|
|
93 |
return (mode == setting.mode &&
|
|
94 |
hidden == setting.hidden &&
|
|
95 |
wpsSupported == setting.wpsSupported);
|
|
96 |
}
|
|
97 |
};
|
|
98 |
|
|
99 |
/*!
|
|
100 |
* Necessary public function for an argument of type WlanNetworkSetting to
|
|
101 |
* function as a QHash key.
|
|
102 |
*/
|
|
103 |
inline uint qHash(const WlanNetworkSetting &key)
|
|
104 |
{
|
|
105 |
uint hash = key.mode;
|
|
106 |
hash <<= 1;
|
|
107 |
hash |= key.hidden ? 1 : 0;
|
|
108 |
hash <<= 1;
|
|
109 |
hash |= key.wpsSupported ? 1 : 0;
|
|
110 |
return qHash(hash);
|
|
111 |
}
|
|
112 |
|
|
113 |
// Constants
|
|
114 |
|
|
115 |
class WlanWizardScanList
|
|
116 |
{
|
|
117 |
public:
|
|
118 |
WlanWizardScanList();
|
|
119 |
WlanWizardScanList(const WlanWizardScanList &scanList);
|
|
120 |
~WlanWizardScanList();
|
|
121 |
void build(const QList<WlanScanResult> &results);
|
|
122 |
const WlanSecuritySetting &getSecMode(WlanNetworkSetting netMode, int index = 0) const;
|
|
123 |
int netModes() const;
|
|
124 |
int secModes(WlanNetworkSetting netMode) const;
|
|
125 |
QList<WlanNetworkSetting> getNetModes() const;
|
43
|
126 |
bool wpsSelected() const;
|
39
|
127 |
|
|
128 |
private:
|
|
129 |
// Disabling implicit assignment operator
|
|
130 |
WlanWizardScanList &operator=(const WlanWizardScanList &);
|
|
131 |
|
|
132 |
private:
|
|
133 |
QHash<WlanNetworkSetting, QList<WlanSecuritySetting> > mOpenOptions;
|
43
|
134 |
bool mWpsSelected;
|
39
|
135 |
};
|
|
136 |
|
|
137 |
/*!
|
|
138 |
* This macro makes WlanWizardScanList QVariant-compatible.
|
|
139 |
*/
|
|
140 |
Q_DECLARE_METATYPE(WlanWizardScanList)
|
|
141 |
|
|
142 |
/*! @} */
|
|
143 |
|
|
144 |
#endif /* WLANWIZARDSCANLIST_H_ */
|