Index: sources/device/DeviceController.cpp =================================================================== diff -u -r20fd0f6c963bc4dedc81ecb3258a2a4c52295a0f -r5a9b7ff46df9cecc258f7cb18019a51bca76bce3 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 20fd0f6c963bc4dedc81ecb3258a2a4c52295a0f) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 5a9b7ff46df9cecc258f7cb18019a51bca76bce3) @@ -108,6 +108,8 @@ connect(&_fileSystemWatcher , SIGNAL( fileChanged(const QString &)), this , SLOT( onWatchFileChanged(const QString &))); + connect(&_ApplicationController , SIGNAL(didPOSTOSVersionData (const QString &)), + this , SLOT( onPOSTOSVersionData (const QString &))); connect(&_ApplicationController , SIGNAL(didPOSTEthernetData (const QString &)), this , SLOT( onPOSTEthernetData (const QString &))); connect(&_ApplicationController , SIGNAL(didPOSTWirelessData (const QString &)), @@ -556,7 +558,12 @@ } // ----- run the process - _processBrightness.start(script, QStringList() << QString::number(_deviceBrightnessRequest._data.mBrightness_val)); + int timeout_ms = 1000; + QStringList params; + params << QString::number(_deviceBrightnessRequest._data.mBrightness_val); + TimedProcess *timedProcess = new TimedProcess(&_processBrightness, script, timeout_ms, params); + timedProcess->start(); + } /*! @@ -608,7 +615,7 @@ // ----- check that script exists. QString script; - if ( checkError( DeviceError::checkScript(script, vData.mIsGet ? RootSSHAccess_Get : RootSSHAccess_Set), _deviceRootSSHAccessResponse, script) ) + if ( checkError( DeviceError::checkScript(script, RootSSHAccess), _deviceRootSSHAccessResponse, script) ) return; // ----- check if the process is not running @@ -618,8 +625,9 @@ } // ----- run the process - - TimedProcess *timedProcess = new TimedProcess(&_processRootSSHAccess, script, 1000, { _deviceRootSSHAccessRequest._data.mRootSSHAccess ? "YES": "no" }); + QStringList params; + if ( ! _deviceRootSSHAccessRequest._data.mIsGet ) params << FSN(_deviceRootSSHAccessRequest._data.mRootSSHAccess); + TimedProcess *timedProcess = new TimedProcess(&_processRootSSHAccess, script, 1000, params); timedProcess->start(); } @@ -638,27 +646,38 @@ { if ( ! checkError(static_cast(vExitCode), _deviceRootSSHAccessResponse, _deviceRootSSHAccessResponse.toString()) ) { // has no error if (_deviceRootSSHAccessRequest._data.mIsGet) { - bool ok = false; - bool rootSSHAccess = _processRootSSHAccess.readLine().toUInt(&ok); - if ( ok ) { - _deviceRootSSHAccessResponse._data.mMessage = _deviceRootSSHAccessResponse.toString(); - _deviceRootSSHAccessResponse._data.mRootSSHAccess = rootSSHAccess; + bool ok = true; + Qt::CheckState rootSSHAccess = Qt:: Unchecked; + uint value = _processRootSSHAccess.readLine().toUInt(&ok); + if ( ! ok ) goto lError; + + switch (value) { + case 0 : rootSSHAccess = Qt:: Unchecked; break; + case 1 : rootSSHAccess = Qt::PartiallyChecked; break; + case 2 : rootSSHAccess = Qt:: Checked; break; + default : ok = false; } - else { - checkError(DeviceError::eDevice_Scripts_Error_Incorrect_Rsp, _deviceRootSSHAccessResponse, _deviceRootSSHAccessResponse.toString()); - return; - } + + if ( ! ok ) goto lError; + + _deviceRootSSHAccessResponse._data.mMessage = _deviceRootSSHAccessResponse.toString(); + _deviceRootSSHAccessResponse._data.mRootSSHAccess = rootSSHAccess; } else { - _deviceRootSSHAccessResponse._data.mMessage = _deviceRootSSHAccessResponse.toString(); - _deviceRootSSHAccessResponse._data.mRootSSHAccess = _deviceRootSSHAccessRequest._data.mRootSSHAccess; + _deviceRootSSHAccessResponse._data.mMessage = _deviceRootSSHAccessResponse.toString(); + _deviceRootSSHAccessResponse._data.mRootSSHAccess = _deviceRootSSHAccessRequest._data.mRootSSHAccess; } + LOG_APPED(_deviceRootSSHAccessResponse._data.mMessage); emit didAttributeResponse(_deviceRootSSHAccessResponse._data); } else { // the error in this case is handled in the checkError } + return; + +lError: + checkError(DeviceError::eDevice_Scripts_Error_Incorrect_Rsp, _deviceRootSSHAccessResponse, _deviceRootSSHAccessResponse.toString()); } ///////////////////////////////////////////// DeviceCryptSetup @@ -884,6 +903,17 @@ } /*! + * \brief DeviceController::onPOSTOSVersionData + * \details Collects the OS Version + * when it is ready after the POST is done reading OS Version + * \param vMacAddress - The Ethernet MAC address + */ +void DeviceController::onPOSTOSVersionData(const QString &vOSVersion) { + _osVersion = vOSVersion; + emit didPOSTOSVersionData (vOSVersion); +} + +/*! * \brief DeviceController::onPOSTEthernetData * \details Collects the ethernet mac address * when it is ready after the POST is done for the Ethernet