/*! * * Copyright (c) 2021-2025 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 VTreatmentAdjustmentVitals.cpp * \author (last) Nico Ramirez * \date (last) 3-Sep-2025 * \author (original) Nico Ramirez * \date (original) 3-Sep-2025 * */ #include "VTreatmentAdjustmentVitals.h" // Project #include "GuiController.h" VIEW_DEF_CLASS_ADJUSTMENT(VTreatmentAdjustmentVitals) /*! * \brief Connection Initializer * \details All the class signal/slot connections are defined here. */ void View::VTreatmentAdjustmentVitals::initConnections() { ACTION_VIEW_CONNECTION(AdjustVitalsResponseData); ADJUST_VIEW_CONNECTION(AdjustVitalsRequestData ); // set singleshot timer when requesting and stop if responded from fw. // if timeout is emited then let QML know to skip measurement _timeoutTimer.setSingleShot(true); _timeoutTimer.setInterval(2 * 60 * 1000); // 2 min timeout connect(&_timeoutTimer, &QTimer::timeout, this, [this]() { timedOut(true); }); } /*! * \brief VTreatmentAdjustmentVitals::onActionReceive * \details received response model data handler * \param vData - model data */ void View::VTreatmentAdjustmentVitals::onActionReceive(const AdjustVitalsResponseData &vData) { _timeoutTimer.stop(); adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( 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 ); } /*! * \brief View::VTreatmentAdjustmentVitals::doRequest * \details Sends the request to get vitals */ void View::VTreatmentAdjustmentVitals::doRequest() { _timeoutTimer.start(); AdjustVitalsRequestData data; emit didAdjustment(data); }