Index: denali.pro.user =================================================================== diff -u -r595ede3b4cf5a1f5c06a04d1db99a0674ae742bd -rdf0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e --- denali.pro.user (.../denali.pro.user) (revision 595ede3b4cf5a1f5c06a04d1db99a0674ae742bd) +++ denali.pro.user (.../denali.pro.user) (revision df0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e) @@ -1,6 +1,6 @@ - + EnvironmentId Index: sources/gui/qml/pages/treatment/sections/TreatmentHeparin.qml =================================================================== diff -u -r153409973471214f29d5fad170a8b4ec0f4c4f2e -rdf0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e --- sources/gui/qml/pages/treatment/sections/TreatmentHeparin.qml (.../TreatmentHeparin.qml) (revision 153409973471214f29d5fad170a8b4ec0f4c4f2e) +++ sources/gui/qml/pages/treatment/sections/TreatmentHeparin.qml (.../TreatmentHeparin.qml) (revision df0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e) @@ -29,11 +29,13 @@ TreatmentFluid { id: _root readonly property bool isOff : vHDTreatmentStates.hpOff readonly property bool isPaused : vHDTreatmentStates.hpPaused - readonly property bool isBolus : vHDTreatmentStates.hpInitial_bolus + readonly property bool isBolus : vHDTreatmentStates.hpInitial_bolus readonly property bool isDispensing : vHDTreatmentStates.hpDispensing readonly property bool isCompleted : vHDTreatmentStates.hpCompleted readonly property bool isEmpty : vHDTreatmentStates.hpEmpty + readonly property bool isTxRunning : vHDTreatmentStates.txDialysis_Running + QtObject { id: _private readonly property string textHeparin : qsTr("HEPARIN DELIVERY") readonly property string textPause : qsTr("PAUSE DELIVERY") @@ -53,11 +55,12 @@ targetVisible: false progressBarVisible: false - isTouchable : ! (isOff || isBolus || isEmpty) && ! isSBInProgress - buttonText : isDispensing ? _private.textPause : - isPaused ? _private.textResume : - isCompleted ? _private.textResume : - _private.textHeparin + isTouchable : ! (isOff || isBolus || isEmpty) && ! isSBInProgress && isTxRunning + buttonText : ! isTxRunning ? _private.textHeparin : + isDispensing ? _private.textPause : + isPaused ? _private.textResume : + isCompleted ? _private.textResume : + _private.textHeparin unit : Variables.unitTextSaline valueDelivered: vTreatmentHeparin.cumulative.toFixed(1) // this is the cumulative volume of the Heparin bolus and despensing. Index: sources/view/VPriming.h =================================================================== diff -u -r1f8abdd821041623392d18cf4f80cad9ae1bf246 -rdf0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e --- sources/view/VPriming.h (.../VPriming.h) (revision 1f8abdd821041623392d18cf4f80cad9ae1bf246) +++ sources/view/VPriming.h (.../VPriming.h) (revision df0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e) @@ -40,7 +40,7 @@ friend class::tst_views; public: - VPriming(QObject *parent = NULL); + explicit VPriming(QObject *parent = NULL); private: PROPERTY(bool , checkingInstallationComplete , false) Index: unittests/tst_messaging.cpp =================================================================== diff -u -r14c541d2b780b0a244bc84860aa565cf8dd7fe4b -rdf0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision 14c541d2b780b0a244bc84860aa565cf8dd7fe4b) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision df0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e) @@ -765,6 +765,20 @@ QVERIFY(payload.isEmpty()); } +/*! + * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustHeparinReq + * \details Tests MessageInterpreter interpretMessage to handle ID_AdjustHeparinReq message type + * if data is empty (count==0) + */ +void tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustHeparinReq() +{ + 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_AdjustHeparinReq, {}, payload)); + QVERIFY(payload.isEmpty()); +} + void tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustPressuresReq() { Can::MessageInterpreter iMsg; Index: unittests/tst_messaging.h =================================================================== diff -u -r14c541d2b780b0a244bc84860aa565cf8dd7fe4b -rdf0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e --- unittests/tst_messaging.h (.../tst_messaging.h) (revision 14c541d2b780b0a244bc84860aa565cf8dd7fe4b) +++ unittests/tst_messaging.h (.../tst_messaging.h) (revision df0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e) @@ -90,6 +90,7 @@ void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationEditReq(); void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationConfirmReq(); void tst_MessageInterpreter_interpretMessage_AdjustSalineReq(); + void tst_MessageInterpreter_interpretMessage_AdjustHeparinReq(); void tst_MessageInterpreter_interpretMessage_AdjustPressuresReq(); void tst_MessageInterpreter_interpretMessage_CANBusFaultCount(); Index: unittests/tst_models.cpp =================================================================== diff -u -r14c541d2b780b0a244bc84860aa565cf8dd7fe4b -rdf0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e --- unittests/tst_models.cpp (.../tst_models.cpp) (revision 14c541d2b780b0a244bc84860aa565cf8dd7fe4b) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision df0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e) @@ -44,8 +44,9 @@ #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" -#include "MTreatmentAdjustSalineResponse.h" #include "MTreatmentAdjustPressuresLimitsResponse.h" +#include "MTreatmentAdjustSalineResponse.h" +#include "MTreatmentAdjustHeparinResponse.h" #include "MAlarmStatusData.h" #include "MAlarmTriggered.h" @@ -916,19 +917,23 @@ void tst_models::tst_MTreatmentStateData_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("mSubmode ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + 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("mSubmode ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStateData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentStateData() { @@ -946,10 +951,11 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mSubMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mUFState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mSalineState; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mSubMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mUFState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mSalineState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mHeparinState; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -1637,6 +1643,43 @@ } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentHeparinData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentHeparinData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentHeparinData_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("mCumulative ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mCumulative ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mCumulative ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mCumulative ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentHeparinData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentHeparinData() { + Model::MTreatmentHeparin 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.mCumulative; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MPrimingData_data () { @@ -1814,6 +1857,52 @@ } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHeparinResponse_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("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("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHeparinResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHeparinResponse() { + Model::MAdjustHeparinResponse 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.mState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + void tst_models::tst_MAlarmAcknowledgeRequest() { MessageInterpreter interpreter; Index: unittests/tst_models.h =================================================================== diff -u -r14c541d2b780b0a244bc84860aa565cf8dd7fe4b -rdf0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e --- unittests/tst_models.h (.../tst_models.h) (revision 14c541d2b780b0a244bc84860aa565cf8dd7fe4b) +++ unittests/tst_models.h (.../tst_models.h) (revision df0c8b4fa51d4f5ef0216eb2c3f6f5dfc97bf12e) @@ -66,6 +66,14 @@ void tst_MAdjustPressuresLimitsResponse_data (); void tst_MAdjustPressuresLimitsResponse (); + // -- Treatment Saline Bolus + void tst_MSalineBolusResponse_data(); + void tst_MSalineBolusResponse(); + + // -- Treatment Heparin + void tst_MHeparinResponse_data(); + void tst_MHeparinResponse(); + // - Data Messages void tst_DGROPumpData_data(); void tst_DGROPumpData(); @@ -99,6 +107,10 @@ void tst_MTreatmentTimeData(); void tst_MPressureOcclusionData_data(); void tst_MPressureOcclusionData(); + void tst_MTreatmentSalineBolusData_data(); + void tst_MTreatmentSalineBolusData(); + void tst_MTreatmentHeparinData_data(); + void tst_MTreatmentHeparinData(); void tst_MPowerOff_data(); void tst_MPowerOff(); void tst_MPrimingData_data(); @@ -122,10 +134,4 @@ // Treatment Parameters void tst_MTreatmentParametersResp_data(); void tst_MTreatmentParametersResp(); - - void tst_MTreatmentSalineBolusData_data(); - void tst_MTreatmentSalineBolusData(); - - void tst_MSalineBolusResponse_data(); - void tst_MSalineBolusResponse(); };