/*! * * Copyright (c) 2019-2020 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 VTreatmentAdjustmentSaline.cpp * \author (last) Behrouz NematiPour * \date (last) 13-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 13-Aug-2020 * */ #include "VTreatmentAdjustmentSaline.h" // Project #include "guicontroller.h" VIEW_DEF_CLASS_ADJUSTMENT(VTreatmentAdjustmentSaline, AdjustSalineResponseData) void VTreatmentAdjustmentSaline::initConnections() { ACTION_VIEW_CONNECTION(TreatmentStatesData ); ACTION_VIEW_CONNECTION(AdjustSalineResponseData); ADJUST_VIEW_CONNECTION(AdjustSalineRequestData ); } void VTreatmentAdjustmentSaline::onActionReceive(const AdjustSalineResponseData &vData) { adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( vData.mReason ); target ( vData.mTarget ); if (adjustment_Accepted()) { // the response doesn't have the state so the requested state which has been accepted is used. isStarted ( _data.requestedState == AdjustSalineRequestData::eStart ); } // *** 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 ); } /*! * \brief VTreatmentAdjustmentSaline::onActionReceive * \details This is the message handler of when the Saline is done * the state of the Saline in the SalineState of the TreatmentStates message will change at anytime * and so the state of the UI should change in regards to that field and affect the isStarted * after the saline start request has been accepted. * \param vData - data of the Treatment State Message. */ void VTreatmentAdjustmentSaline::onActionReceive(const TreatmentStatesData &vData) { isStarted ( vData.mSalineState == GuiSalineStates::SALINE_START_STATE ); isDisabled( vData.mSalineState == GuiSalineStates::SALINE_DISABLE_STATE ); } void View::VTreatmentAdjustmentSaline::doAdjustment() { if (isStarted()) { _data.requestedState = AdjustSalineRequestData::eStop; } else { _data.requestedState = AdjustSalineRequestData::eStart; } emit didAdjustment(_data); // notify the controllers to do the adjustment }