Index: denali.pro.user =================================================================== diff -u -r805119c460b4a266d6401c8705f4427e7fbe270f -r426208cdb707400759bdc663b871ece9d1208aed --- denali.pro.user (.../denali.pro.user) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) +++ denali.pro.user (.../denali.pro.user) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -352,7 +352,7 @@ 1 false - 1 1 + 3768 false true @@ -373,7 +373,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 @@ -388,7 +388,7 @@ false false - true + false true @@ -990,7 +990,7 @@ denali Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Project/application/denali.pro - 1 1 + 3768 false true @@ -999,7 +999,7 @@ true false - /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release 1 Index: denali.qrc =================================================================== diff -u -r9e57e4c990afab0996def98521d4f9fee83f96d8 -r426208cdb707400759bdc663b871ece9d1208aed --- denali.qrc (.../denali.qrc) (revision 9e57e4c990afab0996def98521d4f9fee83f96d8) +++ denali.qrc (.../denali.qrc) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -63,5 +63,6 @@ sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml sources/gui/qml/pages/treatment/sections/TreatmentFluid.qml sources/gui/qml/pages/treatment/sections/TreatmentInfusion.qml + sources/gui/qml/pages/treatment/sections/TreatmentTime.qml Index: sources/canbus/messageglobals.h =================================================================== diff -u -r732bc047743c99a157cf147f5313194867c1f5e3 -r426208cdb707400759bdc663b871ece9d1208aed --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 732bc047743c99a157cf147f5313194867c1f5e3) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -41,6 +41,7 @@ {Gui::GuiActionType::BloodFlow , 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::DialysateInletFlow , 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::DialysateOutletFlow, 7 * 4 }, // 7 parameters each 4bytes + {Gui::GuiActionType::TreatmentTime , 3 * 4 }, // 3 parameters each 4bytes {Gui::GuiActionType::String , 255 }, {Gui::GuiActionType::Acknow , 0 }, }; Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r9391d4058233e096350d9dc3ced79aed8ed93b38 -r426208cdb707400759bdc663b871ece9d1208aed --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 9391d4058233e096350d9dc3ced79aed8ed93b38) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -14,6 +14,7 @@ #include "messageinterpreter.h" // Qt +#include // Project #include "logger.h" @@ -177,6 +178,10 @@ ok = dialysateOutletFlowData (vMessage, vData); break; + case Gui::GuiActionType::TreatmentTime: + ok = treatmentTime (vMessage, vData); + break; + case Gui::GuiActionType::AlarmStatus: ok = alarmStatus (vMessage, vData); break; @@ -466,6 +471,38 @@ } /*! + * \brief MessageInterpreter::getDialysateOutletFlowData + * \param vMessage - The vMessage of type Message which contains all the data, require to be interpreted. + * \param vTotal - Total treatment time in sec + * \param vElapsed - Elapsed treatment time in sec + * \param vRemaining - Remaining treatment time in sec + * \return true if the message can be successfully converted to the Blood Flow data elements. + */ +bool MessageInterpreter::getTreatmentTime( + const Message &vMessage , + Types::U32 &vTotal , + Types::U32 &vElapsed , + Types::U32 &vRemaining ) + +{ + if ( vMessage.actionId != Gui::GuiActionType::TreatmentTime ) { + return false; + } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::TreatmentTime] ) { + QString mActionIdHexString = Format::toHexString(vMessage.actionId); + LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); + return false; + } + + int index = 0; // message data start position + Types::getValue<>(vMessage.data, index, vTotal ); + Types::getValue<>(vMessage.data, index, vElapsed ); + Types::getValue<>(vMessage.data, index, vRemaining ); + + return true; +} + +/*! * \brief MessageInterpreter::dialysateOutletFlowData * \details Used the getDialysateOutletFlowData method and converts each parameter * in vData of type QVaranitList, to be used in the GUI @@ -515,6 +552,39 @@ } /*! + * \brief MessageInterpreter::treatmentTime + * \details Used the getTreatmentTime method and converts each parameter + * in vData of type QVaranitList, to be used in the GUI + * Also logs the data + * \param vMessage - The message + * \param vData - the output data + * \return return value of the method getDialysateOutletFlowData + */ +bool MessageInterpreter::treatmentTime(const Message &vMessage, QVariantList &vData) +{ + bool ok; + Types::U32 mTotal ; + Types::U32 mElapsed ; + Types::U32 mRemaining ; + ok = getTreatmentTime(vMessage, + mTotal , + mElapsed , + mRemaining ); + QString msg = QString("Treatment Time(%1, %2, %3)") + .arg(mTotal .value) + .arg(mElapsed .value) + .arg(mRemaining .value); + LOG_DATUM(msg); + + if (ok) { + vData += mTotal .value; + vData += mElapsed .value; + vData += mRemaining .value; + } + return ok; +} + +/*! * \brief MessageInterpreter::getAlarmStatus * \details This method interprets AlarmStatus message data * in vMessage of type Message. Index: sources/canbus/messageinterpreter.h =================================================================== diff -u -r732bc047743c99a157cf147f5313194867c1f5e3 -r426208cdb707400759bdc663b871ece9d1208aed --- sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 732bc047743c99a157cf147f5313194867c1f5e3) +++ sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -72,6 +72,10 @@ Types::Flags &vFlags ) __attribute_warn_unused_result__; bool alarmStatus (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; + // ---- Treatment Time + bool getTreatmentTime (const Message &vMessage, + Types::U32 &vTotal, Types::U32 &vElapsed, Types::U32 &vRemaining); + bool treatmentTime (const Message &vMessage, QVariantList &vData); public: explicit MessageInterpreter(QObject *parent = nullptr); Index: sources/gui/guiglobals.h =================================================================== diff -u -r732bc047743c99a157cf147f5313194867c1f5e3 -r426208cdb707400759bdc663b871ece9d1208aed --- sources/gui/guiglobals.h (.../guiglobals.h) (revision 732bc047743c99a157cf147f5313194867c1f5e3) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -35,6 +35,7 @@ BloodFlow = 0x0500, DialysateInletFlow = 0x0800, DialysateOutletFlow = 0x0B00, + TreatmentTime = 0x0D00, AlarmStatus = 0x0200, AlarmTriggered = 0x0300, @@ -94,6 +95,11 @@ AlarmStatus_Flag_alarmsSilenced , AlarmStatus_Flag_Bits_Length = 16, + // ---- TreatmentTime + TreatmentTime_Total = 0 , + TreatmentTime_Elapsed , + TreatmentTime_Remaining , + }; enum class GuiActionsData_Enum /*: quint8 QML doesn't support*/ { Index: sources/gui/qml/pages/treatment/TreatmentStart.qml =================================================================== diff -u -rca1be6d62d36d8da766bd05d1df2ce1488344dee -r426208cdb707400759bdc663b871ece9d1208aed --- sources/gui/qml/pages/treatment/TreatmentStart.qml (.../TreatmentStart.qml) (revision ca1be6d62d36d8da766bd05d1df2ce1488344dee) +++ sources/gui/qml/pages/treatment/TreatmentStart.qml (.../TreatmentStart.qml) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -15,7 +15,6 @@ // Qt import QtQuick 2.12 import QtQuick.Controls 2.12 -import QtQuick.Shapes 1.12 // Project import Gui.Actions 0.1; @@ -61,7 +60,12 @@ // ---------- COLUMN RIGHT - TreatmentUltrafiltration { id: _ultrafiltrationTouchArea } + TreatmentUltrafiltration { id: _ultrafiltrationTouchArea + minimum: 0 + maximum: 1000 // TEST : this is a test has to be read form the prescreprion values + value : 0 + valueEx: 0 + } Line { x: rightLinesX; y: row1LineY; length: lineLength } @@ -71,57 +75,8 @@ TreatmentInfusion { id: _solutionInfusionTouchArea } - // Time Remaining - Rectangle { id: _timeRemaining - property int value: 0 - property int minimum: 0 - property int maximum: 360 + TreatmentTime { id: _treatmentTime } - QtObject { id: _private - property int length: ((360 * (_timeRemaining.value - _timeRemaining.minimum)) / (_timeRemaining.maximum - _timeRemaining.minimum)) - } - - anchors.centerIn: parent - width: 336 - height: 336 - radius: width - color: "Transparent" - border.width: 2 - border.color: Colors.backgroundMainMenu - Shape { id: _shape - width: parent.width - height: parent.height - layer.enabled: true - layer.smooth: true - layer.textureSize: Qt.size(_shape.width * 2, _shape.height * 2) - ShapePath { - fillColor: "Transparent" - strokeColor: Colors.borderButton - strokeWidth: 2 - PathAngleArc { - centerX: _timeRemaining.width / 2 - centerY: _timeRemaining.height / 2 - radiusX: 167 - radiusY: 167 - startAngle: -90 - sweepAngle: _private.length - } - } - } - Text { id: _timeRemainingText - text:"04:37" - font.pixelSize: 90 - font.weight: Font.ExtraLight - color: "white" - anchors.centerIn: parent - } - NumberAnimation on value { duration: 5000 - from: _timeRemaining.minimum - to : _timeRemaining.maximum - loops: Animation.Infinite - } - } - onVisibleChanged: { if (visible) { _mainMenu.hidden = true @@ -139,6 +94,13 @@ case GuiActions.DialysateInletFlow: _flowsTouchArea.textRectDialysateInletFlow.label = vData[GuiActions.DialysateInletFlow_MeasuredFlow].toFixed(dialysateInletFlow_MeasuredFlow_Precision); break + case GuiActions.DialysateOutletFlow: + _ultrafiltrationTouchArea.value = vData[GuiActions.DialysateOutletFlow_MeasUFVol].toFixed(2); + break; + case GuiActions.TreatmentTime: + _treatmentTime.maximum = vData[GuiActions.TreatmentTime_Total ]; + _treatmentTime.value = vData[GuiActions.TreatmentTime_Elapsed]; + break; } } } Index: sources/gui/qml/pages/treatment/sections/TreatmentTime.qml =================================================================== diff -u --- sources/gui/qml/pages/treatment/sections/TreatmentTime.qml (revision 0) +++ sources/gui/qml/pages/treatment/sections/TreatmentTime.qml (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -0,0 +1,148 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright \n + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n + * IN PART OR IN WHOLE, \n + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * + * \file TreatmentTime.qml + * \date 2020/01/31 + * \author Behrouz NematiPour + * + */ + +// Qt +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Shapes 1.12 + +// Project +import Gui.Actions 0.1; + +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +/*! + * \brief Treatment Screen Treatment Time Remaining section + */ +Rectangle { id: _treatmentTime + property int minimum : 0 + property int maximum : 0 + property int value : minimum + + signal clicked() + + QtObject { id: _private + property int length: ((360 * (_treatmentTime.value - _treatmentTime.minimum)) / (_treatmentTime.maximum - _treatmentTime.minimum)) + property int seconds: _treatmentTime.value; + property int hour : Math.floor( seconds / 3600 ) + property int minute : Math.floor((seconds % 3600) / 60); + property int second : seconds % 60 + } + + anchors.centerIn: parent + width: 336 + height: 336 + radius: width + color: "Transparent" + border.width: 4 + border.color: Colors.backgroundMainMenu + Shape { id: _shape + width: parent.width + height: parent.height + layer.enabled: true + layer.smooth: true + layer.textureSize: Qt.size(_shape.width * 2, _shape.height * 2) + ShapePath { + fillColor: "Transparent" + strokeColor: Colors.borderButton + strokeWidth: 2 + PathAngleArc { + centerX: _treatmentTime.width / 2 + centerY: _treatmentTime.height / 2 + radiusX: 166 + radiusY: 166 + startAngle: -90 + sweepAngle: _private.length + } + } + } + Text { id: _timeSeparator + text: ":" + + font.pixelSize: 90 + font.weight: Font.ExtraLight + color: "white" + + anchors.centerIn: parent + anchors.topMargin: 50 + + } + Text { id: _timeHour + property alias hour: _private.hour + font.pixelSize: 90 + font.weight: Font.ExtraLight + color: "white" + + horizontalAlignment: Text.AlignRight + anchors.right: _timeSeparator.left + anchors.baseline: _timeSeparator.baseline + + text: (hour < 10 ? "0"+hour : hour) + } + Text { id: _timeMinute + property alias minute: _private.minute + text: (minute < 10 ? "0" + minute : minute) + font.pixelSize: 90 + font.weight: Font.ExtraLight + color: "white" + horizontalAlignment: Text.AlignLeft + anchors.left: _timeSeparator.right + anchors.baseline: _timeSeparator.baseline + } + Text { id: _timeSecond + property alias second: _private.second + text: (second < 10 ? "0" + second : second) + font.pixelSize: 16 + //font.weight: Font.ExtraLight + color: "white" + horizontalAlignment: Text.AlignLeft + anchors.left: _timeMinute.right + anchors.baseline: _timeSeparator.baseline + } + Rectangle { id: _timeTitleRect + color: "Transparent" + anchors.horizontalCenter: _timeSeparator.horizontalCenter + anchors.bottom: _timeSeparator.top + + width : _timeTitle.width + _arrowImage.width + _arrowImage.anchors.leftMargin + height : _timeTitle.height + + Text { id: _timeTitle + text: qsTr("Time Remaining") + + font.pixelSize: 26 + color: "white" + + anchors.left: parent.left + Image { id: _arrowImage + visible: true + anchors.left : parent.right + anchors.bottom: parent.baseline + anchors.leftMargin: 10 + width : Variables.arrowWidth + height: Variables.arrowHeight + source: "qrc:/images/iArrow" + } + } + } + MouseArea { id: _mouseArea + anchors.fill: parent + onClicked: { + _root.clicked() + } + } +} + Index: sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml =================================================================== diff -u -r9e57e4c990afab0996def98521d4f9fee83f96d8 -r426208cdb707400759bdc663b871ece9d1208aed --- sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml (.../TreatmentUltrafiltration.qml) (revision 9e57e4c990afab0996def98521d4f9fee83f96d8) +++ sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml (.../TreatmentUltrafiltration.qml) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -27,6 +27,11 @@ * \brief Treatment Screen Ultrafiltration section */ TouchArea { id: _ultrafiltrationTouchArea + property alias minimum : _progressbar.minimum + property alias maximum : _progressbar.maximum + property alias value : _progressbar.value + property alias valueEx : _progressbar.valueEx + clip: false x : rightColumnX y : row1Y @@ -40,14 +45,14 @@ y : 75 width : parent.width height : Variables.progressbarHeight - value : 0 // TEST : simulation code - property int r: Math.floor(Math.random() * 5000 + 1000) - minimum : 0 // TEST : only test values - maximum : 4000 // TEST : only test values - valueEx : 3000 // TEST : only test values - NumberAnimation on value { duration: 50000 /*_progressbar.r*/; from: _progressbar.minimum; to: _progressbar.maximum; loops: Animation.Infinite; } + // disabled since the actual values are receiving from HD + // property int r: Math.floor(Math.random() * 5000 + 1000) + // minimum : 0 // TEST : only test values + // maximum : 4000 // TEST : only test values + // valueEx : 3000 // TEST : only test values + // NumberAnimation on value { duration: 50000 /*_progressbar.r*/; from: _progressbar.minimum; to: _progressbar.maximum; loops: Animation.Infinite; } } } Index: sources/storage/logger.h =================================================================== diff -u -r7d23aecac8db9b7495e7d505f55bba5a0d510360 -r426208cdb707400759bdc663b871ece9d1208aed --- sources/storage/logger.h (.../logger.h) (revision 7d23aecac8db9b7495e7d505f55bba5a0d510360) +++ sources/storage/logger.h (.../logger.h) (revision 426208cdb707400759bdc663b871ece9d1208aed) @@ -69,7 +69,7 @@ * \details Main logger class that has all the required implementation for logging. * The provided interface is the LOG_DATUM, LOG_EVENT, LOG_ERROR, LOG_EXPORT defines * and no other methods. - * This should have it's own thread. + * This should have its own thread. * \note * PLEASE BE CAREFUL THIS CLASS IS USING QtConcurrent::run FOR THE EXPORT LOG FILES. * AND ONLY PRIVATE VOID LOG (,) IS CALLING IN POOLED THREAD