Index: denali.pro =================================================================== diff -u -r70986eda0c1b55e62935f500014d0aa72f7262fe -r9a61db88ccc5454001d4759e6ee5402695fda993 --- denali.pro (.../denali.pro) (revision 70986eda0c1b55e62935f500014d0aa72f7262fe) +++ denali.pro (.../denali.pro) (revision 9a61db88ccc5454001d4759e6ee5402695fda993) @@ -119,7 +119,6 @@ sources/device/DeviceController.h \ sources/storage/Settings.h \ sources/storage/TreatmentLog.h \ - sources/view/hd/data/post/VHDPOSTData.h \ sources/wifi/WifiInterface.h \ sources/bluetooth/BluetoothInterface.h \ sources/cloudsync/CloudSyncController.h \ @@ -283,6 +282,7 @@ sources/view/settings/VAdjustmentAlarmVolume.h \ sources/view/settings/VAdjustmentServiceMode.h \ sources/view/settings/VAdjustmentServiceDates.h \ + sources/view/settings/VDuetRoWaterDG.h \ \ # ---------- Views - Alarm sources/view/hd/alarm/VAlarmStatus.h \ sources/view/hd/alarm/VAlarmActiveList.h \ @@ -329,6 +329,7 @@ sources/view/hd/data/pretreatment/VPreTreatmentSelfTestDryData.h \ sources/view/hd/data/pretreatment/VPreTreatmentDisposablesPrimeData.h \ \ # ---------- Views - HD - Data + sources/view/hd/data/post/VHDPOSTData.h \ sources/view/hd/data/VHDAccelerometerData.h \ sources/view/hd/data/VHDSyringePumpData.h \ sources/view/hd/data/VHDAirBubbleData.h \ @@ -385,7 +386,7 @@ sources/device/DeviceController.cpp \ sources/model/ui/data/MUIBloodPressureData.cpp \ sources/storage/Settings.cpp \ - sources/storage/TreatmentLog.cpp \ + sources/storage/TreatmentLog.cpp \ sources/view/hd/data/post/VHDPOSTData.cpp \ sources/wifi/WifiInterface.cpp \ sources/bluetooth/BluetoothInterface.cpp \ @@ -541,6 +542,7 @@ sources/view/settings/VAdjustmentAlarmVolume.cpp \ sources/view/settings/VAdjustmentServiceMode.cpp \ sources/view/settings/VAdjustmentServiceDates.cpp \ + sources/view/settings/VDuetRoWaterDG.cpp \ \ # ---------- Views - HD - Adjustment sources/view/VAdjustmentResponseBase.cpp \ \ # ---------- Views - HD - Adjustment - common Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r9a61db88ccc5454001d4759e6ee5402695fda993 --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 9a61db88ccc5454001d4759e6ee5402695fda993) @@ -47,6 +47,7 @@ #include "VNetworkModel.h" #include "VAdjustmentAlarmVolume.h" #include "VBluetooth.h" +#include "VDuetRoWaterDG.h" // states data #include "VHDOperationModeData.h" #include "VPreTreatmentStatesData.h" Index: sources/gui/qml/main.qml =================================================================== diff -u -raf8d98b36b427e2b5f4d6659fcf3b58ee79eab6a -r9a61db88ccc5454001d4759e6ee5402695fda993 --- sources/gui/qml/main.qml (.../main.qml) (revision af8d98b36b427e2b5f4d6659fcf3b58ee79eab6a) +++ sources/gui/qml/main.qml (.../main.qml) (revision 9a61db88ccc5454001d4759e6ee5402695fda993) @@ -44,6 +44,7 @@ import VNetworkModel 0.1 import VAdjustmentAlarmVolume 0.1 import VBluetooth 0.1 +import VDuetRoWaterDG 0.1 // States views import VHDOperationMode 0.1 @@ -142,6 +143,7 @@ VNetworkModel { id: vNetwork } VAdjustmentAlarmVolume { id: vAdjustmentAlarmVolume } VBluetooth { id: vBluetooth } + VDuetRoWaterDG { id: vDuetRoWaterDG } // ---- States VHDOperationMode { id: vHDOperationMode } Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -r8ee8ce1e868b66dd0ae197ef7a947e0436037ef3 -r9a61db88ccc5454001d4759e6ee5402695fda993 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 8ee8ce1e868b66dd0ae197ef7a947e0436037ef3) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 9a61db88ccc5454001d4759e6ee5402695fda993) @@ -265,12 +265,8 @@ Switch { id: _settingsRoInputSwitch property bool active: true - onCheckedChanged: { - if ( ! active ) active = true - vSettings.roWaterMode = checked - } - checked : vSettings.roWaterMode + checked : vDuetRoWaterDG.status width : 85 height : 85 @@ -305,11 +301,26 @@ color : _settingsRoInputSwitch.active ? Colors.textMain : Colors.textDisableButton verticalAlignment : Text.AlignTop horizontalAlignment : Text.AlignHCenter - // anchors.bottom : parent.top - // anchors.verticalCenter : parent.verticalCenter } } } + + Connections { target: _settingsRoInputSwitch + function onCheckedChanged() { + vDuetRoWaterDG.doAdjustment ( _settingsRoInputSwitch.checked ) + } + } + Connections { target: vDuetRoWaterDG + function onAdjustmentTriggered(vValue) { + if ( vDuetRoWaterDG.adjustment_Accepted ) { + _settingsRoInput.notificationText = "" + } + else { + _settingsRoInput.notificationText = vDuetRoWaterDG.notification // adjustment_ReasonText + } + vSettings.roWaterMode = vDuetRoWaterDG.status + } + } } UserConfirmation { id: _servicePassword Index: sources/view/VView.h =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r9a61db88ccc5454001d4759e6ee5402695fda993 --- sources/view/VView.h (.../VView.h) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/view/VView.h (.../VView.h) (revision 9a61db88ccc5454001d4759e6ee5402695fda993) @@ -118,6 +118,7 @@ REGISTER_TYPE( VNetworkModel ) \ REGISTER_TYPE( VAdjustmentAlarmVolume ) \ REGISTER_TYPE( VBluetooth ) \ + REGISTER_TYPE( VDuetRoWaterDG ) \ /* Alarm */ \ REGISTER_TYPE( VAlarmStatus ) \ REGISTER_TYPE( VAlarmActiveList ) \ Index: sources/view/settings/VDuetRoWaterDG.cpp =================================================================== diff -u --- sources/view/settings/VDuetRoWaterDG.cpp (revision 0) +++ sources/view/settings/VDuetRoWaterDG.cpp (revision 9a61db88ccc5454001d4759e6ee5402695fda993) @@ -0,0 +1,81 @@ +/*! + * + * Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VDuetRoWaterDG.cpp + * \author (last) Behrouz NematiPour + * \date (last) 18-Apr-2021 + * \author (original) Behrouz NematiPour + * \date (original) 18-Apr-2021 + * + */ +#include "VDuetRoWaterDG.h" + +// Project +#include "GuiController.h" + +VIEW_DEF_CLASS_ADJUSTMENT(VDuetRoWaterDG) + +/*! + * \brief Connection Initializer + * \details All the class signal/slot connections are defined here. +*/ +void View::VDuetRoWaterDG::initConnections() { + ADJUST_VIEW_CONNECTION(DuetRoWaterModeUIiData) + ACTION_VIEW_CONNECTION(DuetRoWaterModeDGrData) + ACTION_VIEW_CONNECTION(SettingsData) + ACTION_VIEW_CONNECTION(DuetRoWaterStatDGqData) +} + +void View::VDuetRoWaterDG::onActionReceive(const DuetRoWaterStatDGqData & ) // 0xC300 : 195 +{ + _post = true; + doAdjustment( _status ); +} + +void View::VDuetRoWaterDG::onActionReceive(const DuetRoWaterModeDGrData &vData) // 0xC400 : 196 +{ + adjustment_Accepted ( vData.mAccepted ); + adjustment_Reason ( vData.mReason ); + + if (vData.mAccepted) { + status( _data.mStatus ); // apply the request + notification(""); + } + else { + if ( _post ) { + status( ! _status ); // on post what UI currently has, is rejected, so UI should change to opposite. + _post = false; + } + else { + status( _status ); // use the old value to emit signal for UI + } + notification(tr("The RO Water Mode change request has been rejected [%1]").arg(vData.mReason)); + } + + + // *** has to be the last to let the information to be set and then emit the signal *** + // *** otherwise will use the Previous values before being set. *** + adjustment ( true ); +} + +void View::VDuetRoWaterDG::doAdjustment(bool vStatus) // 0xBC00 : 188 +{ + _data.mStatus = vStatus ? 1 : 0; + emit didAdjustment(_data); +} + +/*! + * \brief VDuetRoWaterDG::onSettingsDone + * \details fills the items below, read from the settings file, when the reading is notified done by ApplicationController. + * acidConcentrateOptions + * + */ +void View::VDuetRoWaterDG::onActionReceive(const SettingsData &) +{ + QString mCategory = Storage::Settings_Category_SettingsSystem; + FROMVARIANT( status, "RoWaterMode", "RoWaterMode", UInt ); +} Index: sources/view/settings/VDuetRoWaterDG.h =================================================================== diff -u --- sources/view/settings/VDuetRoWaterDG.h (revision 0) +++ sources/view/settings/VDuetRoWaterDG.h (revision 9a61db88ccc5454001d4759e6ee5402695fda993) @@ -0,0 +1,101 @@ +/*! + * + * Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VDuetRoWaterDG.h + * \author (last) Behrouz NematiPour + * \date (last) 10-Aug-2021 + * \author (original) Behrouz NematiPour + * \date (original) 18-Apr-2021 + * + */ +#pragma once + +// Qt +#include + +// Project +#include "main.h" // Doxygen : do not remove +#include "VAdjustmentResponseBase.h" +#include "MDuetRoWaterDG.h" +#include "MSettings.h" + +// namespace +namespace View { + +/*! + * \brief The VTreatmentTime class + * \details View for Model's data representation. + * + * \sa Model::MTreatmentTime + * + * \startuml + * actor User as US + * participant UI as UI + * participant DG as DG + * participant FS as FS + * + * == REQUEST == + * group DG POST + * DG -> UI : Water Input Mode Status [0xC3] + * UI -> DG : Water Mode Set [0xBC] + * end + * + * group UI POST + * UI -> DG : Water Mode Set [0xBC] + * end + * + * group Settings + * US -> UI : Water Input Mode Adjust + * UI -> DG : Water Mode Set [0xBC] + * end + * + * == RESPONSE == + * + * DG --> UI : Water Mode Set [0xC4] + * alt Accept + * UI -> FS : Water Mode Store + * UI -> US : Pass Notification + * else Reject + * UI -> UI : Revert the Water Mode + * UI -> US : Fail Notification + * end + * \enduml + * \note UI Init update sequence: + * Settings -> status -> checked -> doAdjustment -> DG + */ +class VDuetRoWaterDG : public VAdjustmentResponseBase +{ + Q_OBJECT + + DuetRoWaterModeUIiData _data; + bool _post = true; + + // The property adjustment_Triggered has to be always true + // and to always trigger the change event to work as a notifier for GUI + // has been manually tested that it works perfectly fine + TRIGGER ( bool , adjustment , 0) + + TRIGGER ( bool , status , 0) + PROPERTY( QString , notification , 0) + + VIEW_DEC_CLASS(VDuetRoWaterDG) + VIEW_DEC_SLOT(DuetRoWaterStatDGqData) + VIEW_DEC_SLOT(DuetRoWaterModeDGrData) + VIEW_DEC_SLOT(SettingsData) + +public slots: + void doAdjustment(bool vStatus); + +signals: + /*! + * \brief didAdjustment + * \details the notification signal to send the user's Request + * \param vData - data model includes request information + */ + void didAdjustment(const DuetRoWaterModeUIiData &vData); +}; +}