netctlgui  1.3.1
Qt library which interacts with netctl
 All Classes Files Functions Variables
wpasupinteract.h
Go to the documentation of this file.
1 /***************************************************************************
2  * This file is part of netctl-gui *
3  * *
4  * netctl-gui is free software: you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation, either version 3 of the *
7  * License, or (at your option) any later version. *
8  * *
9  * netctl-gui is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
16  ***************************************************************************/
26 #ifndef WPASUPINTERACT_H
27 #define WPASUPINTERACT_H
28 
29 #include <QDir>
30 #include <QMap>
31 #include <QObject>
32 
33 
34 class Netctl;
35 class NetctlProfile;
36 
51 typedef struct
52 {
53  QString name;
54  QString security;
55  QString signal;
56  bool active;
57  bool exists;
59 
63 class WpaSup : public QObject
64 {
65  Q_OBJECT
66 
67 public:
81  explicit WpaSup(const bool debugCmd = false,
82  const QMap<QString, QString> settings = QMap<QString, QString>());
86  ~WpaSup();
87  // general information
93  QString existentProfile(const QString essid);
98  static QMap<QString, QString> getRecommendedConfiguration();
105  bool isProfileActive(const QString essid);
112  bool isProfileExists(const QString essid);
113 
114 public slots:
115  // functions
120  QList<netctlWifiInfo> scanWifi();
126  bool startWpaSupplicant();
132  bool stopWpaSupplicant();
133 
134 private:
138  Netctl *netctlCommand = nullptr;
142  NetctlProfile *netctlProfile = nullptr;
146  bool debug = false;
150  bool useSuid = true;
154  QString ctrlDir = QString("/run/wpa_supplicant_netctl-gui");
158  QString ctrlGroup = QString("users");
162  QString pidFile = QString("/run/wpa_supplicant_netctl-gui.pid");
166  QString sudoCommand = QString("/usr/bin/kdesu");
170  QString wpaCliPath = QString("/usr/bin/wpa_cli");
174  QString wpaDrivers = QString("nl80211,wext");
178  QString wpaSupPath = QString("/usr/bin/wpa_supplicant");
179  // functions
185  QString getWpaCliOutput(const QString commandLine);
190  bool waitForProcess(const int sec);
197  bool wpaCliCall(const QString commandLine);
198 };
199 
200 
201 #endif /* WPASUPINTERACT_H */
bool isProfileExists(const QString essid)
method which checks profile existence by ESSID
bool exists
Definition: wpasupinteract.h:57
bool stopWpaSupplicant()
method which send TERMINATE signal to wpa_supplicant
QList< netctlWifiInfo > scanWifi()
method which scans WiFi networks
WpaSup(const bool debugCmd=false, const QMap< QString, QString > settings=QMap< QString, QString >())
WpaSup class constructor.
QString name
Definition: wpasupinteract.h:53
QString security
Definition: wpasupinteract.h:54
The NetctlProfile class interacts with netctl profiles.
Definition: netctlprofile.h:37
bool isProfileActive(const QString essid)
method which checks profile status by ESSID
The Netctl class interacts with netctl.
Definition: netctlinteract.h:59
~WpaSup()
WpaSup class destructor.
QString existentProfile(const QString essid)
method which gets profile name by ESSID
bool startWpaSupplicant()
method which calls wpa_supplicant
QString signal
Definition: wpasupinteract.h:55
The WpaSup class interacts with wpa_supplicant.
Definition: wpasupinteract.h:63
WiFi information structure.
Definition: wpasupinteract.h:51
bool active
Definition: wpasupinteract.h:56
static QMap< QString, QString > getRecommendedConfiguration()
method which check system configuration and return recommended values to keys