Index: sources/wifi/WifiInterface.h =================================================================== diff -u -rc77365fa76422bc2150e58d483c446325b50f4b8 -rf35b360054e1e2fa81bf107427fe2d50d78e9e8a --- sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision c77365fa76422bc2150e58d483c446325b50f4b8) +++ sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision f35b360054e1e2fa81bf107427fe2d50d78e9e8a) @@ -3,6 +3,7 @@ // Qt #include #include +#include // Project #include "main.h" @@ -29,6 +30,8 @@ int _defaultTimeout = 5000; int _dhcpTimeout = 10000; int _scanTimeout = 30000; + int _processCounter = 0; + QProcess _processScan; const QString _iface = "wlan0"; const QString _wpaSupplicantConfPath = "/etc/wpa_supplicant.conf"; @@ -38,6 +41,8 @@ SINGLETON(WifiInterface) private: +// QFutureWatcher _scanWatcher; + bool generateWPASupplicant(const Network &vNetwork, const QString &vPassword); bool startWPASupplicant(); bool requestAutoAssignedIP(int vTries = 4); @@ -53,24 +58,36 @@ void onInitConnections(); void onQuitThread(); void timerEvent(QTimerEvent* event); + void initThread(QThread &vThread); + void quitThread(); public slots: - bool doInit(); + bool init(QThread &vThread); + bool init(); void doScan(); void doJoinNetwork(const Network &vNetwork, const QString &vPassword); void doDisconnectNetwork(const Network &vNetwork); void doRequestIPSettings(); +private slots: + void quit(); + signals: void didAddNetwork(const Network); + void didDisconnectNetwork(const Network); + void didGetIPSettings(const Network::IPSettings); + void didRequestScan(); + void didScan(); + + // emitted from separate threads void didScanStatusChanged(const bool); void didConnectToNetwork(const Network); - void didDisconnectNetwork(const Network); void didError(const QString); - void didGetIPSettings(const Network::IPSettings); private slots: void onQuit(); void onParseWifiScan(const QString &vOutput); void onLogFailure(const QString &vMessage); + void onScanFinished(int vExitCode, QProcess::ExitStatus vExitStatus); + void onScan(); };