Index: leahi.pro =================================================================== diff -u -r721e055ca19c92525a45be953ad1cffdc2d69abb -r472c10e72a8d278f13d2343f9c81c1def14490ff --- leahi.pro (.../leahi.pro) (revision 721e055ca19c92525a45be953ad1cffdc2d69abb) +++ leahi.pro (.../leahi.pro) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -127,7 +127,6 @@ sources/device/DeviceController.h \ sources/storage/Settings.h \ sources/storage/TreatmentLog.h \ - sources/wifi/WifiInterface.h \ sources/bluetooth/BluetoothInterface.h \ sources/cloudsync/CloudSyncController.h \ \ # ---------- Models ---------- @@ -291,7 +290,6 @@ sources/view/settings/VSettings.h \ sources/view/settings/VLocalization.h \ sources/view/settings/VBluetooth.h \ - sources/view/settings/VNetworkModel.h \ sources/view/settings/VAdjustmentVersions.h \ sources/view/settings/VAdjustmentAlarmVolume.h \ sources/view/settings/VAdjustmentServiceMode.h \ @@ -408,7 +406,6 @@ sources/storage/Settings.cpp \ sources/storage/TreatmentLog.cpp \ sources/view/hd/data/post/VHDPOSTData.cpp \ - sources/wifi/WifiInterface.cpp \ sources/bluetooth/BluetoothInterface.cpp \ sources/cloudsync/CloudSyncController.cpp \ \ # ---------- Models ---------- @@ -563,7 +560,6 @@ sources/view/settings/VLocalization.cpp \ sources/view/settings/VDateTime.cpp \ sources/view/settings/VBluetooth.cpp \ - sources/view/settings/VNetworkModel.cpp \ sources/view/settings/VAdjustmentVersions.cpp \ sources/view/settings/VAdjustmentAlarmVolume.cpp \ sources/view/settings/VAdjustmentServiceMode.cpp \ Index: main.cpp =================================================================== diff -u -r6e47dacddee3eb819703dc1ba30386f8272869cb -r472c10e72a8d278f13d2343f9c81c1def14490ff --- main.cpp (.../main.cpp) (revision 6e47dacddee3eb819703dc1ba30386f8272869cb) +++ main.cpp (.../main.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -50,7 +50,6 @@ #include "GuiController.h" #include "Logger.h" #include "DeviceController.h" -#include "WifiInterface.h" #include "BluetoothInterface.h" #include "CloudSyncController.h" //AMIR @@ -504,10 +503,10 @@ // and all the files are copied to the /home/root/ to later be copied to secured locations // and that will be done by lockdown.sh script running within application after the user is done with the setup and QUIT s the application. if ( gEnableManufacturing || gEnableUpdating ) { - QString scriptName = Storage::Device_Lockdown; + QString scriptName = Storage::Scripts_Device_Lockdown; quint16 errorCode; QString errorText; - errorCode = Device::DeviceError::checkScript (scriptName, Storage::Device_Lockdown ); + errorCode = Device::DeviceError::checkScript (scriptName, Storage::Scripts_Device_Lockdown ); errorText = Device::DeviceError::deviceErrorText( static_cast(errorCode), 1); qDebug() << errorText; // since we are in the manufacturing mode it is possible to probably take a look at the serial, if not that is being logged. #ifdef BUILD_FOR_TARGET @@ -630,9 +629,6 @@ //! - Initializing Main Timer _MainTimer.init(); - //! - Initializing WiFi Interface - _WifiInterface.init(Threads::_Wifi_Thread); - //! - Initializing Bluetooth Interface _BluetoothInterface.init(Threads::_Bluetooth_Thread); Index: sources/ApplicationController.cpp =================================================================== diff -u -r721e055ca19c92525a45be953ad1cffdc2d69abb -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 721e055ca19c92525a45be953ad1cffdc2d69abb) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -26,7 +26,6 @@ #include "GuiController.h" #include "Settings.h" #include "MSettings.h" -#include "WifiInterface.h" #include "BluetoothInterface.h" #include "VAdjustmentVersions.h" @@ -586,7 +585,7 @@ */ void ApplicationController::onPOSTWiFi(bool vPass) { if (vPass) { - _WifiInterface.doStart(); + // _WifiInterface.doStart(); // =========================================================== FIX ME } // sending the data first, therefore in the slot for the didPOST we have the vPass and the Data to decide to use the data or not. emit didPOSTWirelessData(_post.macWireless()); Index: sources/cloudsync/CloudSyncController.h =================================================================== diff -u -r9363dbc93c2be5d664c0ca2a565d8206679d9bf3 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 9363dbc93c2be5d664c0ca2a565d8206679d9bf3) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -33,6 +33,94 @@ /*! * \brief The CloudSyncController class * \details Singleton class which is the main gateway of CloudSync signal/slots. + * \startuml + * title CloudSync Buff communication protocol + * participant HD + * queue CAN + * database FS + * participant UI + * database BUF + * participant CS + * participant DRT + * participant DCS + * + * skinparam sequenceMessageAlign left + * + * === - Manufacturing - === + * == CMDx1 - Registration == + * UI -> BUF : log:\n[1001] Registration Request + * BUF -> CS : notify + * CS -> DRT : + * DRT -> DCS : + * DCS -> DRT : DONE + * DCS -> CS : DONE + * + * == CMDx3 - Credentials - Save == + * DCS -> CS : credentials + * CS -> FS : write:\n - path_to_client_certificate_pem,\n - client_private_key_pem\n - client_public_key_pem + * CS -> BUF : log:\n[2003] Credentials Store Request\n - path_to_client_certificate_pem\n - path_to_client_private_key_pem\n - path_to_client_public_key_pem + * BUF -> UI : notify + * UI -> FS : write:\nStore it in the encrypted partition + * UI -> BUF : log:\n[1003] Credentials Store Response + * + * == CMDx4 - Credentials - Read == + * CS -> DCS : start a Session + * DCS -> CS : authentication request + * CS -> BUF : log:\n[2004] Credentials Read Request + * BUF -> UI : notify + * UI -> FS : copy credentials on tmp + * UI -> BUF : log:\n[1004] Credentials Read Response\n - path_to_credentials + * BUF -> CS : notify + * CS -> FS : read credentials + * CS -> DCS : authentication response + * + * == CMDx5 - Factory Reset == + * DCS -> CS : Registration Complete + * CS -> BUF : log:\n[2005] Factory Reset Request + * BUF -> UI : notify + * UI -> FS : factory reset: clear the related information from the system. + * UI -> BUF : log:\n[1002] Factory Reset Response + * BUF -> CS : notify + * + * === - Normal Operation - === + * + * == CMDx7 - Send Treatment Report == + * CS -> BUF : log:\n[2002] Device Info Request + * BUF -> UI : notify + * UI -> BUF : log:\n[1002] Device Info Response \n - HD Serial\n - DG Serial\n - SW Version + * BUF -> CS : notify + * + * == CMDx6 - Device State == + * CS -> BUF : log:\n[2006] Device State Request + * HD -> CAN : msg:\n[0x37] Device State Broadcast + * CAN -> UI : notify + * UI -> BUF : log:\n[1006] Device State (Top History)\n - HD Op-Mode\n - HD Sub-Mode + * BUF -> CS : notify + * CS -> BUF : read:\n[1002] Device State + * CS -> DCS : + * + * == CMDx7 - Send Tx Report == + * + * == CMDx8 - Tx Code Display == + * + * \enduml + * + * \startuml + * title "Device Management flow" + * + * actor User + * database System + * + * user -> qml : set vATTRIBUTE + * qml -> VDevice : vATTRIBUTE##Request + * VDevice -> DeviceController : didAttributeRequest \n(cosnt Device##vATTRIBUTE##RequestData &) + * DeviceController -> Script : onAttributeRequest \n(const Device##vATTRIBUTE##RequestData &) + * Script -> system : + * system -> Script + * + * \enduml + * + */ class CloudSyncController : public QObject { Q_OBJECT Index: sources/device/DeviceController.cpp =================================================================== diff -u -r3c547f89553d3aabe59423b82ecb7f8c28f9d32a -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 3c547f89553d3aabe59423b82ecb7f8c28f9d32a) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -103,11 +103,11 @@ connect(&_ApplicationController , SIGNAL(didUSBDriveUmount()), this , SLOT( onUSBDriveUmount())); - connect(this , SIGNAL(didScreenshot(const QImage &, const QString &)), - this , SLOT( onScreenshot(const QImage &, const QString &))); + connect(this , SIGNAL(didScreenshot (const QImage &, const QString &)), + this , SLOT( onScreenshot (const QImage &, const QString &))); - connect(&_fileSystemWatcher , SIGNAL( fileChanged(const QString &)), - this , SLOT( onWatchFileChanged(const QString &))); + connect(&_fileSystemWatcher , SIGNAL( fileChanged (const QString &)), + this , SLOT( onWatchFileChanged (const QString &))); connect(&_ApplicationController , SIGNAL(didPOSTOSVersionData (const QString &)), this , SLOT( onPOSTOSVersionData (const QString &))); @@ -538,319 +538,7 @@ return false; } -///////////////////////////////////////////// DeviceBrightness /*! - * \brief DeviceController::onAttributeRequest - * \details Sets the brightness level - * \param vBrightness - */ -void DeviceController::onAttributeRequest(const DeviceBrightnessRequestData &vData) -{ - // ----- initializing the member variable models - _deviceBrightnessRequest ._data = vData; - - - // ----- extract the required data - _deviceBrightnessRequest.setBrightnessSysVal(); - LOG_APPED( _deviceBrightnessRequest.toString()); - - // ----- check that script exists. - QString script; - if ( checkError( DeviceError::checkScript(script, vData.mRead ? Brightness_Get : Brightness_Set), _deviceBrightnessResponse, script) ) - return; - - // ----- check if the process is not running - if ( _processBrightness.state() != QProcess::NotRunning ) { - checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceBrightnessResponse); - return; - } - - // ----- run the process - int timeout_ms = 10000; - QStringList params; - params << QString::number(_deviceBrightnessRequest._data.mBrightness_val); - TimedProcess *timedProcess = new TimedProcess(&_processBrightness, script, timeout_ms, params); - timedProcess->start(); - -} - -/*! - * \brief DeviceController::processBrightnessResponse - * \details Called when the process to set the brightness has finished - * \param vExitCode (int) the exit code - * \note exit code -> 0 : set Accept [MBase] -> Log -> emit - * !0 : set Attrib [MBrgh] -> Log -> emit - * 1 - get an error when in onAttributeRequest : scriptErrorText([Gui Enum ]) - * 2 - get an error when in onProcessBrightnessExitCode : scriptErrorText([vExitCode]) - * 3 - get no error when in onProcessBrightnessExitCode : MDeviceResponse.toString() - * - in case 3 the specific model _data has to be filled prior to the toString to have it in the log. - */ -void DeviceController::processBrightnessResponse(int vExitCode, QProcess::ExitStatus vStatus, QProcess::ProcessChannel /*vChannel*/) -{ - //DEBUG - qDebug() << __FUNCTION__ << vExitCode << vStatus; - - if ( ! checkError(static_cast(vExitCode), _deviceBrightnessResponse, _deviceBrightnessResponse.toString()) ) { // has no error - if (_deviceBrightnessRequest._data.mRead) { - bool ok = false; - int brightness = _processBrightness.readLine().toInt(&ok); - if (ok) { - _deviceBrightnessResponse.setBrightnessPercent(brightness); - } - else { - checkError(DeviceError::eDevice_Scripts_Error_Incorrect_Rsp,_deviceBrightnessResponse, _deviceBrightnessResponse.toString()); - return; - } - } - else { - _deviceBrightnessResponse.setBrightnessPercent(_deviceBrightnessRequest._data.mBrightness_val); - _deviceBrightnessResponse._data.mMessage = _deviceBrightnessResponse.toString(); - } - LOG_APPED(_deviceBrightnessResponse._data.mMessage); - emit didAttributeResponse(_deviceBrightnessResponse._data); - } -} - - -///////////////////////////////////////////// DeviceRootSSHAccess -/*! - * \brief DeviceController::onAttributeRequest - * \details Sets the RootSSHAccess - * \param vRootSSHAccess - */ -void DeviceController::onAttributeRequest(const DeviceRootSSHAccessRequestData &vData) -{ - // ----- initializing the member variable models - _deviceRootSSHAccessRequest._data = vData; - LOG_APPED( _deviceRootSSHAccessRequest.toString()); - - // ----- check that script exists. - QString script; - if ( checkError( DeviceError::checkScript(script, RootSSHAccess), _deviceRootSSHAccessResponse, script) ) - return; - - // ----- check if the process is not running - if ( _processRootSSHAccess.state() != QProcess::NotRunning ) { - checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceRootSSHAccessResponse); - return; - } - - // ----- run the process - int timeout_ms = 10000; - QStringList params; - if ( ! _deviceRootSSHAccessRequest._data.mIsGet ) params << FSN(_deviceRootSSHAccessRequest._data.mRootSSHAccess); - TimedProcess *timedProcess = new TimedProcess(&_processRootSSHAccess, script, timeout_ms, params); - timedProcess->start(); -} - -/*! - * \brief DeviceController::processRootSSHAccessResponse - * \details Called when the process to set the RootSSHAccess has finished - * \param vExitCode (int) the exit code - * \note exit code -> 0 : set Accept [MBase] -> Log -> emit - * !0 : set Attrib [MBrgh] -> Log -> emit - * 1 - get an error when in onAttributeRequest : scriptErrorText([Gui Enum ]) - * 2 - get an error when in onProcessRootSSHAccessExitCode : scriptErrorText([vExitCode]) - * 3 - get no error when in onProcessRootSSHAccessExitCode : MDeviceResponse.toString() - * - in case 3 the specific model _data has to be filled prior to the toString to have it in the log. - */ -void DeviceController::processRootSSHAccessResponse(int vExitCode, QProcess::ExitStatus, QProcess::ProcessChannel /*vChannel*/) -{ - if ( ! checkError(static_cast(vExitCode), _deviceRootSSHAccessResponse, _deviceRootSSHAccessResponse.toString()) ) { // has no error - if (_deviceRootSSHAccessRequest._data.mIsGet) { - 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; - } - - 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; - } - - 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 -/*! - * \brief DeviceController::onAttributeRequest - * \details Calls the CryptSetup script with the model data DeviceCryptSetupRequestData - * \param vData - the model data - */ -void DeviceController::onAttributeRequest(const DeviceCryptSetupRequestData &vData) -{ - //DEBUG qDebug() << " ---------- " << vData.mCommand << vData.mPassword; - - _deviceCryptSetupRequest._data = vData; - - // ----- check that script exists. - QString script; - if ( checkError( DeviceError::checkScript(script, Crypt_Setup), _deviceCryptSetupResponse, script) ) - return; - - // ----- check if the process is not running - if ( _processCryptSetup.state() != QProcess::NotRunning ) { - checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceCryptSetupResponse); - return; - } - - - // ----- run the process - int timeout = 10000; - TimedProcess *timedProcess = new TimedProcess(&_processCryptSetup, script, timeout, { _deviceCryptSetupRequest._data.mCommand }); - _processCryptSetup.setEnvironment(QProcess::systemEnvironment() << QString("PASSWORD=%1").arg(_deviceCryptSetupRequest._data.mPassword)); - timedProcess->start(); - - // Update UI with a response - MDeviceCryptSetupResponse model; - model._data.mAccepted = false; - model._data.mMessage = tr("Encrypted Partition %1 started.").arg(_deviceCryptSetupRequest._data.mCommand); - emit didAttributeResponse(model.data()); -} - -/*! - * \brief DeviceController::processCryptSetupResponse - * \param vExitCode - * \param vStatus - */ -void DeviceController::processCryptSetupResponse(int vExitCode, QProcess::ExitStatus vStatus, QProcess::ProcessChannel /*vChannel*/) -{ - const int ERR_CRYPTSETUP_MOUNT_ISMOUNT=134; // is used in crypt_setup.sh do not modify - - // The Exit code in this script is not used. - // any other checking is done by UI Software at the moment this script is called. - // The only thing matters is the pared device info in text and it will be empty string if error happens. - MDeviceCryptSetupResponse model; - QByteArray deviceInfo; - if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; - else deviceInfo = _processCryptSetup.readAll(); - model.fromByteArray( deviceInfo, &vExitCode ); - // DEBUG: qDebug() << model._data.mEchoInfo; - emit didAttributeResponse(model.data()); - LOG_APPED_UI(model.data().mMessage); - - bool isSetup = _deviceCryptSetupRequest._data.mCommand == "setup"; - bool isMount = _deviceCryptSetupRequest._data.mCommand == "mount"; - bool isMounted = isMount && ( - vExitCode == ERR_CRYPTSETUP_MOUNT_ISMOUNT || // is already mounted - vExitCode == 0 // successful mount - ); - bool isUpdate = gEnableUpdating && isMounted; - - if ( isMount ) emit didCryptSetupMount(model._data.mAccepted); - - QString msg = ""; - int err = 0 ; - // moving the configuration files if the encrypted partition creation was successful. - if ( isUpdate ) goto lMove; // if it is gEnableUpdating, bypass the mAccepted for already mounted. - if ( ! model._data.mAccepted ) goto lErr ; // any other case goto error - if ( ! isSetup ) goto lOut ; // if not setup do NOT continue to move configurations - -lMove: - err = Storage::Settings::configurationsMove(&msg, isUpdate); - if ( err ) { - model._data.mAccepted = false ; - model._data.mReason = err ; - model._data.mMessage = msg ; - emit didAttributeResponse(model.data()); - LOG_APPED_UI(model.data().mMessage); - } - -lOut: - return; - -lErr: - LOG_DEBUG(QString("Encrypted Partition %1 failed").arg(_deviceCryptSetupRequest._data.mCommand)); -} - -///////////////////////////////////////////// DeviceBluetoothPaired -void DeviceController::onAttributeRequest(const DeviceBluetoothPairedResetRequestData &) -{ - // ----- check that script exists. - QString script; - if ( checkError( DeviceError::checkScript(script, Bluetooth_Paired_Reset), _deviceBluetoothPairedResetResponse, script) ) - return; - - // ----- check if the process is not running - if ( _processBluetoothPairedReset.state() != QProcess::NotRunning ) { - checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceBluetoothPairedResetResponse); - return; - } - - // ----- run the process - int timeout_ms = 10000; - TimedProcess *timedProcess = new TimedProcess(&_processBluetoothPairedReset, script, timeout_ms); - timedProcess->start(); -} - -void DeviceController::processBluetoothPairedResetResponse(int vExitCode, QProcess::ExitStatus vStatus, QProcess::ProcessChannel /*vChannel*/) -{ - // TODO: review the usage and definition of this object _deviceBluetoothPairedResetResponse. do we need it any more? - MDeviceBluetoothPairedResetResponse model; - QByteArray deviceInfo; - if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; - else deviceInfo = _processBluetoothPairedReset.readAll(); - model.fromByteArray( deviceInfo, &vExitCode ); - LOG_APPED_UI(model.data().mMessage); - emit didAttributeResponse(model.data()); -} - -///////////////////////////////////////////// DeviceBluetoothPairedQuery -void DeviceController::onAttributeRequest(const DeviceBluetoothPairedQueryRequestData &) -{ - // ----- check that script exists. - QString script; - if ( checkError( DeviceError::checkScript(script, Bluetooth_Paired_Query), _deviceBluetoothPairedQueryResponse, script) ) - return; - - // ----- check if the process is not running - if ( _processBluetoothPairedQuery.state() != QProcess::NotRunning ) { - checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceBluetoothPairedQueryResponse); - return; - } - - // ----- run the process - int timeout_ms = 10000; - TimedProcess *timedProcess = new TimedProcess(&_processBluetoothPairedQuery, script, timeout_ms); - timedProcess->start(); -} - -void DeviceController::processBluetoothPairedQueryResponse(int vExitCode, QProcess::ExitStatus vStatus, QProcess::ProcessChannel /*vChannel*/) -{ - // The Exit code in this script is not used. - // any other checking is done by UI Software at the moment this script is called. - // The only thing matters is the pared device info in text and it will be empty string if error happens. - MDeviceBluetoothPairedQueryResponse model; - QByteArray deviceInfo; - if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; - else deviceInfo = _processBluetoothPairedQuery.readAll(); - model.fromByteArray( deviceInfo, &vExitCode ); - emit didAttributeResponse(model.data()); - LOG_APPED_UI(model.data().mMessage); -} - -/*! * \brief DeviceController::doScreenshot * \details emit the screenshot signal to run that in Device controller thread * \param vCurrentDateTime @@ -1061,7 +749,7 @@ // status(tr("Not enough secure information provided")); } else { - onAttributeRequest(data); + // onAttributeRequest(data); // ==================================================== FIX ME } // I_AM_HERE @@ -1128,108 +816,8 @@ return; } -///////////////////////////////////////////// DeviceFactoryReset -void DeviceController::onAttributeRequest(const DeviceFactoryResetRequestData &vData) -{ - _deviceFactoryResetRequest._data = vData; - // ----- check that script exists. - QString script; - if ( checkError( DeviceError::checkScript(script, Factory_Reset), _deviceFactoryResetResponse, script) ) - return; - - // ----- check if the process is not running - if ( _processFactoryReset.state() != QProcess::NotRunning ) { - checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceFactoryResetResponse); - return; - } - - - // ----- run the process - int timeout_ms = 10000; - TimedProcess *timedProcess = new TimedProcess(&_processFactoryReset, script, timeout_ms); - timedProcess->start(); - - MDeviceFactoryResetResponse model; - model._data.mAccepted = false; // will indirectly set the property factoryResetEnabled - model._data.mMessage = tr("Factory Reset started."); - emit didAttributeResponse(model.data()); -} - -/*! - * \brief DeviceController::processFactoryResetResponse - * \param vExitCode - the script exit code. - * \param vStatus - the script echoed message. - */ -void DeviceController::processFactoryResetResponse(int vExitCode, QProcess::ExitStatus vStatus, QProcess::ProcessChannel /*vChannel*/) -{ - // The Exit code in this script is not used. - // any other checking is done by UI Software at the moment this script is called. - // The only thing matters is the paired device info in text and it will be empty string if error happens. - MDeviceFactoryResetResponse model; - QByteArray deviceInfo; - if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; - else deviceInfo = _processFactoryReset.readAll(); - model.fromByteArray( deviceInfo, &vExitCode ); - // DEBUG: qDebug() << model._data.mMessage << deviceInfo; - emit didAttributeResponse (model.data()); - emit didFactoryReset (model._data.mAccepted); - - LOG_APPED_UI(model.data().mMessage); -} - -///////////////////////////////////////////// DeviceDecommission -void DeviceController::onAttributeRequest(const DeviceDecommissionRequestData &vData) -{ - _deviceDecommissionRequest._data = vData; - - // ----- check that script exists. - QString script; - if ( checkError( DeviceError::checkScript(script, Device_Decommission), _deviceDecommissionResponse, script) ) - return; - - // ----- check if the process is not running - if ( _processDecommission.state() != QProcess::NotRunning ) { - checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceDecommissionResponse); - return; - } - - - // ----- run the process - int timeout_ms = 10000; - TimedProcess *timedProcess = new TimedProcess(&_processDecommission, script, timeout_ms, { CloudSyncPath }); - _processDecommission.setEnvironment(QProcess::systemEnvironment() << QString("PASSWORD=%1").arg(_deviceDecommissionRequest._data.mPassword)); - timedProcess->start(); - - MDeviceDecommissionResponse model; - model._data.mAccepted = false; // will indirectly set the property decommissionEnabled - model._data.mMessage = tr("Decommissioning started."); - emit didAttributeResponse(model.data()); -} - -/*! - * \brief DeviceController::processDecommissionResponse - * \param vExitCode - * \param vStatus - */ -void DeviceController::processDecommissionResponse(int vExitCode, QProcess::ExitStatus vStatus, QProcess::ProcessChannel /*vChannel*/) -{ - // The Exit code in this script is not used. - // any other checking is done by UI Software at the moment this script is called. - // The only thing matters is the paired device info in text and it will be empty string if error happens. - MDeviceDecommissionResponse model; - QByteArray deviceInfo; - if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; - else deviceInfo = _processDecommission.readAll(); - model.fromByteArray( deviceInfo, &vExitCode ); - // DEBUG: qDebug() << model._data.mMessage << deviceInfo; - emit didAttributeResponse (model.data()); - emit didDecommissioning (model._data.mAccepted); - - LOG_APPED_UI(model.data().mMessage); -} - -///////////////////////////////////////////// DeviceUSBMounting +////////////////////////////////////////////////////////////////////////////////////////////////// DeviceUSBMounting void DeviceController::onAttributeRequest(const DeviceUSBMountRequestData &vData) { usbMountReq(vData.usbDevice, vData.isMountRequest); @@ -1243,13 +831,13 @@ */ void DeviceController::usbMountReq(const QString &vDevice, bool vIsMount) { - qDebug() << __FUNCTION__ << vDevice << vIsMount; + // DEBUG qDebug() << __FUNCTION__ << vDevice << vIsMount; _deviceUSBMountRequest._data.isMountRequest = vIsMount ; _deviceUSBMountRequest._data.usbDevice = vDevice ; // not necessary, but to be consistent // ----- check that script exists. QString script; - if ( checkError( DeviceError::checkScript(script, (vIsMount ? USB_Mount : USB_Unmount )), _deviceUSBMountResponse, script) ) + if ( checkError( DeviceError::checkScript(script, (vIsMount ? Scripts_USB_Mount : Scripts_USB_Unmount )), _deviceUSBMountResponse, script) ) return; // ----- check if the process is not running @@ -1314,7 +902,79 @@ return; } -///////////////////////////////////////////// DeviceWifiList +////////////////////////////////////////////////////////////////////////////////////////////////// DeviceBrightness +/*! + * \brief DeviceController::onAttributeRequest + * \details Sets the brightness level + * \param vBrightness + */ +void DeviceController::onAttributeRequest(const DeviceBrightnessRequestData &vData) +{ + DeviceError::Scripts_Error_Enum error = DeviceError::eDevice_OK; + + // ----- initializing the member variable models + _deviceBrightnessRequest._data = vData; + + // ----- extract the required data + LOG_APPED( _deviceBrightnessRequest.toString() ); + + // ----- check that script exists. + QString script; + if ( checkError( DeviceError::checkScript(script, Scripts_Brightness), _deviceBrightnessResponse, script) ) + return; + + // ----- check if the process is not running + if ( _processBrightness.state() != QProcess::NotRunning ) { + checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceBrightnessResponse); + return; + } + + QStringList params; + params << _deviceBrightnessRequest.toByteArray(&error); + if ( error ) { + checkError(error, _deviceBrightnessResponse); + return; + } + + // ----- run the process + int timeout_ms = 10000; + TimedProcess *timedProcess = new TimedProcess(&_processBrightness, script, timeout_ms, params); + timedProcess->start(); +} + +/*! + * \brief DeviceController::processBrightnessResponse + * \details Called when the process to set the brightness has finished + * \param vExitCode (int) the exit code + * \note exit code -> 0 : set Accept [MBase] -> Log -> emit + * !0 : set Attrib [MBrgh] -> Log -> emit + * 1 - get an error when in onAttributeRequest : scriptErrorText([Gui Enum ]) + * 2 - get an error when in onProcessBrightnessExitCode : scriptErrorText([vExitCode]) + * 3 - get no error when in onProcessBrightnessExitCode : MDeviceResponse.toString() + * - in case 3 the specific model _data has to be filled prior to the toString to have it in the log. + */ +void DeviceController::processBrightnessResponse(int vExitCode, QProcess::ExitStatus vStatus, QProcess::ProcessChannel vChannel) +{ + Q_UNUSED(vStatus ) + Q_UNUSED(vChannel ) + //DEBUG qDebug() << " 1 ---------- " << __FUNCTION__ << vExitCode << vStatus << vChannel; + static MDeviceBrightnessResponse model; + + if ( vExitCode < 0 ) { + emit didAttributeResponse(model.data()); + switch (vChannel) { + case QProcess::StandardOutput : processBrightnessReadyOut(model); break; + case QProcess::StandardError : processBrightnessReadyErr(model); break; + } + } + else { + processBrightnessComplete(model, vExitCode, vStatus); + emit didAttributeResponse(model.data()); + model._data.clear(); + } +} + +////////////////////////////////////////////////////////////////////////////////////////////////// DeviceWifiList void DeviceController::onAttributeRequest(const DeviceWifiListRequestData &) { wifiListRequest(); @@ -1329,7 +989,7 @@ { // ----- check that script exists. QString script; - if ( checkError( DeviceError::checkScript(script, Wifi_Scan_For_Networks), _deviceWifiListResponse, script) ) + if ( checkError( DeviceError::checkScript(script, Scripts_Wifi_Scan), _deviceWifiListResponse, script) ) return; // ----- check if the process is not running Index: sources/device/DeviceController.h =================================================================== diff -u -rdb52d097addadd2eef6102340778be143ee81df4 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceController.h (.../DeviceController.h) (revision db52d097addadd2eef6102340778be143ee81df4) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -155,14 +155,15 @@ this , SLOT(onFinish (int))); } void start() { -#ifndef BUILD_FOR_DESKTOP //FIXME : Revert this back to the #ifdef and remove the #if(n)def to avoid executing the shell scripts on VM. +#ifdef BUILD_FOR_DESKTOP //FIXME : Revert this back to the #ifdef and remove the #if(n)def to avoid executing the shell scripts on VM. qDebug() << "DeviceController.TimedProcess: " << _timeout << _command << _arguments; QFileInfo fileInfo(_command); QString path = fileInfo.absolutePath(); - QString name = "empty.sh"; + QString name = "test.sh"; _command = QString("%1/%2").arg(path, name); #endif _pid = startTimer(_timeout); + _process->setWorkingDirectory(Storage::Scripts_Path_Name()); //FIXME: get it in the DeviceController once and send it to constructor. _process->start(_command, _arguments); } Index: sources/device/DeviceError.cpp =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -31,10 +31,15 @@ QT_TR_NOOP("The device script file is not found." ), // eDevice_Scripts_Error_NotFound QT_TR_NOOP("The device script file is not executable." ), // eDevice_Scripts_Error_NotExecutable QT_TR_NOOP("The request is already in progress." ), // eDevice_Scripts_Error_IsRunning - QT_TR_NOOP("The requested value is out of range." ), // eDevice_Scripts_Error_OutOfRange - QT_TR_NOOP("The requested value is incorrect." ), // eDevice_Scripts_Error_Incorrect_Req - QT_TR_NOOP("The response value is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp + QT_TR_NOOP("The requested value length is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp_Len + QT_TR_NOOP("The requested value type is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp_Type + QT_TR_NOOP("The requested value range is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp_Range + + QT_TR_NOOP("The response value length is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp_Len + QT_TR_NOOP("The response value type is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp_Type + QT_TR_NOOP("The response value range is incorrect." ), // eDevice_Scripts_Error_Incorrect_Rsp_Range + QT_TR_NOOP("The watch file cannot be created." ), // eDevice_Watch_Error_NotCreate QT_TR_NOOP("The watch file is not found." ), // eDevice_Watch_Error_NotFound QT_TR_NOOP("The watch file cannot be added." ), // eDevice_Watch_Error_NotAdded @@ -46,6 +51,11 @@ QT_TR_NOOP("The Bluetooth cuff pair invalid address." ), // eDevice_BCuff_Error_Query_Addr QT_TR_NOOP("The Encrypted Partition error." ), // eDevice_CryptSetup_Error + QT_TR_NOOP("The Factory Reset failed." ), // eDevice_FactoryReset_Error + QT_TR_NOOP("The Decommissioning failed." ), // eDevice_Decommission_Error + QT_TR_NOOP("The Brightness failed." ), // eDevice_Brightness_Error + QT_TR_NOOP("The WiFi scan failed." ), // eDevice_WifiList_Error + QT_TR_NOOP("The USB Mount failed." ), // eDevice_USBMount_Error }; /*! @@ -70,13 +80,19 @@ QString DeviceError::deviceErrorText(DeviceError::Scripts_Error_Enum vError, int vExitCode) { QString message; int idx = vError - eDevice_Scripts_Error_Start - 1; - int len = (sizeof Scripts_Error_Text / sizeof Scripts_Error_Text[0]); - // DEBUG: qDebug() << len << idx; - if (idx >= len) { message = QObject::tr("Unknown device error %2 [%1]").arg(vExitCode).arg(vError) ; goto lOut; } + const int l = (sizeof Scripts_Error_Text / sizeof Scripts_Error_Text[0]); + const int i = eDevice_Error_End - eDevice_Scripts_Error_Start - 1; + + // DEBUG: qDebug() << l << i << idx; + // if this error happens it means not all the Error IDs in the Scripts_Error_Enum are covered in the Scripts_Error_Text + static_assert(l == i, "Device Error Scripts Error Text is incomplete."); + + if (idx >= l) { message = QObject::tr("Unknown device error %2 [%1]").arg(vExitCode).arg(vError) ; goto lOut; } if (eDevice_Scripts_Error_Start < vError && vError < eDevice_Error_End) { message = QObject::tr(Scripts_Error_Text[idx]) + (vExitCode ? QString(" [%1]").arg(vExitCode) : "") ; goto lOut; } message = QObject::tr("Device error [%1]").arg(vExitCode); + lOut: return message; } Index: sources/device/DeviceError.h =================================================================== diff -u -r0932b2beee9cc169291cbf69161f902f805237b1 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceError.h (.../DeviceError.h) (revision 0932b2beee9cc169291cbf69161f902f805237b1) +++ sources/device/DeviceError.h (.../DeviceError.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -42,33 +42,39 @@ // The scripts can use the exit code of each commands they execute and the assumption is most of Linux commands exit codes are less than 1000. // so any error less that 1000 will be identified as device error - eDevice_Scripts_Error_Start = 1000, // the script itself in system starts from 0 so give it enough gap - eDevice_Scripts_Error_Unknown = 1000, + eDevice_Scripts_Error_Start = 1000 , // the script itself in system starts from 0 so give it enough gap + eDevice_Scripts_Error_Unknown = 1000 , - eDevice_Scripts_Error_Status , - eDevice_Scripts_Error_NotFound , - eDevice_Scripts_Error_NotExecutable , - eDevice_Scripts_Error_IsRunning , - eDevice_Scripts_Error_OutOfRange , - eDevice_Scripts_Error_Incorrect_Req , - eDevice_Scripts_Error_Incorrect_Rsp , + eDevice_Scripts_Error_Status , + eDevice_Scripts_Error_NotFound , + eDevice_Scripts_Error_NotExecutable , + eDevice_Scripts_Error_IsRunning , - eDevice_Watch_Error_NotCreate , - eDevice_Watch_Error_NotFound , - eDevice_Watch_Error_NotAdded , + eDevice_Scripts_Error_Incorrect_Req_Len , + eDevice_Scripts_Error_Incorrect_Req_Type , + eDevice_Scripts_Error_Incorrect_Req_Range , - eDevice_BCuff_Error_Reset , + eDevice_Scripts_Error_Incorrect_Rsp_Len , + eDevice_Scripts_Error_Incorrect_Rsp_Type , + eDevice_Scripts_Error_Incorrect_Rsp_Range , - eDevice_BCuff_Error_Query , - eDevice_BCuff_Error_Query_Empty , - eDevice_BCuff_Error_Query_Addr , + eDevice_Watch_Error_NotCreate , + eDevice_Watch_Error_NotFound , + eDevice_Watch_Error_NotAdded , - eDevice_CryptSetup_Error , - eDevice_FactoryReset_Error , - eDevice_Decommission_Error , - eDevice_WifiList_Error , - eDevice_USBMount_Error , + eDevice_BCuff_Error_Reset , + eDevice_BCuff_Error_Query , + eDevice_BCuff_Error_Query_Empty , + eDevice_BCuff_Error_Query_Addr , + + eDevice_CryptSetup_Error , + eDevice_FactoryReset_Error , + eDevice_Decommission_Error , + eDevice_Brightness_Error , + eDevice_WifiList_Error , + eDevice_USBMount_Error , + eDevice_Error_End }; Index: sources/device/DeviceGlobals.h =================================================================== diff -u -rdb52d097addadd2eef6102340778be143ee81df4 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceGlobals.h (.../DeviceGlobals.h) (revision db52d097addadd2eef6102340778be143ee81df4) +++ sources/device/DeviceGlobals.h (.../DeviceGlobals.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -84,8 +84,8 @@ #define DEVICE_DEV_DEFINITION( vATTRIBUTEFLC ) \ QProcess _process##vATTRIBUTEFLC; \ - Model::MDevice##vATTRIBUTEFLC##Response _device##vATTRIBUTEFLC##Response; \ Model::MDevice##vATTRIBUTEFLC##Request _device##vATTRIBUTEFLC##Request ; \ + Model::MDevice##vATTRIBUTEFLC##Response _device##vATTRIBUTEFLC##Response; \ Q_SIGNALS : void didAttributeResponse (const Device##vATTRIBUTEFLC##ResponseData &); \ private Q_SLOTS : \ /*! \ @@ -202,109 +202,126 @@ // All the device attributes need to be listed here to be re-parented. #define DEVICE_DEV_PARENT_LIST \ DEVICE_DEV_PARENT ( Brightness ) \ + DEVICE_DEV_PARENT ( USBMount ) \ + DEVICE_DEV_PARENT ( WifiList ) \ +/* DEVICE_DEV_PARENT ( BluetoothPairedReset ) \ DEVICE_DEV_PARENT ( BluetoothPairedQuery ) \ DEVICE_DEV_PARENT ( CryptSetup ) \ DEVICE_DEV_PARENT ( RootSSHAccess ) \ DEVICE_DEV_PARENT ( FactoryReset ) \ DEVICE_DEV_PARENT ( Decommission ) \ - DEVICE_DEV_PARENT ( USBMount ) \ - DEVICE_DEV_PARENT ( WifiList ) \ +*/ // All the device attributes need to be listed here to be connected to the signal slots. #define DEVICE_DEV_INIT_CONNECTIONS_LIST \ DEVICE_DEV_INIT_CONNECTIONS ( Brightness ) \ + DEVICE_DEV_INIT_CONNECTIONS ( USBMount ) \ + DEVICE_DEV_INIT_CONNECTIONS ( WifiList ) \ +/* DEVICE_DEV_INIT_CONNECTIONS ( BluetoothPairedReset ) \ DEVICE_DEV_INIT_CONNECTIONS ( BluetoothPairedQuery ) \ DEVICE_DEV_INIT_CONNECTIONS ( CryptSetup ) \ DEVICE_DEV_INIT_CONNECTIONS ( RootSSHAccess ) \ DEVICE_DEV_INIT_CONNECTIONS ( FactoryReset ) \ DEVICE_DEV_INIT_CONNECTIONS ( Decommission ) \ - DEVICE_DEV_INIT_CONNECTIONS ( USBMount ) \ - DEVICE_DEV_INIT_CONNECTIONS ( WifiList ) \ +*/ // All the device attributes need to be listed here to be defined with needed signal, slots, values, ... . #define DEVICE_DEV_DEFINITION_LIST \ DEVICE_DEV_DEFINITION ( Brightness ) \ + DEVICE_DEV_DEFINITION ( USBMount ) \ + DEVICE_DEV_DEFINITION ( WifiList ) \ +/* DEVICE_DEV_DEFINITION ( BluetoothPairedReset ) \ DEVICE_DEV_DEFINITION ( BluetoothPairedQuery ) \ DEVICE_DEV_DEFINITION ( CryptSetup ) \ DEVICE_DEV_DEFINITION ( RootSSHAccess ) \ DEVICE_DEV_DEFINITION ( FactoryReset ) \ DEVICE_DEV_DEFINITION ( Decommission ) \ - DEVICE_DEV_DEFINITION ( WifiList ) \ - DEVICE_DEV_DEFINITION ( USBMount ) \ +*/ // All the device attributes need to be listed here to be defined with needed signal, slots, values, ... . #define DEVICE_DEV_DECLARATION_LIST \ DEVICE_DEV_DECLARATION ( Brightness ) \ + DEVICE_DEV_DECLARATION ( USBMount ) \ + DEVICE_DEV_DECLARATION ( WifiList ) \ +/* DEVICE_DEV_DECLARATION ( BluetoothPairedReset ) \ DEVICE_DEV_DECLARATION ( BluetoothPairedQuery ) \ DEVICE_DEV_DECLARATION ( CryptSetup ) \ DEVICE_DEV_DECLARATION ( RootSSHAccess ) \ DEVICE_DEV_DECLARATION ( FactoryReset ) \ DEVICE_DEV_DECLARATION ( Decommission ) \ - DEVICE_DEV_DECLARATION ( WifiList ) \ - DEVICE_DEV_DECLARATION ( USBMount ) \ +*/ - /* ---------------------------- APP */ // All the device attributes if added here will make a connection on Application controller for the following: // Gui -> App <- Dev #define DEVICE_APP_INIT_CONNECTIONS_LIST \ DEVICE_APP_INIT_CONNECTIONS ( Brightness ) \ + DEVICE_APP_INIT_CONNECTIONS ( WifiList ) \ +/* DEVICE_APP_INIT_CONNECTIONS ( BluetoothPairedReset ) \ DEVICE_APP_INIT_CONNECTIONS ( BluetoothPairedQuery ) \ DEVICE_APP_INIT_CONNECTIONS ( CryptSetup ) \ DEVICE_APP_INIT_CONNECTIONS ( RootSSHAccess ) \ - DEVICE_APP_INIT_CONNECTIONS ( FactoryReset ) \ DEVICE_APP_INIT_CONNECTIONS ( Decommission ) \ - DEVICE_APP_INIT_CONNECTIONS ( WifiList ) \ + DEVICE_APP_INIT_CONNECTIONS ( FactoryReset ) \ +*/ #define DEVICE_APP_BRIDGE_DEFINITION_LIST \ DEVICE_APP_BRIDGE_DEFINITION( Brightness ) \ + DEVICE_APP_BRIDGE_DEFINITION( USBMount ) \ + DEVICE_APP_BRIDGE_DEFINITION( WifiList ) \ +/* DEVICE_APP_BRIDGE_DEFINITION( BluetoothPairedReset ) \ DEVICE_APP_BRIDGE_DEFINITION( BluetoothPairedQuery ) \ DEVICE_APP_BRIDGE_DEFINITION( CryptSetup ) \ DEVICE_APP_BRIDGE_DEFINITION( RootSSHAccess ) \ DEVICE_APP_BRIDGE_DEFINITION( FactoryReset ) \ DEVICE_APP_BRIDGE_DEFINITION( Decommission ) \ - DEVICE_APP_BRIDGE_DEFINITION( USBMount ) \ - DEVICE_APP_BRIDGE_DEFINITION( WifiList ) \ +*/ /* ---------------------------- GUI */ // All the device attributes if added here will make a connection on Gui controller for the following: // Gui <- App #define DEVICE_GUI_INIT_CONNECTIONS_LIST \ DEVICE_GUI_INIT_CONNECTIONS ( Brightness ) \ + DEVICE_GUI_INIT_CONNECTIONS ( WifiList ) \ +/* DEVICE_GUI_INIT_CONNECTIONS ( BluetoothPairedReset ) \ DEVICE_GUI_INIT_CONNECTIONS ( BluetoothPairedQuery ) \ DEVICE_GUI_INIT_CONNECTIONS ( CryptSetup ) \ DEVICE_GUI_INIT_CONNECTIONS ( RootSSHAccess ) \ DEVICE_GUI_INIT_CONNECTIONS ( FactoryReset ) \ DEVICE_GUI_INIT_CONNECTIONS ( Decommission ) \ - DEVICE_GUI_INIT_CONNECTIONS ( WifiList ) \ +*/ #define DEVICE_GUI_BRIDGE_DEFINITION_LIST \ DEVICE_GUI_BRIDGE_DEFINITION( Brightness ) \ + DEVICE_GUI_BRIDGE_DEFINITION( WifiList ) \ +/* DEVICE_GUI_BRIDGE_DEFINITION( BluetoothPairedReset ) \ DEVICE_GUI_BRIDGE_DEFINITION( BluetoothPairedQuery ) \ DEVICE_GUI_BRIDGE_DEFINITION( CryptSetup ) \ DEVICE_GUI_BRIDGE_DEFINITION( RootSSHAccess ) \ DEVICE_GUI_BRIDGE_DEFINITION( FactoryReset ) \ DEVICE_GUI_BRIDGE_DEFINITION( Decommission ) \ - DEVICE_GUI_BRIDGE_DEFINITION( WifiList ) \ +*/ /* ---------------------------- VIEW */ // All the device attributes if added here will make a connection on Gui controller for the following: // Qml -> View <- Gui #define DEVICE_VIEW_INIT_CONNECTIONS_LIST \ DEVICE_VIEW_INIT_CONNECTIONS( Brightness ) \ + DEVICE_VIEW_INIT_CONNECTIONS( WifiList ) \ +/* DEVICE_VIEW_INIT_CONNECTIONS( BluetoothPairedReset ) \ DEVICE_VIEW_INIT_CONNECTIONS( BluetoothPairedQuery ) \ DEVICE_VIEW_INIT_CONNECTIONS( CryptSetup ) \ DEVICE_VIEW_INIT_CONNECTIONS( RootSSHAccess ) \ DEVICE_VIEW_INIT_CONNECTIONS( FactoryReset ) \ DEVICE_VIEW_INIT_CONNECTIONS( Decommission ) \ - DEVICE_VIEW_INIT_CONNECTIONS( WifiList ) \ +*/ Index: sources/device/DeviceModels.cpp =================================================================== diff -u -r3c547f89553d3aabe59423b82ecb7f8c28f9d32a -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 3c547f89553d3aabe59423b82ecb7f8c28f9d32a) +++ sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -127,7 +127,7 @@ count = deviceInfo.count(); if ( count ) { if ( count != LEN_COUNT) { - _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp; goto lError; // incorrect response, length + _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp_Len; goto lError; // incorrect response, length } } @@ -150,49 +150,6 @@ } /*! - * \brief MDeviceBrightnessRequest::setBrightnessSysVal - * \details checks for the requested brightness percentage (in range and resolution) - * \return returns device script error enum and is 0 on no error - */ -Device::DeviceError::Scripts_Error_Enum MDeviceBrightnessRequest::setBrightnessSysVal() -{ - // check range(min,max) - quint8 len = UI2HW.size(); - if ( ! len ) { - LOG_DEBUG("Empty UI2HW map"); - return Device::DeviceError::eDevice_Scripts_Error_Unknown; - } - quint8 min = UI2HW.begin() .key(); - quint8 max = (UI2HW.end () - 1).key(); - if ( ! ( min <= _data.mBrightnessPercent && _data.mBrightnessPercent <= max ) ) { - return Device::DeviceError::eDevice_Scripts_Error_OutOfRange; - } - - // check range(resolution) - if ( ! UI2HW.contains(_data.mBrightnessPercent) ) { - return Device::DeviceError::eDevice_Scripts_Error_Incorrect_Req; - } - - _data.mBrightness_val = UI2HW[_data.mBrightnessPercent]; - return Device::DeviceError::eDevice_OK; -} - -/*! - * \brief MDeviceBrightnessResponse::setBrightnessPercent - * \param vSysVal - updated the response with returned brightness system value - * \return returns device script error enum and is 0 on no error - */ -Device::DeviceError::Scripts_Error_Enum MDeviceBrightnessResponse::setBrightnessPercent(quint8 vSysVal) { - if ( ! HW2UI.contains( vSysVal ) ) { - return Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp; - } - - _data.mBrightnessPercent = HW2UI[ vSysVal ]; - return Device::DeviceError::eDevice_OK; -} - - -/*! * \brief MDeviceFactoryResetResponse::fromByteArray * \details Checks the response and sets up the model data. * \param vExitCode - Passed script exit code @@ -264,27 +221,39 @@ //DEBUG qDebug() << __FUNCTION__ << vByteArray; // initialize data + bool ok = false; int error = 0; _data.mCompleted = true; _data.mAccepted = false; + _data.mReason = Device::DeviceError::eDevice_OK; - // check if the vExitCode passed and it has a value other than zero - if ( vExitCode && *vExitCode ){ _data.mReason = Device::DeviceError::eDevice_WifiList_Error; error = *vExitCode; } - else _data.mReason = Device::DeviceError::eDevice_OK; + // set as default if the val is invalid. + _data.mWifiList = ""; - // if vExitCode is not zero go to error since the data is no longer valid - if ( _data.mReason ) goto lError; // non-zero Exit code + // get the value + QString val = vByteArray; + ok = ! val.isNull() && val.isSimpleText(); + // check if the vExitCode passed and it has a value other than zero + if ( ! ok ){ _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp_Type ; goto lError; } // there is not a valid value + if ( vExitCode && *vExitCode ){ _data.mReason = Device::DeviceError::eDevice_WifiList_Error ; goto lApply; } // there still a valid value + // Now everything is good to extract the data _data.mAccepted = true; - _data.mWifiList = vByteArray; - _data.mMessage = QObject::tr("The Wifi list scan complete."); goto lOut ; // normal return + _data.mMessage = QObject::tr("The WiFi scan is complete."); goto lApply; // normal return + // apply returned value in case the passed value is valid (type, range) + // regardless of the exit code (success, fail) +lApply: + _data.mWifiList= val; + goto lOut; + + // immediate exit on fail exitcode and invalid returned value. lError: + if ( vExitCode ) error = *vExitCode; _data.mMessage = Device::DeviceError::deviceErrorText(static_cast(_data.mReason), error) + "\n" + vByteArray; lOut: - _data.mCompleted= true; return _data.mAccepted; } @@ -296,24 +265,104 @@ */ bool MDeviceUSBMountResponse::fromByteArray(const QByteArray &vByteArray, int *vExitCode) { + //DEBUG qDebug() << __FUNCTION__ << vByteArray; + // initialize data - int error = 0; - _data.mAccepted = false; + bool ok = false; + int error = 0; + _data.mCompleted = true; // mark the data as final to be identified by the view. + _data.mAccepted = false; + _data.mReason = Device::DeviceError::eDevice_OK; + // set as default if the val is invalid (min=0). + // N/A + // get the value + ok = true; // check if the vExitCode passed and it has a value other than zero - if ( vExitCode && *vExitCode ){ _data.mReason = Device::DeviceError::eDevice_USBMount_Error; error = *vExitCode; } - else _data.mReason = Device::DeviceError::eDevice_OK; + if ( ! ok ){ _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp_Type ; goto lError ; } // there is not a valid value + if ( vExitCode && *vExitCode ){ _data.mReason = Device::DeviceError::eDevice_USBMount_Error ; goto lRevert; } // there still a valid value - // if vExitCode is not zero go to error since the data is no longer valid - if ( _data.mReason ) goto lError; // non-zero Exit code + // Now everything is good to extract the data + _data.mAccepted = true; + _data.mMessage = QObject::tr("The USB (un)mount is complete."); goto lOut ; // normal return + // apply returned value in case the passed value is valid (type, range) + // regardless of the exit code (success, fail) +lRevert: + // N/A + + // immediate exit on fail exitcode and invalid returned value. +lError: + if ( vExitCode ) error = *vExitCode; + _data.mMessage = Device::DeviceError::deviceErrorText(static_cast(_data.mReason), error) + "\n" + vByteArray; + +lOut: + return _data.mAccepted;} + +bool MDeviceBrightnessResponse::fromByteArray(const QByteArray &vByteArray, int *vExitCode) +{ + //DEBUG qDebug() << __FUNCTION__ << vByteArray; + + // initialize data + bool ok = false; + int error = 0; + _data.mCompleted = true; // mark the data as final to be identified by the view. + _data.mAccepted = false; + _data.mReason = Device::DeviceError::eDevice_OK; + + // set as default if the val is invalid (min=0). + _data.mBrightness = HW2UI.last(); + + // get the value + quint8 val = vByteArray.toUShort(&ok); + + // check if the vExitCode passed and it has a value other than zero + if ( ! ok ){ _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp_Type ; goto lError; } // there is not a valid value + if ( ! HW2UI.contains(val) ){ _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp_Range ; goto lError; } // there is not a valid value + if ( vExitCode && *vExitCode ){ _data.mReason = Device::DeviceError::eDevice_Brightness_Error ; goto lApply; } // there still a valid value + // Now everything is good to extract the data _data.mAccepted = true; - _data.mMessage = QObject::tr("The USB (un)mount Command Complete."); goto lOut ; // normal return + _data.mMessage = QObject::tr("The Brightness set is complete."); goto lApply; // normal return + + + // apply returned value in case the passed value is valid (type, range) + // regardless of the exit code (success, fail) +lApply: + _data.mBrightness = HW2UI[val]; + goto lOut; + + // immediate exit on fail exitcode and invalid returned value. lError: + if ( vExitCode ) error = *vExitCode; _data.mMessage = Device::DeviceError::deviceErrorText(static_cast(_data.mReason), error) + "\n" + vByteArray; + lOut: return _data.mAccepted; } + +QByteArray MDeviceBrightnessRequest::toByteArray(Device::DeviceError::Scripts_Error_Enum *vError) +{ + // initialize data + Device::DeviceError::Scripts_Error_Enum error = Device::DeviceError::Scripts_Error_Enum::eDevice_OK; + + /// return QString::number(UI2HW[_data.mBrightness]).toLatin1(); + // set as default if the val is invalid (min=0). + + // get the value + quint8 val = UI2HW.last(); + + // check if the vExitCode passed and it has a value other than zero + if ( ! UI2HW.contains(_data.mBrightness) ){ error = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Req_Range ; goto lError; } // there is not a valid value + + // if no error assign the passed value to val. + val = UI2HW[_data.mBrightness]; + return QString::number(val).toLatin1(); + + // set the error to ok (success), or any error(fail). +lError: + if ( vError && error ) *vError = error; + return ""; +} Index: sources/device/DeviceModels.h =================================================================== diff -u -r3c547f89553d3aabe59423b82ecb7f8c28f9d32a -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceModels.h (.../DeviceModels.h) (revision 3c547f89553d3aabe59423b82ecb7f8c28f9d32a) +++ sources/device/DeviceModels.h (.../DeviceModels.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -50,6 +50,9 @@ mString += QString(",%1").arg(param.toString()); return mString; } + + virtual QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum *vError = nullptr) = 0; + }; /*! @@ -79,8 +82,6 @@ }; MDeviceResponseBase () { } - - bool fromByteArray (const QByteArray &, int * = nullptr) override { return false; /* no conversion needed */ } }; @@ -90,64 +91,50 @@ * \details The model for the device brightness value modification request. */ class MDeviceBrightnessRequest : public MDeviceRequestBase { -// ------------------------------------------------------------------ -// TODO : Merge the two models as they have much in common in this case. -// On the CANBus it was separated since the type of data in send and receive was totally different. -// But here it's the same. - // TODO: improve later - this has to be match with HW2UI in response - QMap UI2HW = { // the mapping is not linear so has to be mapped to keep the order - { 1, 1}, // "key" is the value accepted from QML mapped to HW - { 2, 3}, - { 3, 5}, - { 4, 6}, - { 5, 10}, + QMap UI2HW = { // the mapping may not be linear so has to be mapped to keep the order + { 1, 20}, + { 2, 40}, + { 3, 60}, + { 4, 80}, + { 5, 100}, }; -public: - // TODO : these needs to be available in Views - static const quint8 mBrightness_min = 2; - static const quint8 mBrightness_max = 10; - static const quint8 mBrightness_res = 2; - +public: struct Data { - quint8 mBrightness_old = mBrightness_min ; - quint8 mBrightness_val = 0; - - quint8 mBrightnessPercent = 5; // ~ 100% - bool mRead = false; + quint8 mBrightness = 5; } _data; - Device::DeviceError::Scripts_Error_Enum setBrightnessSysVal(); - QString toString() { - return MDeviceRequestBase::toString("DeviceBrightness", { _data.mBrightnessPercent }); + return MDeviceRequestBase::toString("DeviceBrightness", { _data.mBrightness }); } + + QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum *vError = nullptr) override; }; /*! * \brief The MDeviceBrightnessResponse class * \details The model for the device brightness value request. */ class MDeviceBrightnessResponse : public MDeviceResponseBase { - // TODO: improve later - this has to be match with UI2HW in request - QMap HW2UI = { // the mapping is not linear so has to be mapped to keep the order; - { 1, 1}, // "value" is the displayed number in QML for property "brightness" - { 3, 2}, - { 5, 3}, - { 6, 4}, - { 10, 5}, + QMap HW2UI = { // the mapping may not linear so has to be mapped to keep the order; + { 20, 1}, + { 40, 2}, + { 60, 3}, + { 80, 4}, + { 100, 5}, }; public: struct Data : MDeviceResponseBase::Data { - quint8 mBrightnessPercent = 0; + quint8 mBrightness = 100; } _data; - QVariantList parameters () const override { return { _data.mBrightnessPercent }; } + QVariantList parameters () const override { return { _data.mBrightness } ; } QString infoText () const override { return QString("DeviceBrightness") ; } Data data () const { return _data; } - Device::DeviceError::Scripts_Error_Enum setBrightnessPercent(quint8 vSysVal); + bool fromByteArray(const QByteArray &vByteArray, int *vExitCode = nullptr) override; + }; // ================================================= MDeviceBluetoothPaired 'Reset' @@ -192,6 +179,8 @@ QString toString() { return MDeviceRequestBase::toString("DeviceBluetoothPairedQuery", { }); } + + }; /*! @@ -233,6 +222,8 @@ QString toString() { return MDeviceRequestBase::toString("DeviceCryptSetup", { }); } + + QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum * = nullptr) override { return ""; } }; /*! @@ -264,6 +255,8 @@ QString toString() { return MDeviceRequestBase::toString("RootSSHAccess", { _data.mIsGet?"q":"r", _data.mRootSSHAccess } ); } + + QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum * = nullptr) override { return ""; } }; /*! @@ -294,6 +287,8 @@ QString toString() { return MDeviceRequestBase::toString("FactoryReset", { }); } + + QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum * = nullptr) override { return ""; } }; /*! @@ -324,6 +319,8 @@ QString toString() { return MDeviceRequestBase::toString("Decommission", { }); } + + QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum * = nullptr) override { return ""; } }; /*! @@ -355,6 +352,8 @@ QString toString() { return MDeviceRequestBase::toString("UsbMount", { _data.usbDevice, _data.isMountRequest }); } + + QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum * = nullptr) override { return ""; } }; /*! @@ -384,6 +383,8 @@ QString toString() { return MDeviceRequestBase::toString("WifiList", {}); } + + QByteArray toByteArray(Device::DeviceError::Scripts_Error_Enum * = nullptr) override { return ""; } }; /*! Index: sources/device/DeviceView.cpp =================================================================== diff -u -r3c547f89553d3aabe59423b82ecb7f8c28f9d32a -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 3c547f89553d3aabe59423b82ecb7f8c28f9d32a) +++ sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -47,29 +47,25 @@ void VDevice::doInitBrightness() { // DEBUG : qDebug() << "HERE Request" << vValue; DeviceBrightnessRequestData data; - data.mRead = true; emit didAttributeRequest(data); } void VDevice::brightnessRequest(const quint8 &vValue) { // DEBUG : qDebug() << "HERE Request" << vValue; DeviceBrightnessRequestData data; - data.mBrightnessPercent = vValue; + data.mBrightness = vValue; emit didAttributeRequest(data); } void VDevice::onAttributeResponse(const DeviceBrightnessResponseData &vData) { - // DEBUG : qDebug() << "HERE Response" << vData.mBrightnessPercent; - if ( vData.mAccepted ) { - brightness(vData.mBrightnessPercent); - status(""); + // DEBUG : qDebug() << "HERE Response" << vData.mBrightness << brightness(); + if ( vData.mCompleted ) { + // for the brightness we will set what ever comes from the script either succeed or failed. + brightness(vData.mBrightness); + emit brightnessChanged(vData.mBrightness); } - else { - // this has to be called to let Gui to set to old value that device controller provided. - emit brightnessChanged(vData.mBrightnessPercent); - status(vData.mMessage); - } + status (vData.mMessage ); accepted(vData.mAccepted); reason (vData.mReason ); Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -45,7 +45,6 @@ #include "VAdjustmentServiceMode.h" #include "VAdjustmentServiceDates.h" #include "VDateTime.h" -#include "VNetworkModel.h" #include "VAdjustmentAlarmVolume.h" #include "VBluetooth.h" #include "VDuetRoWaterDG.h" Index: sources/gui/qml/main.qml =================================================================== diff -u -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/gui/qml/main.qml (.../main.qml) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) +++ sources/gui/qml/main.qml (.../main.qml) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -42,7 +42,6 @@ import VAdjustmentServiceMode 0.1 import VAdjustmentServiceDates 0.1 import VDateTime 0.1 -import VNetworkModel 0.1 import VAdjustmentAlarmVolume 0.1 import VBluetooth 0.1 import VDuetRoWaterDG 0.1 @@ -145,7 +144,6 @@ VAdjustmentServiceMode { id: vAdjustmentServiceMode } VAdjustmentServiceDates { id: vAdjustmentServiceDates } VDateTime { id: vDateTime } - VNetworkModel { id: vNetwork } VAdjustmentAlarmVolume { id: vAdjustmentAlarmVolume } VBluetooth { id: vBluetooth } VDuetRoWaterDG { id: vDuetRoWaterDG } @@ -313,7 +311,7 @@ verticalAlignment : Text.AlignBottom height : 15 - text : "W:" + vNetwork.wirelessIP + text : "W:" // + vNetwork.wirelessIP // ===================== Device Controller: FIXME font.pixelSize: 15 } @@ -328,7 +326,7 @@ verticalAlignment : Text.AlignBottom height : 15 - text : "E:" + vNetwork.ethernetIP + text : "E:" // + vNetwork.ethernetIP // ===================== Device Controller: FIXME font.pixelSize: 15 } Index: sources/gui/qml/pages/settings/SettingsDeviceRegistration.qml =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/gui/qml/pages/settings/SettingsDeviceRegistration.qml (.../SettingsDeviceRegistration.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/gui/qml/pages/settings/SettingsDeviceRegistration.qml (.../SettingsDeviceRegistration.qml) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -97,7 +97,7 @@ TextEntry { id : _ipAddress_wlan0 textInput.clip : true hasCursor : false - textInput.text : vNetwork.wirelessIP + textInput.text : "" // vNetwork.wirelessIP // ===================== Device Controller: FIXME textInput.horizontalAlignment: Text.AlignLeft label.text : qsTr("Wireless") separator.text : _root.separatorText @@ -110,7 +110,7 @@ TextEntry { id : _ipAddress_eth0 textInput.clip : true hasCursor : false - textInput.text : vNetwork.ethernetIP + textInput.text : "" // vNetwork.ethernetIP // ===================== Device Controller: FIXME textInput.horizontalAlignment: Text.AlignLeft label.text : qsTr("Ethernet") separator.text : _root.separatorText Index: sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml (.../SettingsVolumeBrightness.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml (.../SettingsVolumeBrightness.qml) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -36,7 +36,6 @@ notificationText: "" - Column { spacing : _root.spacing anchors.centerIn: parent Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -rdb52d097addadd2eef6102340778be143ee81df4 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision db52d097addadd2eef6102340778be143ee81df4) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -55,11 +55,12 @@ firstFocusInput : _ipAddress notificationText: vDevice.status onConfirmClicked: { - vNetwork.doConfirm( - _ipAddress .textInput.text , - _gateway .textInput.text , - _subnetmask .textInput.text , - _dns .textInput.text ) + // ===================== Device Controller: FIXME + // vNetwork.doConfirm( + // _ipAddress .textInput.text , + // _gateway .textInput.text , + // _subnetmask .textInput.text , + // _dns .textInput.text ) } Column { id : _ipColumn @@ -77,7 +78,8 @@ hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - vNetwork.doSetIPAddress(textInput.text) + // ===================== Device Controller: FIXME + // vNetwork.doSetIPAddress(textInput.text) } } @@ -90,7 +92,8 @@ hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - vNetwork.doSetGateway(textInput.text) + // ===================== Device Controller: FIXME + // vNetwork.doSetGateway(textInput.text) } } @@ -103,7 +106,8 @@ hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - vNetwork.doSetSubnetMask(textInput.text) + // ===================== Device Controller: FIXME + // vNetwork.doSetSubnetMask(textInput.text) } } @@ -115,7 +119,8 @@ hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - vNetwork.doSetDNS(textInput.text) + // ===================== Device Controller: FIXME + // vNetwork.doSetDNS(textInput.text) } } } @@ -237,11 +242,13 @@ onConfirmClicked : { if ( isPassword ) { if( passwordCurrent.length > 0 ) { - vNetwork.doJoinNetwork ( macAddress, passwordCurrent ) + // ===================== Device Controller: FIXME + // vNetwork.doJoinNetwork ( macAddress, passwordCurrent ) pop() } } else { - vNetwork.doDisconnectNetwork( macAddress ) + // ===================== Device Controller: FIXME + // vNetwork.doDisconnectNetwork( macAddress ) pop() } } Index: sources/model/MModel.h =================================================================== diff -u -r0932b2beee9cc169291cbf69161f902f805237b1 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/model/MModel.h (.../MModel.h) (revision 0932b2beee9cc169291cbf69161f902f805237b1) +++ sources/model/MModel.h (.../MModel.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -304,7 +304,6 @@ REGISTER_METATYPE( DeviceWifiListResponseData ) \ /* Settings */ \ REGISTER_METATYPE( SettingsData ) \ - REGISTER_METATYPE( WifiNetworkData ) \ REGISTER_METATYPE( BluetoothData ) \ REGISTER_METATYPE( BluetoothDeviceData ) \ /* Data */ \ @@ -987,7 +986,7 @@ /* disabled coco begin validated: Manually tested. This model class is a placeholder and there is no use case for this now. ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AlarmClearedConditionRequestData ) \ disabled coco end */ \ - + //== MessageInterpreter Signal Definition =======================================// #define ACTION_RECEIVE_SIGNALS \ /* CONFIRM */ \ Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r721e055ca19c92525a45be953ad1cffdc2d69abb -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 721e055ca19c92525a45be953ad1cffdc2d69abb) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -180,28 +180,16 @@ const char *Date_Time_Set_Sh = "date_time_set.sh"; // WiFi Settings - const char *Wifi_Disconnect_Network = "wifi_disconnect_network.sh"; - const char *Wifi_Generate_WPA_Supplicant = "wifi_generate_wpa_supplicant.sh"; - const char *Wifi_Read_DNS = "wifi_read_dns.sh"; - const char *Wifi_Read_Gateway = "wifi_read_gateway.sh"; - const char *Wifi_Read_IP_Settings = "wifi_read_ip_settings.sh"; - const char *Wifi_Get_Auto_Assigned_IP = "wifi_request_auto_assigned_ip.sh"; - const char *Wifi_Reset_Adapter = "wifi_reset_adapter.sh"; - const char *Wifi_Reset_Interface = "wifi_reset_interface.sh"; - const char *Wifi_Scan_For_Networks = "wifi_scan_for_networks.sh"; - const char *Wifi_Set_Auto_Assigned_IP = "wifi_set_auto_assigned_ip.sh"; - const char *Wifi_Set_DNS = "wifi_set_dns.sh"; - const char *Wifi_Set_Static_IP = "wifi_set_static_ip.sh"; - const char *Wifi_Set_Gateway = "wifi_set_gateway.sh"; - const char *Wifi_Set_SubnetMask = "wifi_set_subnetmask.sh"; - const char *Wifi_Start_WPA_Supplicant = "wifi_start_wpa_supplicant.sh"; - const char *Wifi_Read_Network_Info = "wifi_read_network_info.sh"; + const char *Scripts_Wifi_Scan = "wifi_scan.sh"; + const char *Scripts_Wifi_Disconnect = "wifi_disconnect.sh"; + const char *Scripts_Wifi_Active_Info = "wifi_active_info.sh"; + const char *Scripts_Wifi_Connect_Dhcp = "wifi_connect_dhcp.sh"; + // Brightness - const char *Brightness_Set = "brightness_set.sh"; - const char *Brightness_Get = "brightness_get.sh"; + const char *Scripts_Brightness = "brightness.sh"; // Root SSH - const char *RootSSHAccess = "rootsshaccess.sh"; + const char *Scripts_Ssh_Access = "rootsshaccess.sh"; // Bluetooth const char *Bluetooth_Paired_Reset = "bluetooth_paired_clear.sh"; @@ -211,21 +199,21 @@ const char *Crypt_Setup = "crypt_setup.sh"; // Factory Reset - const char *Factory_Reset = "factory_reset.sh"; + const char *Scripts_Factory_Reset = "factory_reset.sh"; // Device Decommissioning - const char *Device_Decommission = "decommission.sh"; + const char *Scripts_Device_Decommission = "decommission.sh"; // Device Lockdown - const char *Device_Lockdown = "lockdown.sh"; + const char *Scripts_Device_Lockdown = "lockdown.sh"; #ifdef LEAHI_DIGI_BOARD const char *CloudSyncPath = "/mnt/data/configurations/CloudSync/credentials/"; #else const char *CloudSyncPath = "/var/configurations/CloudSync/credentials/"; #endif // USB unmount/ mount - const char *USB_Unmount = "usb_unmount.sh"; - const char *USB_Mount = "usb_mount.sh"; + const char *Scripts_USB_Unmount = "usb_unmount.sh"; + const char *Scripts_USB_Mount = "usb_mount.sh"; } Index: sources/storage/StorageGlobals.h =================================================================== diff -u -rd9b9df9b23da89b4c27f4672ff6e7f570adcc48a -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision d9b9df9b23da89b4c27f4672ff6e7f570adcc48a) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -97,15 +97,15 @@ // WiFi extern const char *Wifi_Scripts_Dir; - extern const char *Wifi_Disconnect_Network; + extern const char *Scripts_Wifi_Disconnect; extern const char *Wifi_Generate_WPA_Supplicant; extern const char *Wifi_Read_DNS; extern const char *Wifi_Read_Gateway; extern const char *Wifi_Read_IP_Settings; extern const char *Wifi_Get_Auto_Assigned_IP; extern const char *Wifi_Reset_Adapter; extern const char *Wifi_Reset_Interface; - extern const char *Wifi_Scan_For_Networks; + extern const char *Scripts_Wifi_Scan; extern const char *Wifi_Set_Auto_Assigned_IP; extern const char *Wifi_Set_DNS; extern const char *Wifi_Set_Static_IP; @@ -115,11 +115,10 @@ extern const char *Wifi_Read_Network_Info; // Brightness - extern const char *Brightness_Set; - extern const char *Brightness_Get; + extern const char *Scripts_Brightness; // RootSSHAccess - extern const char *RootSSHAccess; + extern const char *Scripts_Ssh_Access; // Bluetooth extern const char *Bluetooth_Paired_Reset; @@ -129,18 +128,18 @@ extern const char *Crypt_Setup; // Factory Reset - extern const char *Factory_Reset; + extern const char *Scripts_Factory_Reset; // Device Decommissioning - extern const char *Device_Decommission; + extern const char *Scripts_Device_Decommission; // Device Lockdown - extern const char *Device_Lockdown; + extern const char *Scripts_Device_Lockdown; extern const char *CloudSyncPath; // USB mount/unmount - extern const char *USB_Unmount; - extern const char *USB_Mount; + extern const char *Scripts_USB_Unmount; + extern const char *Scripts_USB_Mount; } Index: sources/view/VView.h =================================================================== diff -u -r574c7c5fb48b1fcb72337f5fb4c0119a20288815 -r472c10e72a8d278f13d2343f9c81c1def14490ff --- sources/view/VView.h (.../VView.h) (revision 574c7c5fb48b1fcb72337f5fb4c0119a20288815) +++ sources/view/VView.h (.../VView.h) (revision 472c10e72a8d278f13d2343f9c81c1def14490ff) @@ -135,7 +135,6 @@ REGISTER_TYPE( VAdjustmentServiceMode ) \ REGISTER_TYPE( VAdjustmentServiceDates ) \ REGISTER_TYPE( VDateTime ) \ - REGISTER_TYPE( VNetworkModel ) \ REGISTER_TYPE( VAdjustmentAlarmVolume ) \ REGISTER_TYPE( VBluetooth ) \ REGISTER_TYPE( VDuetRoWaterDG ) \ Fisheye: Tag 472c10e72a8d278f13d2343f9c81c1def14490ff refers to a dead (removed) revision in file `sources/view/settings/VNetworkModel.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 472c10e72a8d278f13d2343f9c81c1def14490ff refers to a dead (removed) revision in file `sources/view/settings/VNetworkModel.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 472c10e72a8d278f13d2343f9c81c1def14490ff refers to a dead (removed) revision in file `sources/wifi/WifiInterface.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 472c10e72a8d278f13d2343f9c81c1def14490ff refers to a dead (removed) revision in file `sources/wifi/WifiInterface.h'. Fisheye: No comparison available. Pass `N' to diff?