Index: denali.pro.user =================================================================== diff -u -rc77365fa76422bc2150e58d483c446325b50f4b8 -r3403122944ec8f31dfd33b387e21204783579f60 --- denali.pro.user (.../denali.pro.user) (revision c77365fa76422bc2150e58d483c446325b50f4b8) +++ denali.pro.user (.../denali.pro.user) (revision 3403122944ec8f31dfd33b387e21204783579f60) @@ -1,14 +1,14 @@ - + EnvironmentId {67370740-e20f-4fc6-be45-6652e866a8bf} ProjectExplorer.Project.ActiveTarget - 1 + 0 ProjectExplorer.Project.EditorSettings @@ -86,6 +86,311 @@ ProjectExplorer.Project.Target.0 + Qt 5.12.5 (iMX8) + Qt 5.12.5 (iMX8) + {5d6458ef-f917-4aef-a092-c77bbe106149} + 1 + 0 + 0 + + /home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Check for free disk space + + RemoteLinux.CheckForFreeDiskSpaceStep + + + + + / + 5242880 + + + + + true + Kill current application instance + + RemoteLinux.KillAppStep + + + + + + + + + true + Deploy files via rsync + + RemoteLinux.RsyncDeployStep + + + + + + + -av + false + + 3 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Remote Linux Host + + DeployToGenericLinux + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 1 + + + denali (on UI Test Board) + RemoteLinuxRunConfiguration:/home/denali/Projects/application/denali.pro + 1 + + false + + 3768 + false + true + false + false + true + false + + + :0 + + 1 + + + + ProjectExplorer.Project.Target.1 + Desktop Qt 5.12.5 GCC 64bit Desktop Qt 5.12.5 GCC 64bit qt.qt5.5125.gcc_64_kit @@ -1185,312 +1490,7 @@ false true - /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release - - 1 - - - - ProjectExplorer.Project.Target.1 - - Qt 5.12.5 (iMX8) - Qt 5.12.5 (iMX8) - {5d6458ef-f917-4aef-a092-c77bbe106149} - 1 - 0 - 0 - - /home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /home/denali/Projects/tmp/build/denali-Qt_5_12_5_iMX8-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - Check for free disk space - - RemoteLinux.CheckForFreeDiskSpaceStep - - - - - / - 5242880 - - - - - true - Kill current application instance - - RemoteLinux.KillAppStep - - - - - - - - - true - Deploy files via rsync - - RemoteLinux.RsyncDeployStep - - - - - - - -av - false - - 3 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy to Remote Linux Host - - DeployToGenericLinux - - 1 - - - dwarf - - cpu-cycles - - - 250 - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 1 - - - denali (on UI Test Board) - RemoteLinuxRunConfiguration:/home/denali/Projects/application/denali.pro - 1 - - false - - 3768 - false - true - false - false - true - false - - :0 1 Index: sources/view/VNetworkModel.cpp =================================================================== diff -u -rf35b360054e1e2fa81bf107427fe2d50d78e9e8a -r3403122944ec8f31dfd33b387e21204783579f60 --- sources/view/VNetworkModel.cpp (.../VNetworkModel.cpp) (revision f35b360054e1e2fa81bf107427fe2d50d78e9e8a) +++ sources/view/VNetworkModel.cpp (.../VNetworkModel.cpp) (revision 3403122944ec8f31dfd33b387e21204783579f60) @@ -219,10 +219,10 @@ void VNetworkModel::onConnectedToNetwork(const Network &vNetwork) { LOG_DEBUG(QString("Connected to %1.").arg(vNetwork.ssid())); - ipAddress(vNetwork.ipSettings().mIPAddress); - gateway(vNetwork.ipSettings().mGateway); - subnetMask(vNetwork.ipSettings().mSubnetMask); - dns(vNetwork.ipSettings().mDns); + ipAddress(vNetwork.mIPSettings.mIPAddress); + gateway(vNetwork.mIPSettings.mGateway); + subnetMask(vNetwork.mIPSettings.mSubnetMask); + dns(vNetwork.mIPSettings.mDNS); status(tr("Connected to %1.").arg(vNetwork.ssid())); } Index: sources/wifi/Network.h =================================================================== diff -u -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 -r3403122944ec8f31dfd33b387e21204783579f60 --- sources/wifi/Network.h (.../Network.h) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) +++ sources/wifi/Network.h (.../Network.h) (revision 3403122944ec8f31dfd33b387e21204783579f60) @@ -48,9 +48,11 @@ QString mGateway; QString mSubnetMask; QString mBroadcast; - QString mDns; + QString mDNS; }; + IPSettings mIPSettings; + bool operator==(const Network &d1) { if (ssid() == d1.ssid()) return true; @@ -117,14 +119,6 @@ return NO_SIGNAL; } - IPSettings ipSettings() const { - return _ipSettings; - } - - void ipSettings(const IPSettings &vIPSettings) { - _ipSettings = vIPSettings; - } - explicit Network() {} explicit Network(const QString &vMacAddress) {_macAddress = vMacAddress; } explicit Network(const QString &vMacAddress, const QString &vSSID, const SECURITY_LEVEL &vSecurityLevel, const STATUS &vStatus, const int &vSignalLevel) { @@ -135,12 +129,23 @@ _signalLevel = convertSignalLevel(vSignalLevel); } + void clearSettings() { + mIPSettings.mIPAddress = ""; + mIPSettings.mDNS = ""; + mIPSettings.mGateway = ""; + mIPSettings.mSubnetMask = ""; + + _macAddress = ""; + _ssid = ""; + _security = UNSUPPORTED; + _status = NOT_CONNECTED; + _signalLevel = NO_SIGNAL; + } + private: QString _macAddress; QString _ssid; SECURITY_LEVEL _security = UNSUPPORTED; SIGNAL_LEVEL _signalLevel = NO_SIGNAL; STATUS _status = NOT_CONNECTED; - IPSettings _ipSettings; - }; Index: sources/wifi/WifiInterface.cpp =================================================================== diff -u -rf35b360054e1e2fa81bf107427fe2d50d78e9e8a -r3403122944ec8f31dfd33b387e21204783579f60 --- sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision f35b360054e1e2fa81bf107427fe2d50d78e9e8a) +++ sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 3403122944ec8f31dfd33b387e21204783579f60) @@ -12,23 +12,42 @@ using namespace Storage; -WifiInterface::WifiInterface(QObject *parent) : QObject(parent) {} +WifiInterface::WifiInterface(QObject *parent) : QObject(parent) +{ + _processScan.setParent(this); + _processReadIPSettings.setParent(this); + _processReadGateway.setParent(this); + _processReadDNS.setParent(this); + _processGenerateWPASupplicant.setParent(this); + _processStartWPASupplicant.setParent(this); + _processRequestAutoAssignedIP.setParent(this); +} void WifiInterface::onInitConnections() { - connect(this, SIGNAL(didError(const QString)), this, SLOT(onLogFailure(const QString))); connect(&_processScan, SIGNAL(finished(int, QProcess::ExitStatus)), - this, SLOT(onScanFinished(int,QProcess::ExitStatus))); + this, SLOT(onProcessFinishedScan(int,QProcess::ExitStatus))); -// connect(&_scanWatcher, SIGNAL(finished()), -// this , SLOT(onFinishedScan())); + connect(&_processReadIPSettings, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(onProcessFinishedReadIP(int,QProcess::ExitStatus))); - connect(this, SIGNAL(didScan()), - this, SLOT(onScan())); + connect(&_processReadGateway, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(onProcessFinishedReadGateway(int,QProcess::ExitStatus))); + connect(&_processReadDNS, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(onProcessFinishedReadDNS(int,QProcess::ExitStatus))); + + connect(&_processGenerateWPASupplicant, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(onProcessFinishedGenerateWPASupplicant(int,QProcess::ExitStatus))); + + connect(&_processStartWPASupplicant, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(onProcessFinishedStartWPASupplicant(int,QProcess::ExitStatus))); + + connect(&_processRequestAutoAssignedIP, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(onProcessFinishedRequestAutoAssignedIP(int,QProcess::ExitStatus))); } /*! @@ -151,12 +170,6 @@ void WifiInterface::doScan() { qDebug() << __FUNCTION__ << QThread::currentThread()->objectName(); - emit didScan(); -} - -void WifiInterface::onScan() -{ - qDebug() << __FUNCTION__ << QThread::currentThread()->objectName(); if (_scanRunning) { LOG_DEBUG("Wifi network scan is already running."); @@ -175,17 +188,17 @@ * \param vExitCode - (int) the exit code * \param vExitStatus - (QProcess::ExitStatus) the exit status */ -void WifiInterface::onScanFinished(int vExitCode, QProcess::ExitStatus vExitStatus) +void WifiInterface::onProcessFinishedScan(int vExitCode, QProcess::ExitStatus vExitStatus) { Q_UNUSED(vExitCode) Q_UNUSED(vExitStatus) -// QString out = _processScan.readAllStandardOutput(); -// QString err = _processScan.readAllStandardError(); -// LOG_DEBUG(out); -// LOG_DEBUG(err); -// _scanRunning = false; -// emit didScanStatusChanged(_scanRunning); -// onParseWifiScan(out); + QString out = _processScan.readAllStandardOutput(); + QString err = _processScan.readAllStandardError(); + LOG_DEBUG(QString("stdout: %1").arg(out)); + LOG_DEBUG(QString("stderr: %1").arg(err)); + _scanRunning = false; + emit didScanStatusChanged(_scanRunning); + onParseWifiScan(out); } /*! @@ -250,49 +263,67 @@ */ void WifiInterface::doJoinNetwork(const Network &vNetwork, const QString &vPassword) { + _network = vNetwork; LOG_DEBUG(QString("Joining Network %1").arg(vNetwork.ssid())); - if (!generateWPASupplicant(vNetwork, vPassword)) + _processGenerateWPASupplicant.start(Wifi_Generate_WPA_Supplicant, + QStringList() << vNetwork.ssid() + << vPassword + << _wpaSupplicantConfPath); +} + +/*! + * \brief WifiInterface::onProcessFinishedGenerateWPASupplicant + * Called when the process that generates the WPA supplicant file has finished + * \param vExitCode - (int) the exit code + * \param vExitStatus - (QProcess::ExitStatus) the exit status + */ +void WifiInterface::onProcessFinishedGenerateWPASupplicant(int vExitCode, QProcess::ExitStatus vExitStatus) +{ + Q_UNUSED(vExitStatus) + if (vExitCode != 0) { emit didError("Could not configure network."); return; } - if (!startWPASupplicant()) + _processStartWPASupplicant.start(Wifi_Start_WPA_Supplicant, + QStringList() << _iface + << _wpaSupplicantConfPath); +} + +/*! + * \brief WifiInterface::onProcessFinishedStartWPASupplicant + * Called when the process that starts the WPA supplicant has finished + * \param vExitCode - (int) the exit code + * \param vExitStatus - (QProcess::ExitStatus) the exit status + */ +void WifiInterface::onProcessFinishedStartWPASupplicant(int vExitCode, QProcess::ExitStatus vExitStatus) +{ + Q_UNUSED(vExitStatus) + if (vExitCode != 0) { emit didError("Could not configure network."); return; } - - // TODO: Add option to setup with static IP settings instead - if (!requestAutoAssignedIP()) - { - emit didError(QString("Could not connect to %1").arg(vNetwork.ssid())); - return; - } - - Network network = vNetwork; - network.ipSettings(getIPSettings()); - emit didConnectToNetwork(network); + _processRequestAutoAssignedIP.start(Wifi_Get_Auto_Assigned_IP, + QStringList() << _iface); } /*! - * \brief WifiInterface::getIPSettings - * Gets the IP settings from the device. If an IP address - * is not found, all other IP settings are left blank as well. + * \brief WifiInterface::onProcessFinishedRequestAutoAssignedIP + * Called when the process that requests an auto-assigned IP has finished + * \param vExitCode - (int) the exit code + * \param vExitStatus - (QProcess::ExitStatus) the exit status */ -Network::IPSettings WifiInterface::getIPSettings() +void WifiInterface::onProcessFinishedRequestAutoAssignedIP(int vExitCode, QProcess::ExitStatus vExitStatus) { - Network::IPSettings ipSettings; - QString output = readIPSettings(); - ipSettings.mIPAddress = parseIP(output); - if (ipSettings.mIPAddress == "") { - return ipSettings; + Q_UNUSED(vExitStatus) + if (vExitCode != 0) + { + emit didError(QString("Could not connect to %1").arg(_network.ssid())); + return; } - ipSettings.mBroadcast = parseBroadcast(output); - ipSettings.mSubnetMask = parseSubnetMask(output); - ipSettings.mGateway = readGateway(); - ipSettings.mDns = readDNS(); - return ipSettings; + doRequestIPSettings(); } /*! @@ -301,107 +332,91 @@ */ void WifiInterface::doRequestIPSettings() { - emit didGetIPSettings(getIPSettings()); + QString result = ""; + _processReadIPSettings.start(Wifi_Read_IP_Settings, + QStringList() << _iface); } /*! - * \brief WifiInterface::doDisconnectNetwork - * Disconnects from the specified network - * \param vNetwork - (Network) the network to disconnect from + * \brief WifiInterface::onProcessFinishedReadIP + * Parses the IP settings of the device when the process has finished + * \param vExitCode - (int) the exit code + * \param vExitStatus - (QProcess::ExitStatus) the exit status */ -void WifiInterface::doDisconnectNetwork(const Network &vNetwork) +void WifiInterface::onProcessFinishedReadIP(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG(QString("Disconnecting from Network %1").arg(vNetwork.ssid())); - QProcess process; - process.start(Wifi_Disconnect_Network, - QStringList() << _iface); - if (process.waitForFinished(_defaultTimeout)) - emit didDisconnectNetwork(vNetwork); - process.kill(); - emit didError(tr("Failed to disconnect from %1").arg(vNetwork.ssid())); + Q_UNUSED(vExitCode); + Q_UNUSED(vExitStatus); + QString output = _processReadIPSettings.readAllStandardOutput(); + _network.mIPSettings.mIPAddress = parseIP(output); + _network.mIPSettings.mBroadcast = parseBroadcast(output); + _network.mIPSettings.mSubnetMask = parseSubnetMask(output); + _processReadGateway.start(Wifi_Read_Gateway); } - /*! - * \brief WifiInterface::generateWPASupplicant - * Generates the WPA Supplicant configuration file - * \param vNetwork (Network) the network w/ ssid we want to connect to - * \param vPassword (QString) the password the user entered for this network - * \return (bool) true if writing the file completed, false otherwise + * \brief WifiInterface::onProcessFinishedReadGateway + * Parses the gateway of the device when the process has finished then + * initiates reading the DNS + * \param vExitCode - (int) the exit code + * \param vExitStatus - (QProcess::ExitStatus) the exit status */ -bool WifiInterface::generateWPASupplicant(const Network &vNetwork, const QString &vPassword) +void WifiInterface::onProcessFinishedReadGateway(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG("Generating WPA Supplicant..."); - QProcess process; - process.start(Wifi_Generate_WPA_Supplicant, - QStringList() << vNetwork.ssid() - << vPassword - << _wpaSupplicantConfPath); - if (!process.waitForFinished(_defaultTimeout)) - { - process.kill(); - return false; - } - return true; + Q_UNUSED(vExitCode); + Q_UNUSED(vExitStatus); + _network.mIPSettings.mGateway = parseGateway(_processReadGateway.readAllStandardOutput()); + _processReadDNS.start(Wifi_Read_DNS); } /*! - * \brief WifiInterface::startWPASupplicant - * Starts WPA supplicant in the background. Assumes the conf file has already been written - * \return true if successful, false on timeout + * \brief WifiInterface::onProcessFinishedReadDNS + * Parses the DNS of the device when the process has finished then + * emits the newtwork with all the ip address information filled + * \param vExitCode - (int) the exit code + * \param vExitStatus - (QProcess::ExitStatus) the exit status */ -bool WifiInterface::startWPASupplicant() +void WifiInterface::onProcessFinishedReadDNS(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG("Starting wpa supplicant..."); - QProcess process; - process.start(Wifi_Start_WPA_Supplicant, - QStringList() << _iface - << _wpaSupplicantConfPath); - if (!process.waitForFinished(_defaultTimeout)) - { - process.kill(); - return false; - } - return true; + Q_UNUSED(vExitCode); + Q_UNUSED(vExitStatus); + _network.mIPSettings.mDNS = parseDNS(_processReadDNS.readAllStandardOutput()); + emit didConnectToNetwork(_network); } /*! - * \brief WifiInterface::requestAutoAssignedIP - * Requests an auto-assigned IP addressed - * \return true if successful, false on timeout + * \brief WifiInterface::doDisconnectNetwork + * Disconnects from the specified network + * \param vNetwork - (Network) the network to disconnect from */ -bool WifiInterface::requestAutoAssignedIP(int vTries) +void WifiInterface::doDisconnectNetwork(const Network &vNetwork) { - LOG_DEBUG(QString("Requesting auto-assigned IP address...")); + LOG_DEBUG(QString("Disconnecting from Network %1").arg(vNetwork.ssid())); QProcess process; - process.start(Wifi_Get_Auto_Assigned_IP, - QStringList() << _iface); - if (!process.waitForFinished(_dhcpTimeout)) - { - if (vTries > 0) - return requestAutoAssignedIP(--vTries); - return false; - } - return true; + process.start(Wifi_Disconnect_Network, + QStringList() << _iface); + if (process.waitForFinished(_defaultTimeout)) + emit didDisconnectNetwork(vNetwork); + process.kill(); + emit didError(tr("Failed to disconnect from %1").arg(vNetwork.ssid())); } /*! - * \brief WifiInterface::readIPSettings - * Reads the IP settings of the device - * \return (QString) the unparsed standard output + * \brief WifiInterface::onProcessFinishedDisconnectNetwork + * Called when we disconnect from the wifi network + * \param vExitCode - (int) the exit code + * \param vExitStatus - (QProcess::ExitStatus) the exit status */ -QString WifiInterface::readIPSettings() +void WifiInterface::onProcessFinishedDisconnectNetwork(int vExitCode, QProcess::ExitStatus vExitStatus) { - QString result = ""; - QProcess process; - process.start(Wifi_Read_IP_Settings, - QStringList() << _iface); - if (process.waitForFinished(_defaultTimeout)) - result = process.readAllStandardOutput(); - else - process.kill(); - LOG_DEBUG(QString("Output with IP address information: %1").arg(result)); - return result; + Q_UNUSED(vExitStatus) + if (vExitCode != 0) + { + emit didError(tr("Failed to disconnect from %1").arg(_network.ssid())); + return; + } + emit didDisconnectNetwork(_network); + _network.clearSettings(); } /*! @@ -468,33 +483,3 @@ return vOutput.split("nameserver")[1].split("\n")[0].trimmed(); return ""; } - -/*! - * \brief WifiInterface::readGateway - * Reads the current gateway - * \return (QString) the gateway if found, "" otherwise - */ -QString WifiInterface::readGateway() -{ - QProcess process; - process.start(Wifi_Read_Gateway); - if (process.waitForFinished(_defaultTimeout)) - return parseGateway(process.readAllStandardOutput()); - process.kill(); - return ""; -} - -/*! - * \brief WifiInterface::readDNS - * Reads the DNS setting - * \return (QString) the first dns found, "" otherwise - */ -QString WifiInterface::readDNS() -{ - QProcess process; - process.start(Wifi_Read_DNS); - if (process.waitForFinished(_defaultTimeout)) - return parseDNS(process.readAllStandardOutput()); - process.kill(); - return ""; -} Index: sources/wifi/WifiInterface.h =================================================================== diff -u -rf35b360054e1e2fa81bf107427fe2d50d78e9e8a -r3403122944ec8f31dfd33b387e21204783579f60 --- sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision f35b360054e1e2fa81bf107427fe2d50d78e9e8a) +++ sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision 3403122944ec8f31dfd33b387e21204783579f60) @@ -32,6 +32,13 @@ int _scanTimeout = 30000; int _processCounter = 0; QProcess _processScan; + QProcess _processReadIPSettings; + QProcess _processReadGateway; + QProcess _processReadDNS; + QProcess _processGenerateWPASupplicant; + QProcess _processStartWPASupplicant; + QProcess _processRequestAutoAssignedIP; + Network _network; const QString _iface = "wlan0"; const QString _wpaSupplicantConfPath = "/etc/wpa_supplicant.conf"; @@ -41,15 +48,9 @@ SINGLETON(WifiInterface) private: -// QFutureWatcher _scanWatcher; - bool generateWPASupplicant(const Network &vNetwork, const QString &vPassword); bool startWPASupplicant(); bool requestAutoAssignedIP(int vTries = 4); - Network::IPSettings getIPSettings(); - QString readIPSettings(); - QString readGateway(); - QString readDNS(); QString parseIP(const QString &vOutput); QString parseBroadcast(const QString &vOutput); QString parseSubnetMask(const QString &vOutput); @@ -77,7 +78,6 @@ void didDisconnectNetwork(const Network); void didGetIPSettings(const Network::IPSettings); void didRequestScan(); - void didScan(); // emitted from separate threads void didScanStatusChanged(const bool); @@ -88,6 +88,12 @@ void onQuit(); void onParseWifiScan(const QString &vOutput); void onLogFailure(const QString &vMessage); - void onScanFinished(int vExitCode, QProcess::ExitStatus vExitStatus); - void onScan(); + void onProcessFinishedScan(int vExitCode, QProcess::ExitStatus vExitStatus); + void onProcessFinishedReadIP(int vExitCode, QProcess::ExitStatus vExitStatus); + void onProcessFinishedReadGateway(int vExitCode, QProcess::ExitStatus vExitStatus); + void onProcessFinishedReadDNS(int vExitCode, QProcess::ExitStatus vExitStatus); + void onProcessFinishedGenerateWPASupplicant(int vExitCode, QProcess::ExitStatus vExitStatus); + void onProcessFinishedStartWPASupplicant(int vExitCode, QProcess::ExitStatus vExitStatus); + void onProcessFinishedRequestAutoAssignedIP(int vExitCode, QProcess::ExitStatus vExitStatus); + void onProcessFinishedDisconnectNetwork(int vExitCode, QProcess::ExitStatus vExitStatus); };