Index: leahi.pro =================================================================== diff -u -re07cde120d7476c4add90c4f86cf55af9ea830de -radf593e5ad91c1e689564298bf8d411d7847b158 --- leahi.pro (.../leahi.pro) (revision e07cde120d7476c4add90c4f86cf55af9ea830de) +++ leahi.pro (.../leahi.pro) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -61,6 +61,7 @@ sources/model/td/data \ sources/model/td/data/treatment \ sources/model/td/data/treatmentlog \ + sources/model/td/data/pretreatment \ sources/model/td/alarm \ sources/model/td/adjustment \ sources/model/td/adjustment/settings \ @@ -79,6 +80,7 @@ sources/view/td \ sources/view/td/data \ sources/view/td/data/treatment \ + sources/view/td/data/pretreatment \ sources/view/td/adjustment/treatment \ sources/view/td/adjustment/pretreatment \ sources/view/td/adjustment/posttreatment \ @@ -193,6 +195,7 @@ sources/model/td/data/MTDValvesData.h \ sources/model/td/data/MTDVoltageData.h \ sources/model/td/data/MWaterSampleData.h \ + sources/model/td/data/pretreatment/MPreTreatmentStatesData.h \ sources/model/td/data/treatment/MTreatmentBloodFlowData.h \ sources/model/td/data/treatment/MTreatmentBloodPrimeData.h \ sources/model/td/data/treatment/MTreatmentIsolatedUFData.h \ @@ -276,6 +279,8 @@ sources/view/td/data/VTDVoltageData.h \ sources/view/td/data/VTreatmentRanges.h \ sources/view/td/data/VWaterSampleData.h \ + \ # ---------- Views - TD - Data - Pre-Treatment + sources/view/td/data/pretreatment/VPreTreatmentStatesData.h \ \ # ---------- Views - TD - Data - In-Treatment sources/view/td/data/treatment/VTDTreatmentStatesData.h \ sources/view/td/data/treatment/VTreatmentBloodFlow.h \ @@ -359,7 +364,6 @@ sources/model/hd/alarm/MAlarmCleared.h \ sources/model/hd/alarm/MAlarmActiveList.h \ \ # ---------- Models - States Data - sources/model/hd/data/pretreatment/MPreTreatmentStatesData.h \ sources/model/hd/data/posttreatment/MPostTreatmentStatesData.h \ \ # ---------- Models - HD - Adjustment sources/model/hd/adjustment/MAdjustRequestsBase.h \ @@ -476,7 +480,6 @@ \ # ---------- Views - HD - Adjustment - Disinfection sources/view/hd/adjustment/disinfect/VDisinfectAdjustDisinfect.h \ \ # ---------- Views - HD - Data - States - sources/view/hd/data/pretreatment/VPreTreatmentStatesData.h \ sources/view/hd/data/posttreatment/VPostTreatmentStatesData.h \ \ # ---------- Views - HD - Data - Pre-Treatment - Progress sources/view/hd/data/pretreatment/VPreTreatmentSelfTestNoCartridgeData.h \ @@ -564,6 +567,7 @@ sources/model/td/data/MTDValvesData.cpp \ sources/model/td/data/MTDVoltageData.cpp \ sources/model/td/data/MWaterSampleData.cpp \ + sources/model/td/data/pretreatment/MPreTreatmentStatesData.cpp \ sources/model/td/data/treatment/MTreatmentBloodFlowData.cpp \ sources/model/td/data/treatment/MTreatmentBloodPrimeData.cpp \ sources/model/td/data/treatment/MTreatmentIsolatedUFData.cpp \ @@ -657,7 +661,6 @@ sources/model/hd/alarm/MAlarmCleared.cpp \ sources/model/hd/alarm/MAlarmActiveList.cpp \ \ # ---------- Models - Data - States - sources/model/hd/data/pretreatment/MPreTreatmentStatesData.cpp \ sources/model/hd/data/posttreatment/MPostTreatmentStatesData.cpp \ \ # ---------- Models - TD - Adjustment - Settings sources/model/td/adjustment/settings/MAdjustTDDateTimeResponse.cpp \ @@ -754,6 +757,8 @@ sources/view/td/data/VTDVoltageData.cpp \ sources/view/td/data/VTreatmentRanges.cpp \ sources/view/td/data/VWaterSampleData.cpp \ + \ # ---------- Views - TD - Data - Pre-Treatment + sources/view/td/data/pretreatment/VPreTreatmentStatesData.cpp \ \ # ---------- Views - TD - Data - In-Treatment sources/view/td/data/treatment/VTDTreatmentStatesData.cpp \ sources/view/td/data/treatment/VTreatmentBloodFlow.cpp \ @@ -836,7 +841,6 @@ \ # ---------- Views - HD - Adjustment - Disinfection sources/view/hd/adjustment/disinfect/VDisinfectAdjustDisinfect.cpp \ \ # ---------- Views - HD - States Data - sources/view/hd/data/pretreatment/VPreTreatmentStatesData.cpp \ sources/view/hd/data/posttreatment/VPostTreatmentStatesData.cpp \ \ # ---------- Views - HD - Data sources/view/hd/data/VHDAccelerometerData.cpp \ Index: sources/canbus/MessageGlobals.h =================================================================== diff -u -r718a3ed0b0693f0bc36e11931f41ccd0f49d7251 -radf593e5ad91c1e689564298bf8d411d7847b158 --- sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision 718a3ed0b0693f0bc36e11931f41ccd0f49d7251) +++ sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -90,7 +90,7 @@ {Gui::GuiActionType::ID_HDBloodLeakData , 4 * 4 }, // 4 parameters each 4bytes // ---- {Gui::GuiActionType::ID_TDOpModeData , 2 * 4 }, // 2 parameter each 4bytes - {Gui::GuiActionType::ID_PreTreatmentStates , 11 * 4 }, //11 parameters each 4bytes + {Gui::GuiActionType::ID_PreTreatmentStates , 8 * 4 }, // 8 parameters each 4bytes {Gui::GuiActionType::ID_TreatmentStates , 10 * 4 }, //10 parameters each 4bytes {Gui::GuiActionType::ID_PostTreatmentStates , 2 * 4 }, // 2 parameter each 4bytes Index: sources/gui/GuiGlobals.h =================================================================== diff -u -rac290dfdbd332fafc7a70ad7f78a21ef15e7f82e -radf593e5ad91c1e689564298bf8d411d7847b158 --- sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision ac290dfdbd332fafc7a70ad7f78a21ef15e7f82e) +++ sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -121,7 +121,7 @@ // State Messages ID_TDOpModeData = 0x1200, // 18 //// ----- @LEAHIZED - ID_PreTreatmentStates = 0x5C00, // 92 + ID_PreTreatmentStates = 0xB700, // 183 //// ----- @LEAHIZED ID_TreatmentStates = 0x3C00, // 60 //// ----- @LEAHIZED ID_PostTreatmentStates = 0x770F, // 119 //// ----- @CRAPIZED: had to change to avoid duplication Index: sources/gui/qml/dialogs/AlarmDialog.qml =================================================================== diff -u -r8f6ecb60abf6d47d4554cfd3019ca496d79b6f69 -radf593e5ad91c1e689564298bf8d411d7847b158 --- sources/gui/qml/dialogs/AlarmDialog.qml (.../AlarmDialog.qml) (revision 8f6ecb60abf6d47d4554cfd3019ca496d79b6f69) +++ sources/gui/qml/dialogs/AlarmDialog.qml (.../AlarmDialog.qml) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -177,7 +177,7 @@ font.pixelSize : Fonts.fontPixelInstructionStep font.weight : _delegateControl.ListView.isCurrentItem ? Font.DemiBold : Font.Normal color : _delegateControl.ListView.isCurrentItem ? _colorMode.modeSelctedColor : _colorMode.modeTextColor - text : model.instruction + text : model.instruction.join(" ") wrapMode : Text.WordWrap } Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreatePatientPrescription.qml =================================================================== diff -u -r4b86351821cd865f5d0383190a17b2137f79f9aa -radf593e5ad91c1e689564298bf8d411d7847b158 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreatePatientPrescription.qml (.../PreTreatmentCreatePatientPrescription.qml) (revision 4b86351821cd865f5d0383190a17b2137f79f9aa) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreatePatientPrescription.qml (.../PreTreatmentCreatePatientPrescription.qml) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -20,6 +20,7 @@ spacing : Variables.defaultMargin * 3 + enum HeparinEnabled { OFF, ON Fisheye: Tag adf593e5ad91c1e689564298bf8d411d7847b158 refers to a dead (removed) revision in file `sources/model/hd/data/pretreatment/MPreTreatmentStatesData.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag adf593e5ad91c1e689564298bf8d411d7847b158 refers to a dead (removed) revision in file `sources/model/hd/data/pretreatment/MPreTreatmentStatesData.h'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/model/hd/data/treatment/MTreatmentHeparinData.h =================================================================== diff -u -r1edd5fe4e852a2b352a86587820a269a5103fc9f -radf593e5ad91c1e689564298bf8d411d7847b158 --- sources/model/hd/data/treatment/MTreatmentHeparinData.h (.../MTreatmentHeparinData.h) (revision 1edd5fe4e852a2b352a86587820a269a5103fc9f) +++ sources/model/hd/data/treatment/MTreatmentHeparinData.h (.../MTreatmentHeparinData.h) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -38,7 +38,7 @@ * | || * | #1:(F32) | \ref Data::mCumulative | * | #2:(F32) | \ref Data::mTarget | - * | #2:(U32) | \ref Data::mTimeRemaining | + * | #3:(U32) | \ref Data::mTimeRemaining | * * \sa Data * \sa MAdjustHeparinReq : Heparin Request Index: sources/model/td/data/pretreatment/MPreTreatmentStatesData.cpp =================================================================== diff -u --- sources/model/td/data/pretreatment/MPreTreatmentStatesData.cpp (revision 0) +++ sources/model/td/data/pretreatment/MPreTreatmentStatesData.cpp (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -0,0 +1,68 @@ +/*! + * + * Copyright (c) 2021-2024 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 MPreTreatmentStatesData.cpp + * \author (last) Behrouz NematiPour + * \date (last) 10-Feb-2023 + * \author (original) Behrouz NematiPour + * \date (original) 11-Apr-2021 + * + */ +#include "MPreTreatmentStatesData.h" + +using namespace Model; + +QVariantList MPreTreatmentStates::parameters() const { + return { + _data.mSubMode .value, + _data.mInstallState .value, + _data.mSelfTestDryState .value, + _data.mPrimeState .value, + _data.mRecirculateState .value, + _data.mConfirmRxState .value, + _data.mHeparinState .value, + _data.mPatientConnectionState .value, + }; +} + +bool MPreTreatmentStates::fromByteArray(const QByteArray &vByteArray, int *vIndex) { + int index = 0; // message data start position + if ( ! GetValue(vByteArray, index, _data.mSubMode )) goto lError; + if ( ! GetValue(vByteArray, index, _data.mInstallState )) goto lError; + if ( ! GetValue(vByteArray, index, _data.mSelfTestDryState )) goto lError; + if ( ! GetValue(vByteArray, index, _data.mPrimeState )) goto lError; + if ( ! GetValue(vByteArray, index, _data.mRecirculateState )) goto lError; + if ( ! GetValue(vByteArray, index, _data.mConfirmRxState )) goto lError; + if ( ! GetValue(vByteArray, index, _data.mHeparinState )) goto lError; + if ( ! GetValue(vByteArray, index, _data.mPatientConnectionState )) goto lError; + + return true ; + +lError: + if(vIndex) { *vIndex = index; } + + return false ; +} + +/*! + * \brief MPreTreatmentStates::data + * \details Provides model's Data from the received messages data values + * \return Data + */ +MPreTreatmentStates::Data MPreTreatmentStates::data() const { + Data data; + data.mSubMode = _data.mSubMode .value; + data.mInstallState = _data.mInstallState .value; + data.mSelfTestDryState = _data.mSelfTestDryState .value; + data.mPrimeState = _data.mPrimeState .value; + data.mRecirculateState = _data.mRecirculateState .value; + data.mConfirmRxState = _data.mConfirmRxState .value; + data.mHeparinState = _data.mHeparinState .value; + data.mPatientConnectionState = _data.mPatientConnectionState .value; + + return data; +} Index: sources/model/td/data/pretreatment/MPreTreatmentStatesData.h =================================================================== diff -u --- sources/model/td/data/pretreatment/MPreTreatmentStatesData.h (revision 0) +++ sources/model/td/data/pretreatment/MPreTreatmentStatesData.h (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -0,0 +1,106 @@ +/*! + * + * Copyright (c) 2021-2024 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 MPreTreatmentStatesData.h + * \author (last) Behrouz NematiPour + * \date (last) 24-Mar-2023 + * \author (original) Behrouz NematiPour + * \date (original) 11-Apr-2021 + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; + +namespace Model { + +/*! + * \brief The MPreTreatmentStates class + * \details The pre treatment states data model + * + * | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | + * |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | + * |0xB700| 0x040 | 7 | 1 Hz | N | TD | All | Pre-Treatment States Data | + * + * | Payload || + * | || + * | # 1:(U32) | \ref Data::mSubMode | + * | # 2:(U32) | \ref Data::mInstallState | + * | # 3:(U32) | \ref Data::mSelfTestDryState | + * | # 4:(U32) | \ref Data::mPrimeState | + * | # 5:(U32) | \ref Data::mRecirculateState | + * | # 6:(U32) | \ref Data::mConfirmRxState | + * | # 7:(U32) | \ref Data::mHeparinState | + * | # 8:(U32) | \ref Data::mPatientConnectionState | + * + * \sa Data + * \sa TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE + * \sa TD_PRE_TREATMENT_SELF_TEST_DRY_STATE + * \sa TD_PRE_TREATMENT_PRIME_STATE + * \sa TD_PRE_TREATMENT_RECIRCULATE_STATE + * \sa TD_PRE_TREATMENT_CONFIRM_RX_STATE + * \sa TD_PRE_TREATMENT_HEPARIN_SETUP_STATE + * \sa TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE + * + * | || + * | typeText | Datum | + * | unitText | TD | + * | infoText | PreTreatmentStates | + * + */ +class MPreTreatmentStates : public MAbstract { + + // friends + friend class ::tst_models; + + QVariantList parameters() const override; + + struct { + Types::U32 mSubMode ; ///< Current pre-treatment sub-mode + Types::U32 mInstallState ; ///< Tube set install state + Types::U32 mSelfTestDryState ; ///< Self-tests when the cartridge is dry state + Types::U32 mPrimeState ; ///< Prime blood and dialysate circuits and run wet self-tests state + Types::U32 mRecirculateState ; ///< Re-circulate blood and dialysate circuits state + Types::U32 mConfirmRxState ; ///< User reviews and confirms prescription ( Confirm Rx ) + Types::U32 mHeparinState ; ///< Heparin setup state + Types::U32 mPatientConnectionState ; ///< Patient connection state + + } _data; + +public: + + Type_Enum typeText () const override { return Type_Enum::eDatum ; } + Unit_Enum unitText () const override { return Unit_Enum::eTD ; } + QString infoText () const override { return QString("PreTreatmentStates"); } + + struct Data { + quint32 mSubMode = 0; ///< SubMode State - TD_Pre_Treatment_Mode_States + quint32 mInstallState = 0; ///< mInstallState State - TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE + quint32 mSelfTestDryState = 0; ///< mSelfTestDryState State - TD_PRE_TREATMENT_SELF_TEST_DRY_STATE + quint32 mPrimeState = 0; ///< mPrimeState State - TD_PRE_TREATMENT_PRIME_STATE + quint32 mRecirculateState = 0; ///< mRecirculateState State - TD_PRE_TREATMENT_RECIRCULATE_STATE + quint32 mConfirmRxState = 0; ///< mConfirmRxState State - TD_PRE_TREATMENT_CONFIRM_RX_STATE + quint32 mHeparinState = 0; ///< mHeparinState State - TD_PRE_TREATMENT_HEPARIN_SETUP_STATE + quint32 mPatientConnectionState = 0; ///< mPatientConnectionState State - TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE + }; + + MPreTreatmentStates() { } + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; +}; +} + +typedef Model::MPreTreatmentStates::Data PreTreatmentStatesData; Index: sources/view/hd/alarm/VAlarmStatus.cpp =================================================================== diff -u -r0f83de066c8a116195a3cc60577d597ef9654c55 -radf593e5ad91c1e689564298bf8d411d7847b158 --- sources/view/hd/alarm/VAlarmStatus.cpp (.../VAlarmStatus.cpp) (revision 0f83de066c8a116195a3cc60577d597ef9654c55) +++ sources/view/hd/alarm/VAlarmStatus.cpp (.../VAlarmStatus.cpp) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -14,6 +14,10 @@ */ #include "VAlarmStatus.h" +// Qt +#include +#include + // Project #include "GuiController.h" #include "Settings.h" @@ -26,6 +30,9 @@ ADJUST_VIEW_CONNECTION(AlarmSilenceRequestData ); ADJUST_VIEW_CONNECTION(AlarmUserActionRequestData ); + connect(&_GuiController, SIGNAL(didActionReceive (GuiActionType, const QVariantList &)), + this , SLOT( onActionReceive (GuiActionType, const QVariantList &))); + _instructionsList.setRoleNames({ { eRole_Instruction , "instruction" }, { eRole_Image , "image" }, @@ -228,11 +235,10 @@ QFileInfo fileInfo(imagePath); - QHash instructionStep; - instructionStep.insert(eRole_Instruction, key); + QStringList updatedKey = updateReplacements(group, key, id, instructionData.count()); + instructionStep.insert(eRole_Instruction, updatedKey); instructionStep.insert(eRole_Image, fileInfo.exists() && fileInfo.isFile() ? "file:" + imagePath : "") ; - instructionData.append(instructionStep); alarmData.instructions = instructionData; } @@ -249,3 +255,82 @@ } emit alarm_AlarmIDChanged(_alarm_AlarmID); // to get the dialog content in sync with the Alarm.conf in case there is an early alarm. } + +QStringList VAlarmStatus::updateReplacements(const QString &vGroup, const QString &vKey, const int &vAlarmID, const int &vIndex) +{ + QRegExp regx("\\{\\s*\\d+\\s*:\\s*\\d+\\s*:\\s*\\w*\\s*:\\s*\\d*\\s*\\}"); + QString key = vKey; + int replacementCount = key.count(regx); + QStringList keyList; + for ( int j = 0; j < replacementCount; j++ ) { + int pos = key.indexOf(regx); + int len = regx.matchedLength(); + QString blk = key.mid(pos+1, len-2); + keyList += key.mid(0, pos); + keyList += ""; // value placeholder + key.remove(0, pos + regx.matchedLength()); + QStringList lst = blk.split(":"); + quint16 id = lst[0].toUInt(); + quint16 ix = lst[1].toUInt(); + QString ex = lst[2] ; + quint16 rd = lst[3].toUInt(); + Q_UNUSED(vGroup); + TLocation loc; + loc.group = vGroup ; + loc.alarmID = vAlarmID ; + loc.index = vIndex ; + loc.locIndex = j * 2 + 1 ; + loc.prmIndex = ix ; + loc.prmExtra = ex ; + loc.prmRound = rd ; + + _replacements[id] += loc; + } + keyList += key; + + return keyList; +} + +/*! + * \brief VSettings::onActionReceive + * \details emits didActionReceive signal to notify other classes (Gui) + * , an action has been received. + * \param vAction - the action + * \param vData - the action data + */ +void VAlarmStatus::onActionReceive (GuiActionType vAction, const QVariantList &vData) +{ + bool isChanged = false; + quint16 id = qFromBigEndian((quint16)vAction); + quint32 alarmID; + if (_replacements.contains(id)) { + isChanged = true; + for ( const auto &item : _replacements[id]) { + QString value; + + quint16 len = vData.length(); + + if ( 0 < item.prmIndex && item.prmIndex <= len ) { + if ( item.prmRound > 0 ) { + value = QString::number(vData[item.prmIndex - 1].toFloat(), 'f', item.prmRound) + item.prmExtra; + } + else { + value = vData[item.prmIndex - 1].toString() + item.prmExtra; + } + } + else { + qDebug() << QString("Given prmIndex %1 is out of message %2 parameters count %3 on alarm id '%4'") + .arg(item.prmIndex).arg(id).arg(len).arg(item.alarmID); + continue; + } + + // update alarm instruction step + alarmID = item.alarmID; + QStringList step = _alarms[alarmID].instructions[item.index][eRole_Instruction].toStringList(); + step[item.locIndex] = value; + _alarms[alarmID].instructions[item.index][eRole_Instruction] = step; + } + } + + if ( isChanged ) emit alarm_AlarmIDChanged(alarmID); +} Index: sources/view/hd/alarm/VAlarmStatus.h =================================================================== diff -u -r0f83de066c8a116195a3cc60577d597ef9654c55 -radf593e5ad91c1e689564298bf8d411d7847b158 --- sources/view/hd/alarm/VAlarmStatus.h (.../VAlarmStatus.h) (revision 0f83de066c8a116195a3cc60577d597ef9654c55) +++ sources/view/hd/alarm/VAlarmStatus.h (.../VAlarmStatus.h) (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -60,6 +60,19 @@ QMap _alarms; + typedef struct { + QString group ; + quint32 alarmID ; + quint16 index ; + quint16 locIndex; + quint16 prmIndex; + QString prmExtra; + quint16 prmRound; + } TLocation; + typedef QList TLocationList; + typedef QMap TReplacements; + TReplacements _replacements; + // ********** DYNAMIC PROPERTIES: The properties which need to be updated by each alarm message received. ********** // READONLY( bool , hasAlarm , false) PROPERTY( quint32 , alarm_Priority , 0) @@ -88,7 +101,7 @@ // ********** STATIC PROPERTIES: The properties which need to be updated by each alarm message received. ********** // Q_PROPERTY(QString title READ title NOTIFY alarm_AlarmIDChanged ) Q_PROPERTY(QString text READ text NOTIFY alarm_AlarmIDChanged ) - Q_PROPERTY(MListModel* instructions READ instructions NOTIFY alarm_AlarmIDChanged) + Q_PROPERTY(MListModel* instructions READ instructions NOTIFY alarm_AlarmIDChanged ) VIEW_DEC_CLASS ( VAlarmStatus ) VIEW_DEC_SLOT ( AlarmStatusData ) @@ -110,6 +123,12 @@ MListModel* instructions () { return &_instructionsList; } ; MListModel _instructionsList; + QStringList updateReplacements( const QString &vGroup , + const QString &vKey , + const int &vAlarmID , + const int &vIndex ); +private slots: + void onActionReceive (GuiActionType vAction, const QVariantList &vData); signals: void didAlarmRaise(); Fisheye: Tag adf593e5ad91c1e689564298bf8d411d7847b158 refers to a dead (removed) revision in file `sources/view/hd/data/pretreatment/VPreTreatmentStatesData.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag adf593e5ad91c1e689564298bf8d411d7847b158 refers to a dead (removed) revision in file `sources/view/hd/data/pretreatment/VPreTreatmentStatesData.h'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/view/td/data/pretreatment/VPreTreatmentStatesData.cpp =================================================================== diff -u --- sources/view/td/data/pretreatment/VPreTreatmentStatesData.cpp (revision 0) +++ sources/view/td/data/pretreatment/VPreTreatmentStatesData.cpp (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -0,0 +1,96 @@ +/*! + * + * Copyright (c) 2021-2024 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 VPreTreatmentStatesData.cpp + * \author (last) Behrouz NematiPour + * \date (last) 01-Aug-2023 + * \author (original) Behrouz NematiPour + * \date (original) 11-Apr-2021 + * + */ +#include "VPreTreatmentStatesData.h" + +// Project +#include "GuiController.h" + +VIEW_DEF(VPreTreatmentStates, PreTreatmentStatesData) + + +/*! + * \brief VTDTreatmentStates::onActionReceive + * \details sets the properties for the received data of Treatment States + * \param vData - Treatment States data + */ +void VPreTreatmentStates::onActionReceive(const PreTreatmentStatesData &vData) +{ + subMode ( vData.mSubMode ); + installationState ( vData.mInstallState ); + selfTestDryState ( vData.mSelfTestDryState ); + primeState ( vData.mPrimeState ); + recirculateState ( vData.mRecirculateState ); + confirmRxState ( vData.mConfirmRxState ); + heparinState ( vData.mHeparinState ); + patientConnectionState ( vData.mPatientConnectionState ); + + // Consumable and cartridge installation state + bool mInstallation = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE ; + if ( mInstallation ) { + // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. + installation_start ( vData.mInstallState == 0 /* There is no other state and it is always 0 for now */ ); + } + installation(mInstallation); // it's the main even so moved last to have all the sub-states updated prior to. + + // TODO: Self tests dry state + bool mSelfTestDry = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_SELF_TEST_DRY_STATE ; + if ( mSelfTestDry ) { + selfTestDry_start ( vData.mConfirmRxState == 0 /* There is no other state and it is always 0 for now */ ); + } + selfTestDry(mSelfTestDry); // it's the main even so moved last to have all the sub-states updated prior to. + + + // TODO: Prime blood and dialysate circuits and run wet self-tests state + bool mPrime = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_PRIME_STATE ; + if ( mPrime ) { + prime_start ( vData.mConfirmRxState == 0 /* There is no other state and it is always 0 for now */ ); + } + prime(mPrime); // it's the main even so moved last to have all the sub-states updated prior to. + + + // Re-circulate blood and dialysate circuits state + bool mRecirculate = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_RECIRCULATE_STATE ; + if ( mRecirculate ) { + recirculate_start ( vData.mRecirculateState == GuiPreTreatmentRecirculateStates ::PRE_TREATMENT_RECIRC_STATE ); + recirculate_stopped ( vData.mRecirculateState == GuiPreTreatmentRecirculateStates ::PRE_TREATMENT_RECIRC_STOPPED_STATE ); + } + recirculate(mRecirculate); // it's the main even so moved last to have all the sub-states updated prior to. + + // Confirm Rx state + bool mConfirmStae = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_CONFIRM_RX_STATE ; + if ( mConfirmStae ) { + confirmRx_start ( vData.mConfirmRxState == 0 /* There is no other state and it is always 0 for now */ ); + } + confirmRx(mConfirmStae); // it's the main even so moved last to have all the sub-states updated prior to. + + // Heparin state + bool mHeparin = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_HEPARIN_SETUP_STATE ; + if ( mHeparin ) { + heparin_start ( vData.mHeparinState == 0 /* There is no other state and it is always 0 for now */ ); + } + heparin(mHeparin); // it's the main even so moved last to have all the sub-states updated prior to. + + // Patient connection state + bool mPatientConnection = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE ; + if ( mPatientConnection ) { + // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. + patientConnection_start ( vData.mPatientConnectionState == 0 /* There is no other state and it is always 0 for now */ ); + } + patientConnection(mPatientConnection); + + // *** Only for test *** + // Be careful it is always triggered on each message. + state(true); +} Index: sources/view/td/data/pretreatment/VPreTreatmentStatesData.h =================================================================== diff -u --- sources/view/td/data/pretreatment/VPreTreatmentStatesData.h (revision 0) +++ sources/view/td/data/pretreatment/VPreTreatmentStatesData.h (revision adf593e5ad91c1e689564298bf8d411d7847b158) @@ -0,0 +1,89 @@ +/*! + * + * Copyright (c) 2021-2024 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 VPreTreatmentStatesData.h + * \author (last) Behrouz NematiPour + * \date (last) 01-Aug-2023 + * \author (original) Behrouz NematiPour + * \date (original) 11-Apr-2021 + * + */ +#pragma once + +// Qt +#include + +// Project +#include "main.h" // Doxygen : do not remove +#include "VView.h" +#include "MPreTreatmentStatesData.h" + +// namespace +namespace View { + +/*! + * \brief The VPreTreatmentStates class + * \details View for Model's data representation. + * + * \sa Model::MPreTreatmentStates + * + */ +class VPreTreatmentStates : public QObject +{ + Q_OBJECT + + // *** Only for test *** + // Be careful it is always triggered on each message. + TRIGGER ( bool , state , false ) // changes in case any message received. + + PROPERTY( quint8 , subMode , 0 ) ///< TD_Pre_Treatment_Mode_States , + PROPERTY( quint8 , installationState , 0 ) ///< TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE , Tube set install state + PROPERTY( quint8 , selfTestDryState , 0 ) ///< TD_PRE_TREATMENT_SELF_TEST_DRY_STATE , Self-tests when the cartridge is dry state + PROPERTY( quint8 , primeState , 0 ) ///< TD_PRE_TREATMENT_PRIME_STATE , Prime blood and dialysate circuits and run wet self-tests state + PROPERTY( quint8 , recirculateState , 0 ) ///< TD_PRE_TREATMENT_RECIRCULATE_STATE , Re-circulate blood and dialysate circuits state + PROPERTY( quint8 , confirmRxState , 0 ) ///< TD_PRE_TREATMENT_CONFIRM_RX_STATE , User reviews and confirms prescription ( Confirm Rx ) + PROPERTY( quint8 , heparinState , 0 ) ///< TD_PRE_TREATMENT_HEPARIN_SETUP_STATE , Heparin setup state + PROPERTY( quint8 , patientConnectionState , 0 ) ///< TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE , Patient connection state + + // Start pre-treatment mode state + PROPERTY( bool , installation , false ) ///< TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE , Tube set install state + PROPERTY( bool , selfTestDry , false ) ///< TD_PRE_TREATMENT_SELF_TEST_DRY_STATE , Self-tests when the cartridge is dry state + PROPERTY( bool , prime , false ) ///< TD_PRE_TREATMENT_PRIME_STATE , Prime blood and dialysate circuits and run wet self-tests state + PROPERTY( bool , recirculate , false ) ///< TD_PRE_TREATMENT_RECIRCULATE_STATE , Re-circulate blood and dialysate circuits state + PROPERTY( bool , confirmRx , false ) ///< TD_PRE_TREATMENT_CONFIRM_RX_STATE , User reviews and confirms prescription ( Confirm Rx ) + PROPERTY( bool , heparin , false ) ///< TD_PRE_TREATMENT_HEPARIN_SETUP_STATE , Heparin setup state + PROPERTY( bool , patientConnection , false ) ///< TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE , Patient connection state + + // Consumable and cartridge installation state + // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. + PROPERTY( bool , installation_start , false ) ///< Consumable and cartridge installation state + + // Self tests dry state + PROPERTY( bool , selfTestDry_start , false ) + + // Prime + PROPERTY( bool , prime_start , false ) + + // Re-circulate blood and dialysate circuits state + PROPERTY( bool , recirculate_start , false ) ///< PRE_TREATMENT_RECIRC_STATE , Pre-treatment recirculate state. + PROPERTY( bool , recirculate_stopped , false ) ///< PRE_TREATMENT_RECIRC_STOPPED_STATE , Pre-treatment recirculate stopped state. + + // Create Rx state + // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. + PROPERTY( bool , confirmRx_start , false ) ///< Confirm Rx state + + // Heparin state + // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. + PROPERTY( bool , heparin_start , false ) ///< Heparin state + + // Patient connection state + // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. + PROPERTY( bool , patientConnection_start , false ) ///< Patient connection state + + VIEW_DEC(VPreTreatmentStates, PreTreatmentStatesData) +}; +}