| netctlgui 1.4.7 Qt library which interacts with netctl

- Main Page
- Classes
- Files

- File List
- File Members

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
48 enum InterfaceAnswer {
49 False = 0,
50 True,
51 Error
52 };
53
66 typedef struct
67 {
68 QStringList current;
69 QList<bool> enables;
70 QStringList profiles;
71 bool netctlAuto = false;
72 } netctlCurrent;
73
86 typedef struct
87 {
88 QList<netctlProfileInfo> netctlProfiles;
89 QList<netctlProfileInfo> netctlAutoProfiles;
90 bool netctlAuto = false;
91 bool netctlAutoEnabled = false;
92 } netctlInformation;
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>());
112 ~NetctlInterface();
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);
194 InterfaceAnswer stopAllProfiles();
203 InterfaceAnswer switchToProfile(const QString profile);
204 // information
210 netctlInformation information();
216 QMap<QString, QString> profileSettings(const QString profile);
222 netctlCurrent status();
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 */
False
Definition: netctlinterface.h:49
True
Definition: netctlinterface.h:50
NetctlInterface::connectToUnknownEssid
InterfaceAnswer connectToUnknownEssid(const QString essid, QMap< QString, QString > settings)
method which creates wireless profile and connects to it
NetctlInterface::connectToKnownEssid
InterfaceAnswer connectToKnownEssid(const QString essid)
method which connects to existent profile by ESSID
netctlInformation::netctlProfiles
QList< netctlProfileInfo > netctlProfiles
Definition: netctlinterface.h:88
netctlCurrent::current
QStringList current
Definition: netctlinterface.h:68
NetctlInterface::~NetctlInterface
~NetctlInterface()
NetctlInterface class destructor.
NetctlInterface::stopAllProfiles
InterfaceAnswer stopAllProfiles()
method which stops all profiles
NetctlInterface::startProfile
InterfaceAnswer startProfile(const QString profile)
method which starts/stops or switchs to selected profile and returns its status
NetctlInterface
The NetctlInterface class provides complex methods to get access to library.
Definition: netctlinterface.h:97
netctlInformation::netctlAutoProfiles
QList< netctlProfileInfo > netctlAutoProfiles
Definition: netctlinterface.h:89
NetctlProfile
The NetctlProfile class interacts with netctl profiles.
Definition: netctlprofile.h:39
Netctl
The Netctl class interacts with netctl.
Definition: netctlinteract.h:73
netctlCurrent::enables
QList< bool > enables
Definition: netctlinterface.h:69
NetctlInterface::enableProfile
InterfaceAnswer enableProfile(const QString profile)
method which enables or disables selected profile and returns its status
NetctlInterface::connectToEssid
InterfaceAnswer connectToEssid(const QString essid, QMap< QString, QString > settings)
method which connects to ESSID
netctlCurrent::profiles
QStringList profiles
Definition: netctlinterface.h:70
Error
Definition: netctlinterface.h:51
NetctlInterface::status
netctlCurrent status()
method which returns current status
netctlprofile.h
NetctlInterface::profileSettings
QMap< QString, QString > profileSettings(const QString profile)
method which reads settings from profile
NetctlInterface::restartProfile
InterfaceAnswer restartProfile(const QString profile)
method which restarts selected profile and returns its status
InterfaceAnswer
InterfaceAnswer
standard interface answer enumeration
Definition: netctlinterface.h:48
NetctlInterface::createProfile
InterfaceAnswer createProfile(const QString profile, const QMap< QString, QString > settings)
method which creates and copies profile
wpasupinteract.h
netctlInformation
general information structure
Definition: netctlinterface.h:86
NetctlInterface::NetctlInterface
NetctlInterface(const bool debugCmd=false, const QMap< QString, QString > settings=QMap< QString, QString >())
NetctlInterface class constructor.
WpaSup
The WpaSup class interacts with wpa_supplicant.
Definition: wpasupinteract.h:93
NetctlInterface::switchToProfile
InterfaceAnswer switchToProfile(const QString profile)
method which switchs to selected profile and returns its status
NetctlInterface::information
netctlInformation information()
method which returns general information
NetctlInterface::removeProfile
InterfaceAnswer removeProfile(const QString profile)
method which removes selected profile
netctlinteract.h
netctlCurrent
current status structure
Definition: netctlinterface.h:66