Index: denali.pro =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- denali.pro (.../denali.pro) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ denali.pro (.../denali.pro) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -1,6 +1,6 @@ QT += widgets qml quick serialbus concurrent CONFIG += c++17 warn_on -QMAKE_CXXFLAGS += -Wall -Werror -Wimplicit-fallthrough # -save-temps // see .ii and .s files +QMAKE_CXXFLAGS += -Wall -Werror -Wimplicit-fallthrough # -save-temps # see .ii and .s files #CONFIG += disable_crc disable_crc { @@ -30,17 +30,19 @@ INCLUDEPATH += \ common \ sources \ - sources/model \ - sources/view \ sources/storage \ sources/gui \ sources/canbus \ sources/utility \ sources/abstract \ + sources/model \ sources/model/hd/adjustment \ sources/model/hd/alarm \ sources/model/hd/data \ sources/model/dg/data \ + sources/view \ + sources/view/hd/adjustment \ + sources/view/hd/data \ sources/view/dg/data HEADERS += \ @@ -77,6 +79,7 @@ sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationStateResponse.h \ sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationEditResponse.h \ sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationConfirmResponse.h \ + sources/model/hd/adjustment/MTreatmentAdjustSalineResponse.h \ \ # ---------- Models - HD - Data sources/model/hd/data/MTreatmentTimeData.h \ sources/model/hd/data/MTreatmentFlowsData.h \ @@ -85,6 +88,7 @@ sources/model/hd/data/MTreatmentPressureOcclusionData.h \ sources/model/hd/data/MTreatmentStatesData.h \ sources/model/hd/data/MHDOperationModeData.h \ + sources/model/hd/data/MTreatmentSalineData.h \ \ # ---------- Models - DG - Data sources/model/dg/data/MDGDrainPumpData.h \ sources/model/dg/data/MDGHeatersData.h \ @@ -109,34 +113,40 @@ sources/gui/guiview.h \ sources/gui/guicontroller.h \ \ # ---------- Views ---------- - sources/view/dg/data/VDGDrainPumpData.h \ - sources/view/dg/data/VDGHeatersData.h \ - sources/view/dg/data/VDGLoadCellReadingsData.h \ - sources/view/dg/data/VDGOperationModeData.h \ - sources/view/dg/data/VDGPressuresData.h \ - sources/view/dg/data/VDGROPumpData.h \ - sources/view/dg/data/VDGReservoirData.h \ - sources/view/dg/data/VDGTemperaturesData.h \ - sources/view/dg/data/VDGValvesStatesData.h \ sources/view/VCreateTreatment.h \ - \ + sources/view/VEventSpy.h \ + sources/view/hd/data/VHDTreatmentStatesData.h \ sources/view/vview.h \ sources/view/vpoweroff.h \ + \ # ---------- Views - Alarm sources/view/valarmstatus.h \ - sources/view/VHDOperationModeData.h \ - sources/view/vtreatmenttime.h \ - sources/view/vtreatmentbloodflow.h \ - sources/view/vtreatmentdialysateflow.h \ - sources/view/vtreatmentultrafiltration.h \ - sources/view/vtreatmentranges.h \ - sources/view/vtreatmentpressureocclusion.h \ - \ # Treatment Adjustments + \ # ---------- Views - HD - Adjustment - In-Treatment sources/view/vtreatmentadjustmentresponsebase.h \ sources/view/vtreatmentadjustmentduration.h \ sources/view/vtreatmentadjustmentflows.h \ sources/view/vtreatmentadjustmentultrafiltrationstate.h \ sources/view/vtreatmentadjustmentultrafiltrationedit.h \ sources/view/vtreatmentadjustmentultrafiltrationconfirm.h \ + sources/view/hd/adjustment/VTreatmentAdjustmentSaline.h \ + \ # ---------- Views - HD - Data + sources/view/vtreatmenttime.h \ + sources/view/vtreatmentbloodflow.h \ + sources/view/vtreatmentdialysateflow.h \ + sources/view/vtreatmentultrafiltration.h \ + sources/view/vtreatmentranges.h \ + sources/view/vtreatmentpressureocclusion.h \ + sources/view/hd/data/VHDOperationModeData.h \ + sources/view/hd/data/VTreatmentSalineData.h \ + \ # ---------- Views - DG - Data + sources/view/dg/data/VDGDrainPumpData.h \ + sources/view/dg/data/VDGHeatersData.h \ + sources/view/dg/data/VDGLoadCellReadingsData.h \ + sources/view/dg/data/VDGOperationModeData.h \ + sources/view/dg/data/VDGPressuresData.h \ + sources/view/dg/data/VDGROPumpData.h \ + sources/view/dg/data/VDGReservoirData.h \ + sources/view/dg/data/VDGTemperaturesData.h \ + sources/view/dg/data/VDGValvesStatesData.h \ \ # Storage sources/storage/storageglobals.h \ sources/storage/filehandler.h \ @@ -177,6 +187,7 @@ sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationStateResponse.cpp \ sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationEditResponse.cpp \ sources/model/hd/adjustment/MTreatmentAdjustUltrafiltrationConfirmResponse.cpp \ + sources/model/hd/adjustment/MTreatmentAdjustSalineResponse.cpp \ \ # ---------- Models - HD - Data sources/model/hd/data/MTreatmentTimeData.cpp \ sources/model/hd/data/MTreatmentFlowsData.cpp \ @@ -185,6 +196,7 @@ sources/model/hd/data/MTreatmentPressureOcclusionData.cpp \ sources/model/hd/data/MTreatmentStatesData.cpp \ sources/model/hd/data/MHDOperationModeData.cpp \ + sources/model/hd/data/MTreatmentSalineData.cpp \ \ # ---------- Models - DG - Data sources/model/dg/data/MDGDrainPumpData.cpp \ sources/model/dg/data/MDGHeatersData.cpp \ @@ -209,6 +221,29 @@ sources/gui/guicontroller.cpp \ sources/view/VCreateTreatment.cpp \ \ # ---------- Views ---------- + sources/view/VEventSpy.cpp \ + sources/view/hd/data/VHDTreatmentStatesData.cpp \ + sources/view/vpoweroff.cpp \ + \ # ---------- Views - Alarm + sources/view/valarmstatus.cpp \ + \ # ---------- Views - HD - Adjustment - In-Treatment + sources/view/vtreatmentadjustmentresponsebase.cpp \ + sources/view/vtreatmentadjustmentduration.cpp \ + sources/view/vtreatmentadjustmentflows.cpp \ + sources/view/vtreatmentadjustmentultrafiltrationstate.cpp \ + sources/view/vtreatmentadjustmentultrafiltrationedit.cpp \ + sources/view/vtreatmentadjustmentultrafiltrationconfirm.cpp \ + sources/view/hd/adjustment/VTreatmentAdjustmentSaline.cpp \ + \ # ---------- Views - HD - Data + sources/view/vtreatmenttime.cpp \ + sources/view/vtreatmentbloodflow.cpp \ + sources/view/vtreatmentdialysateflow.cpp \ + sources/view/vtreatmentultrafiltration.cpp \ + sources/view/vtreatmentranges.cpp \ + sources/view/vtreatmentpressureocclusion.cpp \ + sources/view/hd/data/VHDOperationModeData.cpp \ + sources/view/hd/data/VTreatmentSalineData.cpp \ + \ # ---------- Views - DG - Data sources/view/dg/data/VDGDrainPumpData.cpp \ sources/view/dg/data/VDGHeatersData.cpp \ sources/view/dg/data/VDGLoadCellReadingsData.cpp \ @@ -218,23 +253,6 @@ sources/view/dg/data/VDGReservoirData.cpp \ sources/view/dg/data/VDGTemperaturesData.cpp \ sources/view/dg/data/VDGValvesStatesData.cpp \ - \ - sources/view/vpoweroff.cpp \ - sources/view/valarmstatus.cpp \ - sources/view/VHDOperationModeData.cpp \ - sources/view/vtreatmenttime.cpp \ - sources/view/vtreatmentbloodflow.cpp \ - sources/view/vtreatmentdialysateflow.cpp \ - sources/view/vtreatmentultrafiltration.cpp \ - sources/view/vtreatmentranges.cpp \ - sources/view/vtreatmentpressureocclusion.cpp \ - \ # Treatment Adjustments - sources/view/vtreatmentadjustmentresponsebase.cpp \ - sources/view/vtreatmentadjustmentduration.cpp \ - sources/view/vtreatmentadjustmentflows.cpp \ - sources/view/vtreatmentadjustmentultrafiltrationstate.cpp \ - sources/view/vtreatmentadjustmentultrafiltrationedit.cpp \ - sources/view/vtreatmentadjustmentultrafiltrationconfirm.cpp \ \ # Storage sources/storage/storageglobals.cpp \ sources/storage/filehandler.cpp \ Index: denali.pro.user =================================================================== diff -u -r4df19fe88c454bd54abcdaf983be59464c5ef5bc -r7edcaf054062754370e0abd165f17ca9941b7d07 --- denali.pro.user (.../denali.pro.user) (revision 4df19fe88c454bd54abcdaf983be59464c5ef5bc) +++ denali.pro.user (.../denali.pro.user) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 @@ -1122,6 +1122,15 @@ 1 + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 1000 @@ -1176,7 +1185,7 @@ 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 @@ -1414,6 +1423,15 @@ 1 + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 1000 Index: denali.qrc =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- denali.qrc (.../denali.qrc) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ denali.qrc (.../denali.qrc) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -31,6 +31,7 @@ resources/images/Clock-Plus.png resources/images/Wave-Minus.png resources/images/Wave-Plus.png + resources/images/microsd.png sources/gui/qml/components/MainMenu.qml @@ -73,6 +74,7 @@ sources/gui/qml/components/ImageWave.qml sources/gui/qml/components/ImageClock.qml sources/gui/qml/components/ImageLogoDDarkTransparent.qml + sources/gui/qml/components/DebugDataColumn.qml qtquickcontrols2.conf @@ -101,6 +103,7 @@ sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml sources/gui/qml/pages/treatment/sections/TreatmentFluid.qml sources/gui/qml/pages/treatment/sections/TreatmentTime.qml + sources/gui/qml/pages/treatment/sections/TreatmentSaline.qml sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentFlow.qml Index: scripts/copy.sh =================================================================== diff -u -r7a4f59af7287d30e8790e6b580327684d4e02e55 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- scripts/copy.sh (.../copy.sh) (revision 7a4f59af7287d30e8790e6b580327684d4e02e55) +++ scripts/copy.sh (.../copy.sh) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -1,3 +1,4 @@ +#!/bin/bash ########################################################################### # # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. @@ -13,7 +14,6 @@ # @date (original) 13-Mar-2020 # ############################################################################ -#!/bin/bash # device default Ip Address and denali application path if [ "$1" == "" ]; then Index: sources/applicationcontroller.cpp =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file applicationcontroller.cpp - * \author (last) Peter Lucia - * \date (last) 25-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 * @@ -106,13 +106,19 @@ connect(&_MessageDispatcher, SIGNAL(didFailedTransmit(Sequence)), this , SLOT( onFailedTransmit(Sequence))); + // USB drive connect(&_GuiController , SIGNAL(didUSBDriveUmount()), this , SLOT( onUSBDriveUmount())); connect(&_DriveWatcher , SIGNAL(didUSBDriveMount ()), this , SLOT( onUSBDriveMount ())); connect(&_DriveWatcher , SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + // SD Card + connect(&_DriveWatcher , SIGNAL(didSDCardStateChange(bool, bool)), + this , SLOT( onSDCardStateChange(bool, bool))); + + connect(&_GuiController , SIGNAL(didExportLog()), this , SLOT( onExportLog())); @@ -242,6 +248,21 @@ // coco end /*! + * \brief ApplicationController::onSDCardStateChange + * \details This is the slot which connects to the _DriveWatcher didSDCardStateChange signal + * and notifies the other classes (GuiController) by emitting its signal didSDCardStateChange + * \param vIsReady - SdCard is Ready + * \param vIsReadOnly - SdCard is ReadOnly + */ +void ApplicationController::onSDCardStateChange(bool vIsReady, bool vIsReadOnly) +{ + // coco begin validated: This needs user interaction to plug-in SD Card + // has been tested manually + emit didSDCardStateChange(vIsReady, vIsReadOnly); +} +// coco end + +/*! * \brief ApplicationController::onExportLog * \details the slot which will be called by UI to so the log export. */ Index: sources/applicationcontroller.h =================================================================== diff -u -r3b4fd62b510f6b09d663e35b0cadc93050e6a6f0 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/applicationcontroller.h (.../applicationcontroller.h) (revision 3b4fd62b510f6b09d663e35b0cadc93050e6a6f0) +++ sources/applicationcontroller.h (.../applicationcontroller.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file applicationcontroller.h - * \author (last) Peter Lucia - * \date (last) 25-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 * @@ -28,7 +28,7 @@ // define #define _ApplicationController ApplicationController::I() -// forward diclations +// forward declarations class tst_initializations; // namespace @@ -80,6 +80,8 @@ void onUSBDriveUmount(); void onUSBDriveRemove(); + void onSDCardStateChange(bool vIsReady, bool vIsReadOnly); + void onExportLog (); void onExport (); @@ -93,6 +95,8 @@ void didUSBDriveUmount(); void didUSBDriveRemove(); + void didSDCardStateChange(bool vIsReady, bool vIsReadOnly); + void didExport (); void didAdjustBloodDialysateFlows(quint32 vBloodFlow, quint32 vDialysateFlow); Index: sources/canbus/messageglobals.h =================================================================== diff -u -r7a4f59af7287d30e8790e6b580327684d4e02e55 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 7a4f59af7287d30e8790e6b580327684d4e02e55) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 messageglobals.h - * \author (last) Peter Lucia - * \date (last) 25-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 06-Dec-2019 - * + * */ #pragma once @@ -54,6 +54,7 @@ {Gui::GuiActionType::ID_DialysateInletFlow , 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::ID_DialysateOutletFlow , 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::ID_PressureOcclusion , 5 * 4 }, // 5 parameters each 4bytes + {Gui::GuiActionType::ID_Saline , 3 * 4 }, // 3 parameters each 4bytes // ---- {Gui::GuiActionType::ID_HDOperationModeData , 1 * 4 }, // 1 parameter each 4bytes @@ -100,10 +101,14 @@ {Gui::GuiActionType::ID_CreateTreatmentRsp , 18 * 4 }, // 18 parameters, each 4 bytes // ---- - {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq , 2 * 4 }, // 2 parameters each 4bytes - {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp , 5 * 4 }, + {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp , 5 * 4 }, // ---- + {Gui::GuiActionType::ID_AdjustSalineReq , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_AdjustSalineRsp , 3 * 4 }, // 3 parameters each 4bytes + + // ---- {Gui::GuiActionType::ID_CANBusFaultCount , 1 }, {Gui::GuiActionType::ID_RawData , 255 }, {Gui::GuiActionType::ID_Acknow , 0 }, @@ -171,7 +176,7 @@ eChlid_UI_HD = 0x100, ///< UI => HD [Out] // UI lessens occasionally - eChlid_DG_UI = 0x070, ///< No direct channel has been defined between DG&UI, May be required for logging + eChlid_DG_UI = 0x070, ///< DG => UI eChlid_UI_DG = eChlid_UI_Sync , ///< No direct channel has been defined between DG&UI, May be required for logging }; @@ -192,15 +197,15 @@ // coco begin validated:Has been validated manually. // Since the crc is part of the data and there is no message without crc // initialized flag and data.length() == 0 became the same. - // I preffer too keep it as it is so the initialization would be independent of the data. + // It's been preferred too keep it as it is so the initialization would be independent of the data. return !initialized || !data.length(); // coco end } bool isComplete() { // coco begin validated:Has been validated manually. // Since the crc is part of the data and there is no message without crc // then a message would never be empty. - // I preffer too keep it as it is so the initialization would be independent of the data. + // I prefer too keep it as it is so the initialization would be independent of the data. return !isEmpty() && data.length() == length; // coco end } Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -ra19862d191c2501faa4e8cde64804ef18b80c6b3 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision a19862d191c2501faa4e8cde64804ef18b80c6b3) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file messageinterpreter.cpp - * \author (last) Peter Lucia - * \date (last) 29-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 13-Dec-2019 * @@ -39,8 +39,8 @@ /*! * \brief MessageInterpreter::notify * \details Checks and prepares the model with the Message Data - * Regarding the type of message logs the message recived. - * Notofies observers by emiting the didActionReceive( < Data > ) signal + * Regarding the type of message logs the message received. + * Notifies observers by emitting the didActionReceive( < Data > ) signal * \param vMessage - The Denali message * \param vID - The Message ID to be checked against * \param vModel - The appropriate model for the Message Data @@ -83,8 +83,8 @@ /*! * \brief MessageInterpreter::isPayloadLenValid - * \details Checks if the Data length has been defined for this type od messsage - * if not logs Undefind Data Length error + * \details Checks if the Data length has been defined for this type of message + * if not logs Undefined Data Length error * if defined checks if the correct length of data is provided for this type of message. * if not logs Incorrect Data Length error * otherwise returns true @@ -106,16 +106,21 @@ return true; } +/*! + * \brief MessageInterpreter::logInvalidLength + * \details Logs invalid data length for the message type vActionId + * \param vActionId - Message Type + */ void MessageInterpreter::logInvalidLength(const Gui::GuiActionType &vActionId) { QString mActionIdHexString = Format::toHexString(vActionId); - LOG_DEBUG(QString("Incorrect data length for trsansmit Message with ID '%1'") + LOG_DEBUG(QString("Incorrect data length for transmit message with ID '%1'") .arg(mActionIdHexString)); } /*! * \brief MessageInterpreter::validateMessage - * \details Validate the messgae by checking its type and data + * \details Validate the message by checking its type and data * \param vMessage - The message * \param vType - The type of the message to be checked against * \return true on valid massage @@ -140,15 +145,15 @@ QString mActionIdHexString = Format::toHexString(vMessage.actionId, false, eLenMessageIDDigits); QString logMessage = tr("Unhandled Message ID (HD)") + '\n' + QString("%1 # %2 %3") - .arg(int(vMessage.can_id), 3, 16, QChar('0')) - .arg(mActionIdHexString) - .arg(QString(vMessage.data.toHex('.'))); + .arg(int(vMessage.can_id), 3, 16, QChar('0')) + .arg(mActionIdHexString) + .arg(QString(vMessage.data.toHex('.'))); LOG_DEBUG(logMessage); } /*! * \brief MessageInterpreter::logReceived - * \details Regarding the type of message logs the message recived. + * \details Regarding the type of message logs the message received. * \param vModel - the MAbstract model type */ void MessageInterpreter::logReceivedMessage(const Model::MAbstract &vModel) @@ -183,89 +188,87 @@ vPayload.clear(); int count = vData.length(); - LOG_EVENT(QString("%0").arg(vActionId)); - switch (vActionId) { // notice we are in transmit mode - case Gui::GuiActionType::ID_Acknow: // len: 0, can have zero len - break; // No data, Just registered + case Gui::GuiActionType::ID_Acknow: // len: 0, can have zero len + break; // No data, Just registered - case Gui::GuiActionType::ID_KeepAlive: // len: 255, can have any len - { - if ( count ) { // this message has a variable length - vPayload = Format::fromVariant(vData[0]); - } - LOG_EVENT(mSenderID + QString("CheckIn")); - } break; - case Gui::GuiActionType::ID_RawData: // len: 255, can have any len - { - if ( count ) { // this message has a variable length - vPayload = Format::fromVariant(vData[0]); - } - LOG_EVENT(mSenderID + QString("RawData")); + case Gui::GuiActionType::ID_KeepAlive: // len: 255, can have any len + if ( count ) { // this message has a variable length + vPayload = Format::fromVariant(vData[0]); + } + LOG_EVENT(mSenderID + QString("CheckIn")); + break; - } break; + case Gui::GuiActionType::ID_RawData: // len: 255, can have any len + if ( count ) { // this message has a variable length + vPayload = Format::fromVariant(vData[0]); + } + LOG_EVENT(mSenderID + QString("RawData")); + break; - case Gui::GuiActionType::ID_PowerOff: - { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload += Format::fromVariant(vData); - LOG_EVENT(AdjustPowerOffRequestData::toString(vData)); + case Gui::GuiActionType::ID_PowerOff: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload += Format::fromVariant(vData); + LOG_EVENT(AdjustPowerOffRequestData::toString(vData)); + break; - } break; + case Gui::GuiActionType::ID_AdjustBloodDialysateReq: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AdjustBloodDialysateRequestData::toString(vData)); + break; - case Gui::GuiActionType::ID_AdjustBloodDialysateReq: - { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload = Format::fromVariant(vData); - LOG_EVENT(AdjustBloodDialysateRequestData::toString(vData)); - } break; + case Gui::GuiActionType::ID_AdjustDurationReq: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AdjustDurationRequestData::toString(vData)); + break; - case Gui::GuiActionType::ID_AdjustDurationReq: - { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload = Format::fromVariant(vData); - LOG_EVENT(AdjustDurationRequestData::toString(vData)); - } break; + case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AdjustUltrafiltrationStateRequestData::toString(vData)); + break; - case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq: { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload = Format::fromVariant(vData); - LOG_EVENT(AdjustUltrafiltrationStateRequestData::toString(vData)); - } break; + case Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AdjustUltrafiltrationEditRequestData::toString(vData)); + break; - case Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq: { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload = Format::fromVariant(vData); - LOG_EVENT(AdjustUltrafiltrationEditRequestData::toString(vData)); - } break; + case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AdjustUltrafiltrationConfirmRequestData::toString(vData)); + break; - case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq: { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload = Format::fromVariant(vData); - LOG_EVENT(AdjustUltrafiltrationConfirmRequestData::toString(vData)); - } break; + case Gui::GuiActionType::ID_AdjustSalineReq: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AdjustSalineRequestData::toString(vData)); + break; - case Gui::GuiActionType::ID_AlarmSilenceReq: { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload = Format::fromVariant(vData); - LOG_EVENT(AlarmSilenceRequestData::toString(vData)); - } break; + case Gui::GuiActionType::ID_AlarmSilenceReq: + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AlarmSilenceRequestData::toString(vData)); + break; - case Gui::GuiActionType::ID_CreateTreatmentReq: { - if ( ! count ) { logInvalidLength(vActionId); return false; } - vPayload = Format::fromVariant(vData); - TreatmentParameters params; - params.fromVariantList(vData); - LOG_EVENT("GOT HERE"); - LOG_EVENT(params.toString()); - } break; + case Gui::GuiActionType::ID_CreateTreatmentReq: { + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + TreatmentParameters params; + params.fromVariantList(vData); + LOG_EVENT("GOT HERE"); + LOG_EVENT(params.toString()); + } break; - default: { - QString mActionIdHexString = Format::toHexString(vActionId); - LOG_DEBUG(mSenderID + tr("Unknown transmit Message with ID '%1'").arg(mActionIdHexString)); - ok = false; - } break; + default: { + QString mActionIdHexString = Format::toHexString(vActionId); + LOG_DEBUG(mSenderID + tr("Unknown transmit Message with ID '%1'").arg(mActionIdHexString)); + ok = false; + } break; } return ok; @@ -295,7 +298,7 @@ case eChlid_DG_HD : case eChlid_DG_UI : - // case eChlid_DG_Alarm: // commented out for now. Currentlyh there is no message in this category. + // case eChlid_DG_Alarm: // commented out for now. Currently there is no message in this category. case eChlid_DG_Sync : ok = interpretMessage_DG(vMessage, vData); break; default: @@ -333,6 +336,7 @@ case Gui::GuiActionType::ID_TreatmentRanges : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentRanges ); break; case Gui::GuiActionType::ID_PressureOcclusion : ok = notify(vMessage, vData, Gui::GuiActionType::ID_PressureOcclusion ); break; case Gui::GuiActionType::ID_TreatmentStates : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentStates ); break; + case Gui::GuiActionType::ID_Saline : ok = notify(vMessage, vData, Gui::GuiActionType::ID_Saline ); break; // ----- Events case Gui::GuiActionType::ID_HDOperationModeData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDOperationModeData ); break; @@ -348,15 +352,20 @@ // 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; + + // ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq); break; + // this message has been inherited from MAbstract and should use notify but since the response message is not standard can't use notify yet. + // when received gets payload len error and can't be interpreted. case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq : ok = adjustUltrafiltrationState (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp : ok = adjustUltrafiltrationEdit (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp : ok = adjustUltrafiltrationConfirm (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_CreateTreatmentRsp : ok = createTreatmentRespData (vMessage, vData); break; - // unhandles messages: these will only be logged as received message + // there has nothing been defined for these messages. - default : printUnhandled (vMessage ); break; + default : printUnhandled (vMessage ); break; } return ok; @@ -396,7 +405,7 @@ case Gui::GuiActionType::ID_DGTemperaturesData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGTemperaturesData ); break; case Gui::GuiActionType::ID_DGDebugText : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGDebugText ); break; - // unhandles messages: these will only be logged as received message + // unhandled messages: these will only be logged as received message // there has nothing been defined for these messages. default: printUnhandled (vMessage); @@ -534,7 +543,7 @@ Model::MAdjustUltrafiltrationStateResponse mData; ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); + LOG_EVENT(mData.toString()); mData.toVariantList(vData); emit didActionReceive(mData.data()); Index: sources/canbus/messageinterpreter.h =================================================================== diff -u -r7a4f59af7287d30e8790e6b580327684d4e02e55 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 7a4f59af7287d30e8790e6b580327684d4e02e55) +++ sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file messageinterpreter.h - * \author (last) Behrouz NemaiPour - * \date (last) 22-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 03-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 13-Dec-2019 * Index: sources/gui/guicontroller.cpp =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 guicontroller.cpp - * \author (last) Peter Lucia - * \date (last) 25-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 - * + * */ #include "guicontroller.h" @@ -74,16 +74,23 @@ // From OS : USB Drive has been removed physically. + // USB drive connect(&_ApplicationController, SIGNAL(didUSBDriveMount ()), this , SLOT( onUSBDriveMount ())); connect(&_ApplicationController, SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + // SD card + connect(&_ApplicationController, SIGNAL(didSDCardStateChange(bool,bool)), + this , SLOT( onSDCardStateChange(bool,bool))); + + // Export connect(&_ApplicationController, SIGNAL(didExport()), this , SLOT( onExport())); + // transmission fail connect(&_ApplicationController, SIGNAL(didFailedTransmit(Sequence)), - this , SLOT(didFailedTransmit(Sequence))); + this , SLOT( onFailedTransmit(Sequence))); // ---- Signal/Slots ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(_ApplicationController) @@ -257,6 +264,21 @@ // coco end /*! + * \brief GuiController::onSDCardStateChange + * \details emits didSDCardStateChange signal to notify other classes (GuiView) + * , the SD Card state has been changed. + * \param vIsReady - SdCard is Ready + * \param vIsReadOnly - SdCard is ReadOnly + */ +void GuiController::onSDCardStateChange(bool vIsReady, bool vIsReadOnly) +{ + // coco begin validated: This needs user interaction to plug-out the SD Card + // has been tested manually + emit didSDCardStateChange(vIsReady, vIsReadOnly); +} +// coco end + +/*! * \brief GuiController::onExport * \details The slot which will be called to notify the export is done * by emitting the didExport signal. @@ -284,10 +306,10 @@ /*! * \brief GuiController::didFailedTransmit - * Raises an HD communiation timeout alarm if communication with HD is lost. + * Raises an HD communication timeout alarm if communication with HD is lost. * \param seq - Sequence that failed to transmit */ -void GuiController::didFailedTransmit(Sequence seq) +void GuiController::onFailedTransmit(Sequence seq) { Q_UNUSED(seq); AlarmStatusData data; Index: sources/gui/guicontroller.h =================================================================== diff -u -r7a4f59af7287d30e8790e6b580327684d4e02e55 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/guicontroller.h (.../guicontroller.h) (revision 7a4f59af7287d30e8790e6b580327684d4e02e55) +++ sources/gui/guicontroller.h (.../guicontroller.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file guicontroller.h - * \author (last) Peter Lucia - * \date (last) 25-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 * @@ -68,8 +68,10 @@ void onUSBDriveMount (); // OS => UI void onUSBDriveRemove(); // OS => UI + void onSDCardStateChange(bool vIsReady, bool vIsReadOnly); // OS => UI + void onExport (); // OS => UI - void didFailedTransmit(Sequence seq); + void onFailedTransmit(Sequence seq); signals: void didActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG @@ -79,6 +81,8 @@ void didUSBDriveUmount(); void didUSBDriveRemove(); + void didSDCardStateChange(bool vIsReady, bool vIsReadOnly); + void didExportLog(); void didExport (); Index: sources/gui/guiglobals.cpp =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file guiglobals.cpp - * \author (last) Behrouz NemaiPour - * \date (last) 12-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 23-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 28-Oct-2019 * @@ -20,6 +20,7 @@ // Project #include "logger.h" #include "guiview.h" +#include "VEventSpy.h" // Project #include "MModel.h" @@ -36,6 +37,8 @@ #include "vtreatmenttime.h" #include "vtreatmentranges.h" #include "VHDOperationModeData.h" +#include "VTreatmentSalineData.h" +#include "VHDTreatmentStatesData.h" #include "VDGDrainPumpData.h" #include "VDGHeatersData.h" @@ -52,9 +55,10 @@ #include "vtreatmentadjustmentultrafiltrationedit.h" #include "vtreatmentadjustmentultrafiltrationconfirm.h" #include "VCreateTreatment.h" +#include "VTreatmentAdjustmentSaline.h" namespace Gui { - QQuickView *_viewer = nullptr; + MainView *_viewer = nullptr; /*! * \brief registerTypes @@ -70,6 +74,7 @@ qRegisterMetaType ("GuiRequestReasons"); + // Note that this Models are not used in the qml // but Qt needs them to be registered to be able to use them in between threads queue // by their metadata information. @@ -83,8 +88,12 @@ */ void registerQmlTypes() { - qmlRegisterType ("Gui.View" , 0, 1, "GuiView"); - qmlRegisterUncreatableType ("Gui.Actions", 0, 1, "GuiActions", QStringLiteral("Used only for enumerations no need to have an object")); + //using namespace View; + qmlRegisterType ("Gui.View" , 0, 1, "GuiView"); + qmlRegisterUncreatableType ("Gui.Actions" , 0, 1, "GuiActions" , QStringLiteral("Used only for enumerations no need to have an object")); + qmlRegisterSingletonType ("Gui.VEventSpy", 0, 1, "GuiEventSpy", [](QQmlEngine *, QJSEngine *) -> QObject * { + return &_VEventSpy; + }); REGISTER_VIEW_TYPES LOG_DEBUG("Views Registered"); @@ -95,20 +104,19 @@ * \details the GUI initializer/starter function */ bool startGui() { - _viewer = new QQuickView; + _viewer = new MainView; registerTypes(); registerQmlTypes(); - QObject::connect(_viewer, &QQuickView::statusChanged, qApp, [=](QQuickView::Status vStatus) { + QObject::connect(_viewer, &MainView::statusChanged, qApp, [=](MainView::Status vStatus) { // coco begin validated: this portion of the code is handling application initialization - // and if not initialized correctly will terminate the applicaiton . + // and if not initialized correctly will terminate the application . // So it had been manually tested. - LOG_DEBUG(__FUNCTION__); - bool ok = vStatus == QQuickView::Ready; + bool ok = vStatus == MainView::Ready; if (ok) { _viewer->show(); } - else if (vStatus == QQuickView::Error || vStatus == QQuickView::Null) { + else if (vStatus == MainView::Error || vStatus == MainView::Null) { for (const auto &error : _viewer->errors()) { LOG_DEBUG(QString("Application Terminated: %1").arg(error.toString())); } @@ -117,9 +125,9 @@ // coco end }, Qt::QueuedConnection ); - LOG_DEBUG("QQuickView Starting"); + LOG_DEBUG("MainView Starting"); _viewer->setSource(QStringLiteral("qrc:/main.qml")); - LOG_DEBUG("QQuickView started"); + LOG_DEBUG("MainView started"); return true; } } Index: sources/gui/guiglobals.h =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/guiglobals.h (.../guiglobals.h) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file guiglobals.h - * \author (last) Peter Lucia - * \date (last) 25-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 28-Oct-2019 - * + * */ #pragma once @@ -20,7 +20,19 @@ // Project namespace Gui { - extern QQuickView *_viewer; + class MainView : public QQuickView { + Q_OBJECT + + bool event(QEvent* vEvent) override + { + emit eventSpy(vEvent); + return QQuickView::event(vEvent); + } + signals: + void eventSpy(QEvent* vEvent); + }; + extern MainView *_viewer; + class GuiActions { Q_GADGET @@ -35,7 +47,7 @@ * *** So it has to be converted, each time it is referenced. ***\n * *** Since an enum is a constant value, ***\n * *** There is no point in calculating it on each reference. ***\n - * *** Therefore it is preffered to keep them as constant values ***\n + * *** Therefore it is preferred to keep them as constant values ***\n * *** Exactly as it is going to be shown/used in denali messages ***\n * *** then it can be compared exactly the way it is with no conversion.***\n */ @@ -64,16 +76,17 @@ ID_TreatmentRanges = 0x1A00, // 26 ID_PressureOcclusion = 0x0900, ID_TreatmentStates = 0x0F00, // 15 + ID_Saline = 0x2F00, // 47 ID_AlarmStatus = 0x0200, ID_AlarmTriggered = 0x0300, ID_AlarmCleared = 0x0400, - ID_AlarmSilenceReq = 0x2F00, // 47 - Not implemented yet on FW side - ID_AlarmSilenceRsp = 0x3000, // 48 - TODO: As per conversation with Sean this can be deleted. - ID_CreateTreatmentReq = 0x3500, // 53 - Not implemented yet on FW side ID_CreateTreatmentRsp = 0x3600, // 54 - Not implemented yet on FW side + ID_AlarmSilenceReq = 0x3200, // 50 - Not implemented yet on FW side + ID_AlarmSilenceRsp = 0x0000, // Needs to be removed. + ID_HDOperationModeData = 0x2500, // 37 ID_DGROPumpData = 0x1F00, // 31 @@ -100,6 +113,10 @@ ID_AdjustDurationReq = 0x1600, // 22 ID_AdjustDurationRsp = 0x1B00, // 27 + + ID_AdjustSalineReq = 0x1200, // 18 + ID_AdjustSalineRsp = 0x1400, // 20 + }; enum class GuiActionsData_Enum /*: quint8 QML doesn't support*/ { @@ -116,6 +133,12 @@ Timeout = 0x01, }; + enum Saline_States { // FW currently doesn't have enum for Saline Bolus when provided better to be replaced. + SALINE_STOP_STATE = 0, ///< Saline is not delivered + SALINE_START_STATE , ///< Saline being Delivered + SALINE_DISABLE_STATE , ///< Saline cumulative volume delivery has reached the maximum + }; + Q_ENUM(GuiActionsType_Enum) Q_ENUM(GuiActionsData_Enum) @@ -129,6 +152,9 @@ #include "HDDefs.h" Q_ENUM(HD_Op_Modes) Q_ENUM(UF_Adjustments) + Q_ENUM(Treatment_States) + Q_ENUM(UF_States) + Q_ENUM(Saline_States) #include "DGDefs.h" Q_ENUM(DG_Op_Modes) @@ -147,8 +173,10 @@ typedef GuiActions::DG_Op_Modes GuiDGOpModes; typedef GuiActions::UF_Adjustments GuiUFAdjustment; + typedef GuiActions::Treatment_States GuiTreatment_States; + typedef GuiActions::UF_States GuiUFStates; + typedef GuiActions::Saline_States GuiSalineStates; - void registerTypes(); void registerQmlTypes(); Index: sources/gui/qml/components/NotificationBar.qml =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file NotificationBar.qml - * \author (last) Peter Lucia - * \date (last) 01-Jul-2020 + * \author (last) Behrouz NemaiPour + * \date (last) 06-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 30-Mar-2020 * Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -rc71deaab48699cffdf9db816dfac2778d79c2238 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision c71deaab48699cffdf9db816dfac2778d79c2238) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 Slider.qml * \author (last) Behrouz NemaiPour * \date (last) 04-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 18-Mar-2020 - * + * */ // Qt Index: sources/gui/qml/components/TouchRect.qml =================================================================== diff -u -r305d411b4bc617d858075f5750dea487d707bebb -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision 305d411b4bc617d858075f5750dea487d707bebb) +++ sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 TouchRect.qml * \author (last) Behrouz NemaiPour * \date (last) 15-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 18-Oct-2019 - * + * */ // Qt Index: sources/gui/qml/dialogs/NotificationDialog.qml =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file NotificationDialog.qml - * \author (last) Peter Lucia - * \date (last) 26-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 * \author (original) Peter Lucia * \date (original) 02-Jun-2020 * @@ -80,6 +80,7 @@ anchors.centerIn: _titleBar; } } + Text { id: _desc objectName: "_NotificationDialog_Description" color: Colors.textMain @@ -108,6 +109,7 @@ } } + TouchRect { id : _dismiss width: _root.width / 3; text.text: qsTr("SILENCE") Index: sources/gui/qml/globals/Colors.qml =================================================================== diff -u -r2d09ae36f6b791e0415a87b6f14f582d4b434d7d -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 2d09ae36f6b791e0415a87b6f14f582d4b434d7d) +++ sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 Colors.qml * \author (last) Peter Lucia * \date (last) 01-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 17-Oct-2019 - * + * */ // Qt Index: sources/gui/qml/globals/Fonts.qml =================================================================== diff -u -rc8eb6d0e29f8951a793b2f52d11a08b9902470ee -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision c8eb6d0e29f8951a793b2f52d11a08b9902470ee) +++ sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 Fonts.qml * \author (last) Peter Lucia * \date (last) 06-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 17-Oct-2019 - * + * */ // Qt Index: sources/gui/qml/globals/Variables.qml =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 Variables.qml - * \author (last) Peter Lucia - * \date (last) 25-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 10-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 09-Oct-2019 - * + * */ // Qt @@ -118,4 +118,8 @@ // - Vitals readonly property string unitTextBloodPressure : qsTr("mmHg") readonly property string unitTextHeartBeat : qsTr("BPM" ) + // - Fluid + readonly property string unitTextSaline : qsTr("mL") + readonly property string unitTextHeparin : qsTr("mL") + } Index: sources/gui/qml/main.qml =================================================================== diff -u -r2c35a3fa17eef76c7a47578974b928c03f67c83d -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/main.qml (.../main.qml) (revision 2c35a3fa17eef76c7a47578974b928c03f67c83d) +++ sources/gui/qml/main.qml (.../main.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file main.qml - * \author (last) Peter Lucia - * \date (last) 26-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 * @@ -76,7 +76,6 @@ ) break; } - } } @@ -88,7 +87,6 @@ _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; @@ -104,6 +102,7 @@ _alarm_dialog.visible = false; } } + VPowerOff { id: vPowerOff } VHDOperationMode { id: vHDOperationMode } VTreatmentBloodFlow { id: vTreatmentBloodFlow } @@ -228,6 +227,24 @@ font.pixelSize: 14 } + Rectangle { // TEST : SD-Card not present should be handled with better indication(s). + color : ! _GuiView.sdIsReady ? "red" : _GuiView.sdIsReadOnly ? "gray" : "green" + anchors { + right : parent.right + bottom : parent.bottom + bottomMargin: 35 + rightMargin: 10 + } + width : 25 + height: 25 + radius: width + Image { id: _imageMicrosd + anchors.fill: parent + source: "qrc:/images/iMicroSD" + } + visible: true // ! _GuiView.sdIsReady || _GuiView.sdIsReadOnly + } + function getRootTextFromAlarmLevel(level) { let root_color = ""; let text_color = ""; Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -r810e4b12507feba688c3ea2ab045040214661298 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 810e4b12507feba688c3ea2ab045040214661298) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -1,23 +1,26 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file TreatmentStack.qml - * \author (last) Behrouz NemaiPour - * \date (last) 18-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 18-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 27-Jan-2020 - * + * */ // Qt import QtQuick 2.12 // Project -import VTreatmentRanges 0.1 +import Gui.Actions 0.1 +import VTreatmentRanges 0.1 +import VTreatmentAdjustmentSaline 0.1 +import VHDTreatmentStates 0.1 // Qml imports import "qrc:/globals" @@ -34,8 +37,15 @@ stackView.initialItem : _treatmentHome - VTreatmentRanges { id: vTreatmentRanges } + // 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 + } + // Components MainMenu { id: _treatmentMenu y : -Variables.mainMenuHeight position : MainMenu.Position.Top @@ -63,7 +73,10 @@ _treatmentAdjustmentDuration.open() } onSectionUltrafiltrationClicked: { - if ( vTreatmentAdjustmentUltrafiltrationState.isPaused ) { + if ( + vTreatmentAdjustmentUltrafiltrationState.isPaused || // comes from the treatment adjustment + vHDTreatmentStates.ufPaused // comes from the broadcast Treatment States salineState field + ) { _treatmentAdjustmentUltrafiltrationPaused.open() } else { _treatmentAdjustmentUltrafiltrationStart .open() @@ -217,10 +230,10 @@ } } - Connections { target: vCreateTreatment onShowConfirm : { push(_treatmentConfirm) } onShowPrime : { push(_treatmentPrime) } onShowBegin : { push(_treatmentBegin) } } + } Index: sources/main.h =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/main.h (.../main.h) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/main.h (.../main.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 main.h - * \author (last) Peter Lucia - * \date (last) 26-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 30-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 28-Oct-2019 - * + * */ #pragma once Index: sources/model/MModel.h =================================================================== diff -u -ra19862d191c2501faa4e8cde64804ef18b80c6b3 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/model/MModel.h (.../MModel.h) (revision a19862d191c2501faa4e8cde64804ef18b80c6b3) +++ sources/model/MModel.h (.../MModel.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -2,13 +2,14 @@ * * 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. + * 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 models.h - * \date 3/4/2020 - * \author Behrouz NematiPour + * \file MModel.h + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 + * \author (original) Behrouz NemaiPour + * \date (original) 02-Jul-2020 * */ #pragma once @@ -27,6 +28,7 @@ #include "MTreatmentPressureOcclusionData.h" #include "MTreatmentRangesData.h" #include "MTreatmentStatesData.h" +#include "MTreatmentSalineData.h" #include "MDGDrainPumpData.h" #include "MDGHeatersData.h" @@ -51,6 +53,7 @@ #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" +#include "MTreatmentAdjustSalineResponse.h" /*! * \brief Message interpretation instruction @@ -67,7 +70,7 @@ * \endcode * * 3 - MSG Payload Len : - * Add a line in the "messageglobals.h" in paloadLen hash table + * Add a line in the "messageglobals.h" in payloadLen hash table * to define the required payload length of the message * * 4 - Model Implementation : @@ -130,6 +133,7 @@ REGISTER_METATYPE( AlarmTriggeredData ) \ REGISTER_METATYPE( AlarmClearedData ) \ REGISTER_METATYPE( TreatmentStatesData ) \ + REGISTER_METATYPE( TreatmentSalineData ) \ REGISTER_METATYPE( HDOperationModeData ) \ \ REGISTER_METATYPE( DGROPumpData ) \ @@ -144,19 +148,21 @@ \ REGISTER_METATYPE( HDDebugTextData ) \ REGISTER_METATYPE( DGDebugTextData ) \ - \ + /* Request */ \ REGISTER_METATYPE( AdjustBloodDialysateRequestData ) \ REGISTER_METATYPE( AdjustDurationRequestData ) \ REGISTER_METATYPE( AdjustUltrafiltrationStateRequestData ) \ REGISTER_METATYPE( AdjustUltrafiltrationEditRequestData ) \ REGISTER_METATYPE( AdjustUltrafiltrationConfirmRequestData ) \ - \ + REGISTER_METATYPE( AdjustSalineRequestData ) \ + /* Response */ \ REGISTER_METATYPE( AdjustBloodDialysateResponseData ) \ REGISTER_METATYPE( AdjustDurationResponseData ) \ REGISTER_METATYPE( AdjustUltrafiltrationStateResponseData ) \ REGISTER_METATYPE( AdjustUltrafiltrationEditResponseData ) \ REGISTER_METATYPE( AdjustUltrafiltrationConfirmResponseData ) \ - REGISTER_METATYPE( TreatmentData ) + REGISTER_METATYPE( TreatmentData ) \ + REGISTER_METATYPE( AdjustSalineResponseData ) //===============================================================================// #define ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(vSOURCE) \ @@ -171,6 +177,7 @@ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AlarmTriggeredData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AlarmClearedData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, TreatmentStatesData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, TreatmentSalineData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, HDOperationModeData ) \ \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DGROPumpData ) \ @@ -185,19 +192,21 @@ \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, HDDebugTextData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DGDebugTextData ) \ - \ + /* Response */ \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationStateResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustDurationResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationEditResponseData ) \ - ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmResponseData ) -//--------------------------------------------------------------------------------// + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmResponseData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustSalineResponseData ) +// /* Request */ ---------------------------------------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_CONNECTIONS(vSOURCE) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmRequestData ) + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_CONNECTION(vSOURCE, AdjustSalineRequestData ) //===============================================================================// #define ACTION_RECEIVE_MODEL_BRIDGE_DEFINITIONS \ ACTION_RECEIVE_BRIDGE_DEFINITION( BloodFlowData ) \ @@ -211,6 +220,7 @@ ACTION_RECEIVE_BRIDGE_DEFINITION( AlarmTriggeredData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AlarmClearedData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( TreatmentStatesData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( TreatmentSalineData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( HDOperationModeData ) \ \ ACTION_RECEIVE_BRIDGE_DEFINITION( DGROPumpData ) \ @@ -225,34 +235,37 @@ \ ACTION_RECEIVE_BRIDGE_DEFINITION( HDDebugTextData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( DGDebugTextData ) \ - \ + /* Response */ \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationStateResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustDurationResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationEditResponseData ) \ - ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmResponseData ) - -//--------------------------------------------------------------------------------// + ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmResponseData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustSalineResponseData ) +// /* Request */ ---------------------------------------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmRequestData ) -//--------------------------------------------------------------------------------// + ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION( AdjustSalineRequestData ) +// /* Request */ ----------------------- NoEmit --------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS_NOEMIT \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationConfirmRequestData ) -//--------------------------------------------------------------------------------// + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_NOEMIT( AdjustSalineRequestData ) +// /* Request */ ----------------------- public --------------------------// #define ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS_PUBLIC \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustBloodDialysateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustDurationRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationStateRequestData ) \ ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationEditRequestData ) \ - ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationConfirmRequestData ) + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustUltrafiltrationConfirmRequestData ) \ + ADJUST_TRANSMT_BRIDGE_DEFINITION_PUBLIC( AdjustSalineRequestData ) //===============================================================================// #define ACTION_RECEIVE_SIGNALS \ ACTION_RECEIVE_SIGNAL( BloodFlowData ) \ @@ -266,6 +279,7 @@ ACTION_RECEIVE_SIGNAL( AlarmTriggeredData ) \ ACTION_RECEIVE_SIGNAL( AlarmClearedData ) \ ACTION_RECEIVE_SIGNAL( TreatmentStatesData ) \ + ACTION_RECEIVE_SIGNAL( TreatmentSalineData ) \ ACTION_RECEIVE_SIGNAL( HDOperationModeData ) \ \ ACTION_RECEIVE_SIGNAL( DGROPumpData ) \ @@ -280,12 +294,13 @@ \ ACTION_RECEIVE_SIGNAL( HDDebugTextData ) \ ACTION_RECEIVE_SIGNAL( DGDebugTextData ) \ - \ + /* Response */ \ ACTION_RECEIVE_SIGNAL( AdjustUltrafiltrationStateResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustDurationResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustUltrafiltrationEditResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustUltrafiltrationConfirmResponseData ) \ - ACTION_RECEIVE_SIGNAL( TreatmentParametersRespData ) + ACTION_RECEIVE_SIGNAL( TreatmentParametersRespData ) \ + ACTION_RECEIVE_SIGNAL( AdjustSalineResponseData ) //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// Index: sources/storage/filehandler.cpp =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/storage/filehandler.cpp (.../filehandler.cpp) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/storage/filehandler.cpp (.../filehandler.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -7,7 +7,7 @@ * * \file filehandler.cpp * \author (last) Behrouz NematiPour - * \date (last) 22-Apr-2020 + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 * @@ -21,6 +21,7 @@ #include #include #include +#include // Project #include "logger.h" @@ -38,9 +39,21 @@ */ void FileHandler::errOut(const QString &vMessage) { - QString mCritical = vMessage; - QTextStream err(stderr); - err << mCritical << endl; + static uint count; + static QString mCritical; + // coco begin validated : This has been manually test. Needs file system access to produce errors for hundred times. + if (mCritical != vMessage || !(count % 1000)) { + // coco end + count = 0; + mCritical = vMessage; + QTextStream err(stderr); + err << "FS" << " " + << QDate::currentDate().toString("yyyy_MM_dd") << " " + << QTime::currentTime().toString("HH:mm:ss" ) << " " + << mCritical + << endl; + } + ++count; } /*! @@ -58,11 +71,11 @@ QFile::OpenMode openMode = vAppend ? QFile::Text | QFile::Append : QFile::Text | QFile::WriteOnly; - // coco begin validated : This has been manually test. Needs filesystem access to make file the way it can't be opened for writing. + // coco begin validated : This has been manually test. Needs file system access to make file the way it can't be opened for writing. if (! file.open(openMode)) { QString msg = QString("Can't open file for write (%1).Possible corrupted file system").arg(vFileName); + // here can't use LOG_XXXX because if the folder can't be created then the log can't be written. errOut (msg); - LOG_DEBUG(msg); return false; } // coco end @@ -85,8 +98,8 @@ QFile file(vFileName); if (! file.open(QFile::Text | QFile::ReadOnly)) { QString msg = QString("Can't open file for read (%1).Possible corrupted file system").arg(vFileName); + // here can't use LOG_XXXX because if the folder can't be created then the log can't be written. errOut (msg); - LOG_DEBUG(msg); return false; } QTextStream in(&file); @@ -182,15 +195,15 @@ if (fileTime.date() <= vDateOlderThan) { if (QFile::remove(fileName)) { ++countRemoved; - LOG_DEBUG(QString("%1 File(s) %2 removed").arg(countRemoved).arg(fileName)); + errOut(QString("%1 File(s) %2 removed").arg(countRemoved).arg(fileName)); } else { - LOG_DEBUG(QString("Can't delete file : ") + fileName); + errOut(QString("Can't delete file : ") + fileName); } } } else { - LOG_DEBUG(QString("Can't get last modified date of file : ") + fileName); + errOut(QString("Can't get last modified date of file : ") + fileName); } // coco end } @@ -202,18 +215,47 @@ * \brief FileHandler::makeFolder * \details Create the folder vFolder if it doesn't exist. * \param vFolder - the folder to create - * \return true on successfull creation + * \return true on successful creation */ bool FileHandler::makeFolder(const QString &vFolder) { QDir dir(vFolder); if ( ! dir.exists(vFolder) ) { if ( ! dir.mkpath(vFolder) ) { QString msg = "Can't create folder " + vFolder; - qDebug() << msg; - LOG_DEBUG(msg); + // here can't use LOG_XXXX because if the folder can't be created then the log can't be written. + errOut(msg); return false; } } return true; } + +/*! + * \brief FileHandler::isMounted + * \param vPath - the rootPath of the device mount point + * \return true - if the given vPath is not empty and is in list of mounted devices + * if so it also has to be ready and valid. + */ +bool FileHandler::isMounted(const QString &vPath, bool *vIsReadOnly) +{ + // coco begin validated: Needed User Interaction to make the device not ready so tested manually + bool mounted = false; + // removing the extra '/' from the vPath if there is to be able to compare to the root path of the storage + QString path = vPath.trimmed(); + if (path.isEmpty()) return false; + int lastIndex = path.size() - 1; + if (path.at(lastIndex) == "/") path.remove(lastIndex, 1); + // check to see if the path in the list of mounted rootPaths + foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) { + if (storage.isValid() && storage.isReady()) { + if ( storage.rootPath() == path ) { + if (vIsReadOnly) *vIsReadOnly = storage.isReadOnly(); + mounted = true; + break; + } + } + } + return mounted; +} +// coco end Index: sources/storage/filehandler.h =================================================================== diff -u -r7a4f59af7287d30e8790e6b580327684d4e02e55 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/storage/filehandler.h (.../filehandler.h) (revision 7a4f59af7287d30e8790e6b580327684d4e02e55) +++ sources/storage/filehandler.h (.../filehandler.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 filehandler.h * \author (last) Behrouz NematiPour - * \date (last) 02-Apr-2020 + * \date (last) 25-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 - * + * */ #pragma once @@ -43,5 +43,6 @@ static int copyFolder (const QString &vSource, const QString &vDestination); static int removeFiles(const QStringList &vFolders, const QStringList &vNameFilter, const QDate &vDateOlderThan); static bool makeFolder (const QString &vFolder); + static bool isMounted (const QString &vPath, bool *vIsReadOnly = nullptr); }; } Index: sources/storage/storageglobals.cpp =================================================================== diff -u -r9551959461d534dc624f0cbcca0e6f953844fb16 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/storage/storageglobals.cpp (.../storageglobals.cpp) (revision 9551959461d534dc624f0cbcca0e6f953844fb16) +++ sources/storage/storageglobals.cpp (.../storageglobals.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 storageglobals.cpp * \author (last) Behrouz NematiPour - * \date (last) 07-May-2020 + * \date (last) 30-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 02-Jan-2020 - * + * */ // Qt #include Index: sources/storage/storageglobals.h =================================================================== diff -u -r7a4f59af7287d30e8790e6b580327684d4e02e55 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/storage/storageglobals.h (.../storageglobals.h) (revision 7a4f59af7287d30e8790e6b580327684d4e02e55) +++ sources/storage/storageglobals.h (.../storageglobals.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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 storageglobals.h * \author (last) Behrouz NematiPour - * \date (last) 07-May-2020 + * \date (last) 30-Jul-2020 * \author (original) Behrouz NematiPour * \date (original) 02-Jan-2020 - * + * */ #pragma once Index: sources/view/vview.h =================================================================== diff -u -r3b4fd62b510f6b09d663e35b0cadc93050e6a6f0 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- sources/view/vview.h (.../vview.h) (revision 3b4fd62b510f6b09d663e35b0cadc93050e6a6f0) +++ sources/view/vview.h (.../vview.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file vview.h - * \author (last) Behrouz NemaiPour - * \date (last) 12-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 13-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 10-Mar-2020 - * + * */ #pragma once @@ -102,7 +102,9 @@ REGISTER_TYPE( VTreatmentPressureOcclusion ) \ REGISTER_TYPE( VTreatmentTime ) \ REGISTER_TYPE( VTreatmentRanges ) \ + REGISTER_TYPE( VTreatmentSaline ) \ REGISTER_TYPE( VHDOperationMode ) \ + REGISTER_TYPE( VHDTreatmentStates ) \ \ REGISTER_TYPE( VDGDrainPump ) \ REGISTER_TYPE( VDGHeaters ) \ @@ -119,5 +121,7 @@ REGISTER_TYPE( VTreatmentAdjustmentUltrafiltrationState ) \ REGISTER_TYPE( VTreatmentAdjustmentUltrafiltrationEdit ) \ REGISTER_TYPE( VTreatmentAdjustmentUltrafiltrationConfirm ) \ - REGISTER_TYPE( VCreateTreatment ) + REGISTER_TYPE( VCreateTreatment ) \ + REGISTER_TYPE( VTreatmentAdjustmentSaline ) \ + //--------------------------------------------------------------------------------// Index: unittests/tst_messaging.cpp =================================================================== diff -u -rf3b164487b1648637f5dd9a306cb6ade763d27c9 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision f3b164487b1648637f5dd9a306cb6ade763d27c9) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file tst_messaging.cpp - * \author (last) Peter Lucia - * \date (last) 06-Jul-2020 + * \author (last) Behrouz NematiPour + * \date (last) 23-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 * @@ -781,13 +781,27 @@ } /*! - * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationConfirmReq - * \details Tests MessageInterpreter interpretMessage to handle AdjustUltrafiltrationConfirmReq message type + * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustSalineReq + * \details Tests MessageInterpreter interpretMessage to handle ID_AdjustSalineReq message type * if data is empty (count==0) */ -void tst_messaging::tst_MessageInterpreter_interpretMessage_canbusFaultCountData() +void tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustSalineReq() { Can::MessageInterpreter iMsg; + QByteArray payload; + // if the payload is empty the len is not valid and should return false and empty payload + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustSalineReq, {}, payload)); + QVERIFY(payload.isEmpty()); +} + +/*! + * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_CANBusFaultCount + * \details Tests MessageInterpreter interpretMessage to handle ID_CANBusFaultCount message type + * if data is empty (count==0) + */ +void tst_messaging::tst_MessageInterpreter_interpretMessage_CANBusFaultCount() +{ + Can::MessageInterpreter iMsg; Can::Message msg; msg.actionId = Gui::GuiActionType::ID_CANBusFaultCount; msg.data = {}; @@ -958,4 +972,3 @@ Can::Sequence seq = 1; dMsg.actionTransmit(Gui::GuiActionType::ID_KeepAlive, data, seq); } - Index: unittests/tst_messaging.h =================================================================== diff -u -r3b4fd62b510f6b09d663e35b0cadc93050e6a6f0 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- unittests/tst_messaging.h (.../tst_messaging.h) (revision 3b4fd62b510f6b09d663e35b0cadc93050e6a6f0) +++ unittests/tst_messaging.h (.../tst_messaging.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file tst_messaging.h - * \author (last) Peter Lucia - * \date (last) 06-Jul-2020 + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 * @@ -92,8 +92,9 @@ void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationStateReq(); void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationEditReq(); void tst_MessageInterpreter_interpretMessage_AdjustUltrafiltrationConfirmReq(); + void tst_MessageInterpreter_interpretMessage_AdjustSalineReq(); - void tst_MessageInterpreter_interpretMessage_canbusFaultCountData(); + void tst_MessageInterpreter_interpretMessage_CANBusFaultCount(); void tst_MessageInterpreter_interpretMessage_String(); void tst_MessageInterpreter_interpretMessage_DG_Unhandled(); Index: unittests/tst_models.cpp =================================================================== diff -u -r3b4fd62b510f6b09d663e35b0cadc93050e6a6f0 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- unittests/tst_models.cpp (.../tst_models.cpp) (revision 3b4fd62b510f6b09d663e35b0cadc93050e6a6f0) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file tst_models.cpp - * \author (last) Peter Lucia - * \date (last) 07-Jul-2020 + * \author (last) Behrouz NematiPour + * \date (last) 13-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 * @@ -38,10 +38,12 @@ #include "MTreatmentFlowsData.h" #include "MTreatmentTimeData.h" #include "MTreatmentPressureOcclusionData.h" +#include "MTreatmentSalineData.h" #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" +#include "MTreatmentAdjustSalineResponse.h" #include "MAlarmStatusData.h" #include "MAlarmTriggered.h" @@ -691,7 +693,7 @@ void tst_models::tst_DGLoadCellReadingsData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -915,7 +917,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")); @@ -981,7 +983,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")); @@ -1047,7 +1049,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")); @@ -1159,7 +1161,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")); @@ -1469,7 +1471,31 @@ { Model::TreatmentParametersResp mData; +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentSalineBolusData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mCumulative ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentSalineBolusData() { + Model::MTreatmentSaline mData; + QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); @@ -1479,69 +1505,14 @@ Q_UNUSED(ok) #ifdef CONSOLEOUT - qDebug() << "index: " << index << "\n" - << "errorIndex: " << errorIndex << "\n" - << "startIndex: " << startIndex << "\n" - << "ok: " << ok << "\n" - << "data: " << data; + 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.requestValid; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 2: { index = index * sizeof mData._data.bloodFlowRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 3: { index = index * sizeof mData._data.dialysateFlowRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 4: { index = index * sizeof mData._data.duration; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 5: { index = index * sizeof mData._data.heparinDispensingRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 6: { index = index * sizeof mData._data.heparinBolusVolume; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 7: { index = index * sizeof mData._data.heparinStopTime; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 8: { index = index * sizeof mData._data.salineBolus; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 9: { index = index * sizeof mData._data.acidConcentrate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 10: { index = index * sizeof mData._data.bicarbonateConcentrate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 11: { index = index * sizeof mData._data.dialyzerType; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 12: { index = index * sizeof mData._data.dialysateTemp; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 13: { index = index * sizeof mData._data.arterialPressureLimitLow; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 14: { index = index * sizeof mData._data.arterialPressureLimitHigh; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 15: { index = index * sizeof mData._data.venousPressureLimitLow; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 16: { index = index * sizeof mData._data.venousPressureLimitHigh; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 17: { index = index * sizeof mData._data.bloodPressureMeasureInterval; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 18: { index = index * sizeof mData._data.rinsebackFlowRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCumulative; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mDelivered ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -1654,5 +1625,48 @@ QVERIFY(data.rinsebackFlowRate == tempData.rinsebackFlowRate); } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MSalineBolusResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mReason ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MSalineBolusResponse() { + Model::MAdjustSalineResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; } } Index: unittests/tst_models.h =================================================================== diff -u -r97fc44f948bd39ed0b4238558a16bf99f750bf5e -r7edcaf054062754370e0abd165f17ca9941b7d07 --- unittests/tst_models.h (.../tst_models.h) (revision 97fc44f948bd39ed0b4238558a16bf99f750bf5e) +++ unittests/tst_models.h (.../tst_models.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file tst_models.h - * \author (last) Peter Lucia - * \date (last) 01-Jul-2020 + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 * @@ -28,7 +28,6 @@ explicit tst_models(QObject *parent = nullptr); private slots: - void tst_MTreatmentRanges_data (); void tst_MTreatmentRanges (); @@ -53,7 +52,6 @@ void tst_MAdjustUltrafiltrationConfirmResponse_data (); void tst_MAdjustUltrafiltrationConfirmResponse (); - // - Data Messages void tst_DGROPumpData_data(); void tst_DGROPumpData(); @@ -109,3 +107,10 @@ void tst_MTreatmentParametersResp_fromVariantList(); }; + + void tst_MTreatmentSalineBolusData_data(); + void tst_MTreatmentSalineBolusData(); + + void tst_MSalineBolusResponse_data(); + void tst_MSalineBolusResponse(); +}; Index: unittests/tst_views.cpp =================================================================== diff -u -r3b4fd62b510f6b09d663e35b0cadc93050e6a6f0 -r7edcaf054062754370e0abd165f17ca9941b7d07 --- unittests/tst_views.cpp (.../tst_views.cpp) (revision 3b4fd62b510f6b09d663e35b0cadc93050e6a6f0) +++ unittests/tst_views.cpp (.../tst_views.cpp) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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) Behrouz NemaiPour * \date (last) 23-Jun-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 - * + * */ #include "tst_views.h" Index: unittests/tst_views.h =================================================================== diff -u -r97fc44f948bd39ed0b4238558a16bf99f750bf5e -r7edcaf054062754370e0abd165f17ca9941b7d07 --- unittests/tst_views.h (.../tst_views.h) (revision 97fc44f948bd39ed0b4238558a16bf99f750bf5e) +++ unittests/tst_views.h (.../tst_views.h) (revision 7edcaf054062754370e0abd165f17ca9941b7d07) @@ -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.h - * \author (last) Behrouz NemaiPour - * \date (last) 23-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 - * + * */ #pragma once @@ -46,4 +46,3 @@ void VCreateTreatment_load_parameter_ranges(); void VCreateTreatment_check_init(); }; -