Index: denali.pro.user =================================================================== diff -u -r767367e5779764bec1c1857f32eaf3d86089d5d9 -re58be51c4aa52938af250db3ee579e98de08542c --- denali.pro.user (.../denali.pro.user) (revision 767367e5779764bec1c1857f32eaf3d86089d5d9) +++ denali.pro.user (.../denali.pro.user) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -89,7 +89,7 @@ Desktop Qt 5.12.5 GCC 64bit Desktop Qt 5.12.5 GCC 64bit qt.qt5.5125.gcc_64_kit - 0 + 1 0 0 @@ -104,7 +104,7 @@ false false - true + false true @@ -156,11 +156,11 @@ qmake QtProjectManager.QMakeBuildStep - true + false false false - true + false true @@ -205,15 +205,15 @@ true - /home/denali/Projects/tmp/build/unittest/tst_messaging + /home/denali/Projects/tmp/build/unittest/tst_threads true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_messaging CONFIG+=CodeCoverage + CONFIG+=tst_threads CONFIG+=CodeCoverage false false false @@ -292,25 +292,25 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_messaging - tst_messaging + tst_threads + tst_threads Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/workspace_UI/squish/build + /home/denali/Projects/tmp/build/unittest/tst_messaging true qmake QtProjectManager.QMakeBuildStep - true - CONFIG+=Profile CONFIG+=CodeCoverage TARGET=denaliSquish + false + CONFIG+=tst_messaging CONFIG+=CodeCoverage false false - true + false true @@ -324,7 +324,7 @@ false - false + true %{buildDir}/denali %{buildDir} @@ -333,7 +333,7 @@ ProjectExplorer.ProcessStep - false + true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} @@ -342,7 +342,7 @@ ProjectExplorer.ProcessStep - false + true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} @@ -351,7 +351,7 @@ ProjectExplorer.ProcessStep - false + true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} @@ -386,23 +386,23 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_acknow - Profile + tst_messaging + tst_messaging Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/Projects/tmp/build/unittest/tst_canbus + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Profile true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_canbus CONFIG+=CodeCoverage - false + + true false false @@ -413,47 +413,11 @@ Qt4ProjectManager.MakeStep false - LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 + false - - true - - %{buildDir}/denali - %{buildDir} - Custom Process Step - - ProjectExplorer.ProcessStep - - - true - -m denali.csmes -t UnitTests denali.csexe - cmcsexeimport - %{buildDir} - Custom Process Step - - ProjectExplorer.ProcessStep - - - true - --csmes=denali.csmes --html=Coverage/index - cmreport - %{buildDir} - Custom Process Step - - ProjectExplorer.ProcessStep - - - true - --csmes=denali.csmes --csv-excel=Coverage/coverage.csv - cmreport - %{buildDir} - Custom Process Step - - ProjectExplorer.ProcessStep - - 6 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -477,25 +441,23 @@ 2 false - - PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - - tst_canbus - tst_canbus + + Profile + Profile Qt4ProjectManager.Qt4BuildConfiguration - 2 + 0 true - /home/denali/Projects/tmp/build/unittest/tst_logging + /home/denali/Projects/tmp/build/unittest/tst_canbus true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_logging CONFIG+=CodeCoverage + CONFIG+=tst_canbus CONFIG+=CodeCoverage false false false @@ -574,22 +536,22 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_logging - tst_logging + tst_canbus + tst_canbus Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/Projects/tmp/build/unittest/tst_utilities + /home/denali/Projects/tmp/build/unittest/tst_logging true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_utilities CONFIG+=CodeCoverage + CONFIG+=tst_logging CONFIG+=CodeCoverage false false false @@ -668,22 +630,22 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_utilities - tst_utilities + tst_logging + tst_logging Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/Projects/tmp/build/unittest/tst_acknow + /home/denali/Projects/tmp/build/unittest/tst_utilities true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_acknow CONFIG+=CodeCoverage + CONFIG+=tst_utilities CONFIG+=CodeCoverage false false false @@ -762,22 +724,22 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_acknow - tst_acknow + tst_utilities + tst_utilities Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/Projects/tmp/build/unittest/tst_models + /home/denali/Projects/tmp/build/unittest/tst_acknow true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_models CONFIG+=CodeCoverage + CONFIG+=tst_acknow CONFIG+=CodeCoverage false false false @@ -856,22 +818,22 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_models - tst_models + tst_acknow + tst_acknow Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/Projects/tmp/build/unittest/tst_initializations + /home/denali/Projects/tmp/build/unittest/tst_models true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_initializations CONFIG+=CodeCoverage + CONFIG+=tst_models CONFIG+=CodeCoverage false false false @@ -950,22 +912,22 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_initializations - tst_initializations + tst_models + tst_models Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/Projects/tmp/build/unittest/tst_views + /home/denali/Projects/tmp/build/unittest/tst_initializations true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_views CONFIG+=CodeCoverage + CONFIG+=tst_initializations CONFIG+=CodeCoverage false false false @@ -1044,22 +1006,22 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_views - tst_views + tst_initializations + tst_initializations Qt4ProjectManager.Qt4BuildConfiguration 2 true - /home/denali/Projects/tmp/build/unittest/tst_threads + /home/denali/Projects/tmp/build/unittest/tst_views true qmake QtProjectManager.QMakeBuildStep false - CONFIG+=tst_threads CONFIG+=CodeCoverage + CONFIG+=tst_views CONFIG+=CodeCoverage false false false @@ -1138,8 +1100,8 @@ PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - tst_threads - tst_threads + tst_views + tst_views Qt4ProjectManager.Qt4BuildConfiguration 2 true @@ -1214,16 +1176,16 @@ denali Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Projects/application/denali.pro - -q + 3768 false true true false - true - false + false + true - /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release 1 @@ -1249,7 +1211,7 @@ false false - true + false true @@ -1301,11 +1263,11 @@ qmake QtProjectManager.QMakeBuildStep - true + false false false - true + false true @@ -1523,8 +1485,8 @@ false true false - true - false + false + true false Index: denali.qrc =================================================================== diff -u -raabacb1dbdd30968ec8bc8ffc6c97263b09db71b -re58be51c4aa52938af250db3ee579e98de08542c --- denali.qrc (.../denali.qrc) (revision aabacb1dbdd30968ec8bc8ffc6c97263b09db71b) +++ denali.qrc (.../denali.qrc) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -32,6 +32,8 @@ resources/images/Wave-Minus.png resources/images/Wave-Plus.png resources/images/microsd.png + resources/images/check.png + resources/images/checkCircle.png resources/images/OffGray.png resources/images/Done.png @@ -63,8 +65,10 @@ sources/gui/qml/components/ProgressCircle.qml sources/gui/qml/components/Slider.qml sources/gui/qml/components/SliderCreateTreatment.qml + sources/gui/qml/components/ConfirmTreatmentTable.qml + sources/gui/qml/components/ConfirmTreatmentSubTable.qml sources/gui/qml/components/SliderDoubleCreateTreatment.qml - sources/gui/qml/components/RectSelectCreateTreatment.qml + sources/gui/qml/components/GridSelection.qml sources/gui/qml/components/TopMenuBarCreateTreatment.qml sources/gui/qml/components/ProgressBarEx.qml sources/gui/qml/components/CloseButton.qml @@ -76,7 +80,10 @@ sources/gui/qml/components/ImageWave.qml sources/gui/qml/components/ImageClock.qml sources/gui/qml/components/ImageLogoDDarkTransparent.qml + sources/gui/qml/components/PrimingTimer.qml + sources/gui/qml/components/ConfirmTreatmentTableEntry.qml sources/gui/qml/components/DebugDataColumn.qml + sources/gui/qml/components/CheckListItem.qml qtquickcontrols2.conf Index: sources/ApplicationController.h =================================================================== diff -u -ra515cc0871ec0dd8f55a812ce80273726c5a9c24 -re58be51c4aa52938af250db3ee579e98de08542c --- sources/ApplicationController.h (.../ApplicationController.h) (revision a515cc0871ec0dd8f55a812ce80273726c5a9c24) +++ sources/ApplicationController.h (.../ApplicationController.h) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -75,8 +75,6 @@ void createFakeSequencedLongMessage (QVariantList &vData, const int vFakeDataLen); void createFakeSeqAtBeginLongMessage(QVariantList &vData, const int vFakeDataLen); - void saveNewTreatment(QJsonObject obj); - private slots: // Should be private for thread safety and is connected internally. void onActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG void onActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG Index: sources/canbus/MessageGlobals.h =================================================================== diff -u -r2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95 -re58be51c4aa52938af250db3ee579e98de08542c --- sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision 2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95) +++ sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -1,5 +1,5 @@ /*! - * + * * 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 @@ -74,10 +74,17 @@ {Gui::GuiActionType::ID_AlarmStatus , 4 * 4 + 2 }, // 4 parameters each 4bytes + 1 parameter 2bytes {Gui::GuiActionType::ID_AlarmTriggered , 1 * 4 }, // 1 parameter each 4bytes {Gui::GuiActionType::ID_AlarmCleared , 1 * 4 }, // 1 parameter each 4bytes - {Gui::GuiActionType::ID_AlarmSilenceReq , 5 * 4 }, // 5 parameters each 4bytes - {Gui::GuiActionType::ID_AlarmSilenceRsp , 5 * 4 }, // 5 parameters each 4bytes + {Gui::GuiActionType::ID_AlarmSilenceReq , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_AlarmUserAckReq , 1 * 4 }, // 1 parameter each 4bytes // ---- + {Gui::GuiActionType::ID_StartTreatmentReq , 1 * 4 }, // 1 parameters each 4bytes + {Gui::GuiActionType::ID_StartTreatmentRsp , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_ConfirmTreatmentReq , 1 * 4 }, // 1 parameters each 4bytes + {Gui::GuiActionType::ID_EndTreatmentReq , 0 }, + {Gui::GuiActionType::ID_EndTreatmentRsp , 0 }, + + // ---- {Gui::GuiActionType::ID_TreatmentRanges , 6 * 4 }, // 6 parameters each 4bytes {Gui::GuiActionType::ID_TreatmentStates , 3 * 4 }, // 3 parameters each 4bytes @@ -106,6 +113,8 @@ {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp , 5 * 4 }, // ---- + {Gui::GuiActionType::ID_PrimingData , 3 * 4 }, // 3 parameters each 4bytes + // ---- {Gui::GuiActionType::ID_AdjustSalineReq , 1 * 4 }, // 1 parameter each 4bytes {Gui::GuiActionType::ID_AdjustSalineRsp , 3 * 4 }, // 3 parameters each 4bytes Index: sources/canbus/MessageInterpreter.cpp =================================================================== diff -u -r0583a63307936f09e184dfe16acca25f9e3fd81c -re58be51c4aa52938af250db3ee579e98de08542c --- sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 0583a63307936f09e184dfe16acca25f9e3fd81c) +++ sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -372,14 +372,12 @@ case Gui::GuiActionType::ID_CreateTreatmentRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_CreateTreatmentRsp ); break; // Adjustment Response Messages - 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; + 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; + case Gui::GuiActionType::ID_AdjustUltrafiltrationStateRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustUltrafiltrationStateRsp ); 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. (Needs FW modification) - case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq : ok = adjustUltrafiltrationState (vMessage, vData); break; // TODO : implement notify<>() + // these need to be standard and use notify as well 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<>() @@ -488,7 +486,7 @@ Model::MAlarmStatus mData; ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); + LOG_EVENT("HD," + mData.toString()); // TODO: Not Standard mData.toVariantList(vData); emit didActionReceive(mData.data()); @@ -513,7 +511,7 @@ Model::MAlarmTriggered mData; ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); + LOG_EVENT("HD," + mData.toString()); // TODO: Not Standard mData.toVariantList(vData); emit didActionReceive(mData.data()); @@ -547,34 +545,7 @@ } // ---------- ---------- ---------- ---------- ---------- Adjustments ---------- ---------- ---------- ---------- ---------- // - /*! - * \brief MessageInterpreter::ultrafiltrationState - * \details This method interprets Treatment Ultrafiltration State Adjustment Response message data - * in vMessage of type Message. - * \param vMessage - The vMessage of type Message which contains all the data, - * require to be interpreted. - * \param vData - Treatment Ultrafiltration State Adjustment Response data - * \return true if the data can be extracted as defined for Treatment Ultrafiltration State Adjustment Response Message ID - */ -bool MessageInterpreter::adjustUltrafiltrationState(const Message &vMessage, QVariantList &vData) -{ - bool ok = false; - // TODO : In HD the Ultrafiltration State change shall have the rejection reason like other responses. - if ( ! isType (vMessage, Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq) ) return ok; - if ( ! isPayloadLenValid(vMessage, Gui::GuiActionType::ID_AcknowGeneric ) ) return ok; // This is an exception It has to be changed. - - Model::MAdjustUltrafiltrationStateResponse mData; - ok = mData.fromByteArray(vMessage.data); - LOG_EVENT(mData.toString()); - - mData.toVariantList(vData); - emit didActionReceive(mData.data()); - - return ok; -} - -/*! * \brief MessageInterpreter::adjustUltrafiltrationEditData * \details This method interprets Treatment Ultrafiltration Volume Adjustment Response message data * in vMessage of type Message. @@ -590,7 +561,7 @@ Model::MAdjustUltrafiltrationEditResponse mData; ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); + LOG_EVENT("HD," + mData.toString()); // TODO: Not Standard mData.toVariantList(vData); emit didActionReceive(mData.data()); @@ -614,7 +585,7 @@ Model::MAdjustUltrafiltrationConfirmResponse mData; ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); + LOG_EVENT("HD," + mData.toString()); // TODO: Not Standard mData.toVariantList(vData); emit didActionReceive(mData.data()); Index: sources/canbus/MessageInterpreter.h =================================================================== diff -u -ra6abc05918a15924460d2b9358365b3eeedf1d1c -re58be51c4aa52938af250db3ee579e98de08542c --- sources/canbus/MessageInterpreter.h (.../MessageInterpreter.h) (revision a6abc05918a15924460d2b9358365b3eeedf1d1c) +++ sources/canbus/MessageInterpreter.h (.../MessageInterpreter.h) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -24,6 +24,7 @@ // forward declaration class tst_messaging; class tst_logging; +class tst_canbus; namespace Can { @@ -47,6 +48,7 @@ // friend friend class ::tst_messaging; friend class ::tst_logging; + friend class ::tst_models; bool isType (const Message &vMessage, Gui::GuiActionType vType) const; bool isPayloadLenValid (const Message &vMessage, Gui::GuiActionType vType) const; @@ -78,10 +80,6 @@ template bool notify (const Message &vMessage, QVariantList &vData, Gui::GuiActionType vIdCheck) __attribute_warn_unused_result__; - - // ---- Create Treatment Response Data - bool createTreatmentRespData (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; - public: explicit MessageInterpreter(QObject *parent = nullptr); Index: sources/gui/GuiGlobals.h =================================================================== diff -u -r2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95 -re58be51c4aa52938af250db3ee579e98de08542c --- sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision 2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95) +++ sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -1,5 +1,5 @@ /*! - * + * * 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 @@ -89,12 +89,19 @@ ID_AlarmStatus = 0x0200, ID_AlarmTriggered = 0x0300, ID_AlarmCleared = 0x0400, - ID_CreateTreatmentReq = 0x3500, // 53 - Not implemented yet on FW side - ID_CreateTreatmentRsp = 0x3600, // 54 - Not implemented yet on FW side + ID_AlarmUserAckReq = 0x3F00, // 63 + ID_AlarmSilenceReq = 0x3200, // 50 - ID_AlarmSilenceReq = 0x3200, // 50 - Not implemented yet on FW side - ID_AlarmSilenceRsp = 0x0000, // Needs to be removed. + ID_CreateTreatmentReq = 0x3500, // 53 + ID_CreateTreatmentRsp = 0x3600, // 54 + ID_StartTreatmentReq = 0x3800, // 56 + ID_StartTreatmentRsp = 0x3900, // 57 + ID_ConfirmTreatmentReq = 0x3A00, // 58 + ID_EndTreatmentReq = 0x3C00, // 60 + ID_EndTreatmentRsp = 0x3D00, // 61 + ID_PrimingData = 0x4300, // 67 + ID_HDOperationModeData = 0x2500, // 37 ID_DGROPumpData = 0x1F00, // 31 Index: sources/gui/qml/components/NotificationBar.qml =================================================================== diff -u -rb61d8a3e01fef66eee8095c9cddf835d9bb32b66 -re58be51c4aa52938af250db3ee579e98de08542c --- sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision b61d8a3e01fef66eee8095c9cddf835d9bb32b66) +++ sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -23,12 +23,13 @@ Rectangle { id: _root objectName: "NotificationBar" // SquishQt - property alias text : _text.text - property alias textColor : _text.color - property int level : 0 - property bool isSilenced : false - property int muteTimeoutSec : 0 - property color backgroundColor : Colors.textNotificationNoneBg + property alias text : _text.text + property alias textColor : _text.color + property int level : 0 + property bool isSilenced : false + property int muteTimeoutSec : 0 + property color backgroundColor : Colors.textNotificationNoneBg + property alias iconVisible : _icon.visible visible : _text.text height : Variables.notificationHeight Index: sources/gui/qml/main.qml =================================================================== diff -u -r2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95 -re58be51c4aa52938af250db3ee579e98de08542c --- sources/gui/qml/main.qml (.../main.qml) (revision 2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95) +++ sources/gui/qml/main.qml (.../main.qml) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -35,7 +35,7 @@ import VTreatmentAdjustmentDuration 0.1; import VTreatmentAdjustmentFlows 0.1; -import VCreateTreatment 0.1; +import VTreatmentCreate 0.1; import VDGDrainPump 0.1; import VDGHeaters 0.1; import VDGLoadCellReadings 0.1; @@ -45,6 +45,9 @@ import VDGReservoir 0.1; import VDGTemperatures 0.1; import VDGValvesStates 0.1; +import VPriming 0.1; +import VTreatmentBegin 0.1; +import VTreatmentEnd 0.1; // Qml imports import "qrc:/globals" @@ -78,28 +81,7 @@ // TODO : When Testing data on Setting screen is removed // This needs to be moved into the Treatment______.qml - VAlarmStatus { id: vAlarmStatus - onRaiseAlarm: { - updateAlarm(); - _alarm_dialog.isSilenced = vAlarmStatus.alarm_Flag_alarmsSilenced - _alarm_bar.toggleSilence(vAlarmStatus.alarm_Flag_alarmsSilenced, - vAlarmStatus.alarm_MuteTimeout); - if (isAlarmHighPriority()) { - _alarm_dialog.visible = true; - _alarm_bar.visible = false; - } else { - if (!_alarm_dialog.visible) { - _alarm_bar.visible = true; - } - } - } - - onHideAlarm: { - _alarm_bar.visible = false; - _alarm_dialog.visible = false; - } - } - + VAlarmStatus { id: vAlarmStatus } VPowerOff { id: vPowerOff } VHDOperationMode { id: vHDOperationMode } VTreatmentBloodFlow { id: vTreatmentBloodFlow } @@ -120,7 +102,10 @@ VTreatmentAdjustmentDuration { id: vTreatmentAdjustmentDuration } VTreatmentAdjustmentFlows { id: vTreatmentAdjustmentFlows } - VCreateTreatment { id: vCreateTreatment } + VTreatmentCreate { id: vTreatmentCreate } + VPriming { id: vPriming } + VTreatmentBegin { id: vTreatmentBegin } + VTreatmentEnd { id: vTreatmentEnd } // ----- Follow the below Z order ----- // 1 - Screens @@ -165,43 +150,38 @@ onClickedNotificationBar: { updateAlarm(); - _alarm_bar.setFlashing(false); + vAlarmStatus.onSetMinimize(false); _alarm_bar.visible = false; _alarm_dialog.visible = true; } } - function isAlarmHighPriority() { - return vAlarmStatus.alarm_Priority === GuiActions.ALARM_PRIORITY_HIGH; - } - function updateAlarm() { _alarm_dialog.titleText = "Alarm"; _alarm_dialog.description = vAlarmStatus.text; _alarm_dialog.alarmID = vAlarmStatus.alarm_AlarmID; [_alarm_dialog.backgroundColor, _alarm_dialog.textColor] = getRootTextFromAlarmLevel(vAlarmStatus.alarm_Priority); [_alarm_dialog.titleBarBackground, _alarm_dialog.titleBarForeground] = getAlarmTopBarColors(vAlarmStatus.alarm_Priority); _alarm_bar.backgroundColor = _alarm_dialog.titleBarBackground; + + _alarm_dialog.isSilenced = vAlarmStatus.alarm_Flag_alarmsSilenced; + _alarm_bar.toggleSilence(vAlarmStatus.alarm_Flag_alarmsSilenced, vAlarmStatus.alarm_MuteTimeout); + _alarm_dialog.silenceBtn.visible = !vAlarmStatus.alarm_Flag_alarmsSilenced; } NotificationDialog { id: _alarm_dialog alarmID: -1 - onClosed: { - _alarm_bar.visible = true; - } + onClickedOkay: { _alarm_dialog.visible = false; - vAlarmStatus.requestOkay(alarmID) - if (isAlarmHighPriority()) { - _alarm_bar.setFlashing(true); - return; - } - _alarm_bar.setFlashing(false); + _alarm_bar.visible = true; + vAlarmStatus.onRequestOkay(alarmID) } onClickedSilence: { _alarm_dialog.visible = false; - vAlarmStatus.requestSilence(); + _alarm_bar.visible = true; + vAlarmStatus.onRequestSilence(); } } @@ -305,4 +285,23 @@ } } } + + Connections { target: vAlarmStatus + onRaiseAlarm: { + updateAlarm(); + + if (vAlarmStatus.minimizeAlarm) { + _alarm_dialog.visible = false; + _alarm_bar.visible = true; + } else { + _alarm_dialog.visible = true; + _alarm_bar.visible = false; + } + } + + onNoAlarm: { + _alarm_bar.visible = false; + _alarm_dialog.visible = false; + } + } } Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -r321e667cd58da515845f2173d5e1a59082823455 -re58be51c4aa52938af250db3ee579e98de08542c --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 321e667cd58da515845f2173d5e1a59082823455) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -17,15 +17,19 @@ import QtQuick 2.12 // Project -import Gui.Actions 0.1 -import VTreatmentRanges 0.1 -import VTreatmentAdjustmentSaline 0.1 -import VHDTreatmentStates 0.1 +import Gui.Actions 0.1 +import VTreatmentRanges 0.1 +import VTreatmentAdjustmentSaline 0.1 +import VHDTreatmentStates 0.1 +import VTreatmentAdjustmentUltrafiltrationState 0.1 +import VTreatmentAdjustmentUltrafiltrationEdit 0.1 +import VTreatmentAdjustmentUltrafiltrationConfirm 0.1 // Qml imports import "qrc:/globals" import "qrc:/components" import "qrc:/pages/treatment/adjustments" + /*! * \brief TreatmentStack is the screen * which contains the main stack for all the Trearment screens @@ -38,16 +42,31 @@ stackView.initialItem : _treatmentHome // Views - VTreatmentRanges { id: vTreatmentRanges } - VTreatmentAdjustmentSaline { id: vTreatmentAdjustmentSaline } - VHDTreatmentStates { id: vHDTreatmentStates - property bool ufPaused : ufState === GuiActions.UF_PAUSED_STATE - property bool txPaused : subMode !== GuiActions.TREATMENT_DIALYSIS_STATE - } + VTreatmentRanges { id: vTreatmentRanges } + VTreatmentAdjustmentSaline { id: vTreatmentAdjustmentSaline } + VHDTreatmentStates { id: vHDTreatmentStates } + VTreatmentAdjustmentUltrafiltrationState { id: vTreatmentAdjustmentUltrafiltrationState } + VTreatmentAdjustmentUltrafiltrationEdit { id: vTreatmentAdjustmentUltrafiltrationEdit } + VTreatmentAdjustmentUltrafiltrationConfirm { id: vTreatmentAdjustmentUltrafiltrationConfirm } + // ultrafiltration state information bar properties + readonly property bool isUFPaused : vHDTreatmentStates.ufPaused + readonly property bool isUFOff : vHDTreatmentStates.ufOff + readonly property bool isUFRunning : vHDTreatmentStates.ufRunning + readonly property bool isUFCompleted : vHDTreatmentStates.ufCompleted + readonly property string ufInfoImageSource : isUFPaused ? "qrc:/images/iPauseGray" : + isUFOff ? "qrc:/images/iOffGray" : + isUFCompleted ? "qrc:/images/iDone" : "" + readonly property string ufInfoText : isUFPaused ? qsTr("Ultrafiltration is paused" ) : + isUFOff ? qsTr("Ultrafiltration is off" ) : + isUFCompleted ? qsTr("Ultrafiltration is completed" ) : "" + readonly property string ufInfoTextColor : isUFPaused ? "gray" : + isUFOff ? "gray" : + isUFCompleted ? "lightgray" : "" + // Components MainMenu { id: _treatmentMenu - y : -Variables.mainMenuHeight + y : Variables.mainMenuHeight * -1 position : MainMenu.Position.Top hidden : true titles : [ qsTr("Back") , qsTr("Treatment") , qsTr("Trending") , qsTr("Settings") ] @@ -73,13 +92,10 @@ _treatmentAdjustmentDuration.open() } onSectionUltrafiltrationClicked: { - if ( - vTreatmentAdjustmentUltrafiltrationState.isPaused || // comes from the treatment adjustment - vHDTreatmentStates.ufPaused // comes from the broadcast Treatment States salineState field - ) { - _treatmentAdjustmentUltrafiltrationPaused.open() - } else { + if ( isUFRunning ) { _treatmentAdjustmentUltrafiltrationStart .open() + } else { + _treatmentAdjustmentUltrafiltrationPaused.open() } } } @@ -182,17 +198,18 @@ Connections { target: vTreatmentAdjustmentUltrafiltrationState onAdjustmentTriggered : { if ( vTreatmentAdjustmentUltrafiltrationState.adjustment_Accepted ) { - if ( vTreatmentAdjustmentUltrafiltrationState.isPaused ) { + if (vHDTreatmentStates.ufPaused) { // handle screen regarding current accepted _treatmentAdjustmentUltrafiltrationStart .close() _treatmentAdjustmentUltrafiltrationPaused.open () } else { _treatmentAdjustmentUltrafiltrationPaused.close() } - } else { - if ( vTreatmentAdjustmentUltrafiltrationState.isPaused ) { - _treatmentAdjustmentUltrafiltrationPaused.notification.text = vTreatmentAdjustmentUltrafiltrationState.text() + } + else { + if (vHDTreatmentStates.ufRunning) { // handle error messages regarding current accepted + _treatmentAdjustmentUltrafiltrationStart.notificationText = vTreatmentAdjustmentUltrafiltrationState.adjustment_ReasonText } else { - _treatmentAdjustmentUltrafiltrationStart .notification.text = vTreatmentAdjustmentUltrafiltrationState.text() + _treatmentAdjustmentUltrafiltrationPaused.notificationText = vTreatmentAdjustmentUltrafiltrationState.adjustment_ReasonText } } } @@ -220,9 +237,7 @@ Connections { target: vTreatmentAdjustmentUltrafiltrationConfirm onAdjustmentTriggered : { if (vTreatmentAdjustmentUltrafiltrationConfirm.adjustment_Accepted) { - // HD resumes the ultrafiltration and no need to recall the doPause just update the state - vTreatmentAdjustmentUltrafiltrationState.isPaused = false - vTreatmentUltrafiltration.maximum = vTreatmentAdjustmentUltrafiltrationConfirm.volume + vTreatmentUltrafiltration.maximum = vTreatmentAdjustmentUltrafiltrationConfirm.volume _treatmentAdjustmentUltrafiltrationConfirm.close() } else { _treatmentAdjustmentUltrafiltrationConfirm.notification.text = vTreatmentAdjustmentUltrafiltrationConfirm.text() Index: sources/model/hd/adjustment/MTreatmentAdjustRequests.h =================================================================== diff -u -r2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95 -re58be51c4aa52938af250db3ee579e98de08542c --- sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision 2c9421bd6da03c7e0bd0bfa1f49fa95c2bd18a95) +++ sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -284,7 +284,7 @@ */ class MAlarmSilenceReq : public MModel { public: - bool state = 0; + quint8 state; // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { @@ -296,14 +296,214 @@ } }; -} +/*! + * \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); + } +}; -typedef Model:: MAdjustPowerOffReq AdjustPowerOffRequestData; -typedef Model:: MAdjustBloodDialysateReq AdjustBloodDialysateRequestData; -typedef Model:: MAdjustDurationReq AdjustDurationRequestData; -typedef Model:: MAdjustUltrafiltrationStateReq AdjustUltrafiltrationStateRequestData; -typedef Model:: MAdjustUltrafiltrationEditReq AdjustUltrafiltrationEditRequestData; -typedef Model::MAdjustUltrafiltrationConfirmReq AdjustUltrafiltrationConfirmRequestData; -typedef Model:: MAdjustSalineReq AdjustSalineRequestData; +/*! + * \brief The MStartTreatmentReq 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 MStartTreatmentReq : 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); + } +}; -typedef Model:: MAlarmSilenceReq AlarmSilenceRequestData; +/*! + * \brief The MConfirmTreatmentReq class + * \details The model to tell HD treatment parameters have been confirmed + * + * | MSG | CAN ID | M.Box | Type | Ack | Src | Dest | Description | + * |:---:|:------:|:-----:|:----:|:---:|:---:|:----:|:-------------------------:| + * | 56 | 0x100 | 9 | Req | Y | UI | HD | Confirm Treatment Request | + * + * | Payload || + * | || + * | #1:(U32) | \ref request | + * + */ +class MConfirmTreatmentReq : 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 MEndTreatmentReq 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 MEndTreatmentReq : 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:: MStartTreatmentReq StartTreatmentRequestData; +typedef Model:: MConfirmTreatmentReq ConfirmTreatmentRequestData; +typedef Model:: MEndTreatmentReq EndTreatmentRequestData; +typedef Model:: MAdjustSalineReq AdjustSalineRequestData; +typedef Model:: MAlarmSilenceReq AlarmSilenceRequestData; +typedef Model:: MAdjustTreatmentParametersReq AdjustTreatmentParametersRequestData; +typedef Model:: MAlarmAcknowledgeReq AlarmAcknowledgeRequestData; Index: unittests/tst_messaging.cpp =================================================================== diff -u -rd9f8e4e8356bd081f84dc08c4d65d727c0ee707f -re58be51c4aa52938af250db3ee579e98de08542c --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision d9f8e4e8356bd081f84dc08c4d65d727c0ee707f) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -436,34 +436,6 @@ } /*! - * \brief tst_messaging::tst_MessageInterpreter_adjustUltrafiltrationStateData_isType - * \details Tests MessageInterpreter adjustUltrafiltrationStateData method Message Type check - */ -void tst_messaging::tst_MessageInterpreter_adjustUltrafiltrationStateData_isType() -{ - Can::MessageInterpreter iMsg; - Can::Message msg; - msg.actionId = Gui::GuiActionType::ID_Unknown; - msg.data = {}; - QVariantList list; - QVERIFY( ! iMsg.adjustUltrafiltrationState(msg, list)); -} - -/*! - * \brief tst_messaging::tst_MessageInterpreter_adjustUltrafiltrationStateData_payloadLen - * \details Tests MessageInterpreter adjustUltrafiltrationStateData method Message payload length check - */ -void tst_messaging::tst_MessageInterpreter_adjustUltrafiltrationStateData_payloadLen() -{ - Can::MessageInterpreter iMsg; - Can::Message msg; - msg.actionId = Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq; - msg.data = {}; - QVariantList list; - QVERIFY( ! iMsg.adjustUltrafiltrationState(msg, list)); -} - -/*! * \brief tst_messaging::tst_MessageInterpreter_adjustUltrafiltrationEditData_isType * \details Tests MessageInterpreter adjustUltrafiltrationEditData method Message Type check */ Index: unittests/tst_messaging.h =================================================================== diff -u -rd9f8e4e8356bd081f84dc08c4d65d727c0ee707f -re58be51c4aa52938af250db3ee579e98de08542c --- unittests/tst_messaging.h (.../tst_messaging.h) (revision d9f8e4e8356bd081f84dc08c4d65d727c0ee707f) +++ unittests/tst_messaging.h (.../tst_messaging.h) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -64,9 +64,6 @@ void tst_MessageInterpreter_adjustDurationData_isType(); void tst_MessageInterpreter_adjustDurationData_payloadLen(); - void tst_MessageInterpreter_adjustUltrafiltrationStateData_isType(); - void tst_MessageInterpreter_adjustUltrafiltrationStateData_payloadLen(); - void tst_MessageInterpreter_adjustUltrafiltrationEditData_isType(); void tst_MessageInterpreter_adjustUltrafiltrationEditData_payloadLen(); Index: unittests/tst_models.cpp =================================================================== diff -u -ra3f457785f86bd41a4df1dd3c6ca7300d5fca38e -re58be51c4aa52938af250db3ee579e98de08542c --- unittests/tst_models.cpp (.../tst_models.cpp) (revision a3f457785f86bd41a4df1dd3c6ca7300d5fca38e) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -39,6 +39,7 @@ #include "MTreatmentTimeData.h" #include "MTreatmentPressureOcclusionData.h" #include "MTreatmentSalineData.h" +#include "MPrimingData.h" #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" @@ -49,9 +50,14 @@ #include "MAlarmTriggered.h" #include "MAlarmCleared.h" -#include "MTreatmentParameters.h" #include "MTreatmentParametersResp.h" +#include "MStartTreatmentResponse.h" +#include "MEndTreatmentResponse.h" +#include "MessageInterpreter.h" + +using namespace Can; + #undef CONSOLEOUT /*! @@ -930,7 +936,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")); @@ -996,7 +1002,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")); @@ -1062,7 +1068,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")); @@ -1174,7 +1180,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")); @@ -1395,6 +1401,9 @@ } } + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentParametersResp test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentParametersResp data definition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentParametersResp_data() { QTest::addColumn("errorIndex"); @@ -1474,7 +1483,7 @@ QTest::newRow("rinsebackFlowRate") << 18 << 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" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44" "45" "46" "47")); } - +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentParametersResp test definition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentParametersResp() { Model::MTreatmentParametersResponse mData; @@ -1582,7 +1591,6 @@ void tst_models::tst_MTreatmentSalineBolusData() { Model::MTreatmentSaline mData; - QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); @@ -1606,114 +1614,132 @@ } } -void tst_models::tst_MTreatmentParametersResp_fromVariantList() -{ - Model::MTreatmentParametersResponse mData; +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPrimingData_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("currentState ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("currentState ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("currentState ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("currentState ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} - QVariantList list; - for (int i = 0; i < 20; ++i) - { +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPrimingData() { + Model::MPrimingData mData; - list.append(QVariant(1)); - AdjustTreatmentParametersResponseData tempData = mData.fromVariantList(list); - if (i == 17) { - QVERIFY(1 == tempData.requestValid); - QVERIFY(1 == tempData.bloodFlowRate); - QVERIFY(1 == tempData.dialysateFlowRate); - QVERIFY(1 == tempData.duration); - QVERIFY(1 == tempData.heparinDispensingRate); - QVERIFY(1 == tempData.heparinBolusVolume); - QVERIFY(1 == tempData.heparinStopTime); - QVERIFY(1 == tempData.salineBolus); - QVERIFY(1 == tempData.acidConcentrate); - QVERIFY(1 == tempData.bicarbonateConcentrate); - QVERIFY(1 == tempData.dialyzerType); - QVERIFY(1 == tempData.dialysateTemp); - QVERIFY(1 == tempData.arterialPressureLimitLow); - QVERIFY(1 == tempData.arterialPressureLimitHigh); - QVERIFY(1 == tempData.venousPressureLimitLow); - QVERIFY(1 == tempData.venousPressureLimitHigh); - QVERIFY(1 == tempData.bloodPressureMeasureInterval); - QVERIFY(1 == tempData.rinsebackFlowRate); - } - else { - AdjustTreatmentParametersResponseData data; - QVERIFY(data.requestValid == tempData.requestValid); - QVERIFY(data.bloodFlowRate == tempData.bloodFlowRate); - QVERIFY(data.dialysateFlowRate == tempData.dialysateFlowRate); - QVERIFY(data.duration == tempData.duration); - QVERIFY(data.heparinDispensingRate == tempData.heparinDispensingRate); - QVERIFY(data.heparinBolusVolume == tempData.heparinBolusVolume); - QVERIFY(data.heparinStopTime == tempData.heparinStopTime); - QVERIFY(data.salineBolus == tempData.salineBolus); - QVERIFY(data.acidConcentrate == tempData.acidConcentrate); - QVERIFY(data.bicarbonateConcentrate == tempData.bicarbonateConcentrate); - QVERIFY(data.dialyzerType == tempData.dialyzerType); - QVERIFY(data.dialysateTemp == tempData.dialysateTemp); - QVERIFY(data.arterialPressureLimitLow == tempData.arterialPressureLimitLow); - QVERIFY(data.arterialPressureLimitHigh == tempData.arterialPressureLimitHigh); - QVERIFY(data.venousPressureLimitLow == tempData.venousPressureLimitLow); - QVERIFY(data.venousPressureLimitHigh == tempData.venousPressureLimitHigh); - QVERIFY(data.bloodPressureMeasureInterval== tempData.bloodPressureMeasureInterval); - QVERIFY(data.rinsebackFlowRate == tempData.rinsebackFlowRate); + 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.currentState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.secondsRemaining ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.secondsTotal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MStartTreatmentResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MStartTreatmentResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MStartTreatmentResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); +} -void tst_models::tst_MTreatmentParameters_fromVariantList() -{ - Model::MAdjustTreatmentParametersRequest mData; +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MStartTreatmentResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MStartTreatmentResponse() { + Model::MStartTreatmentResponse mData; - QVariantList list; - for (int i = 0; i < 20; ++i) - { + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); - list.append(QVariant(1)); - AdjustTreatmentParametersRequestData tempData = mData.fromVariantList(list); - if (i == 16) { - QVERIFY(1 == tempData.bloodFlowRate); - QVERIFY(1 == tempData.dialysateFlowRate); - QVERIFY(1 == tempData.duration); - QVERIFY(1 == tempData.heparinDispensingRate); - QVERIFY(1 == tempData.heparinBolusVolume); - QVERIFY(1 == tempData.heparinStopTime); - QVERIFY(1 == tempData.salineBolus); - QVERIFY(1 == tempData.acidConcentrate); - QVERIFY(1 == tempData.bicarbonateConcentrate); - QVERIFY(1 == tempData.dialyzerType); - QVERIFY(1 == tempData.dialysateTemp); - QVERIFY(1 == tempData.arterialPressureLimitLow); - QVERIFY(1 == tempData.arterialPressureLimitHigh); - QVERIFY(1 == tempData.venousPressureLimitLow); - QVERIFY(1 == tempData.venousPressureLimitHigh); - QVERIFY(1 == tempData.bloodPressureMeasureInterval); - QVERIFY(1 == tempData.rinsebackFlowRate); - } - else { - AdjustTreatmentParametersRequestData data; - QVERIFY(data.bloodFlowRate == tempData.bloodFlowRate); - QVERIFY(data.dialysateFlowRate == tempData.dialysateFlowRate); - QVERIFY(data.duration == tempData.duration); - QVERIFY(data.heparinDispensingRate == tempData.heparinDispensingRate); - QVERIFY(data.heparinBolusVolume == tempData.heparinBolusVolume); - QVERIFY(data.heparinStopTime == tempData.heparinStopTime); - QVERIFY(data.salineBolus == tempData.salineBolus); - QVERIFY(data.acidConcentrate == tempData.acidConcentrate); - QVERIFY(data.bicarbonateConcentrate == tempData.bicarbonateConcentrate); - QVERIFY(data.dialyzerType == tempData.dialyzerType); - QVERIFY(data.dialysateTemp == tempData.dialysateTemp); - QVERIFY(data.arterialPressureLimitLow == tempData.arterialPressureLimitLow); - QVERIFY(data.arterialPressureLimitHigh == tempData.arterialPressureLimitHigh); - QVERIFY(data.venousPressureLimitLow == tempData.venousPressureLimitLow); - QVERIFY(data.venousPressureLimitHigh == tempData.venousPressureLimitHigh); - QVERIFY(data.bloodPressureMeasureInterval== tempData.bloodPressureMeasureInterval); - QVERIFY(data.rinsebackFlowRate == tempData.rinsebackFlowRate); + 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.startTreatmentResponse ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.startTreatmentRejectReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; } } + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MEndTreatmentResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MEndTreatmentResponse() { + Model::MEndTreatmentResponse 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.endTreatmentResponse ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -1764,3 +1790,49 @@ break; } } + +void tst_models::tst_MAlarmAcknowledgeRequest() +{ + MessageInterpreter interpreter; + QVariantList vData; + QByteArray payload; + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AlarmUserAckReq, vData, payload)); +} + +void tst_models::tst_MStartTreatmentRequest() +{ + MessageInterpreter interpreter; + QVariantList vData; + QByteArray payload; + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_StartTreatmentReq, vData, payload)); +} + +void tst_models::tst_MConfirmTreatmentRequest() +{ + MessageInterpreter interpreter; + QVariantList vData; + QByteArray payload; + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_ConfirmTreatmentReq, vData, payload)); +} + +void tst_models::tst_MEndTreatmentRequest() +{ + MessageInterpreter interpreter; + QVariantList vData; + QByteArray payload; + Message msg; + msg.actionId = Gui::GuiActions::ID_EndTreatmentReq; + + QVERIFY(interpreter.interpretMessage(Gui::GuiActions::ID_EndTreatmentReq, vData, payload)); + QVERIFY(!interpreter.interpretMessage_HD(msg,vData)); + vData.append(0); + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_EndTreatmentReq, vData, payload)); +} + +void tst_models::tst_MAdjustmentTreatmentParametersRequest() +{ + MessageInterpreter interpreter; + QVariantList vData; + QByteArray payload; + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_CreateTreatmentReq, vData, payload)); +} Index: unittests/tst_views.cpp =================================================================== diff -u -ra3f457785f86bd41a4df1dd3c6ca7300d5fca38e -re58be51c4aa52938af250db3ee579e98de08542c --- unittests/tst_views.cpp (.../tst_views.cpp) (revision a3f457785f86bd41a4df1dd3c6ca7300d5fca38e) +++ unittests/tst_views.cpp (.../tst_views.cpp) (revision e58be51c4aa52938af250db3ee579e98de08542c) @@ -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 tst_views.cpp * \author (last) Peter Lucia * \date (last) 15-Oct-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 - * + * */ #include "tst_views.h" @@ -20,6 +20,9 @@ #include "VTreatmentAdjustmentResponseBase.h" #include "VTreatmentAdjustmentUltrafiltrationState.h" #include "FileHandler.h" +#include "VTreatmentBegin.h" +#include "VPriming.h" +#include "VAlarmStatus.h" tst_views::tst_views(QObject *parent) : QObject(parent) { } @@ -75,27 +78,27 @@ { for (int i = 0; i < 18; ++i) { - View::VCreateTreatment view; - if (i != 0) view.set_bloodFlowRate(view.bloodFlowRateMax()); - if (i != 1) view.set_dialysateFlowRate(view.dialysateFlowRateMax()); - if (i != 2) view.set_duration(view.durationMax()); - if (i != 3) view.set_heparinDispensingRate(view.heparinDispensingRateMax()); + View::VTreatmentCreate view; + if (i != 0) view.bloodFlowRate(view.bloodFlowRateMax()); + if (i != 1) view.dialysateFlowRate(view.dialysateFlowRateMax()); + if (i != 2) view.duration(view.durationMax()); + if (i != 3) view.heparinDispensingRate(view.heparinDispensingRateMax()); + if (i != 4) view.heparinBolusVolume(view.heparinBolusVolumeMax()); + if (i != 5) view.heparinStopTime(view.heparinStopTimeMax()); + if (i != 6) view.salineBolusVolume(view.salineBolusVolumeMax()); - if (i != 4) view.set_heparinBolusVolume(view.heparinBolusVolumeMax()); - if (i != 5) view.set_heparinStopTime(view.heparinStopTimeMax()); - if (i != 6) view.set_salineBolusVolume(0); - if (i != 7) view.set_acidConcentrate(0); - if (i != 8) view.set_bicarbonateConcentrate(0); + if (i != 7) view.acidConcentrate(view.acidConcentrateMax()); + if (i != 8) view.bicarbonateConcentrate(view.bicarbonateConcentrateMax()); + if (i != 9) view.dialyzerType(view.dialyzerTypeMax()); - if (i != 9) view.set_dialyzerType(0); - if (i != 10) view.set_dialysateTemp(view.dialysateTempMax()); - if (i != 11) view.set_arterialPressureLimitLow(view.arterialPressureLimitLowMin()); - if (i != 12) view.set_arterialPressureLimitHigh(view.arterialPressureLimitHighMax()); - if (i != 13) view.set_venousPressureLimitLow(view.venousPressureLimitLowMin()); - if (i != 14) view.set_venousPressureLimitHigh(view.venousPressureLimitHighMax()); + if (i != 10) view.dialysateTemp(view.dialysateTempMax()); + if (i != 11) view.arterialPressureLimitLow(view.arterialPressureLimitLowMin()); + if (i != 12) view.arterialPressureLimitHigh(view.arterialPressureLimitHighMax()); + if (i != 13) view.venousPressureLimitLow(view.venousPressureLimitLowMin()); + if (i != 14) view.venousPressureLimitHigh(view.venousPressureLimitHighMax()); - if (i != 15) view.set_bloodPressureMeasureInterval(view.bloodPressureMeasureIntervalMax()); - if (i != 16) view.set_rinsebackFlowRate(view.rinsebackFlowRateMax()); + if (i != 15) view.bloodPressureMeasureInterval(view.bloodPressureMeasureIntervalMax()); + if (i != 16) view.rinsebackFlowRate(view.rinsebackFlowRateMax()); if (i == 17) { QCOMPARE(view.isbloodFlowRateSet, true); @@ -118,28 +121,28 @@ QCOMPARE(view.validate(view.treatmentData), true); // check getters - QCOMPARE(view.get_bloodFlowRate(), view.bloodFlowRateMax()); - QCOMPARE(view.get_dialysateFlowRate(), view.dialysateFlowRateMax()); - QCOMPARE(view.get_duration(), view.durationMax()); - QCOMPARE(view.get_heparinDispensingRate(),view.heparinDispensingRateMax()); + QCOMPARE(view.bloodFlowRate(), view.bloodFlowRateMax()); + QCOMPARE(view.dialysateFlowRate(), view.dialysateFlowRateMax()); + QCOMPARE(view.duration(), view.durationMax()); + QCOMPARE(view.heparinDispensingRate(),view.heparinDispensingRateMax()); - QCOMPARE(view.get_heparinBolusVolume(),view.heparinBolusVolumeMax()); - QCOMPARE(view.get_heparinStopTime(),view.heparinStopTimeMax()); - QCOMPARE(view.get_salineBolusVolume(), quint32(0)); - QCOMPARE(view.get_acidConcentrate(), quint32(0)); - QCOMPARE(view.get_bicarbonateConcentrate(), quint32(0)); + QCOMPARE(view.heparinBolusVolume(),view.heparinBolusVolumeMax()); + QCOMPARE(view.heparinStopTime(),view.heparinStopTimeMax()); + QCOMPARE(view.salineBolusVolume(), view.salineBolusVolumeMax()); + QCOMPARE(view.acidConcentrate(), view.acidConcentrateMax()); + QCOMPARE(view.bicarbonateConcentrate(), view.bicarbonateConcentrateMax()); - QCOMPARE(view.get_dialyzerType(), quint32(0)); - QCOMPARE(view.get_dialysateTemp(), view.dialysateTempMax()); - QCOMPARE(view.get_arterialPressureLimitLow(),view.arterialPressureLimitLowMin()); - QCOMPARE(view.get_arterialPressureLimitHigh(), view.arterialPressureLimitHighMax()); - QCOMPARE(view.get_venousPressureLimitLow(), view.venousPressureLimitLowMin()); - QCOMPARE(view.get_venousPressureLimitHigh(), view.venousPressureLimitHighMax()); + QCOMPARE(view.dialyzerType(), view.dialyzerTypeMax()); + QCOMPARE(view.dialysateTemp(), view.dialysateTempMax()); + QCOMPARE(view.arterialPressureLimitLow(),view.arterialPressureLimitLowMin()); + QCOMPARE(view.arterialPressureLimitHigh(), view.arterialPressureLimitHighMax()); + QCOMPARE(view.venousPressureLimitLow(), view.venousPressureLimitLowMin()); + QCOMPARE(view.venousPressureLimitHigh(), view.venousPressureLimitHighMax()); - QCOMPARE(view.get_bloodPressureMeasureInterval(), view.bloodPressureMeasureIntervalMax()); - QCOMPARE(view.get_rinsebackFlowRate(), view.rinsebackFlowRateMax()); + QCOMPARE(view.bloodPressureMeasureInterval(), view.bloodPressureMeasureIntervalMax()); + QCOMPARE(view.rinsebackFlowRate(), view.rinsebackFlowRateMax()); - view.onFinishedCreate(); + view.doFinishedCreate(); } else { QCOMPARE(view.validate(view.treatmentData), false); @@ -152,29 +155,28 @@ * Simulates a user selection of valid parameters * \param view VCreateTreatment object to be set with valid parameters */ -void tst_views::VCreateTreatment_simulate_valid_parameters(View::VCreateTreatment &view) +void tst_views::VCreateTreatment_simulate_valid_parameters(View::VTreatmentCreate &view) { - view.set_bloodFlowRate(view.bloodFlowRateMax()); - view.set_dialysateFlowRate(view.dialysateFlowRateMax()); - view.set_duration(view.durationMax()); - view.set_heparinDispensingRate(view.heparinDispensingRateMax()); + view.bloodFlowRate(view.bloodFlowRateMax()); + view.dialysateFlowRate(view.dialysateFlowRateMax()); + view.duration(view.durationMax()); + view.heparinDispensingRate(view.heparinDispensingRateMax()); - view.set_heparinBolusVolume(view.heparinBolusVolumeMax()); - view.set_heparinStopTime(view.heparinStopTimeMax()); - view.set_salineBolusVolume(0); - view.set_acidConcentrate(0); - view.set_bicarbonateConcentrate(0); + view.heparinBolusVolume(view.heparinBolusVolumeMax()); + view.heparinStopTime(view.heparinStopTimeMax()); + view.salineBolusVolume(view.salineBolusVolumeMax()); + view.acidConcentrate(view.acidConcentrateMax()); + view.bicarbonateConcentrate(view.bicarbonateConcentrateMax()); - view.set_dialyzerType(0); - view.set_dialysateTemp(view.dialysateTempMax()); - view.set_arterialPressureLimitLow(view.arterialPressureLimitLowMin()); - view.set_arterialPressureLimitHigh(view.arterialPressureLimitHighMax()); - view.set_venousPressureLimitLow(view.venousPressureLimitLowMin()); - view.set_venousPressureLimitHigh(view.venousPressureLimitHighMax()); + view.dialyzerType(view.dialyzerTypeMax()); + view.dialysateTemp(view.dialysateTempMax()); + view.arterialPressureLimitLow(view.arterialPressureLimitLowMin()); + view.arterialPressureLimitHigh(view.arterialPressureLimitHighMax()); + view.venousPressureLimitLow(view.venousPressureLimitLowMin()); + view.venousPressureLimitHigh(view.venousPressureLimitHighMax()); - view.set_bloodPressureMeasureInterval(view.bloodPressureMeasureIntervalMax()); - view.set_rinsebackFlowRate(view.rinsebackFlowRateMax()); - + view.bloodPressureMeasureInterval(view.bloodPressureMeasureIntervalMax()); + view.rinsebackFlowRate(view.rinsebackFlowRateMax()); } /*! @@ -196,11 +198,8 @@ obj["heparinBolusVolumeMax"] = 2000; obj["heparinStopTimeMin"] = 1000; obj["heparinStopTimeMax"] = 2000; - obj["salineBolusOptions"] = QJsonArray({ - "100 mL", - "200 mL", - "300 mL" - }); + obj["salineBolusVolumeMin"] = 100; + obj["salineBolusVolumeMax"] = 300; obj["acidConcentrateOptions"] = QJsonArray({ "08-1251-1", "08-2251-0", @@ -237,15 +236,82 @@ */ void tst_views::VCreateTreatment_validation_ranges() { - View::VCreateTreatment view; + View::VTreatmentCreate v; + // check resolutions + QCOMPARE(v.bloodFlowRateRes(), quint32(25)); + QCOMPARE(v.dialysateFlowRateRes(), quint32(50 )); + QCOMPARE(v.durationRes(), quint32(15 )); + QCOMPARE(v.heparinDispensingRateRes(), qreal(0.1)); + QCOMPARE(v.heparinBolusVolumeRes(), qreal(0.1)); + QCOMPARE(v.heparinStopTimeRes(), quint32(10 )); + QCOMPARE(v.salineBolusVolumeRes(), quint32(100)); + + QCOMPARE(v.acidConcentrateRes(), quint32(1)); + QCOMPARE(v.bicarbonateConcentrateRes(), quint32(1)); + QCOMPARE(v.dialyzerTypeRes(), quint32(1)); + + QCOMPARE(v.dialysateTempRes(), qreal(0.5)); + QCOMPARE(v.arterialPressureLimitLowRes(), qint32(10)); + QCOMPARE(v.arterialPressureLimitHighRes(), qint32(10)); + QCOMPARE(v.venousPressureLimitLowRes(), qint32(10)); + QCOMPARE(v.venousPressureLimitHighRes(), qint32(10)); + QCOMPARE(v.bloodPressureMeasureIntervalRes(), quint32(5)); + QCOMPARE(v.rinsebackFlowRateRes(), quint32(25)); + + v.bloodFlowRateRes (quint32(26)); + v.dialysateFlowRateRes (quint32(51)); + v.durationRes (quint32(16)); + v.heparinDispensingRateRes (qreal(0.2)); + v.heparinBolusVolumeRes (qreal(0.2)); + v.heparinStopTimeRes (quint32(11)); + v.salineBolusVolumeRes (quint32(101)); + + v.acidConcentrateRes (quint32(2)); + v.bicarbonateConcentrateRes (quint32(2)); + v.dialyzerTypeRes (quint32(2)); + + v.dialysateTempRes (qreal(0.6)); + v.arterialPressureLimitLowRes (qint32(11)); + v.arterialPressureLimitHighRes (qint32(11)); + v.venousPressureLimitLowRes (qint32(11)); + v.venousPressureLimitHighRes (qint32(11)); + v.bloodPressureMeasureIntervalRes (quint32(6)); + v.rinsebackFlowRateRes (quint32(26)); + + QCOMPARE(v.bloodFlowRateRes(), quint32(26)); + QCOMPARE(v.dialysateFlowRateRes(), quint32(51)); + QCOMPARE(v.durationRes(), quint32(16)); + QCOMPARE(v.heparinDispensingRateRes(), qreal(0.2)); + QCOMPARE(v.heparinBolusVolumeRes(), qreal(0.2)); + QCOMPARE(v.heparinStopTimeRes(), quint32(11)); + QCOMPARE(v.salineBolusVolumeRes(), quint32(101)); + + QCOMPARE(v.acidConcentrateRes(), quint32(2)); + QCOMPARE(v.bicarbonateConcentrateRes(), quint32(2)); + QCOMPARE(v.dialyzerTypeRes(), quint32(2)); + + QCOMPARE(v.dialysateTempRes(), qreal(0.6)); + QCOMPARE(v.arterialPressureLimitLowRes(), qint32(11)); + QCOMPARE(v.arterialPressureLimitHighRes(), qint32(11)); + QCOMPARE(v.venousPressureLimitLowRes(), qint32(11)); + QCOMPARE(v.venousPressureLimitHighRes(), qint32(11)); + QCOMPARE(v.bloodPressureMeasureIntervalRes(), quint32(6)); + QCOMPARE(v.rinsebackFlowRateRes(), quint32(26)); + + View::VTreatmentCreate view; + // adjust quint32 minimums view.bloodFlowRateMin(1); view.dialysateFlowRateMin(1); view.durationMin(1); view.heparinDispensingRateMin(2); view.heparinBolusVolumeMin(1); view.heparinStopTimeMin(1); + view.salineBolusVolumeMin(1); + view.acidConcentrateMin(1); + view.bicarbonateConcentrateMin(1); + view.dialyzerTypeMin(1); view.dialysateTempMin(1); view.arterialPressureLimitLowMin(2); @@ -256,26 +322,26 @@ view.rinsebackFlowRateMin(1); // setters - view.set_bloodFlowRate(0); - view.set_dialysateFlowRate(0); - view.set_duration(0); - view.set_heparinDispensingRate(1); + view.bloodFlowRate(0); + view.dialysateFlowRate(0); + view.duration(0); + view.heparinDispensingRate(1); - view.set_heparinBolusVolume(0); - view.set_heparinStopTime(0); - view.set_salineBolusVolume(-1); - view.set_acidConcentrate(-1); - view.set_bicarbonateConcentrate(-1); + view.heparinBolusVolume(0); + view.heparinStopTime(0); + view.salineBolusVolume(0); + view.acidConcentrate(view.acidConcentrateMin()); + view.bicarbonateConcentrate(view.bicarbonateConcentrateMin()); - view.set_dialyzerType(-1); - view.set_dialysateTemp(0); - view.set_arterialPressureLimitLow(1); - view.set_arterialPressureLimitHigh(1); - view.set_venousPressureLimitLow(1); - view.set_venousPressureLimitHigh(1); + view.dialyzerType(view.dialyzerTypeMin()); + view.dialysateTemp(0); + view.arterialPressureLimitLow(1); + view.arterialPressureLimitHigh(1); + view.venousPressureLimitLow(1); + view.venousPressureLimitHigh(1); - view.set_bloodPressureMeasureInterval(1); - view.set_rinsebackFlowRate(0); + view.bloodPressureMeasureInterval(1); + view.rinsebackFlowRate(0); view.setTreatmentData(); @@ -300,51 +366,54 @@ QCOMPARE(view.validate(view.treatmentData), false); // edge case when pressure lows are set greater than the highs - view.set_arterialPressureLimitLow(view.arterialPressureLimitHighMin()+1); - view.set_venousPressureLimitLow(view.venousPressureLimitHighMin()+1); + view.arterialPressureLimitLow(view.arterialPressureLimitHighMin()+1); + view.venousPressureLimitLow(view.venousPressureLimitHighMin()+1); QCOMPARE(view.validate(view.treatmentData), false); - view.onResetCreateTreatment(); + view.doResetCreateTreatment(); for (int i = 0; i < 17; ++i) { VCreateTreatment_simulate_valid_parameters(view); switch (i) { - case 0: view.set_bloodFlowRate(view.bloodFlowRateMax()+1); break; - case 1: view.set_dialysateFlowRate(view.dialysateFlowRateMax()+1); break; - case 2: view.set_duration(view.durationMax()+1); break; - case 3: view.set_heparinDispensingRate(view.heparinDispensingRateMax()+1); break; + case 0: view.bloodFlowRate(view.bloodFlowRateMax()+1); break; + case 1: view.dialysateFlowRate(view.dialysateFlowRateMax()+1); break; + case 2: view.duration(view.durationMax()+1); break; + case 3: view.heparinDispensingRate(view.heparinDispensingRateMax()+1); break; - case 4: view.set_heparinBolusVolume(view.heparinBolusVolumeMax()+1); break; - case 5: view.set_heparinStopTime(view.heparinStopTimeMax()+1); break; - case 6: view.set_salineBolusVolume(view.salineBolusOptions().length()); break; - case 7: view.set_acidConcentrate(view.acidConcentrateOptions().length()); break; - case 8: view.set_bicarbonateConcentrate(view.bicarbonateConcentrateOptions().length()); break; + case 4: view.heparinBolusVolume(view.heparinBolusVolumeMax()+1); break; + case 5: view.heparinStopTime(view.heparinStopTimeMax()+1); break; + case 6: view.salineBolusVolume(view.salineBolusVolumeMax()+1); break; + case 7: view.acidConcentrate(view.acidConcentrateOptions().length()); break; + case 8: view.bicarbonateConcentrate(view.bicarbonateConcentrateOptions().length()); break; - case 9: view.set_dialyzerType(view.dialyzerTypeOptions().length()); break; - case 10: view.set_dialysateTemp(view.dialysateTempMax()+1); break; - case 11: view.set_arterialPressureLimitLow(view.arterialPressureLimitLowMax()+1); break; - case 12: view.set_arterialPressureLimitHigh(view.arterialPressureLimitHighMax()+1); break; - case 13: view.set_venousPressureLimitLow(view.venousPressureLimitLowMax()+1); break; - case 14: view.set_venousPressureLimitHigh(view.venousPressureLimitHighMax()+1); break; + case 9: view.dialyzerType(view.dialyzerTypeOptions().length()); break; + case 10: view.dialysateTemp(view.dialysateTempMax()+1); break; + case 11: view.arterialPressureLimitLow(view.arterialPressureLimitLowMax()+1); break; + case 12: view.arterialPressureLimitHigh(view.arterialPressureLimitHighMax()+1); break; + case 13: view.venousPressureLimitLow(view.venousPressureLimitLowMax()+1); break; + case 14: view.venousPressureLimitHigh(view.venousPressureLimitHighMax()+1); break; - case 15: view.set_bloodPressureMeasureInterval(view.bloodPressureMeasureIntervalMax()+1); break; - case 16: view.set_rinsebackFlowRate(view.rinsebackFlowRateMax()+1); break; + case 15: view.bloodPressureMeasureInterval(view.bloodPressureMeasureIntervalMax()+1); break; + case 16: view.rinsebackFlowRate(view.rinsebackFlowRateMax()+1); break; default: break; } QCOMPARE(view.validate(view.treatmentData), false); - view.onFinishedCreate(); + view.doFinishedCreate(); } - + view.dialyzerType(-1); + QVERIFY(!(view.dialyzerTypeOptions().length() - 1 < (int)view.dialyzerType())); + QStringList result = view.doGetOperatingParameterValues(); + QCOMPARE(result.at(2), "None"); } void tst_views::VCreateTreatment_check_init() { - View::VCreateTreatment view; + View::VTreatmentCreate view; quint32 val = 150; view.bloodFlowRateMin(val); ++val; view.bloodFlowRateMin(val); view.bloodFlowRateMin(val); @@ -408,21 +477,21 @@ view.durationMax(val); QCOMPARE(val, view.durationMax()); - QStringList options = QStringList() << "100 mL" << "200 mL" << "300 mL"; - view.salineBolusOptions(options); options.append(" "); - view.salineBolusOptions(options); - view.salineBolusOptions(options); - QCOMPARE(options, view.salineBolusOptions()); + val = 300; view.salineBolusVolumeMax(val); ++val; + view.salineBolusVolumeMax(val); + view.salineBolusVolumeMax(val); + QCOMPARE(val, view.salineBolusVolumeMax()); - - options = QStringList() << "08-1251-1" << "08-2251-0" << "08-3251-9"; + QStringList options = QStringList() << "08-1251-1" << "08-2251-0" << "08-3251-9"; view.acidConcentrateOptions(options); options.append(" "); + view.acidConcentrateMax(view.acidConcentrateMax()+1); view.acidConcentrateOptions(options); view.acidConcentrateOptions(options); QCOMPARE(options, view.acidConcentrateOptions()); options = QStringList() << "Dimesol - BC-201"; view.bicarbonateConcentrateOptions(options); options.append(" "); + view.bicarbonateConcentrateMax(view.bicarbonateConcentrateMax()+1); view.bicarbonateConcentrateOptions(options); view.bicarbonateConcentrateOptions(options); QCOMPARE(options, view.bicarbonateConcentrateOptions()); @@ -433,6 +502,7 @@ << "Fresenius Optiflux F160NRe" << "Fresenius Optiflux F180NRe"; view.dialyzerTypeOptions(options); options.append(" "); + view.dialyzerTypeMax(view.dialyzerTypeMax()+1); view.dialyzerTypeOptions(options); view.dialyzerTypeOptions(options); QCOMPARE(options, view.dialyzerTypeOptions()); @@ -521,7 +591,7 @@ void tst_views::VCreateTreatment_save_csv() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QString csvData = view.getParameterRangesDataCSV(); QString filename = QString("/tmp/out_%0.csv").arg(QDateTime::currentDateTime().toString(datetimeFormat)); @@ -542,7 +612,7 @@ */ void tst_views::VCreateTreatment_save() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QJsonObject objectWritten { {"bloodFlowRate", QString::number(view.treatmentData.bloodFlowRate)}, @@ -600,7 +670,7 @@ */ void tst_views::VCreateTreatment_enums() { - View::VCreateTreatment view; + View::VTreatmentCreate view; GuiRequestReasons reason = GuiRequestReasons::REQUEST_REJECT_REASON_NONE; QCOMPARE(view.enumToString(reason), "REQUEST_REJECT_REASON_NONE"); @@ -616,7 +686,7 @@ */ void tst_views::VCreateTreatment_json() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QJsonArray arr; QStringList list; @@ -648,56 +718,60 @@ */ void tst_views::VCreateTreatment_fw_validation_response() { - View::VCreateTreatment view; + View::VTreatmentCreate view; GuiActionType action = GuiActionType::ID_CreateTreatmentRsp; for (int i = 0; i < 18; ++i) { // 0 = OK, 1,2,3 ... parameter is not OK QVariantList messageData; - if (i == 0) messageData.append(1); else messageData.append(0); - if (i == 1) messageData.append(1); else messageData.append(0); - if (i == 2) messageData.append(1); else messageData.append(0); - if (i == 3) messageData.append(1); else messageData.append(0); - if (i == 4) messageData.append(1); else messageData.append(0); - if (i == 5) messageData.append(1); else messageData.append(0); - if (i == 6) messageData.append(1); else messageData.append(0); - if (i == 7) messageData.append(1); else messageData.append(0); - if (i == 8) messageData.append(1); else messageData.append(0); - if (i == 9) messageData.append(1); else messageData.append(0); - if (i == 10) messageData.append(1); else messageData.append(0); - if (i == 11) messageData.append(1); else messageData.append(0); - if (i == 12) messageData.append(1); else messageData.append(0); - if (i == 13) messageData.append(1); else messageData.append(0); - if (i == 14) messageData.append(1); else messageData.append(0); - if (i == 15) messageData.append(1); else messageData.append(0); - if (i == 16) messageData.append(1); else messageData.append(0); - if (i == 17) messageData.append(1); else messageData.append(0); - QVERIFY(!view.onFWValidationResponse(action, messageData)); + AdjustTreatmentParametersResponseData respData; + if (i == 0) respData.requestValid = 1; else respData.requestValid = 0; + if (i == 1) respData.bloodFlowRate = 1; else respData.bloodFlowRate = 0; + if (i == 2) respData.dialysateFlowRate = 1; else respData.dialysateFlowRate = 0; + if (i == 3) respData.duration = 1; else respData.duration = 0; + if (i == 4) respData.heparinStopTime = 1; else respData.heparinStopTime = 0; + if (i == 5) respData.salineBolus = 1; else respData.salineBolus = 0; + if (i == 6) respData.acidConcentrate = 1; else respData.acidConcentrate = 0; + if (i == 7) respData.bicarbonateConcentrate = 1; else respData.bicarbonateConcentrate = 0; + if (i == 8) respData.dialyzerType = 1; else respData.dialyzerType = 0; + if (i == 9) respData.bloodPressureMeasureInterval = 1; else respData.bloodPressureMeasureInterval= 0; + if (i == 10) respData.rinsebackFlowRate = 1; else respData.rinsebackFlowRate = 0; + if (i == 11) respData.arterialPressureLimitLow = 1; else respData.arterialPressureLimitLow = 0; + if (i == 12) respData.arterialPressureLimitHigh = 1; else respData.arterialPressureLimitHigh = 0; + if (i == 13) respData.venousPressureLimitLow = 1; else respData.venousPressureLimitLow = 0; + if (i == 14) respData.venousPressureLimitHigh = 1; else respData.venousPressureLimitHigh = 0; + if (i == 15) respData.heparinDispensingRate = 1; else respData.heparinDispensingRate = 0; + if (i == 16) respData.heparinBolusVolume = 1; else respData.heparinBolusVolume = 0; + if (i == 17) respData.dialysateTemp = 1; else respData.dialysateTemp = 0; + QVERIFY(!view.doActionReceive(respData)); } AdjustTreatmentParametersRequestData dataBackup = view.treatmentData; - QVariantList validMessageData; - for (int i = 0; i < 18; ++i) { validMessageData.append(0); } + AdjustTreatmentParametersResponseData respData; - QVERIFY(!view.onFWValidationResponse(GuiActionType::ID_CreateTreatmentReq, validMessageData)); + StartTreatmentResponseData startResponse; - QVERIFY(view.onFWValidationResponse(GuiActionType::ID_CreateTreatmentRsp, validMessageData)); + startResponse.startTreatmentResponse = 0; // REJECT + view.doActionReceive(startResponse); + QCOMPARE(view.pageToShow, View::VTreatmentCreate::Page::None); + QVERIFY(view.doActionReceive(respData)); + view.saveTreatmentProfile(false); QVERIFY(!view._saveTreatmentProfile); - view.onFinishedConfirm(); + view.doFinishedConfirm(); view.saveTreatmentProfile(true); QVERIFY(view._saveTreatmentProfile); - view.onFinishedConfirm(); + view.doFinishedConfirm(); view.onFinishedSaveNewTreatment(true); view.onFinishedSaveNewTreatment(false); - view.onFinishedPrime(); - view.onStart(); + view.doFinishedPrime(); + view.doStartTreatment(); QCOMPARE(view.treatmentData.bloodFlowRate, dataBackup.bloodFlowRate); QCOMPARE(view.treatmentData.dialysateFlowRate, dataBackup.dialysateFlowRate); @@ -716,7 +790,6 @@ QCOMPARE(view.treatmentData.venousPressureLimitHigh, dataBackup.venousPressureLimitHigh); QCOMPARE(view.treatmentData.bloodPressureMeasureInterval, dataBackup.bloodPressureMeasureInterval); QCOMPARE(view.treatmentData.rinsebackFlowRate, dataBackup.rinsebackFlowRate); - } /*! @@ -725,7 +798,7 @@ */ void tst_views::VCreateTreatment_load_parameter_ranges() { - View::VCreateTreatment view; + View::VTreatmentCreate view; QJsonObject obj; @@ -739,15 +812,65 @@ _FileSaver.onConcurrentSave(path, document.toJson(), false); - QThread::msleep(500); + int elapsedSeconds = 0; + QDateTime startTime = QDateTime::currentDateTime(); + while (view.loadTreatmentParameterRanges(path) != obj) + elapsedSeconds += startTime.secsTo(QDateTime::currentDateTime()); QJsonObject readObj = view.loadTreatmentParameterRanges(path); QCOMPARE(obj, readObj); + QVERIFY(elapsedSeconds < 2); readObj = view.loadTreatmentParameterRanges(QString("/tmp/wrong_path_%0.json") .arg(QDateTime::currentDateTime().toString(datetimeFormat))); QVERIFY(obj != readObj); } +void tst_views::VTreatmentBegin_continue() +{ + View::VTreatmentBegin view; + view.continueEnabled(false); + QCOMPARE(view.continueEnabled(), false); + view.doUserModifiedParameters(); + QCOMPARE(view.continueEnabled(), true); +} + +void tst_views::VTreatmentPriming_properties() +{ + View::VPriming view; + PrimingData primingData; + primingData.currentState = View::VPriming::PRIMING_COMPLETE+1; + + view.checkingInstallationComplete(true); + QCOMPARE(view.checkingInstallationComplete(), true); + view.creatingDialysateComplete(true); + QCOMPARE(view.creatingDialysateComplete(), true); + view.primingLinesComplete(true); + QCOMPARE(view.primingLinesComplete(), true); + view.primingLinesComplete(false); + QCOMPARE(view.primingLinesComplete(), false); + view.primingComplete(true); + QCOMPARE(view.primingComplete(), true); + view.primingComplete(false); + QCOMPARE(view.primingComplete(), false); + view.primingComplete(false); + QCOMPARE(view.primingComplete(), false); + view.continueEnabled(true); + QCOMPARE(view.continueEnabled(), true); + view.onActionReceive(primingData); + QCOMPARE(view.currentState(), (quint32)View::VPriming::PRIMING_COMPLETE+1); + view.primingLinesComplete(false); + QVERIFY(!view.primingLinesComplete()); + view.secondsRemaining(quint32(10)); + QCOMPARE(view.secondsRemaining(), quint32(10)); + view.secondsRemaining(quint32(1)); + QCOMPARE(view.secondsRemaining(), quint32(1)); + view.secondsRemaining(quint32(1)); + QCOMPARE(view.secondsRemaining(), quint32(1)); + view.secondsTotal(quint32(50)); + QCOMPARE(view.secondsTotal(), quint32(50)); + view.continueEnabled(false); + QCOMPARE(view.continueEnabled(), false); +}