/*! * * Copyright (c) 2023-2024 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) 06-Aug-2023 * \author (original) Behrouz NematiPour * \date (original) 03-Apr-2023 * */ #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) connect(&_GuiController, &GuiController::didPOSTPass, this, [=](bool) { //POST// doAdjustment(_status); }); } 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 ); adjustment_FWValue ( vData.mFirmwareValue ); if (vData.mAccepted) { status( _data.mStatus ); // apply the request notification(""); } else { // If the firmware rejected the set RO only mode, set the value that firmware has it. status( vData.mFirmwareValue ); if ( _post ) { _post = false; } 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 &) { _post = true; QString mCategory = Storage::Settings_Category_SettingsSystem; FROMVARIANT( status, "RoWaterMode", "RoWaterMode", UInt ); }