summaryrefslogtreecommitdiffstats
path: root/src/wifi/qwifidevice.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@theqtcompany.com>2015-07-07 15:58:02 +0200
committerGatis Paeglis <gatis.paeglis@digia.com>2015-07-10 11:58:05 +0000
commit8c25e376947637d51d3f1ae475a4f7f7a1f81fc4 (patch)
tree06eb9b27b8a0c2cf8e6f5c1f49e7f77e624e2689 /src/wifi/qwifidevice.cpp
parent9095f6ef77c87b6114b0613d71fe26cfe0b0d8ff (diff)
Wifi: more refactoring
Move supplicant related code into a proper class. Before it was implementad as C-style API to match with Android code. Change-Id: Idf9610ab9c42bbca34f69b8d5041efb75bb61f57 Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
Diffstat (limited to 'src/wifi/qwifidevice.cpp')
-rw-r--r--src/wifi/qwifidevice.cpp38
1 files changed, 2 insertions, 36 deletions
diff --git a/src/wifi/qwifidevice.cpp b/src/wifi/qwifidevice.cpp
index 5ddc02b..a6812e7 100644
--- a/src/wifi/qwifidevice.cpp
+++ b/src/wifi/qwifidevice.cpp
@@ -18,44 +18,12 @@
****************************************************************************/
#include "qwifidevice.h"
+#include <QtCore/QString>
#include <QtCore/QByteArray>
#include <QtCore/QDir>
QT_BEGIN_NAMESPACE
-class QWifiDevicePrivate
-{
- Q_DECLARE_PUBLIC(QWifiDevice)
-public:
- QWifiDevicePrivate(QWifiDevice *device);
-
- // methods
- void createSupplicantConfig();
- // member variables
- QWifiDevice *const q_ptr;
-};
-
-QWifiDevicePrivate::QWifiDevicePrivate(QWifiDevice *device)
- : q_ptr(device)
-{
-}
-
-void QWifiDevicePrivate::createSupplicantConfig()
-{
- QFile supplicantConfig(QStringLiteral("/etc/wpa_supplicant.qtwifi.conf"));
- if (supplicantConfig.exists())
- return;
-
- if (supplicantConfig.open(QIODevice::WriteOnly)) {
- supplicantConfig.write("ctrl_interface=/var/run/wpa_supplicant\n"
- "ctrl_interface_group=0\n"
- "update_config=1\n");
- } else {
- qCWarning(B2QT_WIFI) << "failed to create supplicant configuration file.";
- }
-}
-
-
/*!
\class QWifiDevice
\inmodule B2Qt.Wifi.Cpp
@@ -78,9 +46,7 @@ void QWifiDevicePrivate::createSupplicantConfig()
*/
QWifiDevice::QWifiDevice()
- : d_ptr(new QWifiDevicePrivate(this))
{
- d_ptr->createSupplicantConfig();
}
QWifiDevice::~QWifiDevice()
@@ -104,7 +70,7 @@ bool QWifiDevice::wifiSupported()
/*!
Returns Wifi interface name.
- Interface name is obtained from the \c B2QT_WIFI_INTERFACE
+ Interface name is read from the \c B2QT_WIFI_INTERFACE
environment variable if it is set, otherwise, the default interface
name ("\e{wlan0}") is used.