mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-25 07:57:20 +00:00
added all documentation
This commit is contained in:
parent
48a879bd71
commit
7e622ad33b
@ -23,7 +23,7 @@ message (STATUS "Build date: ${CURRENT_DATE}")
|
|||||||
|
|
||||||
# install options
|
# install options
|
||||||
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
||||||
option (BUILD_DOCS "Build documentation" OFF)
|
option (BUILD_DOCS "Build documentation and install headers" ON)
|
||||||
option (BUILD_GUI "Build GUI" ON)
|
option (BUILD_GUI "Build GUI" ON)
|
||||||
option (BUILD_LIBRARY "Build library" ON)
|
option (BUILD_LIBRARY "Build library" ON)
|
||||||
option (BUILD_DATAENGINE "Build data engine" ON)
|
option (BUILD_DATAENGINE "Build data engine" ON)
|
||||||
|
@ -14,6 +14,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
/**
|
||||||
|
* @file netctlinteract.h
|
||||||
|
* Header of netctlgui library
|
||||||
|
* @author Evgeniy Alekseev
|
||||||
|
* @copyright GPLv3
|
||||||
|
* @bug https://github.com/arcan1s/netctl-gui/issues
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef NETCTLINTERACT_H
|
#ifndef NETCTLINTERACT_H
|
||||||
#define NETCTLINTERACT_H
|
#define NETCTLINTERACT_H
|
||||||
@ -23,60 +31,270 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The Netctl class interacts with netctl
|
||||||
|
*/
|
||||||
class Netctl : public QObject
|
class Netctl : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Netctl class constructor
|
||||||
|
* @param debugCmd show debug messages
|
||||||
|
* @param settings default settings. Needed keys are
|
||||||
|
* IFACE_DIR (path to directory with interfaces),
|
||||||
|
* PREFERED_IFACE (prefered interface for WiFi),
|
||||||
|
* NETCTL_PATH (path to netctl command),
|
||||||
|
* NETCTLAUTO_PATH (path to netctl-auto command),
|
||||||
|
* NETCTLAUTO_SERVICE (netctl-auto service name),
|
||||||
|
* PROFILE_DIR (path to directory which contains profiles),
|
||||||
|
* SUDO_PATH (path to sudo command),
|
||||||
|
* SYSTEMCTL_PATH (path to systemctl command)
|
||||||
|
*/
|
||||||
explicit Netctl(const bool debugCmd = false,
|
explicit Netctl(const bool debugCmd = false,
|
||||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||||
|
/**
|
||||||
|
* @brief Netctl class destructor
|
||||||
|
*/
|
||||||
~Netctl();
|
~Netctl();
|
||||||
// general information
|
// general information
|
||||||
|
/**
|
||||||
|
* @brief method which returns profile informations from netctl
|
||||||
|
* @return list of profiles. Available information is [NAME, DESCRIPTION, STATUS]:
|
||||||
|
* NAME is a profile name,
|
||||||
|
* DESCRIPTION is a profile description (see more details below),
|
||||||
|
* STATUS is a profile status (see more details below)
|
||||||
|
*/
|
||||||
QList<QStringList> getProfileList();
|
QList<QStringList> getProfileList();
|
||||||
|
/**
|
||||||
|
* @brief method which returns profile informations from netctl-auto
|
||||||
|
* @return list of profiles. Available information is [NAME, DESCRIPTION, STATUS]:
|
||||||
|
* NAME is a profile name,
|
||||||
|
* DESCRIPTION is a profile description (see more details below),
|
||||||
|
* STATUS is a profile status (see more details below)
|
||||||
|
*/
|
||||||
QList<QStringList> getProfileListFromNetctlAuto();
|
QList<QStringList> getProfileListFromNetctlAuto();
|
||||||
|
/**
|
||||||
|
* @brief method which gets description from profile
|
||||||
|
* @param profile profile name
|
||||||
|
* @return profile description or "<unknown>"
|
||||||
|
*/
|
||||||
QString getProfileDescription(const QString profile);
|
QString getProfileDescription(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which gets descriptions from profile list
|
||||||
|
* @param profileList profile names
|
||||||
|
* @return list of profile descriptions (if description is not available return "<unknown>")
|
||||||
|
*/
|
||||||
QStringList getProfileDescriptions(const QStringList profileList);
|
QStringList getProfileDescriptions(const QStringList profileList);
|
||||||
|
/**
|
||||||
|
* @brief method which gets profile status
|
||||||
|
* @param profile profile name
|
||||||
|
* @return profile status. It may be "active (enabled)", "active (static)",
|
||||||
|
* "inactive (enabled)", "inactive (static)"
|
||||||
|
*/
|
||||||
QString getProfileStatus(const QString profile);
|
QString getProfileStatus(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which gets statuses of profile list
|
||||||
|
* @param profileList profile names
|
||||||
|
* @return list of profile statuses. It may be "active (enabled)", "active (static)",
|
||||||
|
* "inactive (enabled)", "inactive (static)"
|
||||||
|
*/
|
||||||
QStringList getProfileStatuses(const QStringList profileList);
|
QStringList getProfileStatuses(const QStringList profileList);
|
||||||
|
/**
|
||||||
|
* @brief method which gets ESSID from profile
|
||||||
|
* @param profile profile name
|
||||||
|
* @return ESSID name or null string
|
||||||
|
*/
|
||||||
QString getSsidFromProfile(const QString profile);
|
QString getSsidFromProfile(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which checks if profile is active
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if profile is inactive
|
||||||
|
* @return true if profile is active
|
||||||
|
*/
|
||||||
bool isProfileActive(const QString profile);
|
bool isProfileActive(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which checks if profile is enabled
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if profile is disabled
|
||||||
|
* @return true if profile is enabled
|
||||||
|
*/
|
||||||
bool isProfileEnabled(const QString profile);
|
bool isProfileEnabled(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which checks if profile is active (netctl-auto)
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if profile is inactive
|
||||||
|
* @return true if profile is active
|
||||||
|
*/
|
||||||
bool autoIsProfileActive(const QString profile);
|
bool autoIsProfileActive(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which checks if profile is enabled (netctl-auto)
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if profile is disabled
|
||||||
|
* @return true if profile is enabled
|
||||||
|
*/
|
||||||
bool autoIsProfileEnabled(const QString profile);
|
bool autoIsProfileEnabled(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which checks netctl-auto autoload status
|
||||||
|
* @return false if netctl-auto is disabled
|
||||||
|
* @return true if netctl-auto is enabled
|
||||||
|
*/
|
||||||
bool isNetctlAutoEnabled();
|
bool isNetctlAutoEnabled();
|
||||||
|
/**
|
||||||
|
* @brief method which checks netctl-auto status
|
||||||
|
* @return false if netctl-auto is inactive
|
||||||
|
* @return true if netctl-auto is active
|
||||||
|
*/
|
||||||
bool isNetctlAutoRunning();
|
bool isNetctlAutoRunning();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// functions
|
// functions
|
||||||
// netctl
|
// netctl
|
||||||
|
/**
|
||||||
|
* @brief method which sets profile disabled or enabled
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool enableProfile(const QString profile);
|
bool enableProfile(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which restarts profile
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool restartProfile(const QString profile);
|
bool restartProfile(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which starts or stops profile
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool startProfile(const QString profile);
|
bool startProfile(const QString profile);
|
||||||
// netctl-auto
|
// netctl-auto
|
||||||
|
/**
|
||||||
|
* @brief method which sets all profiles disabled (netctl-auto)
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool autoDisableAllProfiles();
|
bool autoDisableAllProfiles();
|
||||||
|
/**
|
||||||
|
* @brief method which sets profile disabled or enabled (netctl-auto)
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool autoEnableProfile(const QString profile);
|
bool autoEnableProfile(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief method which sets all profiles enabled (netctl-auto)
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool autoEnableAllProfiles();
|
bool autoEnableAllProfiles();
|
||||||
|
/**
|
||||||
|
* @brief method which switchs to profile (netctl-auto)
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool autoStartProfile(const QString profile);
|
bool autoStartProfile(const QString profile);
|
||||||
// netctl-auto service
|
// netctl-auto service
|
||||||
|
/**
|
||||||
|
* @brief method which sets netctl-auto service enabled or disabled
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool autoEnableService();
|
bool autoEnableService();
|
||||||
|
/**
|
||||||
|
* @brief method which restarted netctl-auto service
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool autoRestartService();
|
bool autoRestartService();
|
||||||
|
/**
|
||||||
|
* @brief method which starts or stops netctl-auto service
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool autoStartService();
|
bool autoStartService();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief show debug messages
|
||||||
|
*/
|
||||||
bool debug;
|
bool debug;
|
||||||
|
/**
|
||||||
|
* @brief directory with interfaces. Default is "/sys/class/net/"
|
||||||
|
*/
|
||||||
QDir *ifaceDirectory;
|
QDir *ifaceDirectory;
|
||||||
|
/**
|
||||||
|
* @brief prefered interface for WiFi. Default is ""
|
||||||
|
*/
|
||||||
QString mainInterface;
|
QString mainInterface;
|
||||||
|
/**
|
||||||
|
* @brief path to netctl command. Default is "/usr/bin/netctl"
|
||||||
|
*/
|
||||||
QString netctlCommand;
|
QString netctlCommand;
|
||||||
|
/**
|
||||||
|
* @brief path to netctl-auto command. Default is "/usr/bin/netctl-auto"
|
||||||
|
*/
|
||||||
QString netctlAutoCommand;
|
QString netctlAutoCommand;
|
||||||
|
/**
|
||||||
|
* @brief netctl-auto service name. Default is "netctl-auto"
|
||||||
|
*/
|
||||||
QString netctlAutoService;
|
QString netctlAutoService;
|
||||||
|
/**
|
||||||
|
* @brief directory which contains profiles. Default is "/etc/netctl"
|
||||||
|
*/
|
||||||
QDir *profileDirectory;
|
QDir *profileDirectory;
|
||||||
|
/**
|
||||||
|
* @brief path to sudo command. Default is "/usr/bin/kdesu"
|
||||||
|
*/
|
||||||
QString sudoCommand;
|
QString sudoCommand;
|
||||||
|
/**
|
||||||
|
* @brief path to systemctl command. Default is "/usr/bin/systemctl"
|
||||||
|
*/
|
||||||
QString systemctlCommand;
|
QString systemctlCommand;
|
||||||
// functions
|
// functions
|
||||||
QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile);
|
/**
|
||||||
|
* @brief method which calls netctl and returns its output
|
||||||
|
* @param sudo set true if sudo is needed
|
||||||
|
* @param commandLine command which will be passed to netctl
|
||||||
|
* @param profile profile name
|
||||||
|
* @return netctl output
|
||||||
|
*/
|
||||||
|
QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile = 0);
|
||||||
|
/**
|
||||||
|
* @brief method which gets interface list from PREFERED_IFACE and IFACE_DIR
|
||||||
|
* @return first element from interface list. If PREFERED_IFACE is not empty it will be first element
|
||||||
|
*/
|
||||||
QString getWifiInterface();
|
QString getWifiInterface();
|
||||||
bool netctlCall(const bool sudo, const QString commandLine, const QString profile);
|
/**
|
||||||
|
* @brief method which calls netctl
|
||||||
|
* @param sudo set true if sudo is needed
|
||||||
|
* @param commandLine command which will be passed to netctl
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
|
bool netctlCall(const bool sudo, const QString commandLine, const QString profile = 0);
|
||||||
|
/**
|
||||||
|
* @brief method which calls netctl-auto
|
||||||
|
* @param sudo set true if sudo is needed
|
||||||
|
* @param commandLine command which will be passed to netctl-auto
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool netctlAutoCall(const bool sudo, const QString commandLine, const QString profile = 0);
|
bool netctlAutoCall(const bool sudo, const QString commandLine, const QString profile = 0);
|
||||||
|
/**
|
||||||
|
* @brief method which calls systemctl associated with netctl-auto
|
||||||
|
* @param sudo set true if sudo is needed
|
||||||
|
* @param commandLine command which will be passed to systemctl
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the method was completed without errors
|
||||||
|
*/
|
||||||
bool systemctlCall(const bool sudo, const QString commandLine);
|
bool systemctlCall(const bool sudo, const QString commandLine);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool debug;
|
bool debug;
|
||||||
/**
|
/**
|
||||||
* @brief path to directory which contains profiles. Default is "/etc/netctl"
|
* @brief directory which contains profiles. Default is "/etc/netctl"
|
||||||
*/
|
*/
|
||||||
QDir *profileDirectory;
|
QDir *profileDirectory;
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +92,7 @@ public slots:
|
|||||||
// functions
|
// functions
|
||||||
/**
|
/**
|
||||||
* @brief method which scans WiFi networks
|
* @brief method which scans WiFi networks
|
||||||
* @return list of profiles. Available information is [NAME, NETCTL_STATUS, SIGNAL, SECUITY]:
|
* @return list of essids. Available information is [NAME, NETCTL_STATUS, SIGNAL, SECUITY]:
|
||||||
* NAME is WiFi point name or "<hidden>",
|
* NAME is WiFi point name or "<hidden>",
|
||||||
* NETCTL_STATUS may be "new", "exist (active)", "exist (inactive)",
|
* NETCTL_STATUS may be "new", "exist (active)", "exist (inactive)",
|
||||||
* SIGNAL is Wifi point signal,
|
* SIGNAL is Wifi point signal,
|
||||||
@ -121,15 +121,6 @@ private:
|
|||||||
* @brief show debug messages
|
* @brief show debug messages
|
||||||
*/
|
*/
|
||||||
bool debug;
|
bool debug;
|
||||||
CTRL_DIR (path to ctrl_directory),
|
|
||||||
* CTRL_GROUP (group which is owner of CTRL_DIR),
|
|
||||||
* IFACE_DIR (path to directory with interfaces),
|
|
||||||
* PREFERED_IFACE (prefered interface for WiFi),
|
|
||||||
* PID_FILE (wpa_supplicant PID file),
|
|
||||||
* SUDO_PATH (path to sudo command),
|
|
||||||
* WPACLI_PATH (path to wpa_cli command),
|
|
||||||
* WPA_DRIVERS (wpa_supplicant drivers comma separated),
|
|
||||||
* WPASUP_PATH (path to wpa_supplicant command)
|
|
||||||
/**
|
/**
|
||||||
* @brief path to ctrl_directory. Defaults is "/run/wpa_supplicant_netctl-gui"
|
* @brief path to ctrl_directory. Defaults is "/run/wpa_supplicant_netctl-gui"
|
||||||
*/
|
*/
|
||||||
@ -139,7 +130,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
QString ctrlGroup;
|
QString ctrlGroup;
|
||||||
/**
|
/**
|
||||||
* @brief path to directory with interfaces. Default is "/sys/class/net/"
|
* @brief directory with interfaces. Default is "/sys/class/net/"
|
||||||
*/
|
*/
|
||||||
QDir *ifaceDirectory;
|
QDir *ifaceDirectory;
|
||||||
/**
|
/**
|
||||||
@ -167,19 +158,19 @@ private:
|
|||||||
*/
|
*/
|
||||||
QString wpaSupPath;
|
QString wpaSupPath;
|
||||||
// functions
|
// functions
|
||||||
|
/**
|
||||||
|
* @brief method which calls wpa_cli and returns its output
|
||||||
|
* @param commandLine command which will be passed to wpa_cli
|
||||||
|
* @return wpa_cli output
|
||||||
|
*/
|
||||||
|
QString getWpaCliOutput(const QString commandLine);
|
||||||
/**
|
/**
|
||||||
* @brief method which calls wpa_cli
|
* @brief method which calls wpa_cli
|
||||||
* @param commandLine command which will be send to wpa_cli
|
* @param commandLine command which will be passed to wpa_cli
|
||||||
* @return false if components are not found or command exit code is not equal to 0
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
* @return true if the method was completed without errors
|
* @return true if the method was completed without errors
|
||||||
*/
|
*/
|
||||||
bool wpaCliCall(const QString commandLine);
|
bool wpaCliCall(const QString commandLine);
|
||||||
/**
|
|
||||||
* @brief method which calls wpa_cli and returns its output
|
|
||||||
* @param commandLine command which will be send to wpa_cli
|
|
||||||
* @return wpa_cli output
|
|
||||||
*/
|
|
||||||
QString getWpaCliOutput(const QString commandLine);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
/**
|
||||||
|
* @file netctlinteract.cpp
|
||||||
|
* Source code of netctlgui library
|
||||||
|
* @author Evgeniy Alekseev
|
||||||
|
* @copyright GPLv3
|
||||||
|
* @bug https://github.com/arcan1s/netctl-gui/issues
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -23,28 +30,53 @@
|
|||||||
#include <netctlgui/netctlinteract.h>
|
#include <netctlgui/netctlinteract.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Netctl
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @fn Netctl
|
||||||
|
*/
|
||||||
Netctl::Netctl(const bool debugCmd, const QMap<QString, QString> settings)
|
Netctl::Netctl(const bool debugCmd, const QMap<QString, QString> settings)
|
||||||
: debug(debugCmd)
|
: debug(debugCmd)
|
||||||
{
|
{
|
||||||
if (settings.contains(QString("IFACE_DIR")))
|
if (settings.contains(QString("IFACE_DIR")))
|
||||||
ifaceDirectory = new QDir(settings[QString("IFACE_DIR")]);
|
ifaceDirectory = new QDir(settings[QString("IFACE_DIR")]);
|
||||||
|
else
|
||||||
|
ifaceDirectory = new QDir(QString("/sys/class/net/"));
|
||||||
if (settings.contains(QString("PREFERED_IFACE")))
|
if (settings.contains(QString("PREFERED_IFACE")))
|
||||||
mainInterface = settings[QString("PREFERED_IFACE")];
|
mainInterface = settings[QString("PREFERED_IFACE")];
|
||||||
|
else
|
||||||
|
mainInterface = QString("");
|
||||||
if (settings.contains(QString("NETCTL_PATH")))
|
if (settings.contains(QString("NETCTL_PATH")))
|
||||||
netctlCommand = settings[QString("NETCTL_PATH")];
|
netctlCommand = settings[QString("NETCTL_PATH")];
|
||||||
|
else
|
||||||
|
netctlCommand = QString("/usr/bin/netctl");
|
||||||
if (settings.contains(QString("NETCTLAUTO_PATH")))
|
if (settings.contains(QString("NETCTLAUTO_PATH")))
|
||||||
netctlAutoCommand = settings[QString("NETCTLAUTO_PATH")];
|
netctlAutoCommand = settings[QString("NETCTLAUTO_PATH")];
|
||||||
|
else
|
||||||
|
netctlAutoCommand = QString("/usr/bin/netctl-auto");
|
||||||
if (settings.contains(QString("NETCTLAUTO_SERVICE")))
|
if (settings.contains(QString("NETCTLAUTO_SERVICE")))
|
||||||
netctlAutoService = settings[QString("NETCTLAUTO_SERVICE")];
|
netctlAutoService = settings[QString("NETCTLAUTO_SERVICE")];
|
||||||
|
else
|
||||||
|
netctlAutoService = QString("netctl-auto");
|
||||||
if (settings.contains(QString("PROFILE_DIR")))
|
if (settings.contains(QString("PROFILE_DIR")))
|
||||||
profileDirectory = new QDir(settings[QString("PROFILE_DIR")]);
|
profileDirectory = new QDir(settings[QString("PROFILE_DIR")]);
|
||||||
|
else
|
||||||
|
profileDirectory = new QDir(QString("/etc/netctl/"));
|
||||||
if (settings.contains(QString("SUDO_PATH")))
|
if (settings.contains(QString("SUDO_PATH")))
|
||||||
sudoCommand = settings[QString("SUDO_PATH")];
|
sudoCommand = settings[QString("SUDO_PATH")];
|
||||||
|
else
|
||||||
|
sudoCommand = QString("/usr/bin/kdesu");
|
||||||
if (settings.contains(QString("SYSTEMCTL_PATH")))
|
if (settings.contains(QString("SYSTEMCTL_PATH")))
|
||||||
systemctlCommand = settings[QString("SYSTEMCTL_PATH")];
|
systemctlCommand = settings[QString("SYSTEMCTL_PATH")];
|
||||||
|
else
|
||||||
|
systemctlCommand = QString("/usr/bin/systemctl");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn ~Netctl
|
||||||
|
*/
|
||||||
Netctl::~Netctl()
|
Netctl::~Netctl()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[~Netctl]";
|
if (debug) qDebug() << "[Netctl]" << "[~Netctl]";
|
||||||
@ -52,11 +84,14 @@ Netctl::~Netctl()
|
|||||||
if (ifaceDirectory != 0)
|
if (ifaceDirectory != 0)
|
||||||
delete ifaceDirectory;
|
delete ifaceDirectory;
|
||||||
if (profileDirectory != 0)
|
if (profileDirectory != 0)
|
||||||
delete profileDirectory;
|
delete profileDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
/**
|
||||||
|
* @fn getNetctlOutput
|
||||||
|
*/
|
||||||
QString Netctl::getNetctlOutput(const bool sudo, const QString commandLine, const QString profile)
|
QString Netctl::getNetctlOutput(const bool sudo, const QString commandLine, const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getNetctlOutput]";
|
if (debug) qDebug() << "[Netctl]" << "[getNetctlOutput]";
|
||||||
@ -86,6 +121,9 @@ QString Netctl::getNetctlOutput(const bool sudo, const QString commandLine, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getWifiInterface
|
||||||
|
*/
|
||||||
QString Netctl::getWifiInterface()
|
QString Netctl::getWifiInterface()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]";
|
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]";
|
||||||
@ -110,6 +148,9 @@ QString Netctl::getWifiInterface()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn netctlCall
|
||||||
|
*/
|
||||||
bool Netctl::netctlCall(const bool sudo, const QString commandLine, const QString profile)
|
bool Netctl::netctlCall(const bool sudo, const QString commandLine, const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[netctlCall]";
|
if (debug) qDebug() << "[Netctl]" << "[netctlCall]";
|
||||||
@ -143,6 +184,9 @@ bool Netctl::netctlCall(const bool sudo, const QString commandLine, const QStrin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn netctlAutoCall
|
||||||
|
*/
|
||||||
bool Netctl::netctlAutoCall(const bool sudo, const QString commandLine, const QString profile)
|
bool Netctl::netctlAutoCall(const bool sudo, const QString commandLine, const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[netctlAutoCall]";
|
if (debug) qDebug() << "[Netctl]" << "[netctlAutoCall]";
|
||||||
@ -177,6 +221,9 @@ bool Netctl::netctlAutoCall(const bool sudo, const QString commandLine, const QS
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn systemctlCall
|
||||||
|
*/
|
||||||
bool Netctl::systemctlCall(const bool sudo, const QString commandLine)
|
bool Netctl::systemctlCall(const bool sudo, const QString commandLine)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[systemctlCall]";
|
if (debug) qDebug() << "[Netctl]" << "[systemctlCall]";
|
||||||
@ -216,6 +263,9 @@ bool Netctl::systemctlCall(const bool sudo, const QString commandLine)
|
|||||||
|
|
||||||
|
|
||||||
// general information
|
// general information
|
||||||
|
/**
|
||||||
|
* @fn getProfileList
|
||||||
|
*/
|
||||||
QList<QStringList> Netctl::getProfileList()
|
QList<QStringList> Netctl::getProfileList()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getProfileList]";
|
if (debug) qDebug() << "[Netctl]" << "[getProfileList]";
|
||||||
@ -240,6 +290,9 @@ QList<QStringList> Netctl::getProfileList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getProfileListFromNetctlAuto
|
||||||
|
*/
|
||||||
QList<QStringList> Netctl::getProfileListFromNetctlAuto()
|
QList<QStringList> Netctl::getProfileListFromNetctlAuto()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getProfileListFromNetctlAuto]";
|
if (debug) qDebug() << "[Netctl]" << "[getProfileListFromNetctlAuto]";
|
||||||
@ -267,6 +320,9 @@ QList<QStringList> Netctl::getProfileListFromNetctlAuto()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getProfileDescription
|
||||||
|
*/
|
||||||
QString Netctl::getProfileDescription(const QString profileName)
|
QString Netctl::getProfileDescription(const QString profileName)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getProfileDescription]";
|
if (debug) qDebug() << "[Netctl]" << "[getProfileDescription]";
|
||||||
@ -292,13 +348,15 @@ QString Netctl::getProfileDescription(const QString profileName)
|
|||||||
if (profile.atEnd())
|
if (profile.atEnd())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
description.remove(QChar('\''));
|
description.remove(QChar('\'')).remove(QChar('"'));
|
||||||
description.remove(QChar('"'));
|
|
||||||
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getProfileDescriptions
|
||||||
|
*/
|
||||||
QStringList Netctl::getProfileDescriptions(const QStringList profileList)
|
QStringList Netctl::getProfileDescriptions(const QStringList profileList)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getProfileDescriptions]";
|
if (debug) qDebug() << "[Netctl]" << "[getProfileDescriptions]";
|
||||||
@ -328,8 +386,7 @@ QStringList Netctl::getProfileDescriptions(const QStringList profileList)
|
|||||||
if (profile.atEnd())
|
if (profile.atEnd())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
description.remove(QChar('\''));
|
description.remove(QChar('\'')).remove(QChar('"'));
|
||||||
description.remove(QChar('"'));
|
|
||||||
descriptions.append(description);
|
descriptions.append(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +394,9 @@ QStringList Netctl::getProfileDescriptions(const QStringList profileList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getProfileStatus
|
||||||
|
*/
|
||||||
QString Netctl::getProfileStatus(const QString profile)
|
QString Netctl::getProfileStatus(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getProfileStatus]";
|
if (debug) qDebug() << "[Netctl]" << "[getProfileStatus]";
|
||||||
@ -356,6 +416,9 @@ QString Netctl::getProfileStatus(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getProfileStatuses
|
||||||
|
*/
|
||||||
QStringList Netctl::getProfileStatuses(const QStringList profileList)
|
QStringList Netctl::getProfileStatuses(const QStringList profileList)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getProfileStatuses]";
|
if (debug) qDebug() << "[Netctl]" << "[getProfileStatuses]";
|
||||||
@ -379,6 +442,9 @@ QStringList Netctl::getProfileStatuses(const QStringList profileList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getSsidFromProfile
|
||||||
|
*/
|
||||||
QString Netctl::getSsidFromProfile(const QString profile)
|
QString Netctl::getSsidFromProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getSsidFromProfile]";
|
if (debug) qDebug() << "[Netctl]" << "[getSsidFromProfile]";
|
||||||
@ -405,13 +471,15 @@ QString Netctl::getSsidFromProfile(const QString profile)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
profileFile.close();
|
profileFile.close();
|
||||||
ssidName.remove(QChar('\''));
|
ssidName.remove(QChar('\'')).remove(QChar('"'));
|
||||||
ssidName.remove(QChar('"'));
|
|
||||||
|
|
||||||
return ssidName;
|
return ssidName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn isProfileActive
|
||||||
|
*/
|
||||||
bool Netctl::isProfileActive(const QString profile)
|
bool Netctl::isProfileActive(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[isProfileActive]";
|
if (debug) qDebug() << "[Netctl]" << "[isProfileActive]";
|
||||||
@ -419,14 +487,16 @@ bool Netctl::isProfileActive(const QString profile)
|
|||||||
|
|
||||||
bool status = false;
|
bool status = false;
|
||||||
QString cmdOutput = getNetctlOutput(false, QString("status"), profile);
|
QString cmdOutput = getNetctlOutput(false, QString("status"), profile);
|
||||||
if (!cmdOutput.isEmpty())
|
if (cmdOutput.contains(QString("Active: active")))
|
||||||
if (cmdOutput.contains(QString("Active: active")))
|
status = true;
|
||||||
status = true;
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn isProfileEnabled
|
||||||
|
*/
|
||||||
bool Netctl::isProfileEnabled(const QString profile)
|
bool Netctl::isProfileEnabled(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[isProfileEnabled]";
|
if (debug) qDebug() << "[Netctl]" << "[isProfileEnabled]";
|
||||||
@ -436,6 +506,9 @@ bool Netctl::isProfileEnabled(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoIsProfileActive
|
||||||
|
*/
|
||||||
bool Netctl::autoIsProfileActive(const QString profile)
|
bool Netctl::autoIsProfileActive(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoIsProfileActive]";
|
if (debug) qDebug() << "[Netctl]" << "[autoIsProfileActive]";
|
||||||
@ -453,6 +526,9 @@ bool Netctl::autoIsProfileActive(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoIsProfileEnabled
|
||||||
|
*/
|
||||||
bool Netctl::autoIsProfileEnabled(const QString profile)
|
bool Netctl::autoIsProfileEnabled(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoIsProfileEnabled]";
|
if (debug) qDebug() << "[Netctl]" << "[autoIsProfileEnabled]";
|
||||||
@ -470,6 +546,9 @@ bool Netctl::autoIsProfileEnabled(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn isNetctlAutoEnabled
|
||||||
|
*/
|
||||||
bool Netctl::isNetctlAutoEnabled()
|
bool Netctl::isNetctlAutoEnabled()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoEnabled]";
|
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoEnabled]";
|
||||||
@ -499,6 +578,9 @@ bool Netctl::isNetctlAutoEnabled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn isNetctlAutoRunning
|
||||||
|
*/
|
||||||
bool Netctl::isNetctlAutoRunning()
|
bool Netctl::isNetctlAutoRunning()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]";
|
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]";
|
||||||
@ -529,6 +611,9 @@ bool Netctl::isNetctlAutoRunning()
|
|||||||
|
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
/**
|
||||||
|
* @fn enableProfile
|
||||||
|
*/
|
||||||
bool Netctl::enableProfile(const QString profile)
|
bool Netctl::enableProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[enableProfile]";
|
if (debug) qDebug() << "[Netctl]" << "[enableProfile]";
|
||||||
@ -541,6 +626,9 @@ bool Netctl::enableProfile(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn restartProfile
|
||||||
|
*/
|
||||||
bool Netctl::restartProfile(const QString profile)
|
bool Netctl::restartProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[restartProfile]";
|
if (debug) qDebug() << "[Netctl]" << "[restartProfile]";
|
||||||
@ -550,6 +638,9 @@ bool Netctl::restartProfile(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn startProfile
|
||||||
|
*/
|
||||||
bool Netctl::startProfile(const QString profile)
|
bool Netctl::startProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[startProfile]";
|
if (debug) qDebug() << "[Netctl]" << "[startProfile]";
|
||||||
@ -562,6 +653,9 @@ bool Netctl::startProfile(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoDisableAllProfiles
|
||||||
|
*/
|
||||||
bool Netctl::autoDisableAllProfiles()
|
bool Netctl::autoDisableAllProfiles()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoDisableAllProfiles]";
|
if (debug) qDebug() << "[Netctl]" << "[autoDisableAllProfiles]";
|
||||||
@ -570,6 +664,9 @@ bool Netctl::autoDisableAllProfiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoEnableProfile
|
||||||
|
*/
|
||||||
bool Netctl::autoEnableProfile(const QString profile)
|
bool Netctl::autoEnableProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoEnableProfile]";
|
if (debug) qDebug() << "[Netctl]" << "[autoEnableProfile]";
|
||||||
@ -582,6 +679,9 @@ bool Netctl::autoEnableProfile(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoEnableAllProfiles
|
||||||
|
*/
|
||||||
bool Netctl::autoEnableAllProfiles()
|
bool Netctl::autoEnableAllProfiles()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoEnableAllProfiles]";
|
if (debug) qDebug() << "[Netctl]" << "[autoEnableAllProfiles]";
|
||||||
@ -590,6 +690,9 @@ bool Netctl::autoEnableAllProfiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoStartProfile
|
||||||
|
*/
|
||||||
bool Netctl::autoStartProfile(const QString profile)
|
bool Netctl::autoStartProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoStartProfile]";
|
if (debug) qDebug() << "[Netctl]" << "[autoStartProfile]";
|
||||||
@ -602,6 +705,9 @@ bool Netctl::autoStartProfile(const QString profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoEnableService
|
||||||
|
*/
|
||||||
bool Netctl::autoEnableService()
|
bool Netctl::autoEnableService()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoEnableService]";
|
if (debug) qDebug() << "[Netctl]" << "[autoEnableService]";
|
||||||
@ -613,6 +719,9 @@ bool Netctl::autoEnableService()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoRestartService
|
||||||
|
*/
|
||||||
bool Netctl::autoRestartService()
|
bool Netctl::autoRestartService()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoRestartService]";
|
if (debug) qDebug() << "[Netctl]" << "[autoRestartService]";
|
||||||
@ -624,6 +733,9 @@ bool Netctl::autoRestartService()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn autoStartService
|
||||||
|
*/
|
||||||
bool Netctl::autoStartService()
|
bool Netctl::autoStartService()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoStartService]";
|
if (debug) qDebug() << "[Netctl]" << "[autoStartService]";
|
||||||
|
@ -320,6 +320,38 @@ bool WpaSup::stopWpaSupplicant()
|
|||||||
|
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
/**
|
||||||
|
* @fn getWpaCliOutput
|
||||||
|
*/
|
||||||
|
QString WpaSup::getWpaCliOutput(const QString commandLine)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]";
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Command" << commandLine;
|
||||||
|
if (ctrlDir == 0) {
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find directory";
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
if (pidFile == 0) {
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find PID file";
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
if (wpaCliPath == 0) {
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find wpa_cli";
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QProcess command;
|
||||||
|
QString interface = getInterfaceList()[0];
|
||||||
|
QString commandText = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
||||||
|
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << commandText;
|
||||||
|
command.start(commandText);
|
||||||
|
command.waitForFinished(-1);
|
||||||
|
|
||||||
|
return command.readAllStandardOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn wpaCliCall
|
* @fn wpaCliCall
|
||||||
*/
|
*/
|
||||||
@ -355,35 +387,3 @@ bool WpaSup::wpaCliCall(const QString commandLine)
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @fn getWpaCliOutput
|
|
||||||
*/
|
|
||||||
QString WpaSup::getWpaCliOutput(const QString commandLine)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]";
|
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Command" << commandLine;
|
|
||||||
if (ctrlDir == 0) {
|
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find directory";
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
if (pidFile == 0) {
|
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find PID file";
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
if (wpaCliPath == 0) {
|
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find wpa_cli";
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QProcess command;
|
|
||||||
QString interface = getInterfaceList()[0];
|
|
||||||
QString commandText = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
|
||||||
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << commandText;
|
|
||||||
command.start(commandText);
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
|
|
||||||
return command.readAllStandardOutput();
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user