/*! * * 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 MTreatmentAdjustRequests.h * \author (last) Behrouz NematiPour * \date (last) 16-Oct-2020 * \author (original) Behrouz NemaiPour * \date (original) 02-Jul-2020 * */ #pragma once // Qt #include //project #include "GuiGlobals.h" using namespace Gui; namespace Model { /*! * Simple request models * These are models to send the request for the doAdjustment * The the only reason thy have been defined to help overloading the adjustment methods * Otherwise the parameters are so tiny models. */ class MModel { protected: /*! * \brief toString * \details the global toString function for all the request message models * which is mainly used for logging and debugging. * \param vStringPrefix - a prefix string to be inserted after senderID (UI) and parameter values list. * This is comma separated. * \param vParameters - list of parameter values of the model as a comma separated string. * \return QString */ static QString toString (const QString &vStringPrefix, const QVariant &vParameters) { QString senderID = "UI,"; return QString(senderID + vStringPrefix + "," + vParameters.toStringList().join(',')); } }; /*! * \brief The MAdjustPowerOffReq class * \details The power off request model * * | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | * |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | * |0x0100| 0x020 | 6 | Cmd | N | HD | UI | Power Off | * * | Payload || * | || * | #1:(U08) | \ref state | * * */ class MAdjustPowerOffReq : public MModel { public: quint8 state; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({state}); } explicit MAdjustPowerOffReq(quint8 vState) : state(vState) { } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("PowerOff", vParameters); } }; /*! * \brief The MAdjustBloodDialysateReq class * \details The blood/dialysate rate change request model * * | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | * |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | * |0x1700| 0x100 | 9 | Req | Y | UI | HD | Blood/dialysate rate Change | * * | Payload || * | || * | #1:(U32) | \ref bloodFlow | * | #2:(U32) | \ref dialysateFlow | * * */ class MAdjustBloodDialysateReq : public MModel { public: quint32 bloodFlow = 0; quint32 dialysateFlow = 0; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({bloodFlow , dialysateFlow}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AdjustBloodDialysate", vParameters); } }; /*! * \brief The MAdjustDurationReq class * \details The treatment duration change request model * * | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | * |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | * |0x1600| 0x100 | 9 | Req | Y | UI | HD | Treatment Duration Change Request | * * | Payload || * | || * | #1:(U32) | \ref duration | * */ class MAdjustDurationReq : public MModel { public: quint32 duration = 0; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({duration}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AdjustDuration", vParameters); } }; /*! * \brief The MAdjustUltrafiltrationStateReq class * \details The ultrafiltration pause/resume request model * * | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | * |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | * |0x1000| 0x100 | 9 | Req | Y | UI | HD | UF Pause/Resume | * * | Payload || * | || * | #1:(U32) | \ref requestedState | * */ class MAdjustUltrafiltrationStateReq : public MModel { public: GuiUFCommands requestedState = GuiUFCommands::UF_CMD_PAUSE; // the requested state. Initially it's running => paused. // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({requestedState}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AdjustUFState", vParameters); } }; /*! * \brief The MAdjustUltrafiltrationEditReq class * \details The ultrafiltration volume change request model * * | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | * |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | * |0x1100| 0x100 | 9 | Req | Y | UI | HD | UF Vol. Change Request | * * | Payload || * | || * | #1:(F32) | \ref volume | * */ class MAdjustUltrafiltrationEditReq : public MModel { public: float volume = 0; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({volume}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AdjustUFEdit", vParameters); } }; /*! * \brief The MAdjustUltrafiltrationConfirmReq class * \details The ultrafiltration volume change user confirm request model * * | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | * |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | * |0x1500| 0x100 | 9 | Req | Y | UI | HD | UF Vol. Change User Confirm | * * | Payload || * | || * | #1:(F32) | \ref volume | * | #2:(U32) | \ref option | * * \sa Options * */ class MAdjustUltrafiltrationConfirmReq : public MModel { public: enum Options : quint32 { eDuration = Gui::GuiActions::UF_ADJ_TREATMENT_TIME, eRate = Gui::GuiActions::UF_ADJ_UF_RATE, }; float volume = 0; Options option = eDuration; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({volume , option}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AdjustUFConfirm", vParameters); } }; /*! * \brief The MAdjustSalineReq class * \details The model to request the Saline Bolus state * * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | * |:---:|:------:|:-----:|:----:|:---:|:---:|:----:|:--------------------:| * | 18 | 0x100 | 9 | Req | Y | UI | HD | Saline Bolus Request | * * | Payload || * | || * | #1:(U32) | \ref requestedState | * * \sa State * \sa MTreatmentSaline : Saline Bolus Data * \sa MAdjustSalineResponse : Saline Bolus Response * */ class MAdjustSalineReq : public MModel { public: /*! * \brief The State enum * \details The saline bolus requested state. * There is no FW shared enum for this so has been defined here as documented in "Messages List". */ enum State { eStop = 0, eStart = 1, }; State requestedState = eStop; // the requested state. Initially it's Stop => start. // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({requestedState}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AdjustSaline", vParameters); } }; /*! * \brief The MAlarmSilenceReq class * \details The model to request alarm silent * * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | * |:---:|:------:|:-----:|:----:|:---:|:---:|:----:|:--------------------:| * | | | | Req | Y | UI | HD | Alarm Silent Request | * * | Payload || * | || * | #1:(U32) | TBD | * */ class MAlarmSilenceReq : public MModel { public: bool state = 0; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({state}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AlarmSilence", vParameters); } }; } typedef Model:: MAdjustPowerOffReq AdjustPowerOffRequestData; typedef Model:: MAdjustBloodDialysateReq AdjustBloodDialysateRequestData; typedef Model:: MAdjustDurationReq AdjustDurationRequestData; typedef Model:: MAdjustUltrafiltrationStateReq AdjustUltrafiltrationStateRequestData; typedef Model:: MAdjustUltrafiltrationEditReq AdjustUltrafiltrationEditRequestData; typedef Model::MAdjustUltrafiltrationConfirmReq AdjustUltrafiltrationConfirmRequestData; typedef Model:: MAdjustSalineReq AdjustSalineRequestData; typedef Model:: MAlarmSilenceReq AlarmSilenceRequestData;