netctlgui  1.4.7
Qt library which interacts with netctl
netctlinterface.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 NETCTLINTERFACE_H
27 #define NETCTLINTERFACE_H
28 
29 #include <QDir>
30 #include <QMap>
31 #include <QObject>
32 
33 #include "netctlinteract.h"
34 #include "netctlprofile.h"
35 #include "wpasupinteract.h"
36 
37 
49  False = 0,
52 };
53 
66 typedef struct
67 {
68  QStringList current;
69  QList<bool> enables;
70  QStringList profiles;
71  bool netctlAuto = false;
73 
86 typedef struct
87 {
88  QList<netctlProfileInfo> netctlProfiles;
89  QList<netctlProfileInfo> netctlAutoProfiles;
90  bool netctlAuto = false;
91  bool netctlAutoEnabled = false;
93 
97 class NetctlInterface : public QObject
98 {
99  Q_OBJECT
100 
101 public:
107  explicit NetctlInterface(const bool debugCmd = false,
108  const QMap<QString, QString> settings = QMap<QString, QString>());
113  // control methods
123  InterfaceAnswer createProfile(const QString profile, const QMap<QString, QString> settings);
133  InterfaceAnswer connectToEssid(const QString essid, QMap<QString, QString> settings);
142  InterfaceAnswer connectToKnownEssid(const QString essid);
152  InterfaceAnswer connectToUnknownEssid(const QString essid, QMap<QString, QString> settings);
161  InterfaceAnswer enableProfile(const QString profile);
169  InterfaceAnswer removeProfile(const QString profile);
178  InterfaceAnswer restartProfile(const QString profile);
187  InterfaceAnswer startProfile(const QString profile);
203  InterfaceAnswer switchToProfile(const QString profile);
204  // information
216  QMap<QString, QString> profileSettings(const QString profile);
223 
224 private:
228  Netctl *netctlCommand = nullptr;
232  NetctlProfile *netctlProfile = nullptr;
236  WpaSup *wpaCommand = nullptr;
240  bool debug = false;
241 };
242 
243 
244 #endif /* NETCTLINTERFACE_H */
Definition: netctlinterface.h:49
Definition: netctlinterface.h:50
InterfaceAnswer connectToUnknownEssid(const QString essid, QMap< QString, QString > settings)
method which creates wireless profile and connects to it
InterfaceAnswer connectToKnownEssid(const QString essid)
method which connects to existent profile by ESSID
QList< netctlProfileInfo > netctlProfiles
Definition: netctlinterface.h:88
QStringList current
Definition: netctlinterface.h:68
~NetctlInterface()
NetctlInterface class destructor.
InterfaceAnswer stopAllProfiles()
method which stops all profiles
InterfaceAnswer startProfile(const QString profile)
method which starts/stops or switchs to selected profile and returns its status
The NetctlInterface class provides complex methods to get access to library.
Definition: netctlinterface.h:97
QList< netctlProfileInfo > netctlAutoProfiles
Definition: netctlinterface.h:89
The NetctlProfile class interacts with netctl profiles.
Definition: netctlprofile.h:39
The Netctl class interacts with netctl.
Definition: netctlinteract.h:73
QList< bool > enables
Definition: netctlinterface.h:69
InterfaceAnswer enableProfile(const QString profile)
method which enables or disables selected profile and returns its status
InterfaceAnswer connectToEssid(const QString essid, QMap< QString, QString > settings)
method which connects to ESSID
QStringList profiles
Definition: netctlinterface.h:70
Definition: netctlinterface.h:51
netctlCurrent status()
method which returns current status
QMap< QString, QString > profileSettings(const QString profile)
method which reads settings from profile
InterfaceAnswer restartProfile(const QString profile)
method which restarts selected profile and returns its status
InterfaceAnswer
standard interface answer enumeration
Definition: netctlinterface.h:48
InterfaceAnswer createProfile(const QString profile, const QMap< QString, QString > settings)
method which creates and copies profile
general information structure
Definition: netctlinterface.h:86
NetctlInterface(const bool debugCmd=false, const QMap< QString, QString > settings=QMap< QString, QString >())
NetctlInterface class constructor.
The WpaSup class interacts with wpa_supplicant.
Definition: wpasupinteract.h:93
InterfaceAnswer switchToProfile(const QString profile)
method which switchs to selected profile and returns its status
netctlInformation information()
method which returns general information
InterfaceAnswer removeProfile(const QString profile)
method which removes selected profile
current status structure
Definition: netctlinterface.h:66