/*! * * 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) 16-Oct-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(AdjustSalineResponseData); ADJUST_VIEW_CONNECTION(AdjustSalineRequestData ); } void VTreatmentAdjustmentSaline::onActionReceive(const AdjustSalineResponseData &vData) { adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( vData.mReason ); target ( vData.mTarget ); state ( vData.mState ); // *** 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 View::VTreatmentAdjustmentSaline::doAdjustment * \details the invocable slot to adjust(start/stop) the treatment saline bolus state */ void View::VTreatmentAdjustmentSaline::doAdjustment() { // if it's accepted or rejected we have the last/current state of saline // so decide on last received/response state // be careful the response enum (GuiSalineStates) is // different than request enum (AdjustSalineRequestData) if ( state() == GuiSalineStates::SALINE_BOLUS_STATE_IN_PROGRESS ) { _data.requestedState = AdjustSalineRequestData::eStop; } else { _data.requestedState = AdjustSalineRequestData::eStart; } emit didAdjustment(_data); // notify the controllers to do the adjustment }