/*! * * 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 VTreatmentAdjustmentHeparin.cpp * \author (last) Behrouz NematiPour * \date (last) 20-Nov-2020 * \author (original) Behrouz NematiPour * \date (original) 20-Nov-2020 * */ #include "VTreatmentAdjustmentHeparin.h" // Project #include "GuiController.h" VIEW_DEF_CLASS_ADJUSTMENT(VTreatmentAdjustmentHeparin, AdjustHeparinResponseData) void VTreatmentAdjustmentHeparin::initConnections() { ACTION_VIEW_CONNECTION(AdjustHeparinResponseData); ADJUST_VIEW_CONNECTION(AdjustHeparinRequestData ); } void VTreatmentAdjustmentHeparin::onActionReceive(const AdjustHeparinResponseData &vData) { adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( vData.mReason ); 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::VTreatmentAdjustmentHeparin::doAdjustment * \details the invocable slot to adjust(start/stop) the treatment Heparin bolus state */ void View::VTreatmentAdjustmentHeparin::doAdjustment() { // if it's accepted or rejected we have the last/current state of Heparin // so decide on last received/response state // be careful the response enum (GuiHeparinStates) is // different than request enum (AdjustHeparinRequestData) if ( state() == GuiHeparinStates::HEPARIN_STATE_PAUSED ) { _data.requestedState = GuiHeparinCommands::HEPARIN_CMD_RESUME; } else { _data.requestedState = GuiHeparinCommands::HEPARIN_CMD_PAUSE; } emit didAdjustment(_data); // notify the controllers to do the adjustment }