netctlgui  1.4.7
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 #include "version.h"
34 
35 
36 class Netctl;
37 class NetctlProfile;
38 
51 enum PointType {
52  None = 0,
56 };
57 
78 typedef struct
79 {
80  QList<int> frequencies;
81  QStringList macs;
82  QString name;
83  QString security;
84  int signal = 0;
86  bool active = false;
87  bool exists = false;
89 
93 class WpaSup : public QObject
94 {
95  Q_OBJECT
96 
97 public:
111  explicit WpaSup(const bool debugCmd = false,
112  const QMap<QString, QString> settings = QMap<QString, QString>());
116  ~WpaSup();
117  // general information
123  QString existentProfile(const QString essid);
128  static QMap<QString, QString> getRecommendedConfiguration();
135  bool isProfileActive(const QString essid);
142  Q_DECL_DEPRECATED bool isProfileExists(const QString essid);
143 
144 public slots:
145  // functions
155  QList<netctlWifiInfo> scanWifi();
161  bool startWpaSupplicant();
167  bool stopWpaSupplicant();
168 
169 private:
173  Netctl *netctlCommand = nullptr;
177  NetctlProfile *netctlProfile = nullptr;
181  bool debug = false;
185  bool useSuid = true;
189  QString ctrlDir = QString(CTRL_DIR);
193  QString ctrlGroup = QString(CTRL_GROUP);
197  QString pidFile = QString(PID_FILE);
201  QString sudoCommand = QString(SUDO_PATH);
205  QString wpaCliPath = QString(WPACLI_PATH);
209  QString wpaDrivers = QString(WPA_DRIVERS);
213  QString wpaSupPath = QString(WPASUP_PATH);
214  // functions
220  QString getWpaCliOutput(const QString commandLine);
225  bool waitForProcess(const int sec);
232  bool wpaCliCall(const QString commandLine);
233 };
234 
235 
236 #endif /* WPASUPINTERACT_H */
Definition: wpasupinteract.h:55
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:80
QString name
Definition: wpasupinteract.h:82
QString security
Definition: wpasupinteract.h:83
The NetctlProfile class interacts with netctl profiles.
Definition: netctlprofile.h:39
Definition: wpasupinteract.h:53
Definition: wpasupinteract.h:54
bool isProfileActive(const QString essid)
method which checks profile status by ESSID
The Netctl class interacts with netctl.
Definition: netctlinteract.h:73
PointType
WiFi point type.
Definition: wpasupinteract.h:51
~WpaSup()
WpaSup class destructor.
QString existentProfile(const QString essid)
method which gets profile name by ESSID
Definition: wpasupinteract.h:52
QStringList macs
Definition: wpasupinteract.h:81
bool startWpaSupplicant()
method which calls wpa_supplicant
The WpaSup class interacts with wpa_supplicant.
Definition: wpasupinteract.h:93
WiFi information structure.
Definition: wpasupinteract.h:78
static QMap< QString, QString > getRecommendedConfiguration()
method which check system configuration and return recommended values to keys