netctlgui  1.4.2
Qt library which interacts with netctl
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 
49 enum PointType {
50  None = 0,
54 };
55 
76 typedef struct
77 {
78  QList<int> frequencies;
79  QStringList macs;
80  QString name;
81  QString security;
82  int signal = 0;
84  bool active = false;
85  bool exists = false;
87 
91 class WpaSup : public QObject
92 {
93  Q_OBJECT
94 
95 public:
109  explicit WpaSup(const bool debugCmd = false,
110  const QMap<QString, QString> settings = QMap<QString, QString>());
114  ~WpaSup();
115  // general information
121  QString existentProfile(const QString essid);
126  static QMap<QString, QString> getRecommendedConfiguration();
133  bool isProfileActive(const QString essid);
140  Q_DECL_DEPRECATED bool isProfileExists(const QString essid);
141 
142 public slots:
143  // functions
153  QList<netctlWifiInfo> scanWifi();
159  bool startWpaSupplicant();
165  bool stopWpaSupplicant();
166 
167 private:
171  Netctl *netctlCommand = nullptr;
175  NetctlProfile *netctlProfile = nullptr;
179  bool debug = false;
183  bool useSuid = true;
187  QString ctrlDir = QString("/run/wpa_supplicant");
191  QString ctrlGroup = QString("users");
195  QString pidFile = QString("/run/wpa_supplicant_$i.pid");
199  QString sudoCommand = QString("/usr/bin/kdesu");
203  QString wpaCliPath = QString("/usr/bin/wpa_cli");
207  QString wpaDrivers = QString("nl80211,wext");
211  QString wpaSupPath = QString("/usr/bin/wpa_supplicant");
212  // functions
218  QString getWpaCliOutput(const QString commandLine);
223  bool waitForProcess(const int sec);
230  bool wpaCliCall(const QString commandLine);
231 };
232 
233 
234 #endif /* WPASUPINTERACT_H */
Definition: wpasupinteract.h:53
bool stopWpaSupplicant()
method which send TERMINATE signal to wpa_supplicant
netctlWifiInfo current()
method which returns active point information
QList< netctlWifiInfo > scanWifi()
method which scans WiFi networks
WpaSup(const bool debugCmd=false, const QMap< QString, QString > settings=QMap< QString, QString >())
WpaSup class constructor.
Q_DECL_DEPRECATED bool isProfileExists(const QString essid)
method which checks profile existence by ESSID
QList< int > frequencies
Definition: wpasupinteract.h:78
QString name
Definition: wpasupinteract.h:80
QString security
Definition: wpasupinteract.h:81
The NetctlProfile class interacts with netctl profiles.
Definition: netctlprofile.h:37
Definition: wpasupinteract.h:51
Definition: wpasupinteract.h:52
bool isProfileActive(const QString essid)
method which checks profile status by ESSID
The Netctl class interacts with netctl.
Definition: netctlinteract.h:71
PointType
WiFi point type.
Definition: wpasupinteract.h:49
~WpaSup()
WpaSup class destructor.
QString existentProfile(const QString essid)
method which gets profile name by ESSID
Definition: wpasupinteract.h:50
QStringList macs
Definition: wpasupinteract.h:79
bool startWpaSupplicant()
method which calls wpa_supplicant
The WpaSup class interacts with wpa_supplicant.
Definition: wpasupinteract.h:91
WiFi information structure.
Definition: wpasupinteract.h:76
static QMap< QString, QString > getRecommendedConfiguration()
method which check system configuration and return recommended values to keys