/*! * * 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: 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}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AlarmSilence", vParameters); } }; /*! * \brief The MAlarmAcknowledgeReq class * \details The model to tell HD an alarm has been acknowledged * * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | * |:---:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| * | 63 | 0x100 | N/A | Cmd | Y | UI | HD | Alarm Acknolwedge Request | * * | Payload || * | || * | #1:(U32) | \ref alarmID | * */ class MAlarmAcknowledgeReq : public MModel { public: quint32 alarmID; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({alarmID}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AlarmAcknowledgeRequest", vParameters); } }; /*! * \brief The MTreatmentStartReq class * \details The model to request starting a treatment * * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | * |:---:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| * | 56 | 0x100 | 9 | Req | Y | UI | HD | Start Treatment Request | * * | Payload || * | || * | #1:(U32) | \ref request | * */ class MTreatmentStartReq : public MModel { public: enum Options { eSelectParams = 0, eCancel = 1, eStartTreatment = 2 }; Options request = eSelectParams; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({request}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("StartTreatment", vParameters); } }; /*! * \brief The MTreatmentConfirmReq class * \details The model to tell HD treatment parameters have been confirmed * * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | * |:-----:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| * | 0x3B00| 0x100 | 9 | Req | Y | UI | HD | Confirm Treatment Request | * * | Payload || * | || * | #1:(U32) | \ref request | * */ class MTreatmentConfirmReq : public MModel { public: enum Options { eCancel = 0, eConfirm = 1 }; Options request = eConfirm; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({request}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("ConfirmTreatment", vParameters); } }; /*! * \brief The MTreatmentEndReq class * \details The model to request an end to treatment * * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | * |:---:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| * | 60 | 0x100 | 9 | Req | Y | UI | HD | End Treatment Request | * * | Payload || * | || * | N/A || * */ class MTreatmentEndReq : public MModel { public: // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({}); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("EndTreatment", vParameters); } }; /*! * \brief The MAdjustTreatmentParametersReq class * \details The model used to request treatment parameters validation * * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | * |:---:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| * | 60 | 0x100 | 9 | Req | Y | UI | HD | New Treatment Parameters Request | * * | Payload || * | || * | #1:(U32) | \ref bloodFlowRate | * | #2:(U32) | \ref dialysateFlowRate | * | #3:(U32) | \ref duration | * | #4:(U32) | \ref heparinStopTime | * | #5:(U32) | \ref salineBolus | * | #6:(U32) | \ref acidConcentrate | * | #7:(U32) | \ref bicarbonateConcentrate | * | #8:(U32) | \ref dialyzerType | * | #9:(U32) | \ref bloodPressureMeasureInterval | * | #10:(U32) | \ref rinsebackFlowRate | * | #11:(S32) | \ref arterialPressureLimitLow | * | #12:(S32) | \ref arterialPressureLimitHigh | * | #13:(S32) | \ref venousPressureLimitLow | * | #14:(S32) | \ref venousPressureLimitHigh | * | #15:(F32) | \ref heparinDispensingRate | * | #16:(F32) | \ref heparinBolusVolume | * | #17:(F32) | \ref dialysateTemp | * */ class MAdjustTreatmentParametersReq : public MModel { public: quint32 bloodFlowRate = 0; // mL/min quint32 dialysateFlowRate = 0; // mL/min quint32 duration = 0; // minutes quint32 heparinStopTime = 0; // min quint32 salineBolus = 0; // mL quint32 acidConcentrate = 0; // quint32 bicarbonateConcentrate = 0; // quint32 dialyzerType = 0; // quint32 bloodPressureMeasureInterval = 0; // minutes quint32 rinsebackFlowRate = 0; // mL/min qint32 arterialPressureLimitLow = 0; // mmHg qint32 arterialPressureLimitHigh = 0; // mmHg qint32 venousPressureLimitLow = 0; // mmHg qint32 venousPressureLimitHigh = 0; // mmHg float heparinDispensingRate = 0; // mL/hr float heparinBolusVolume = 0; // mL float dialysateTemp = 0; // Celsius // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { return toString({ bloodFlowRate , dialysateFlowRate , duration , heparinStopTime , salineBolus , acidConcentrate , bicarbonateConcentrate , dialyzerType , bloodPressureMeasureInterval , rinsebackFlowRate , arterialPressureLimitLow , arterialPressureLimitHigh , venousPressureLimitLow , venousPressureLimitHigh , heparinDispensingRate , heparinBolusVolume , dialysateTemp , }); } // coco end static QString toString(const QVariantList &vParameters) { return MModel::toString("AdjustTreatmentParametersRequest", 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:: MTreatmentStartReq TreatmentStartRequestData; typedef Model:: MTreatmentConfirmReq TreatmentConfirmRequestData; typedef Model:: MTreatmentEndReq TreatmentEndRequestData; typedef Model:: MAdjustSalineReq AdjustSalineRequestData; typedef Model:: MAlarmSilenceReq AlarmSilenceRequestData; typedef Model:: MAdjustTreatmentParametersReq AdjustTreatmentParametersRequestData; typedef Model:: MAlarmAcknowledgeReq AlarmAcknowledgeRequestData;