Index: sources/wifi/WifiInterface.cpp =================================================================== diff -u -r54f11a67ea7b62c64e797d3947d0858530394467 -r08ab5b3dbe26b4c7b7bb2ac539b1cfd62a4676c7 --- sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 54f11a67ea7b62c64e797d3947d0858530394467) +++ sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 08ab5b3dbe26b4c7b7bb2ac539b1cfd62a4676c7) @@ -27,9 +27,6 @@ _processSetStaticGateway.setParent(this); _processSetStaticSubnetMask.setParent(this); _processSetDNS.setParent(this); - - if (hasConnectedToWifi()) - rejoinLastWifiNetwork(); } @@ -86,6 +83,9 @@ void WifiInterface::initConnections() { + connect(this, SIGNAL(didStart()), + this, SLOT(onStart())); + connect(this, SIGNAL(didStatusChanged(const QString)), this, SLOT(onStatusChanged(const QString))); @@ -234,13 +234,30 @@ } /*! + * \brief WifiInterface::start + * Starts the WifiInterface + */ +void WifiInterface::start() +{ + emit didStart({}); +} + +/*! + * \brief WifiInterface::onStart + * Called when the WifiInterface has started + */ +void WifiInterface::onStart() +{ + if (hasConnectedToWifi()) + rejoinLastWifiNetwork(); +} + +/*! * \brief WifiInterface::doScan * Scans for Wifi Access Points */ void WifiInterface::doScan() { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); - if (_scanRunning) { LOG_DEBUG("Wifi network scan is already running."); @@ -269,7 +286,6 @@ */ void WifiInterface::onProcessFinishedScan(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); Q_UNUSED(vExitCode) Q_UNUSED(vExitStatus) QString out = _processScan.readAllStandardOutput(); @@ -312,7 +328,6 @@ */ QList WifiInterface::parseWifiScan(const QString &vOutput) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); QList networks; QString outputNoReturns = vOutput; outputNoReturns = outputNoReturns.replace("\r", ""); @@ -387,7 +402,6 @@ */ void WifiInterface::doJoinNetwork(const Network &vNetwork, const QString &vPassword) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); _network = vNetwork; _useDHCP = true; WifiSettings.setValue(WifiSettings_UseDHCP, _useDHCP); @@ -433,7 +447,6 @@ */ void WifiInterface::onProcessFinishedGenerateWPASupplicant(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); Q_UNUSED(vExitStatus) if (vExitCode != 0) { @@ -461,7 +474,6 @@ */ void WifiInterface::onProcessFinishedStartWPASupplicant(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); Q_UNUSED(vExitStatus) if (vExitCode != 0) { @@ -477,7 +489,6 @@ */ void WifiInterface::onRequestAutoAssignedIP() { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); if (_processRequestAutoAssignedIP.state() != QProcess::NotRunning) { LOG_DEBUG(QString("Rejecting request for %1. %2 is already running.") @@ -498,7 +509,6 @@ */ void WifiInterface::onProcessFinishedRequestAutoAssignedIP(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); Q_UNUSED(vExitStatus) if (vExitCode != 0) { @@ -523,7 +533,6 @@ */ void WifiInterface::doRequestIPSettings() { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); if (_processReadIPSettings.state() != QProcess::NotRunning) { LOG_DEBUG(QString("Rejecting request for %1. %2 is already running.") @@ -543,7 +552,6 @@ */ void WifiInterface::onProcessFinishedReadIP(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); Q_UNUSED(vExitCode); Q_UNUSED(vExitStatus); QString output = _processReadIPSettings.readAllStandardOutput(); @@ -569,7 +577,6 @@ */ void WifiInterface::onProcessFinishedReadGateway(int vExitCode, QProcess::ExitStatus vExitStatus) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); Q_UNUSED(vExitCode); Q_UNUSED(vExitStatus); _network.mIPSettings.mGateway = parseGateway(_processReadGateway.readAllStandardOutput()); @@ -621,7 +628,6 @@ */ void WifiInterface::doDisconnectNetwork(const Network &vNetwork) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); LOG_DEBUG(QString("Disconnecting from Network %1").arg(vNetwork.ssid())); if (_processDisconnectNetwork.state() != QProcess::NotRunning) { @@ -725,7 +731,6 @@ void WifiInterface::doRequestSetIPAddress(const QString &vIPAddress) { Q_UNUSED(vIPAddress) - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); LOG_DEBUG(QString("Handling request to set static IP address: %1").arg(vIPAddress)); if (_processSetStaticIPAddress.state() != QProcess::NotRunning) { @@ -766,7 +771,6 @@ void WifiInterface::doRequestSetGateway(const QString &vGateway) { Q_UNUSED(vGateway) - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); LOG_DEBUG(QString("Handling request to set static gateway: %1").arg(vGateway)); if (_processSetStaticGateway.state() != QProcess::NotRunning) @@ -808,7 +812,6 @@ void WifiInterface::doRequestSetSubnetMask(const QString &vSubnetMask) { Q_UNUSED(vSubnetMask) - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); LOG_DEBUG(QString("Handling request to set static subnet mask: %1").arg(vSubnetMask)); if (_processSetStaticSubnetMask.state() != QProcess::NotRunning) { @@ -848,7 +851,6 @@ */ void WifiInterface::doRequestSetDNS(const QString &vDNS) { - LOG_DEBUG(QString("WifiInterface::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); LOG_DEBUG(QString("Handling request to set DNS: %1").arg(vDNS)); if (_processSetDNS.state() != QProcess::NotRunning) {