Index: sources/wifi/WifiInterface.cpp =================================================================== diff -u -r0629dfe6bcc3e85047319284fa4c534efbf58594 -r091bc0425b84f094cbd863865a5edac2477208eb --- sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 0629dfe6bcc3e85047319284fa4c534efbf58594) +++ sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 091bc0425b84f094cbd863865a5edac2477208eb) @@ -26,7 +26,7 @@ _processSetStaticIPAddress.setParent(this); _processSetStaticGateway.setParent(this); _processSetStaticSubnetMask.setParent(this); - _processSetStaticDNS.setParent(this); + _processSetDNS.setParent(this); } void WifiInterface::initConnections() @@ -74,7 +74,7 @@ connect(&_processSetStaticSubnetMask, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onProcessFinishedSetSubnetMask(int,QProcess::ExitStatus))); - connect(&_processSetStaticDNS, SIGNAL(finished(int, QProcess::ExitStatus)), + connect(&_processSetDNS, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onProcessFinishedSetDNS(int,QProcess::ExitStatus))); } @@ -649,7 +649,17 @@ void WifiInterface::doRequestSetIPAddress(const QString &vIPAddress) { Q_UNUSED(vIPAddress) - // TODO + 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) + { + LOG_DEBUG(QString("Rejecting request for %1. %2 is already running.") + .arg(__FUNCTION__) + .arg(_processSetStaticIPAddress.objectName())); + return; + } + _processSetStaticIPAddress.start(Wifi_Set_Static_IP, + QStringList() << _iface); } /*! @@ -660,9 +670,13 @@ */ void WifiInterface::onProcessFinishedSetIPAddress(int vExitCode, QProcess::ExitStatus vExitStatus) { - Q_UNUSED(vExitCode) Q_UNUSED(vExitStatus) - // TODO + if (vExitCode != 0) + { + emit didError(tr("Failed to set static IP Address for %1").arg(_network.ssid())); + return; + } + emit didSetStaticIPAddress(); } /*! @@ -673,7 +687,17 @@ void WifiInterface::doRequestSetGateway(const QString &vGateway) { Q_UNUSED(vGateway) - // TODO + 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) + { + LOG_DEBUG(QString("Rejecting request for %1. %2 is already running.") + .arg(__FUNCTION__) + .arg(_processSetStaticGateway.objectName())); + return; + } + _processSetStaticGateway.start(Wifi_Set_Static_IP, + QStringList() << vGateway); } /*! @@ -684,9 +708,13 @@ */ void WifiInterface::onProcessFinishedSetGateway(int vExitCode, QProcess::ExitStatus vExitStatus) { - Q_UNUSED(vExitCode) Q_UNUSED(vExitStatus) - // TODO + if (vExitCode != 0) + { + emit didError(tr("Failed to set gateway for %1").arg(_network.ssid())); + return; + } + emit didSetGateway(); } /*! @@ -697,7 +725,17 @@ void WifiInterface::doRequestSetSubnetMask(const QString &vSubnetMask) { Q_UNUSED(vSubnetMask) - // TODO + 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) + { + LOG_DEBUG(QString("Rejecting request for %1. %2 is already running.") + .arg(__FUNCTION__) + .arg(_processSetStaticSubnetMask.objectName())); + return; + } + _processSetStaticSubnetMask.start(Wifi_Set_SubnetMask, + QStringList() << vSubnetMask); } /*! @@ -708,9 +746,13 @@ */ void WifiInterface::onProcessFinishedSetSubnetMask(int vExitCode, QProcess::ExitStatus vExitStatus) { - Q_UNUSED(vExitCode) Q_UNUSED(vExitStatus) - // TODO + if (vExitCode != 0) + { + emit didError(tr("Failed to set subnet mask for %1. Has the IP been set?").arg(_network.ssid())); + return; + } + emit didSetSubnetMask(); } /*! @@ -720,8 +762,17 @@ */ void WifiInterface::doRequestSetDNS(const QString &vDNS) { - Q_UNUSED(vDNS) - // TODO + 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) + { + LOG_DEBUG(QString("Rejecting request for %1. %2 is already running.") + .arg(__FUNCTION__) + .arg(_processSetDNS.objectName())); + return; + } + _processSetDNS.start(Wifi_Set_DNS, + QStringList() << vDNS); } /*! @@ -732,7 +783,11 @@ */ void WifiInterface::onProcessFinishedSetDNS(int vExitCode, QProcess::ExitStatus vExitStatus) { - Q_UNUSED(vExitCode) Q_UNUSED(vExitStatus) - // TODO + if (vExitCode != 0) + { + emit didError(tr("Failed to set DNS.").arg(_network.ssid())); + return; + } + emit didSetDNS(); }