summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/imports/wifi/pluginmain.cpp9
-rw-r--r--src/wifi/qwificonfiguration.cpp24
-rw-r--r--src/wifi/qwificonfiguration.h3
-rw-r--r--src/wifi/qwifimanager.cpp8
4 files changed, 44 insertions, 0 deletions
diff --git a/src/imports/wifi/pluginmain.cpp b/src/imports/wifi/pluginmain.cpp
index a778fa2..7d129d2 100644
--- a/src/imports/wifi/pluginmain.cpp
+++ b/src/imports/wifi/pluginmain.cpp
@@ -322,6 +322,15 @@ QT_BEGIN_NAMESPACE
WPA is used by default if property is not set, supported values are: WPA, WPA2, WEP, WPS.
*/
+/*!
+ \qmlproperty bool WifiConfiguration::ssidHidden
+
+ If a Wifi access point does not broadcast its SSID, setting this property
+ to \c true ensures that the Wifi backend can detect the specified network.
+
+ By default this property is set to \c false.
+*/
+
static QObject *globalWifiDevice(QQmlEngine *, QJSEngine *)
{
return new QWifiDevice;
diff --git a/src/wifi/qwificonfiguration.cpp b/src/wifi/qwificonfiguration.cpp
index 42196a2..b532620 100644
--- a/src/wifi/qwificonfiguration.cpp
+++ b/src/wifi/qwificonfiguration.cpp
@@ -31,10 +31,12 @@ public:
QString m_ssid;
QString m_psk;
QString m_protocol;
+ bool m_ssidHidden;
};
QWifiConfigurationPrivate::QWifiConfigurationPrivate(QWifiConfiguration *config)
: q_ptr(config)
+ , m_ssidHidden(false)
{
}
@@ -119,4 +121,26 @@ void QWifiConfiguration::setProtocol(const QString &protocol)
d->m_protocol = protocol;
}
+/*!
+ \property QWifiConfiguration::ssidHidden
+ \brief Holds whether a Wifi access point broadcasts its SSID
+
+ If a Wifi access point does not broadcast its SSID, setting this
+ property to \c true ensures that the Wifi backend can detect the
+ specified network.
+
+ By default this property is set to \c false.
+*/
+bool QWifiConfiguration::isSsidHidden() const
+{
+ Q_D(const QWifiConfiguration);
+ return d->m_ssidHidden;
+}
+
+void QWifiConfiguration::setSsidHidden(bool hidden)
+{
+ Q_D(QWifiConfiguration);
+ d->m_ssidHidden = hidden;
+}
+
QT_END_NAMESPACE
diff --git a/src/wifi/qwificonfiguration.h b/src/wifi/qwificonfiguration.h
index 9b03c9e..cdeb453 100644
--- a/src/wifi/qwificonfiguration.h
+++ b/src/wifi/qwificonfiguration.h
@@ -32,6 +32,7 @@ class Q_DECL_EXPORT QWifiConfiguration : public QObject
Q_PROPERTY(QString ssid READ ssid WRITE setSsid)
Q_PROPERTY(QString passphrase READ passphrase WRITE setPassphrase)
Q_PROPERTY(QString protocol READ protocol WRITE setProtocol)
+ Q_PROPERTY(bool ssidHidden READ isSsidHidden WRITE setSsidHidden)
public:
explicit QWifiConfiguration(QObject *parent = 0);
virtual ~QWifiConfiguration();
@@ -42,6 +43,8 @@ public:
QString passphrase() const;
void setProtocol(const QString &protocol);
QString protocol() const;
+ void setSsidHidden(bool hidden);
+ bool isSsidHidden() const;
private:
Q_DISABLE_COPY(QWifiConfiguration)
diff --git a/src/wifi/qwifimanager.cpp b/src/wifi/qwifimanager.cpp
index 319c9d9..d60ec13 100644
--- a/src/wifi/qwifimanager.cpp
+++ b/src/wifi/qwifimanager.cpp
@@ -506,7 +506,11 @@ bool QWifiManager::connect(QWifiConfiguration *config)
QString key_mgmt;
QString protocol = config->protocol().toUpper();
QString psk = config->passphrase();
+
+ // --------------------- configure network ------------------------------
// ref: http://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf
+ // ref: https://www.freebsd.org/cgi/man.cgi?wpa_supplicant.conf
+ // ----------------------------------------------------------------------
if (protocol.isEmpty() || protocol.contains(QStringLiteral("WPA"))) {
// ### todo - password length has limits (see IEEE 802.11), we need to check
// for those limits here. Supplicant gives only a meaningless "fail" message.
@@ -520,6 +524,10 @@ bool QWifiManager::connect(QWifiConfiguration *config)
// open network
key_mgmt = QLatin1String("NONE");
}
+
+ if (config->isSsidHidden())
+ ok = ok && d->checkedCall(setNetworkCommand + QLatin1String(" scan_ssid 1"));
+
ok = ok && d->checkedCall(setNetworkCommand + QLatin1String(" key_mgmt ") + key_mgmt);
if (!ok) {
if (!networkKnown)