Index: denali.pro =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- denali.pro (.../denali.pro) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ denali.pro (.../denali.pro) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -1,6 +1,6 @@ QT += widgets qml quick serialbus concurrent CONFIG += c++17 warn_on -QMAKE_CXXFLAGS += -Wall -Werror -Wimplicit-fallthrough # -save-temps // see .ii and .s files +QMAKE_CXXFLAGS += -Wall -Werror -Wimplicit-fallthrough # -save-temps # see .ii and .s files #CONFIG += disable_crc disable_crc { @@ -28,17 +28,19 @@ INCLUDEPATH += \ common \ sources \ - sources/model \ - sources/view \ sources/storage \ sources/gui \ sources/canbus \ sources/utility \ sources/abstract \ + sources/model \ sources/model/hd/adjustment \ sources/model/hd/alarm \ sources/model/hd/data \ sources/model/dg/data \ + sources/view \ + sources/view/hd/adjustment \ + sources/view/hd/data \ sources/view/dg/data HEADERS += \ @@ -106,35 +108,38 @@ sources/gui/guiview.h \ sources/gui/guicontroller.h \ \ # ---------- Views ---------- - sources/view/dg/data/VDGDrainPumpData.h \ - sources/view/dg/data/VDGHeatersData.h \ - sources/view/dg/data/VDGLoadCellReadingsData.h \ - sources/view/dg/data/VDGOperationModeData.h \ - sources/view/dg/data/VDGPressuresData.h \ - sources/view/dg/data/VDGROPumpData.h \ - sources/view/dg/data/VDGReservoirData.h \ - sources/view/dg/data/VDGTemperaturesData.h \ - sources/view/dg/data/VDGValvesStatesData.h \ - \ + sources/view/hd/data/VHDTreatmentStatesData.h \ sources/view/vview.h \ sources/view/vpoweroff.h \ + \ # ---------- Views - Alarm sources/view/valarmstatus.h \ - sources/view/VHDOperationModeData.h \ - sources/view/vtreatmenttime.h \ - sources/view/vtreatmentbloodflow.h \ - sources/view/vtreatmentdialysateflow.h \ - sources/view/vtreatmentultrafiltration.h \ - sources/view/vtreatmentranges.h \ - sources/view/vtreatmentpressureocclusion.h \ - sources/view/VTreatmentSalineData.h \ - \ # Treatment Adjustments + \ # ---------- Views - HD - Adjustment - In-Treatment sources/view/vtreatmentadjustmentresponsebase.h \ sources/view/vtreatmentadjustmentduration.h \ sources/view/vtreatmentadjustmentflows.h \ sources/view/vtreatmentadjustmentultrafiltrationstate.h \ sources/view/vtreatmentadjustmentultrafiltrationedit.h \ sources/view/vtreatmentadjustmentultrafiltrationconfirm.h \ - sources/view/VTreatmentAdjustmentSaline.h \ + sources/view/hd/adjustment/VTreatmentAdjustmentSaline.h \ + \ # ---------- Views - HD - Data + sources/view/vtreatmenttime.h \ + sources/view/vtreatmentbloodflow.h \ + sources/view/vtreatmentdialysateflow.h \ + sources/view/vtreatmentultrafiltration.h \ + sources/view/vtreatmentranges.h \ + sources/view/vtreatmentpressureocclusion.h \ + sources/view/hd/data/VHDOperationModeData.h \ + sources/view/hd/data/VTreatmentSalineData.h \ + \ # ---------- Views - DG - Data + sources/view/dg/data/VDGDrainPumpData.h \ + sources/view/dg/data/VDGHeatersData.h \ + sources/view/dg/data/VDGLoadCellReadingsData.h \ + sources/view/dg/data/VDGOperationModeData.h \ + sources/view/dg/data/VDGPressuresData.h \ + sources/view/dg/data/VDGROPumpData.h \ + sources/view/dg/data/VDGReservoirData.h \ + sources/view/dg/data/VDGTemperaturesData.h \ + sources/view/dg/data/VDGValvesStatesData.h \ \ # Storage sources/storage/storageglobals.h \ sources/storage/filehandler.h \ @@ -205,6 +210,28 @@ sources/gui/guiview.cpp \ sources/gui/guicontroller.cpp \ \ # ---------- Views ---------- + sources/view/hd/data/VHDTreatmentStatesData.cpp \ + sources/view/vpoweroff.cpp \ + \ # ---------- Views - Alarm + sources/view/valarmstatus.cpp \ + \ # ---------- Views - HD - Adjustment - In-Treatment + sources/view/vtreatmentadjustmentresponsebase.cpp \ + sources/view/vtreatmentadjustmentduration.cpp \ + sources/view/vtreatmentadjustmentflows.cpp \ + sources/view/vtreatmentadjustmentultrafiltrationstate.cpp \ + sources/view/vtreatmentadjustmentultrafiltrationedit.cpp \ + sources/view/vtreatmentadjustmentultrafiltrationconfirm.cpp \ + sources/view/hd/adjustment/VTreatmentAdjustmentSaline.cpp \ + \ # ---------- Views - HD - Data + sources/view/vtreatmenttime.cpp \ + sources/view/vtreatmentbloodflow.cpp \ + sources/view/vtreatmentdialysateflow.cpp \ + sources/view/vtreatmentultrafiltration.cpp \ + sources/view/vtreatmentranges.cpp \ + sources/view/vtreatmentpressureocclusion.cpp \ + sources/view/hd/data/VHDOperationModeData.cpp \ + sources/view/hd/data/VTreatmentSalineData.cpp \ + \ # ---------- Views - DG - Data sources/view/dg/data/VDGDrainPumpData.cpp \ sources/view/dg/data/VDGHeatersData.cpp \ sources/view/dg/data/VDGLoadCellReadingsData.cpp \ @@ -214,25 +241,6 @@ sources/view/dg/data/VDGReservoirData.cpp \ sources/view/dg/data/VDGTemperaturesData.cpp \ sources/view/dg/data/VDGValvesStatesData.cpp \ - \ - sources/view/vpoweroff.cpp \ - sources/view/valarmstatus.cpp \ - sources/view/VHDOperationModeData.cpp \ - sources/view/vtreatmenttime.cpp \ - sources/view/vtreatmentbloodflow.cpp \ - sources/view/vtreatmentdialysateflow.cpp \ - sources/view/vtreatmentultrafiltration.cpp \ - sources/view/vtreatmentranges.cpp \ - sources/view/vtreatmentpressureocclusion.cpp \ - sources/view/VTreatmentSalineData.cpp \ - \ # Treatment Adjustments - sources/view/vtreatmentadjustmentresponsebase.cpp \ - sources/view/vtreatmentadjustmentduration.cpp \ - sources/view/vtreatmentadjustmentflows.cpp \ - sources/view/vtreatmentadjustmentultrafiltrationstate.cpp \ - sources/view/vtreatmentadjustmentultrafiltrationedit.cpp \ - sources/view/vtreatmentadjustmentultrafiltrationconfirm.cpp \ - sources/view/VTreatmentAdjustmentSaline.cpp \ \ # Storage sources/storage/storageglobals.cpp \ sources/storage/filehandler.cpp \ Index: denali.pro.user =================================================================== diff -u -rd28dcbacdb1818e5777d83feb1e513a339da6995 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- denali.pro.user (.../denali.pro.user) (revision d28dcbacdb1818e5777d83feb1e513a339da6995) +++ denali.pro.user (.../denali.pro.user) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -100,7 +100,7 @@ qmake QtProjectManager.QMakeBuildStep - false + true false false @@ -1183,7 +1183,7 @@ true false false - true + false /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -337,13 +337,17 @@ case Gui::GuiActionType::ID_AdjustDurationRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustDurationRsp ); break; case Gui::GuiActionType::ID_AdjustBloodDialysateRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustBloodDialysateRsp); break; case Gui::GuiActionType::ID_AdjustSalineRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustSalineRsp ); break; + + // ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq); break; + // this message has been inherited from MAbstract and should use notify but since the response message is not standard can't use notify yet. + // when received gets payload len error and can't be interpreted. case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq : ok = adjustUltrafiltrationState (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp : ok = adjustUltrafiltrationEdit (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp : ok = adjustUltrafiltrationConfirm (vMessage, vData); break; // TODO : implement notify<>() // unhandled messages: these will only be logged as received message // there has nothing been defined for these messages. - default : printUnhandled (vMessage ); break; + default : printUnhandled (vMessage ); break; } return ok; @@ -521,7 +525,7 @@ Model::MAdjustUltrafiltrationStateResponse mData; ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); + LOG_EVENT(mData.toString()); mData.toVariantList(vData); emit didActionReceive(mData.data()); Index: sources/gui/guiglobals.cpp =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -37,6 +37,7 @@ #include "vtreatmentranges.h" #include "VHDOperationModeData.h" #include "VTreatmentSalineData.h" +#include "VHDTreatmentStatesData.h" #include "VDGDrainPumpData.h" #include "VDGHeatersData.h" Index: sources/gui/guiglobals.h =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/guiglobals.h (.../guiglobals.h) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -1,16 +1,16 @@ /*! - * + * * 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 guiglobals.h * \author (last) Peter Lucia * \date (last) 25-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 28-Oct-2019 - * + * */ #pragma once @@ -118,6 +118,11 @@ Timeout = 0x01, }; + enum Saline_States { // FW currently doesn't have enum for Saline Bolus when provided better to be replaced. + SALINE_STOP_STATE = 0, ///< Saline is not delivered + SALINE_START_STATE , ///< Saline being Delivered + }; + Q_ENUM(GuiActionsType_Enum) Q_ENUM(GuiActionsData_Enum) @@ -131,6 +136,9 @@ #include "HDDefs.h" Q_ENUM(HD_Op_Modes) Q_ENUM(UF_Adjustments) + Q_ENUM(Treatment_States) + Q_ENUM(UF_States) + Q_ENUM(Saline_States) #include "DGDefs.h" Q_ENUM(DG_Op_Modes) @@ -149,8 +157,12 @@ typedef GuiActions::DG_Op_Modes GuiDGOpModes; typedef GuiActions::UF_Adjustments GuiUFAdjustment; + typedef GuiActions::Treatment_States GuiTreatment_States; + typedef GuiActions::UF_States GuiUFStates; + typedef GuiActions::Saline_States GuiSalineStates; + void registerTypes(); void registerQmlTypes(); Index: sources/gui/qml/components/NotificationBarSmall.qml =================================================================== diff -u -r96d3da12ee7760f0d97fd7c2e9e89e56bcdcf6b1 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/qml/components/NotificationBarSmall.qml (.../NotificationBarSmall.qml) (revision 96d3da12ee7760f0d97fd7c2e9e89e56bcdcf6b1) +++ sources/gui/qml/components/NotificationBarSmall.qml (.../NotificationBarSmall.qml) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -26,6 +26,8 @@ property alias imageSource : _image.source property bool imageAutoSize : false + property bool imageAnimated : false + property alias text : _text.text property alias textColor : _text.color property alias textfontSize : _text.font.pixelSize @@ -49,9 +51,11 @@ anchors.centerIn: parent spacing: 10 Image { id: _image - anchors.verticalCenter: parent.verticalCenter width : source == "" ? 0 : imageAutoSize ? Math.min(_root.height, _root.width) : Variables.notificationIconSize height: source == "" ? 0 : imageAutoSize ? Math.min(_root.height, _root.width) : Variables.notificationIconSize + anchors.verticalCenter : imageAutoSize ? parent.verticalCenter : undefined + anchors.top : imageAutoSize ? undefined : parent.top + anchors.topMargin : height > _root.height ? -((height - _root.height) / 2) : 0 } Text { id: _text color : Colors.textNotificationNoneFg @@ -61,6 +65,19 @@ } } + OpacityAnimator { target: _image + from : 0.3 + to : 1 + duration : 1500 + running : imageAnimated && _root.visible + onFinished : { + var tmp = from + from = to + to = tmp + restart() + } + } + onLevelChanged: { switch (level) { case GuiActions.ALARM_PRIORITY_HIGH: Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -17,8 +17,10 @@ import QtQuick 2.12 // Project -import VTreatmentRanges 0.1 -import VTreatmentAdjustmentSaline 0.1; +import Gui.Actions 0.1 +import VTreatmentRanges 0.1 +import VTreatmentAdjustmentSaline 0.1 +import VHDTreatmentStates 0.1 // Qml imports import "qrc:/globals" @@ -38,6 +40,10 @@ // Views VTreatmentRanges { id: vTreatmentRanges } VTreatmentAdjustmentSaline { id: vTreatmentAdjustmentSaline } + VHDTreatmentStates { id: vHDTreatmentStates + property bool ufPaused : ufState === GuiActions.UF_PAUSED_STATE + property bool txPaused : subMode === GuiActions.TREATMENT_STOP_STATE + } // Components MainMenu { id: _treatmentMenu Index: sources/gui/qml/pages/treatment/sections/TreatmentFluid.qml =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/qml/pages/treatment/sections/TreatmentFluid.qml (.../TreatmentFluid.qml) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/gui/qml/pages/treatment/sections/TreatmentFluid.qml (.../TreatmentFluid.qml) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -1,16 +1,16 @@ /*! - * + * * 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 TreatmentFluid.qml * \author (last) Behrouz NemaiPour * \date (last) 08-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 27-Jan-2020 - * + * */ // Qt @@ -26,19 +26,17 @@ * \brief Treatment Screen Fluid Management section */ TouchArea { id: _root + property string buttonText : "" + property bool cumulativeVisible : true - property int rowTextSpacing : 10 - property int volumeTextWidth: 60 + property int rowTextSpacing : 10 + property int volumeTextWidth : 60 - property bool cumulativeVisible: true + property string unit : "" + property alias valueTarget : _fluidTarget .value + property alias valueCumulative : _cumulativeValue .value + property alias valueDelivered : _fluidProgressBar .value - property string buttonText: "" - - property string unit - property alias valueTarget : _fluidTarget .value - property alias valueCumulative : _cumulativeValue .value - property alias valueDelivered : _fluidProgressBar .value - x : 0 y : 0 width : 200 Index: sources/gui/qml/pages/treatment/sections/TreatmentSaline.qml =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/qml/pages/treatment/sections/TreatmentSaline.qml (.../TreatmentSaline.qml) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/gui/qml/pages/treatment/sections/TreatmentSaline.qml (.../TreatmentSaline.qml) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -28,15 +28,15 @@ */ TreatmentFluid { id: _root - buttonText : vTreatmentAdjustmentSaline.isStarted ? qsTr("STOP BOLUS") : qsTr("START BOLUS") + buttonText : vTreatmentAdjustmentSaline.isStarted || vHDTreatmentStates.salineStarted ? qsTr("STOP BOLUS") : qsTr("START BOLUS") title : qsTr("SALINE BOLUS") unit : Variables.unitTextSaline VTreatmentSaline { id: vTreatmentSaline } - valueTarget : vTreatmentSaline.target ; - valueCumulative: vTreatmentSaline.cumulative .toFixed(0); - valueDelivered : vTreatmentSaline.delivered .toFixed(0); + valueTarget : vTreatmentSaline.target || vTreatmentAdjustmentSaline.target + valueCumulative: vTreatmentSaline.cumulative .toFixed(0) + valueDelivered : vTreatmentSaline.delivered .toFixed(0) onClicked: { vTreatmentAdjustmentSaline.doAdjustment() Index: sources/gui/qml/pages/treatment/sections/TreatmentTime.qml =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/qml/pages/treatment/sections/TreatmentTime.qml (.../TreatmentTime.qml) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ sources/gui/qml/pages/treatment/sections/TreatmentTime.qml (.../TreatmentTime.qml) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -1,16 +1,16 @@ /*! - * + * * 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 TreatmentTime.qml * \author (last) Behrouz NematiPour * \date (last) 27-Apr-2020 * \author (original) Behrouz NematiPour * \date (original) 31-Jan-2020 - * + * */ // Qt @@ -32,6 +32,9 @@ property int progressValue : vTreatmentTime.time_Elapsed property int timeTextValue : vTreatmentTime.time_Remaining + property bool isPaused : vHDTreatmentStates.txPaused + + signal clicked() anchors.centerIn: parent @@ -50,6 +53,7 @@ TimeText { id: _timeText anchors.centerIn : parent seconds : _root.timeTextValue + secondsVisible: ! _root.isPaused } Rectangle { id: _timeTitleRect @@ -68,7 +72,7 @@ anchors.left: parent.left Image { id: _arrowImage - visible: true + visible: ! _root.isPaused anchors.left : parent.right anchors.bottom: parent.baseline anchors.leftMargin: 10 @@ -79,10 +83,30 @@ } } + NotificationBarSmall { id: _notification + visible : _root.isPaused + height : 25 + imageAutoSize: false + imageAnimated: true + color: "transparent" + anchors { + leftMargin : 80 + bottomMargin: 80 + } + + imageSource : "qrc:/images/iPauseGray" + text : qsTr("Treatment Paused") + textColor : "gray" + textfontSize: 16 + rowAnchors.centerIn: null + } + MouseArea { id: _mouseArea anchors.fill: parent onClicked: { - _root.clicked() + if (! _root.isPaused) { + _root.clicked() + } } } } Index: sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml (.../TreatmentUltrafiltration.qml) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml (.../TreatmentUltrafiltration.qml) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -1,16 +1,16 @@ /*! - * + * * 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 TreatmentUltrafiltration.qml * \author (last) Behrouz NemaiPour * \date (last) 09-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 27-Jan-2020 - * + * */ // Qt @@ -42,11 +42,12 @@ title : qsTr("ULTRAFILTRATION VOLUME") + " " + Variables.unitTextUltrafiltrationVolume notification { imageSource: "qrc:/images/iPauseGray" - text : vTreatmentAdjustmentUltrafiltrationState.isPaused ? qsTr("Ultrafiltration Paused") : "" + text : vTreatmentAdjustmentUltrafiltrationState.isPaused || vHDTreatmentStates.ufPaused + ? qsTr("Ultrafiltration Paused") : "" } ProgressBarEx { id: _progressbarex - enabled: ! vTreatmentAdjustmentSaline.isStarted + enabled : _root.isTouchable y : 75 width : parent.width height : Variables.progressbarHeight Index: sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationStateResponse.h =================================================================== diff -u -r3aab84456cfbdc4c4f495975ba9b8968eb844309 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationStateResponse.h (.../MTreatmentAdjustUltrafiltrationStateResponse.h) (revision 3aab84456cfbdc4c4f495975ba9b8968eb844309) +++ sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationStateResponse.h (.../MTreatmentAdjustUltrafiltrationStateResponse.h) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -37,8 +37,10 @@ } _data; public: - + // coco begin validated : manually validated. + // this message has been inherited from MAbstract and should use notify but since the response message is not standard can't use notify yet. Type_Enum typeText () const override { return Type_Enum::eEvent ; } + // coco end Unit_Enum unitText () const override { return Unit_Enum::eHD ; } QString infoText () const override { return QString("AdjustUFState"); } Fisheye: Tag 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c refers to a dead (removed) revision in file `sources/view/VHDOperationModeData.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c refers to a dead (removed) revision in file `sources/view/VHDOperationModeData.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c refers to a dead (removed) revision in file `sources/view/VTreatmentAdjustmentSaline.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c refers to a dead (removed) revision in file `sources/view/VTreatmentAdjustmentSaline.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c refers to a dead (removed) revision in file `sources/view/VTreatmentSalineData.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c refers to a dead (removed) revision in file `sources/view/VTreatmentSalineData.h'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/view/hd/adjustment/VTreatmentAdjustmentSaline.cpp =================================================================== diff -u --- sources/view/hd/adjustment/VTreatmentAdjustmentSaline.cpp (revision 0) +++ sources/view/hd/adjustment/VTreatmentAdjustmentSaline.cpp (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,66 @@ +/*! + * + * 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(TreatmentStatesData ); + 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 ); +} + +/*! + * \brief VTreatmentAdjustmentSaline::onActionReceive + * \details This is the message handler of when the Saline is done + * the state of the Saline in the SalineState of the TreatmentStates message will change at anytime + * and so the state of the UI should change in regards to that field and affect the isStarted + * after the saline start request has been accepted. + * \param vData - data of the Treatment State Message. + */ +void VTreatmentAdjustmentSaline::onActionReceive(const TreatmentStatesData &vData) +{ + isStarted ( vData.mSalineState == GuiSalineStates::SALINE_START_STATE ); +} + +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 +} Index: sources/view/hd/adjustment/VTreatmentAdjustmentSaline.h =================================================================== diff -u --- sources/view/hd/adjustment/VTreatmentAdjustmentSaline.h (revision 0) +++ sources/view/hd/adjustment/VTreatmentAdjustmentSaline.h (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,54 @@ +/*! + * + * 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.h + * \author Behrouz NematiPour (last) + * \date 10-Aug-2020 (last) + * \author Behrouz NematiPour (original) + * \date 10-Aug-2020 (original) + * + */ +#pragma once + +#include + +// Project +#include "vtreatmentadjustmentresponsebase.h" + +namespace View { + +class VTreatmentAdjustmentSaline : public VTreatmentAdjustmentResponseBase +{ + Q_OBJECT + + // friends + friend class ::tst_views; + + AdjustSalineRequestData _data; + + // coco begin validated: + // The property adjustment_Triggered has to be always true + // and to always trigger the change event to work as a notifier for GUI + // has been manually tested that it works perfectly fine + TRIGGER( bool , adjustment , 0 ) + // coco end + + PROPERTY( qint32 , target , 0 ) + PROPERTY( bool , isStarted , false ) + + VIEW_DEC_CLASS_ADJUSTMENT(VTreatmentAdjustmentSaline, AdjustSalineResponseData) + VIEW_DEC_SLOT(TreatmentStatesData) + +// ---------- Start/Stop Saline Bolus +public slots: + void doAdjustment(); + +signals: + void didAdjustment(const AdjustSalineRequestData &vData); +}; + +} Index: sources/view/hd/data/VHDOperationModeData.cpp =================================================================== diff -u --- sources/view/hd/data/VHDOperationModeData.cpp (revision 0) +++ sources/view/hd/data/VHDOperationModeData.cpp (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,44 @@ +/*! + * + * 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 VHDOperationModeData.cpp + * \date 7/12/2020 + * \author Behrouz NematiPour + * + */ +#include "VHDOperationModeData.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VHDOperationMode, HDOperationModeData) + +void VHDOperationMode::onActionReceive(const HDOperationModeData &vData) +{ + opMode ( vData.mOpMode ); +} + +QString VHDOperationMode::opModeText(GuiHDOpModes vEnum) +{ + // TEST : this code is the place holder for the alarms description mapping + // since it is another feature + // it returns the enum name for now + const QMetaObject *mo = qt_getEnumMetaObject(vEnum); + int enumIdx = mo->indexOfEnumerator(qt_getEnumName(vEnum)); + const char *key = mo->enumerator(enumIdx).valueToKey(vEnum); + if (key) + return qPrintable(key); + else + return QString("UNDEFINED [%1]").arg(vEnum); +} + +QString View::VHDOperationMode::text() +{ + QString text = opModeText(static_cast(opMode())); + return text; +} Index: sources/view/hd/data/VHDOperationModeData.h =================================================================== diff -u --- sources/view/hd/data/VHDOperationModeData.h (revision 0) +++ sources/view/hd/data/VHDOperationModeData.h (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,45 @@ +/*! + * + * 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 VHDOperationModeData.h + * \date 7/12/2020 + * \author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MModel.h" +#include "vview.h" +#include "guiglobals.h" + +// namespace +using namespace Gui; +namespace View { + +class VHDOperationMode : public QObject +{ + Q_OBJECT + + PROPERTY( quint32 , opMode , 0) + + VIEW_DEC(VHDOperationMode, HDOperationModeData) + + Q_PROPERTY(QString text READ text NOTIFY opModeChanged) + +private: + QString opModeText(GuiHDOpModes vEnum); + +public slots: + QString text(); + +}; +} Index: sources/view/hd/data/VHDTreatmentStatesData.cpp =================================================================== diff -u --- sources/view/hd/data/VHDTreatmentStatesData.cpp (revision 0) +++ sources/view/hd/data/VHDTreatmentStatesData.cpp (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,26 @@ +/*! + * + * 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 VHDTreatmentStates.cpp + * \date 8/11/2020 + * \author Behrouz NematiPour + * + */ +#include "VHDTreatmentStatesData.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VHDTreatmentStates, TreatmentStatesData) + +void VHDTreatmentStates::onActionReceive(const TreatmentStatesData &vData) +{ + subMode ( vData.mSubMode ); + ufState ( vData.mUFState ); + salineState ( vData.mSalineState ); +} Index: sources/view/hd/data/VHDTreatmentStatesData.h =================================================================== diff -u --- sources/view/hd/data/VHDTreatmentStatesData.h (revision 0) +++ sources/view/hd/data/VHDTreatmentStatesData.h (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,43 @@ +/*! + * + * 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 VHDTreatmentStates.h + * \date 8/11/2020 + * \author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MModel.h" +#include "vview.h" +#include "guiglobals.h" + +// namespace +using namespace Gui; +namespace View { + +class VHDTreatmentStates : public QObject +{ + Q_OBJECT + + PROPERTY( quint32, subMode , 0) + PROPERTY( quint32, ufState , 0) + // coco begin validated: Validated manually, but has not been used yet. + // instead VTreatmentAdjustmentSaline::isStarted is used which has more control over the saline state. + PROPERTY( quint32, salineState , 0) + // coco end + VIEW_DEC(VHDTreatmentStates, TreatmentStatesData) + +private: +public slots: +}; +} Index: sources/view/hd/data/VTreatmentSalineData.cpp =================================================================== diff -u --- sources/view/hd/data/VTreatmentSalineData.cpp (revision 0) +++ sources/view/hd/data/VTreatmentSalineData.cpp (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,27 @@ +/*! + * + * 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 vTreatmentSalineData.cpp + * \author Behrouz NematiPour (last) + * \date 10-Aug-2020 (last) + * \author Behrouz NematiPour (original) + * \date 10-Aug-2020 (original) + * + */ +#include "VTreatmentSalineData.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VTreatmentSaline, TreatmentSalineData) + +void VTreatmentSaline::onActionReceive(const TreatmentSalineData &vData) +{ + target (vData.mTarget ); + cumulative (vData.mCumulative); + delivered (vData.mDelivered ); +} Index: sources/view/hd/data/VTreatmentSalineData.h =================================================================== diff -u --- sources/view/hd/data/VTreatmentSalineData.h (revision 0) +++ sources/view/hd/data/VTreatmentSalineData.h (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -0,0 +1,38 @@ +/*! + * + * 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 vTreatmentSalineData.h + * \author Behrouz NematiPour (last) + * \date 10-Aug-2020 (last) + * \author Behrouz NematiPour (original) + * \date 10-Aug-2020 (original) + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MModel.h" +#include "vview.h" + +// namespace +namespace View { + +class VTreatmentSaline : public QObject +{ + Q_OBJECT + + PROPERTY( quint32 , target , 0) + PROPERTY( float , cumulative , 0) + PROPERTY( float , delivered , 0) + + VIEW_DEC(VTreatmentSaline, TreatmentSalineData) + +}; +} Index: sources/view/vview.h =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- sources/view/vview.h (.../vview.h) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ sources/view/vview.h (.../vview.h) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -1,16 +1,16 @@ /*! - * + * * 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 vview.h * \author (last) Behrouz NemaiPour * \date (last) 12-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 10-Mar-2020 - * + * */ #pragma once @@ -104,6 +104,7 @@ REGISTER_TYPE( VTreatmentRanges ) \ REGISTER_TYPE( VTreatmentSaline ) \ REGISTER_TYPE( VHDOperationMode ) \ + REGISTER_TYPE( VHDTreatmentStates ) \ \ REGISTER_TYPE( VDGDrainPump ) \ REGISTER_TYPE( VDGHeaters ) \ Index: unittests/tst_messaging.cpp =================================================================== diff -u -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -781,13 +781,27 @@ } /*! - * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationConfirmReq - * \details Tests MessageInterpreter interpretMessage to handle AdjustUltrafiltrationConfirmReq message type + * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustSalineReq + * \details Tests MessageInterpreter interpretMessage to handle ID_AdjustSalineReq message type * if data is empty (count==0) */ -void tst_messaging::tst_MessageInterpreter_interpretMessage_canbusFaultCountData() +void tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustSalineReq() { Can::MessageInterpreter iMsg; + QByteArray payload; + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustSalineReq, {}, payload)); + QVERIFY(payload.isEmpty()); +} + +/*! + * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_CANBusFaultCount + * \details Tests MessageInterpreter interpretMessage to handle ID_CANBusFaultCount message type + * if data is empty (count==0) + */ +void tst_messaging::tst_MessageInterpreter_interpretMessage_CANBusFaultCount() +{ + Can::MessageInterpreter iMsg; Can::Message msg; msg.actionId = Gui::GuiActionType::ID_CANBusFaultCount; msg.data = {}; Index: unittests/tst_messaging.h =================================================================== diff -u -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- unittests/tst_messaging.h (.../tst_messaging.h) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) +++ unittests/tst_messaging.h (.../tst_messaging.h) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -92,8 +92,9 @@ void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationStateReq(); void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationEditReq(); void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationConfirmReq(); + void tst_MessageInterpreter_interpretMessage_AdjustSalineReq(); - void tst_MessageInterpreter_interpretMessage_canbusFaultCountData(); + void tst_MessageInterpreter_interpretMessage_CANBusFaultCount(); void tst_MessageInterpreter_interpretMessage_String(); void tst_MessageInterpreter_interpretMessage_DG_Unhandled(); Index: unittests/tst_models.cpp =================================================================== diff -u -rd28dcbacdb1818e5777d83feb1e513a339da6995 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- unittests/tst_models.cpp (.../tst_models.cpp) (revision d28dcbacdb1818e5777d83feb1e513a339da6995) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -38,10 +38,12 @@ #include "MTreatmentFlowsData.h" #include "MTreatmentTimeData.h" #include "MTreatmentPressureOcclusionData.h" +#include "MTreatmentSalineData.h" #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" +#include "MTreatmentAdjustSalineResponse.h" #include "MAlarmStatusData.h" #include "MAlarmTriggered.h" @@ -688,7 +690,7 @@ void tst_models::tst_DGLoadCellReadingsData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -912,7 +914,7 @@ void tst_models::tst_MOutletFlowData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -978,7 +980,7 @@ void tst_models::tst_MBloodFlowData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -1044,7 +1046,7 @@ void tst_models::tst_MDialysateFlowData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -1156,7 +1158,7 @@ void tst_models::tst_MPressureOcclusionData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -1376,3 +1378,95 @@ break; } } + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentSalineBolusData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentSalineBolusData() { + Model::MTreatmentSaline mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCumulative; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mDelivered ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MSalineBolusResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MSalineBolusResponse() { + Model::MAdjustSalineResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} Index: unittests/tst_models.h =================================================================== diff -u -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c --- unittests/tst_models.h (.../tst_models.h) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) +++ unittests/tst_models.h (.../tst_models.h) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) @@ -101,5 +101,11 @@ void tst_MAlarmCleared_data(); void tst_MAlarmCleared(); + + void tst_MTreatmentSalineBolusData_data(); + void tst_MTreatmentSalineBolusData(); + + void tst_MSalineBolusResponse_data(); + void tst_MSalineBolusResponse(); };