/*! * * 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 Behrouz NematiPour (last) * \date 10-Aug-2020 (last) * \author Behrouz NematiPour (original) * \date 10-Aug-2020 (original) * */ #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 ); 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 ); } 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 }