Index: denali.pro =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- denali.pro (.../denali.pro) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ denali.pro (.../denali.pro) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -28,14 +28,17 @@ INCLUDEPATH += \ sources \ sources/model \ + sources/view \ sources/storage \ sources/gui \ - sources/gui/view \ sources/canbus \ sources/utility \ sources/abstract HEADERS += \ + sources/main.h \ + sources/maintimer.h \ + sources/threads.h \ sources/applicationcontroller.h \ sources/applicationpost.h \ sources/canbus/caninterface.h \ @@ -50,25 +53,32 @@ sources/gui/guiglobals.h \ sources/gui/guiview.h \ sources/gui/guicontroller.h \ - sources/gui/view/valarmstatus.h \ - sources/gui/view/vtreatmentflows.h \ - sources/gui/view/vtreatmenttime.h \ - sources/gui/view/vtreatmentultrafiltration.h \ - sources/main.h \ - sources/maintimer.h \ - sources/model/model.h \ + sources/model/malarmstatus.h \ + sources/model/mmodel.h \ + sources/model/mpoweroff.h \ + sources/model/mtreatmentflows.h \ + sources/model/mtreatmentoutletflow.h \ + sources/model/mtreatmenttime.h \ + sources/view/vview.h \ + sources/view/vpoweroff.h \ + sources/view/vtreatmentbloodflow.h \ + sources/view/vtreatmentdialysateflow.h \ + sources/view/vtreatmenttime.h \ + sources/view/vtreatmentultrafiltration.h \ + sources/view/valarmstatus.h \ sources/storage/filehandler.h \ sources/storage/logger.h \ -# sources/storage/settings.h \ sources/storage/storageglobals.h \ sources/storage/usbwatcher.h \ - sources/threads.h \ +# sources/storage/settings.h \ sources/utility/crc.h \ sources/utility/format.h \ sources/utility/types.h SOURCES += \ main.cpp \ + sources/maintimer.cpp \ + sources/threads.cpp \ sources/applicationcontroller.cpp \ sources/applicationpost.cpp \ sources/canbus/caninterface.cpp \ @@ -82,18 +92,22 @@ sources/gui/guiglobals.cpp \ sources/gui/guiview.cpp \ sources/gui/guicontroller.cpp \ - sources/gui/view/valarmstatus.cpp \ - sources/gui/view/vtreatmentflows.cpp \ - sources/gui/view/vtreatmenttime.cpp \ - sources/gui/view/vtreatmentultrafiltration.cpp \ - sources/maintimer.cpp \ - sources/model/model.cpp \ + sources/model/mpoweroff.cpp \ + sources/model/mtreatmentflows.cpp \ + sources/model/mtreatmentoutletflow.cpp \ + sources/model/mtreatmenttime.cpp \ + sources/model/malarmstatus.cpp \ + sources/view/vpoweroff.cpp \ + sources/view/vtreatmentbloodflow.cpp \ + sources/view/vtreatmentdialysateflow.cpp \ + sources/view/vtreatmentultrafiltration.cpp \ + sources/view/vtreatmenttime.cpp \ + sources/view/valarmstatus.cpp \ sources/storage/filehandler.cpp \ sources/storage/logger.cpp \ -# sources/storage/settings.cpp \ sources/storage/storageglobals.cpp \ sources/storage/usbwatcher.cpp \ - sources/threads.cpp \ +# sources/storage/settings.cpp \ sources/utility/crc.cpp \ sources/utility/format.cpp \ sources/utility/types.cpp Index: sources/applicationcontroller.h =================================================================== diff -u -rd3edfbd78f021082f37c7ee79a5a31a57b2808d4 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/applicationcontroller.h (.../applicationcontroller.h) (revision d3edfbd78f021082f37c7ee79a5a31a57b2808d4) +++ sources/applicationcontroller.h (.../applicationcontroller.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -20,7 +20,7 @@ #include "main.h" #include "guiglobals.h" #include "applicationpost.h" -#include "model.h" +#include "mmodel.h" // define #define _ApplicationController ApplicationController::I() Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -rd3edfbd78f021082f37c7ee79a5a31a57b2808d4 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision d3edfbd78f021082f37c7ee79a5a31a57b2808d4) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -162,12 +162,7 @@ switch (vMessage.actionId) { // notice we are in receive mode case Gui::GuiActionType::PowerOff: { - quint8 mShowHide; - ok = getPowerOffData(vMessage, mShowHide); - if (ok) { - vData += mShowHide; - } - LOG_DATUM(QString("Power Off (%1)").arg(mShowHide)); + ok = powerOffData (vMessage, vData); break; } case Gui::GuiActionType::Acknow: @@ -179,42 +174,42 @@ break; case Gui::GuiActionType::BloodFlow: - ok = bloodFlowData (vMessage, vData); + ok = bloodFlowData (vMessage, vData); break; case Gui::GuiActionType::DialysateInletFlow: - ok = dialysateInletFlowData (vMessage, vData); + ok = dialysateInletFlowData (vMessage, vData); break; case Gui::GuiActionType::DialysateOutletFlow: - ok = dialysateOutletFlowData (vMessage, vData); + ok = dialysateOutletFlowData (vMessage, vData); break; case Gui::GuiActionType::TreatmentTime: - ok = treatmentTime (vMessage, vData); + ok = treatmentTime (vMessage, vData); break; case Gui::GuiActionType::AlarmStatus: - ok = alarmStatus (vMessage, vData); + ok = alarmStatus (vMessage, vData); break; case Gui::GuiActionType::AlarmTriggered: - printUnhandled (vMessage); + printUnhandled (vMessage); ok = true; break; case Gui::GuiActionType::AlarmCleared: - printUnhandled (vMessage); + printUnhandled (vMessage); ok = true; break; case Gui::GuiActionType::PressureOcclusion: - printUnhandled (vMessage); + printUnhandled (vMessage); ok = true; break; default: - printUnhandled (vMessage); + printUnhandled (vMessage); break; } return ok; @@ -246,24 +241,45 @@ * \details This is the method which interprets the PowerOff message data * in vMessage of type Message. * to its elements of data. - * \param vMessage - The vMessage of type Message which contains all the data, - * require to be interpreted. - * \param vShowHide - The return value of extracted fro + * \param vMessage - The vMessage of type Message which contains all the data, require to be interpreted. + * \param vData - The BloodFlow data * \return true if the data can be extracted as defined for PowerOff Message ID */ -bool MessageInterpreter::getPowerOffData(const Message &vMessage, quint8 &vShowHide) +bool MessageInterpreter::getPowerOffData(const Message &vMessage, Model::MPowerOff &vData) { - bool ok = true; - int l = vMessage.data.length(); - quint8 ix = static_cast(Gui::GuiActionIndx::PowerOff_ShowHide); - if (l >= ix + 1) { - quint8 tmp = vMessage.data[ix]; - vShowHide = tmp; - } else { + if ( vMessage.actionId != Gui::GuiActionType::PowerOff) { + return false; + } + if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::PowerOff] ) { QString mActionIdHexString = Format::toHexString(vMessage.actionId); LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); - ok = false; + return false; } + + vData.fromByteArray(vMessage.data); + + return true; +} + +/*! + * \brief MessageInterpreter::bloodFlowData + * \details Used the getBloodFlowData 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 getBloodFlowData + */ +bool MessageInterpreter::powerOffData(const Message &vMessage, QVariantList &vData) +{ + bool ok; + Model::MPowerOff mData; + ok = getPowerOffData(vMessage, mData); + LOG_DATUM(mData.toString()); + if (ok) { + mData.toVariantList(vData); + emit didActionReceive(mData.data()); + } return ok; } @@ -275,7 +291,7 @@ * \param vData - The BloodFlow data * \return true if the message can be successfully converted to the Blood Flow data elements. */ -bool MessageInterpreter::getBloodFlowData(const Message &vMessage, Model::BloodFlow &vData) +bool MessageInterpreter::getBloodFlowData(const Message &vMessage, Model::MBloodFlow &vData) { if ( vMessage.actionId != Gui::GuiActionType::BloodFlow ) { return false; @@ -303,7 +319,7 @@ bool MessageInterpreter::bloodFlowData(const Message &vMessage, QVariantList &vData) { bool ok; - Model::BloodFlow mData; + Model::MBloodFlow mData; ok = getBloodFlowData(vMessage, mData); LOG_DATUM(mData.toString()); if (ok) { @@ -368,7 +384,7 @@ * \param vData - The dialydate outlet flow data (ultrafiltration) * \return true if the message can be successfully converted to the Blood Flow data elements. */ -bool MessageInterpreter::getDialysateOutletFlowData(const Message &vMessage, Model::OutletFlow &vData) +bool MessageInterpreter::getDialysateOutletFlowData(const Message &vMessage, Model::MOutletFlow &vData) { if ( vMessage.actionId != Gui::GuiActionType::DialysateOutletFlow ) { return false; @@ -396,7 +412,7 @@ bool MessageInterpreter::dialysateOutletFlowData(const Message &vMessage, QVariantList &vData) { bool ok; - Model::OutletFlow mData; + Model::MOutletFlow mData; ok = getDialysateOutletFlowData(vMessage, mData); LOG_DATUM(mData.toString()); if (ok) { @@ -412,7 +428,7 @@ * \param vData - Treatment Time data * \return true if the message can be successfully converted to the Blood Flow data elements. */ -bool MessageInterpreter::getTreatmentTime( const Message &vMessage , Model::TreatmentTime &vData) +bool MessageInterpreter::getTreatmentTime( const Message &vMessage , Model::MTreatmentTime &vData) { if ( vMessage.actionId != Gui::GuiActionType::TreatmentTime ) { return false; @@ -440,7 +456,7 @@ bool MessageInterpreter::treatmentTime(const Message &vMessage, QVariantList &vData) { bool ok; - Model::TreatmentTime mData; + Model::MTreatmentTime mData; ok = getTreatmentTime(vMessage, mData); LOG_DATUM(mData.toString()); if (ok) { @@ -459,7 +475,7 @@ * \param vData - Alarm Status dta * \return true if the data can be extracted as defined for PowerOff Message ID */ -bool MessageInterpreter::getAlarmStatus(const Message &vMessage, Model::AlarmStatus &vData) +bool MessageInterpreter::getAlarmStatus(const Message &vMessage, Model::MAlarmStatus &vData) { if ( vMessage.actionId != Gui::GuiActionType::AlarmStatus ) { return false; @@ -486,7 +502,7 @@ */ bool MessageInterpreter::alarmStatus(const Message &vMessage, QVariantList &vData) { bool ok; - Model::AlarmStatus mData; + Model::MAlarmStatus mData; ok = getAlarmStatus(vMessage, mData); LOG_DATUM(mData.toString()); if (ok) { Index: sources/canbus/messageinterpreter.h =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -18,7 +18,7 @@ // Project #include "messageglobals.h" -#include "model.h" +#include "mmodel.h" namespace Can { @@ -35,43 +35,39 @@ void printUnhandled (const Message &vMessage); - bool interpretMessage_HD (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; - bool interpretMessage_DG (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; + bool interpretMessage_HD (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; + bool interpretMessage_DG (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; - bool getPowerOffData (const Message &vMessage , quint8 &vShowHide) __attribute_warn_unused_result__; + // ---- PowerOff + bool getPowerOffData(const Message &vMessage, Model::MPowerOff &vData) __attribute_warn_unused_result__; + bool powerOffData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- BloodFlowData - bool getBloodFlowData (const Message &vMessage , Model::BloodFlow &vData) __attribute_warn_unused_result__; - bool bloodFlowData (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; + bool getBloodFlowData(const Message &vMessage, Model::MBloodFlow &vData) __attribute_warn_unused_result__; + bool bloodFlowData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Dialysate Inlet FlowData - bool getDialysateInletFlowData - (const Message &vMessage , Model::DialysateFlow &vData) __attribute_warn_unused_result__; - bool dialysateInletFlowData - (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; + bool getDialysateInletFlowData(const Message &vMessage, Model::DialysateFlow &vData) __attribute_warn_unused_result__; + bool dialysateInletFlowData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; - // ---- Dialysate Outlet FlowData - bool getDialysateOutletFlowData - (const Message &vMessage , Model::OutletFlow &vData) __attribute_warn_unused_result__; - bool dialysateOutletFlowData - (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; + bool getDialysateOutletFlowData(const Message &vMessage, Model::MOutletFlow &vData) __attribute_warn_unused_result__; + bool dialysateOutletFlowData(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- AlarmStatus - bool getAlarmStatus (const Message &vMessage , Model::AlarmStatus &vData) __attribute_warn_unused_result__; - bool alarmStatus (const Message &vMessage , QVariantList &vData) __attribute_warn_unused_result__; + bool getAlarmStatus (const Message &vMessage, Model::MAlarmStatus &vData) __attribute_warn_unused_result__; + bool alarmStatus (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; // ---- Treatment Time - bool getTreatmentTime (const Message &vMessage, - Model::TreatmentTime &vData); - bool treatmentTime (const Message &vMessage, QVariantList &vData); + bool getTreatmentTime (const Message &vMessage, Model::MTreatmentTime &vData); + bool treatmentTime (const Message &vMessage, QVariantList &vData); public: explicit MessageInterpreter(QObject *parent = nullptr); // interpret the data into GUI understandable Actions/Data - bool interpretMessage(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; - bool interpretMessage(const Gui::GuiActionType &vActionId, const QVariantList &vData, QByteArray &vPayload) __attribute_warn_unused_result__; + bool interpretMessage(const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; + bool interpretMessage(const Gui::GuiActionType &vActionId, const QVariantList &vData, QByteArray &vPayload) __attribute_warn_unused_result__; signals: ACTION_RECEIVE_SIGNALS Index: sources/gui/guicontroller.h =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/gui/guicontroller.h (.../guicontroller.h) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/gui/guicontroller.h (.../guicontroller.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -19,7 +19,7 @@ // Project #include "main.h" #include "guiglobals.h" -#include "model.h" +#include "mmodel.h" // define #define _GuiController GuiController::I() Index: sources/gui/guiglobals.cpp =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -19,12 +19,11 @@ // Project #include "logger.h" #include "guiview.h" -// Project - View -#include "vtreatmentflows.h" -#include "vtreatmentultrafiltration.h" -#include "vtreatmenttime.h" -#include "valarmstatus.h" +// Project +#include "mmodel.h" +#include "vview.h" + namespace Gui { QQuickView *_viewer = nullptr; @@ -53,10 +52,7 @@ qmlRegisterType ("Gui.View" , 0, 1, "GuiView"); qmlRegisterUncreatableType ("Gui.Actions", 0, 1, "GuiActions", QStringLiteral("Used only for enumerations no need to have an object")); - qmlRegisterType ("Gui.VTreatmentFlows" , 0, 1, "VTreatmentFlows" ); - qmlRegisterType ("Gui.VTreatmentUltrafiltration" , 0, 1, "VTreatmentUltrafiltration" ); - qmlRegisterType ("Gui.VTreatmentTime" , 0, 1, "VTreatmentTime" ); - qmlRegisterType ("Gui.VAlarmStatus" , 0, 1, "VAlarmStatus" ); + REGISTER_VIEW_TYPES } /*! Index: sources/gui/qml/main.qml =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/gui/qml/main.qml (.../main.qml) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/gui/qml/main.qml (.../main.qml) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -23,10 +23,12 @@ // TODO : When Testing data on Setting screen is removed // This needs to be moved into the TreatmentFlows.qml -import Gui.VTreatmentFlows 0.1; -import Gui.VTreatmentUltrafiltration 0.1; -import Gui.VTreatmentTime 0.1; -import Gui.VAlarmStatus 0.1; +import VTreatmentBloodFlow 0.1; +import VTreatmentDialysateFlow 0.1; +import VTreatmentUltrafiltration 0.1; +import VTreatmentTime 0.1; +import VAlarmStatus 0.1; +import VPowerOff 0.1; // Qml imports import "qrc:/globals" @@ -54,32 +56,36 @@ 5000 // if there is any error happening then after 5 seconds dialog hides. ) break; - - case GuiActions.PowerOff: - if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Command) { - _powerOffDialog.open() - } - if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Timeout) { - _powerOffDialog.close() - } - if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Rejected) { - _autoHideInfo.showDialog( - qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() - 1000 // if there is any error happening then after 5 seconds dialog hides. - ) - } - break; - } } } // TODO : When Testing data on Setting screen is removed // This needs to be moved into the TreatmentFlows.qml - VTreatmentFlows { id: vTreatmentFlows } + VTreatmentBloodFlow { id: vTreatmentBloodFlow } + VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } VTreatmentUltrafiltration { id: vTreatmentUltrafiltration } VTreatmentTime { id: vTreatmentTime } VAlarmStatus { id: vAlarmStatus } + VPowerOff { id: vPowerOff + onPoweroff_statusChanged: { + console.debug("vpoweroff_status", vpoweroff_status) + switch (vpoweroff_status) { + case GuiActions.Command: + _powerOffDialog.open() + break; + case GuiActions.Timeout: + _powerOffDialog.close() + break; + case GuiActions.Rejected: + _autoHideInfo.showDialog( + qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() + 1000 // if there is any error happening then after 5 seconds dialog hides. + ) + break; + } + } + } // ----- Follow the below Z order ----- // 1 - Screens Index: sources/gui/qml/pages/SettingsHome.qml =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -29,27 +29,27 @@ */ ScreenItem { id: _root - USBButton { id: _usb + USBButton { id: _usbButton anchors { top : parent.top - right : _export.left + right : _exportButton.left topMargin : (Variables.headerHeight - Variables.logoHeight) / 2 rightMargin : (Variables.headerHeight - Variables.logoHeight) / 2 } } - ExportButton { id: _export + ExportButton { id: _exportButton width: 150 height: 50 anchors { top : parent.top - right : _poweroff.left + right : _poweroffButton.left topMargin : (Variables.headerHeight - Variables.logoHeight) / 2 rightMargin : (Variables.headerHeight - Variables.logoHeight) / 2 } } - TouchRect { id : _poweroff + TouchRect { id : _poweroffButton width: 150 height: Variables.logoHeight animated: true @@ -81,13 +81,13 @@ } Repeater { model: [ - vTreatmentFlows.bloodFlow_FlowSetPoint , - vTreatmentFlows.bloodFlow_MeasuredFlow .toFixed(2) , - vTreatmentFlows.bloodFlow_RotorSpeed .toFixed(2) , - vTreatmentFlows.bloodFlow_MotorSpeed .toFixed(2) , - vTreatmentFlows.bloodFlow_MotorCtlSpeed .toFixed(2) , - vTreatmentFlows.bloodFlow_MotorCtlCurrent .toFixed(2) , - "%" + vTreatmentFlows.bloodFlow_PWMDutyCycle .toFixed(2) + vTreatmentBloodFlow.bloodFlow_FlowSetPoint , + vTreatmentBloodFlow.bloodFlow_MeasuredFlow .toFixed(2) , + vTreatmentBloodFlow.bloodFlow_RotorSpeed .toFixed(2) , + vTreatmentBloodFlow.bloodFlow_MotorSpeed .toFixed(2) , + vTreatmentBloodFlow.bloodFlow_MotorCtlSpeed .toFixed(2) , + vTreatmentBloodFlow.bloodFlow_MotorCtlCurrent .toFixed(2) , + "%" + vTreatmentBloodFlow.bloodFlow_PWMDutyCycle .toFixed(2) ] Text { text: modelData @@ -115,13 +115,13 @@ } Repeater { model: [ - vTreatmentFlows.dialysateFlow_FlowSetPoint .toFixed(2) , - vTreatmentFlows.dialysateFlow_MeasuredFlow .toFixed(2) , - vTreatmentFlows.dialysateFlow_RotorSpeed .toFixed(2) , - vTreatmentFlows.dialysateFlow_MotorSpeed .toFixed(2) , - vTreatmentFlows.dialysateFlow_MotorCtlSpeed .toFixed(2) , - vTreatmentFlows.dialysateFlow_MotorCtlCurrent.toFixed(2) , - "%" + vTreatmentFlows.dialysateFlow_PWMDutyCycle .toFixed(2) + vTreatmentDialysateFlow.dialysateFlow_FlowSetPoint .toFixed(2) , + vTreatmentDialysateFlow.dialysateFlow_MeasuredFlow .toFixed(2) , + vTreatmentDialysateFlow.dialysateFlow_RotorSpeed .toFixed(2) , + vTreatmentDialysateFlow.dialysateFlow_MotorSpeed .toFixed(2) , + vTreatmentDialysateFlow.dialysateFlow_MotorCtlSpeed .toFixed(2) , + vTreatmentDialysateFlow.dialysateFlow_MotorCtlCurrent.toFixed(2) , + "%" + vTreatmentDialysateFlow.dialysateFlow_PWMDutyCycle .toFixed(2) ] Text { text: modelData Index: sources/gui/qml/pages/treatment/sections/TreatmentFlows.qml =================================================================== diff -u -r296e0e140bfeb193a9f571873afa6934143b1075 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/gui/qml/pages/treatment/sections/TreatmentFlows.qml (.../TreatmentFlows.qml) (revision 296e0e140bfeb193a9f571873afa6934143b1075) +++ sources/gui/qml/pages/treatment/sections/TreatmentFlows.qml (.../TreatmentFlows.qml) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -33,13 +33,13 @@ components: [ TextRect { id: _bloodFlow title: qsTr("Blood") - label: vTreatmentFlows.bloodFlow_MeasuredFlow + label: vTreatmentBloodFlow.bloodFlow_MeasuredFlow extra: qsTr("mL") // unit labelFont.weight: Font.ExtraLight } , TextRect { id: _dialysateInletFlow title: qsTr("Dialysate") - label: vTreatmentFlows.dialysateFlow_MeasuredFlow + label: vTreatmentDialysateFlow.dialysateFlow_MeasuredFlow extra: qsTr("mL") // unit labelFont.weight: Font.ExtraLight } Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/valarmstatus.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/valarmstatus.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/vtreatmentflows.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/vtreatmentflows.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/vtreatmenttime.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/vtreatmenttime.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/vtreatmentultrafiltration.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/gui/view/vtreatmentultrafiltration.h'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/main.h =================================================================== diff -u -rd3edfbd78f021082f37c7ee79a5a31a57b2808d4 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/main.h (.../main.h) (revision d3edfbd78f021082f37c7ee79a5a31a57b2808d4) +++ sources/main.h (.../main.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -64,8 +64,36 @@ return _##vVARIABLE ; \ } \ void vVARIABLE ( const vTYPE & v##vVARIABLE ) { \ - if ( _##vVARIABLE != v##vVARIABLE ) { \ + static bool init = false; \ + if ( _##vVARIABLE != v##vVARIABLE || ! init ) { \ + init = true; \ _##vVARIABLE = v##vVARIABLE; \ emit vVARIABLE##Changed( _##vVARIABLE ); \ } \ } +//--------------------------------------------------------------------------------// +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, vTYPE) \ + connect(&vSOURCE, SIGNAL(didActionReceive(const vTYPE &)), \ + this , SLOT( onActionReceive(const vTYPE &))); +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_PRIVATE_SLOT(vTYPE) \ +private Q_SLOTS: \ + void onActionReceive (const vTYPE &vData) { \ + emit didActionReceive(vData); \ + } +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_SIGNAL(vTYPE) \ +Q_SIGNALS: \ + void didActionReceive (const vTYPE &vData); +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_BRIDGE_DEFINITION(vTYPE) \ + ACTION_RECEIVE_PRIVATE_SLOT (vTYPE) \ + ACTION_RECEIVE_SIGNAL (vTYPE) +//--------------------------------------------------------------------------------// +#define REGISTER_METATYPE(vTYPE) \ + qRegisterMetaType < vTYPE > (#vTYPE); +//--------------------------------------------------------------------------------// +#define REGISTER_TYPE(vTYPE) \ + qmlRegisterType < vTYPE > (#vTYPE, 0, 1, #vTYPE); + Index: sources/model/malarmstatus.cpp =================================================================== diff -u --- sources/model/malarmstatus.cpp (revision 0) +++ sources/model/malarmstatus.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,57 @@ +/*! + * + * 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 alarmstatus.cpp + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#include "malarmstatus.h" + + +using namespace Model; + +MAlarmStatus::MAlarmStatus() { } + +QString MAlarmStatus::toString() const { + return QString("Alarm Status(%1, %2, %3, %4, %5)") + .arg(_data.mState .value ) + .arg(_data.mTop .value ) + .arg(_data.mMuteTimeout .value ) + .arg(_data.mEscalatesIn .value ) + .arg(_data.mFlags .toString()); +} + +void MAlarmStatus::toVariantList(QVariantList &vData) const { + vData += _data.mState .value ; + vData += _data.mTop .value ; + vData += _data.mMuteTimeout .value ; + vData += _data.mEscalatesIn .value ; + for (int i = 0; i < _data.mFlags.count(); i++) { + vData += _data.mFlags.at(i); + } +} + +void MAlarmStatus::fromByteArray(const QByteArray &vByteArray) { + int index = 0; // message data start position + Types::getValue<>(vByteArray, index, _data.mState ); + Types::getValue<>(vByteArray, index, _data.mTop ); + Types::getValue<>(vByteArray, index, _data.mMuteTimeout ); + Types::getValue<>(vByteArray, index, _data.mEscalatesIn ); + Types::getBits (vByteArray, index, _data.mFlags , eFlag_Bits_Length); +} + +MAlarmStatus::Data MAlarmStatus::data() const { + Data data; + data.mState = _data.mState .value; + data.mTop = _data.mTop .value; + data.mMuteTimeout = _data.mMuteTimeout .value; + data.mEscalatesIn = _data.mEscalatesIn .value; + data.mFlags = _data.mFlags ; + return data; +} Index: sources/model/malarmstatus.h =================================================================== diff -u --- sources/model/malarmstatus.h (revision 0) +++ sources/model/malarmstatus.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,70 @@ +/*! + * + * 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 alarmstatus.h + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "types.h" + +namespace Model { + +class MAlarmStatus { +public: + enum Flag { + eFlag_systemFault = 0 , + eFlag_stop , + eFlag_noClear , + eFlag_noResume , + eFlag_noRinseback , + eFlag_noEndTreatment , + eFlag_noNewTreatment , + eFlag_bypassDialyzer , + eFlag_alarmsToEscalate , + eFlag_alarmsSilenced , + eFlag_Bits_Length = 16, + }; + QString stringPrefix = "Alarm Status"; + struct Data { + quint32 mState = 0; /*!< State - Alarm Priority value of type unsigned int as 4 bytes extracted out */ + quint32 mTop = 0; /*!< Top - Top value of type unsigned int as 4 bytes extracted out */ + quint32 mMuteTimeout = 0; /*!< MuteTimeout - MuteTimeout value of type unsigned int as 4 bytes extracted out */ + quint32 mEscalatesIn = 0; /*!< EscalatesIn - EscalatesIn value of type unsigned int as 4 bytes extracted out */ + QBitArray mFlags ; /*!< Flags - Flags value of type unsigned int as 1 byte extracted out */ + }; + +private: + struct { + Types::U32 mState ; + Types::U32 mTop ; + Types::U32 mMuteTimeout ; + Types::U32 mEscalatesIn ; + Types::Flags mFlags ; + } _data; + +public: + MAlarmStatus(); + + QString toString ( ) const ; + void toVariantList ( QVariantList &vData ) const ; + void fromByteArray (const QByteArray &vByteArray ); + + Data data() const ; +}; + +} + +typedef Model::MAlarmStatus::Data AlarmStatusData; +typedef Model::MAlarmStatus::Flag AlarmStatusFlag; Index: sources/model/mmodel.h =================================================================== diff -u --- sources/model/mmodel.h (revision 0) +++ sources/model/mmodel.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,69 @@ +/*! + * + * 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 models.h + * date 3/4/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +#include "main.h" + +// models +#include "malarmstatus.h" +#include "mtreatmenttime.h" +#include "mtreatmentflows.h" +#include "mtreatmentoutletflow.h" +#include "mpoweroff.h" + +//--------------------------------------------------------------------------------// +//-------- Please add the model type to the lists below to register them ---------// +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(vSOURCE) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, BloodFlowData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DialysateFlowData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, OutletFlowData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, TreatmentTimeData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AlarmStatusData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, PowerOffData ) +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_MODEL_BRIDGE_DEFINITIONS \ + ACTION_RECEIVE_BRIDGE_DEFINITION( BloodFlowData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( DialysateFlowData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( OutletFlowData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( TreatmentTimeData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( AlarmStatusData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( PowerOffData ) +//--------------------------------------------------------------------------------// +#define REGISTER_MODEL_METATYPES \ + REGISTER_METATYPE( BloodFlowData ) \ + REGISTER_METATYPE( DialysateFlowData ) \ + REGISTER_METATYPE( OutletFlowData ) \ + REGISTER_METATYPE( TreatmentTimeData ) \ + REGISTER_METATYPE( AlarmStatusData ) \ + REGISTER_METATYPE( AlarmStatusFlag ) \ + REGISTER_METATYPE( PowerOffData ) +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_INTERPRETER_CONNECTIONS \ + ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, BloodFlowData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, DialysateFlowData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, OutletFlowData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, TreatmentTimeData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, AlarmStatusData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, PowerOffData ) +//--------------------------------------------------------------------------------// +#define ACTION_RECEIVE_SIGNALS \ + ACTION_RECEIVE_SIGNAL( BloodFlowData ) \ + ACTION_RECEIVE_SIGNAL( DialysateFlowData ) \ + ACTION_RECEIVE_SIGNAL( OutletFlowData ) \ + ACTION_RECEIVE_SIGNAL( TreatmentTimeData ) \ + ACTION_RECEIVE_SIGNAL( AlarmStatusData ) \ + ACTION_RECEIVE_SIGNAL( PowerOffData ) +//--------------------------------------------------------------------------------// +//--------------------------------------------------------------------------------// Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/model/model.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 595ed1fbe8066960afd4c8fea168208e81b173d9 refers to a dead (removed) revision in file `sources/model/model.h'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/model/mpoweroff.cpp =================================================================== diff -u --- sources/model/mpoweroff.cpp (revision 0) +++ sources/model/mpoweroff.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,40 @@ +/*! + * + * 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 mpower.cpp + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#include "mpoweroff.h" + +using namespace Model; + +MPowerOff::MPowerOff() { } + +// ----- TreatmentTime ----- +QString MPowerOff::toString() const { + return QString(stringPrefix + "(%1)") + .arg(_data.mStatus .value); +} + +void MPowerOff::toVariantList(QVariantList &vData) const { + vData += _data.mStatus .value; +} + +void MPowerOff::fromByteArray(const QByteArray &vByteArray) { + int index = 0; // message data start position + Types::getValue<>(vByteArray, index, _data.mStatus ); + +} + +MPowerOff::Data MPowerOff::data() const { + Data data; + data.mStatus = _data.mStatus .value; + return data; +} Index: sources/model/mpoweroff.h =================================================================== diff -u --- sources/model/mpoweroff.h (revision 0) +++ sources/model/mpoweroff.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,49 @@ +/*! + * + * 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 mpower.h + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "types.h" + +namespace Model { + +class MPowerOff { +public: + QString stringPrefix = "PowerOff"; + struct Data { + quint8 mStatus = 0; + bool mShutDown = false; + }; + +private: + struct { + Types::U08 mStatus ; + } _data; + +public: + MPowerOff(); + + QString toString ( ) const ; + void toVariantList ( QVariantList &vData ) const ; + void fromByteArray (const QByteArray &vByteArray ); + + Data data() const; +}; + +} + +typedef Model::MPowerOff::Data PowerOffData; Index: sources/model/mtreatmentflows.cpp =================================================================== diff -u --- sources/model/mtreatmentflows.cpp (revision 0) +++ sources/model/mtreatmentflows.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,79 @@ +/*! + * + * 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 mflows.cpp + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#include "mtreatmentflows.h" + +using namespace Model; + +// ----- BloodFlow ----- +QString MFlow::toString() const { + return QString(stringPrefix + "(%1, %2, %3, %4, %5, %6, %7)") + .arg(_data.mFlowSetPoint .value) + .arg(_data.mMeasuredFlow .value) + .arg(_data.mRotorSpeed .value) + .arg(_data.mMotorSpeed .value) + .arg(_data.mMotorCtlSpeed .value) + .arg(_data.mMotorCtlCurrent .value) + .arg(_data.mPWMDutyCycle .value); +} + +void MFlow::toVariantList(QVariantList &vData) const { + vData += _data.mFlowSetPoint .value; + vData += _data.mMeasuredFlow .value; + vData += _data.mRotorSpeed .value; + vData += _data.mMotorSpeed .value; + vData += _data.mMotorCtlSpeed .value; + vData += _data.mMotorCtlCurrent .value; + vData += _data.mPWMDutyCycle .value; +} + +void MFlow::fromByteArray(const QByteArray &vByteArray) { + int index = 0; // message data start position + Types::getValue<>(vByteArray, index, _data.mFlowSetPoint ); + Types::getValue<>(vByteArray, index, _data.mMeasuredFlow ); + Types::getValue<>(vByteArray, index, _data.mRotorSpeed ); + Types::getValue<>(vByteArray, index, _data.mMotorSpeed ); + Types::getValue<>(vByteArray, index, _data.mMotorCtlSpeed ); + Types::getValue<>(vByteArray, index, _data.mMotorCtlCurrent ); + Types::getValue<>(vByteArray, index, _data.mPWMDutyCycle ); +} + +const MFlow::Data &MFlow::data() const { + return _data; +} + +// ----- BloodFlow ----- +MBloodFlow::Data MBloodFlow::data() const { + Data data; + data.mFlowSetPoint = MFlow::data().mFlowSetPoint .value; + data.mMeasuredFlow = MFlow::data().mMeasuredFlow .value; + data.mRotorSpeed = MFlow::data().mRotorSpeed .value; + data.mMotorSpeed = MFlow::data().mMotorSpeed .value; + data.mMotorCtlSpeed = MFlow::data().mMotorCtlSpeed .value; + data.mMotorCtlCurrent = MFlow::data().mMotorCtlCurrent.value; + data.mPWMDutyCycle = MFlow::data().mPWMDutyCycle .value; + return data; +} + +// ----- DialysateFlow ----- +DialysateFlow::Data DialysateFlow::data() const { + Data data; + data.mFlowSetPoint = MFlow::data().mFlowSetPoint .value; + data.mMeasuredFlow = MFlow::data().mMeasuredFlow .value; + data.mRotorSpeed = MFlow::data().mRotorSpeed .value; + data.mMotorSpeed = MFlow::data().mMotorSpeed .value; + data.mMotorCtlSpeed = MFlow::data().mMotorCtlSpeed .value; + data.mMotorCtlCurrent = MFlow::data().mMotorCtlCurrent.value; + data.mPWMDutyCycle = MFlow::data().mPWMDutyCycle .value; + return data; +} Index: sources/model/mtreatmentflows.h =================================================================== diff -u --- sources/model/mtreatmentflows.h (revision 0) +++ sources/model/mtreatmentflows.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,87 @@ +/*! + * + * 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 mflows.h + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + + +// Qt +#include + +// Project +#include "types.h" + +namespace Model { + +/*! + * \brief The Flow Data class + */ +class MFlow { + +public: + QString stringPrefix = ""; + +private: + struct Data { + Types::S32 mFlowSetPoint ; /*!< vFlowSetPoint - Flow Set Point value of type signed int extracted out */ + Types::F32 mMeasuredFlow ; /*!< vMeasuredFlow - Measured Flow value of type float extracted out */ + Types::F32 mRotorSpeed ; /*!< vRotorSpeed - Rotor Speed value of type float extracted out */ + Types::F32 mMotorSpeed ; /*!< vMotorSpeed - Motor Speed value of type float extracted out */ + Types::F32 mMotorCtlSpeed ; /*!< vMotorCtlSpeed - Motor Controller Speed value of type float extracted out */ + Types::F32 mMotorCtlCurrent ; /*!< vMotorCtlCurrent - Motor Controller Current value of type float extracted out */ + Types::F32 mPWMDutyCycle ; /*!< vPWMDtCycle - PWM Duty Cycle in % value of type float extracted out */ + } _data; + +public: + MFlow () { } + + QString toString ( ) const ; + void toVariantList ( QVariantList &vData ) const ; + void fromByteArray (const QByteArray &vByteArray ); + + const Data &data() const ; +}; + +class MBloodFlow : public MFlow { +public: + struct Data { + qint32 mFlowSetPoint = 0; /*!< vFlowSetPoint - Flow Set Point value of type signed int extracted out */ + float mMeasuredFlow = 0; /*!< vMeasuredFlow - Measured Flow value of type float extracted out */ + float mRotorSpeed = 0; /*!< vRotorSpeed - Rotor Speed value of type float extracted out */ + float mMotorSpeed = 0; /*!< vMotorSpeed - Motor Speed value of type float extracted out */ + float mMotorCtlSpeed = 0; /*!< vMotorCtlSpeed - Motor Controller Speed value of type float extracted out */ + float mMotorCtlCurrent = 0; /*!< vMotorCtlCurrent - Motor Controller Current value of type float extracted out */ + float mPWMDutyCycle = 0; /*!< vPWMDtCycle - PWM Duty Cycle in % value of type float extracted out */ + }; + MBloodFlow() { stringPrefix = "Blood Flow"; } + Data data() const; +}; + +class DialysateFlow : public MFlow { +public: + struct Data { + qint32 mFlowSetPoint = 0; /*!< vFlowSetPoint - Flow Set Point value of type signed int extracted out */ + float mMeasuredFlow = 0; /*!< vMeasuredFlow - Measured Flow value of type float extracted out */ + float mRotorSpeed = 0; /*!< vRotorSpeed - Rotor Speed value of type float extracted out */ + float mMotorSpeed = 0; /*!< vMotorSpeed - Motor Speed value of type float extracted out */ + float mMotorCtlSpeed = 0; /*!< vMotorCtlSpeed - Motor Controller Speed value of type float extracted out */ + float mMotorCtlCurrent = 0; /*!< vMotorCtlCurrent - Motor Controller Current value of type float extracted out */ + float mPWMDutyCycle = 0; /*!< vPWMDtCycle - PWM Duty Cycle in % value of type float extracted out */ + }; + DialysateFlow() { stringPrefix = "Dialysate Flow"; } + Data data() const; +}; + +} + +typedef Model:: MBloodFlow::Data BloodFlowData; +typedef Model::DialysateFlow::Data DialysateFlowData; Index: sources/model/mtreatmentoutletflow.cpp =================================================================== diff -u --- sources/model/mtreatmentoutletflow.cpp (revision 0) +++ sources/model/mtreatmentoutletflow.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,61 @@ +/*! + * + * 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 mtreatmentultrafiltration.cpp + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#include "mtreatmentoutletflow.h" + +using namespace Model; + +// ----- OutletFlow ----- +QString MOutletFlow::toString() const { + return QString(stringPrefix + "(%1, %2, %3, %4, %5, %6, %7)") + .arg(_data.mRefUFVol .value) + .arg(_data.mMeasUFVol .value) + .arg(_data.mRotorSpeed .value) + .arg(_data.mMotorSpeed .value) + .arg(_data.mMotorCtlSpeed .value) + .arg(_data.mMotorCtlCurrent .value) + .arg(_data.mPWMDtCycle .value); +} + +void MOutletFlow::toVariantList(QVariantList &vData) const { + vData += _data.mRefUFVol .value; + vData += _data.mMeasUFVol .value; + vData += _data.mRotorSpeed .value; + vData += _data.mMotorSpeed .value; + vData += _data.mMotorCtlSpeed .value; + vData += _data.mMotorCtlCurrent.value; + vData += _data.mPWMDtCycle .value; +} + +void MOutletFlow::fromByteArray(const QByteArray &vByteArray) { + int index = 0; // message data start position + Types::getValue<>(vByteArray, index, _data.mRefUFVol ); + Types::getValue<>(vByteArray, index, _data.mMeasUFVol ); + Types::getValue<>(vByteArray, index, _data.mRotorSpeed ); + Types::getValue<>(vByteArray, index, _data.mMotorSpeed ); + Types::getValue<>(vByteArray, index, _data.mMotorCtlSpeed ); + Types::getValue<>(vByteArray, index, _data.mMotorCtlCurrent); + Types::getValue<>(vByteArray, index, _data.mPWMDtCycle ); +} + +MOutletFlow::Data MOutletFlow::data() const { + Data data; + data.mRefUFVol = _data.mRefUFVol .value; + data.mMeasUFVol = _data.mMeasUFVol .value; + data.mRotorSpeed = _data.mRotorSpeed .value; + data.mMotorSpeed = _data.mMotorSpeed .value; + data.mMotorCtlSpeed = _data.mMotorCtlSpeed .value; + data.mMotorCtlCurrent = _data.mMotorCtlCurrent.value; + data.mPWMDtCycle = _data.mPWMDtCycle .value; + return data; +} Index: sources/model/mtreatmentoutletflow.h =================================================================== diff -u --- sources/model/mtreatmentoutletflow.h (revision 0) +++ sources/model/mtreatmentoutletflow.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,60 @@ +/*! + * + * 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 mtreatmentultrafiltration.h + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "types.h" + +namespace Model { + +class MOutletFlow { +public: + QString stringPrefix = "Dialysate Outlet Flow"; + struct Data { + float mRefUFVol = 0; /*!< Reference UF Volume value of type float extracted out */ + float mMeasUFVol = 0; /*!< Measured UF Volume value of type float extracted out */ + float mRotorSpeed = 0; /*!< Rotor Speed value of type float extracted out */ + float mMotorSpeed = 0; /*!< Motor Speed value of type float extracted out */ + float mMotorCtlSpeed = 0; /*!< Motor Controller Speed value of type float extracted out */ + float mMotorCtlCurrent = 0; /*!< Motor Controller Current value of type float extracted out */ + float mPWMDtCycle = 0; /*!< PWM Duty Cycle in % value of type float extracted out */ + }; + +private: + struct { + Types::F32 mRefUFVol ; + Types::F32 mMeasUFVol ; + Types::F32 mRotorSpeed ; + Types::F32 mMotorSpeed ; + Types::F32 mMotorCtlSpeed ; + Types::F32 mMotorCtlCurrent ; + Types::F32 mPWMDtCycle ; + } _data; + +public: + MOutletFlow () { } + + QString toString ( ) const ; + void toVariantList ( QVariantList &vData ) const ; + void fromByteArray (const QByteArray &vByteArray ); + + Data data() const; +}; + +} + +typedef Model::MOutletFlow::Data OutletFlowData; Index: sources/model/mtreatmenttime.cpp =================================================================== diff -u --- sources/model/mtreatmenttime.cpp (revision 0) +++ sources/model/mtreatmenttime.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,48 @@ +/*! + * + * 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 mtreatmenttime.cpp + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#include "mtreatmenttime.h" + +using namespace Model; + +MTreatmentTime::MTreatmentTime() { } + +// ----- TreatmentTime ----- +QString MTreatmentTime::toString() const { + return QString(stringPrefix + "(%1, %2, %3)") + .arg(_data.mTotal .value) + .arg(_data.mElapsed .value) + .arg(_data.mRemaining .value); +} + +void MTreatmentTime::toVariantList(QVariantList &vData) const { + vData += _data.mTotal .value; + vData += _data.mElapsed .value; + vData += _data.mRemaining .value; +} + +void MTreatmentTime::fromByteArray(const QByteArray &vByteArray) { + int index = 0; // message data start position + Types::getValue<>(vByteArray, index, _data.mTotal ); + Types::getValue<>(vByteArray, index, _data.mElapsed ); + Types::getValue<>(vByteArray, index, _data.mRemaining ); + +} + +MTreatmentTime::Data MTreatmentTime::data() const { + Data data; + data.mTotal = _data.mTotal .value; + data.mElapsed = _data.mElapsed .value; + data.mRemaining = _data.mRemaining .value; + return data; +} Index: sources/model/mtreatmenttime.h =================================================================== diff -u --- sources/model/mtreatmenttime.h (revision 0) +++ sources/model/mtreatmenttime.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,53 @@ +/*! + * + * 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 mtreatmenttime.h + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + + +// Qt +#include + +// Project +#include "types.h" + +namespace Model { + +class MTreatmentTime { +public: + QString stringPrefix = "Treatment Time"; + struct Data { + quint32 mTotal = 0; /*!< Total treatment time in sec */ + quint32 mElapsed = 0; /*!< Elapsed treatment time in sec */ + quint32 mRemaining = 0; /*!< Remaining treatment time in sec */ + }; + +private: + struct { + Types::U32 mTotal ; + Types::U32 mElapsed ; + Types::U32 mRemaining ; + } _data; + +public: + MTreatmentTime(); + + QString toString ( ) const ; + void toVariantList ( QVariantList &vData ) const ; + void fromByteArray (const QByteArray &vByteArray ); + + Data data() const; +}; + +} + +typedef Model::MTreatmentTime::Data TreatmentTimeData; Index: sources/utility/types.h =================================================================== diff -u -r4a6abe765f03feae8100ec660aa04aa218d4dfa3 -r595ed1fbe8066960afd4c8fea168208e81b173d9 --- sources/utility/types.h (.../types.h) (revision 4a6abe765f03feae8100ec660aa04aa218d4dfa3) +++ sources/utility/types.h (.../types.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -30,6 +30,7 @@ class Flags : public QBitArray { public: + Flags() : QBitArray() { } QString toString() const { QString tmp; for (int i = 0; i < count(); i++) { @@ -46,7 +47,7 @@ * \details This is the union which will be used to extract the bytes of a float type value * 4 bytes */ - union F32{ + union F32 { float value = 0; quint8 bytes[sizeof(float)]; }; Index: sources/view/valarmstatus.cpp =================================================================== diff -u --- sources/view/valarmstatus.cpp (revision 0) +++ sources/view/valarmstatus.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,37 @@ +/*! + * + * 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 valarmstatus.cpp + * date 3/6/2020 + * author Behrouz NematiPour + * + */ +#include "valarmstatus.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VAlarmStatus, AlarmStatusData) + +void VAlarmStatus::onActionReceive(const AlarmStatusData &vData) +{ + alarm_Priority (vData.mState ); + alarm_AlarmID (vData.mTop ); + alarm_EscalateIn (vData.mMuteTimeout ); + alarm_MuteTimeout (vData.mEscalatesIn ); + alarm_Flag_systemFault (vData.mFlags.at(AlarmStatusFlag::eFlag_systemFault )); + alarm_Flag_stop (vData.mFlags.at(AlarmStatusFlag::eFlag_stop )); + alarm_Flag_noClear (vData.mFlags.at(AlarmStatusFlag::eFlag_noClear )); + alarm_Flag_noResume (vData.mFlags.at(AlarmStatusFlag::eFlag_noResume )); + alarm_Flag_noRinseback (vData.mFlags.at(AlarmStatusFlag::eFlag_noRinseback )); + alarm_Flag_noEndTreatment (vData.mFlags.at(AlarmStatusFlag::eFlag_noEndTreatment )); + alarm_Flag_noNewTreatment (vData.mFlags.at(AlarmStatusFlag::eFlag_noNewTreatment )); + alarm_Flag_bypassDialyzer (vData.mFlags.at(AlarmStatusFlag::eFlag_bypassDialyzer )); + alarm_Flag_alarmsToEscalate (vData.mFlags.at(AlarmStatusFlag::eFlag_alarmsToEscalate)); + alarm_Flag_alarmsSilenced (vData.mFlags.at(AlarmStatusFlag::eFlag_alarmsSilenced )); +} Index: sources/view/valarmstatus.h =================================================================== diff -u --- sources/view/valarmstatus.h (revision 0) +++ sources/view/valarmstatus.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,49 @@ +/*! + * + * 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 valarmstatus.h + * date 3/6/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "mmodel.h" +#include "vview.h" + +// namespace +namespace Gui { + +class VAlarmStatus : public QObject +{ + Q_OBJECT + + PROPERTY( quint32 , alarm_Priority , 0) + PROPERTY( quint32 , alarm_AlarmID , 0) + PROPERTY( quint32 , alarm_EscalateIn , 0) + PROPERTY( quint32 , alarm_MuteTimeout , 0) + PROPERTY( bool , alarm_Flag_systemFault , false) + PROPERTY( bool , alarm_Flag_stop , false) + PROPERTY( bool , alarm_Flag_noClear , false) + PROPERTY( bool , alarm_Flag_noResume , false) + PROPERTY( bool , alarm_Flag_noRinseback , false) + PROPERTY( bool , alarm_Flag_noEndTreatment , false) + PROPERTY( bool , alarm_Flag_noNewTreatment , false) + PROPERTY( bool , alarm_Flag_bypassDialyzer , false) + PROPERTY( bool , alarm_Flag_alarmsToEscalate , false) + PROPERTY( bool , alarm_Flag_alarmsSilenced , false) + + VIEW_DEC(VAlarmStatus, AlarmStatusData) + +}; + +} Index: sources/view/vpoweroff.cpp =================================================================== diff -u --- sources/view/vpoweroff.cpp (revision 0) +++ sources/view/vpoweroff.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,24 @@ +/*! + * + * 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 vpoweroff.cpp + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#include "vpoweroff.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VPowerOff, PowerOffData) + +void VPowerOff::onActionReceive(const PowerOffData &vData) +{ + poweroff_status(vData.mStatus); +} Index: sources/view/vpoweroff.h =================================================================== diff -u --- sources/view/vpoweroff.h (revision 0) +++ sources/view/vpoweroff.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,37 @@ +/*! + * + * 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 vpoweroff.h + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "mmodel.h" +#include "vview.h" + +// namespace +namespace Gui { + +class VPowerOff : public QObject +{ + Q_OBJECT + + PROPERTY( quint8, poweroff_status, 0) + + VIEW_DEC(VPowerOff, PowerOffData) + +}; + +} + Index: sources/view/vtreatmentbloodflow.cpp =================================================================== diff -u --- sources/view/vtreatmentbloodflow.cpp (revision 0) +++ sources/view/vtreatmentbloodflow.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,30 @@ +/*! + * + * 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 vtreatmentbloodflow.cpp + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#include "vtreatmentbloodflow.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VTreatmentBloodFlow, BloodFlowData) + +void VTreatmentBloodFlow::onActionReceive(const BloodFlowData &vData) +{ + bloodFlow_FlowSetPoint (vData.mFlowSetPoint ); + bloodFlow_MeasuredFlow (vData.mMeasuredFlow ); + bloodFlow_RotorSpeed (vData.mRotorSpeed ); + bloodFlow_MotorSpeed (vData.mMotorSpeed ); + bloodFlow_MotorCtlSpeed (vData.mMotorCtlSpeed ); + bloodFlow_MotorCtlCurrent (vData.mMotorCtlCurrent); + bloodFlow_PWMDutyCycle (vData.mPWMDutyCycle ); +} Index: sources/view/vtreatmentbloodflow.h =================================================================== diff -u --- sources/view/vtreatmentbloodflow.h (revision 0) +++ sources/view/vtreatmentbloodflow.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,42 @@ +/*! + * + * 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 vtreatmentbloodflow.h + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "mmodel.h" +#include "vview.h" + +// namespace +namespace Gui { + +class VTreatmentBloodFlow : public QObject +{ + Q_OBJECT + + PROPERTY( qint32 , bloodFlow_FlowSetPoint , 0) + PROPERTY( float , bloodFlow_MeasuredFlow , 0) + PROPERTY( float , bloodFlow_RotorSpeed , 0) + PROPERTY( float , bloodFlow_MotorSpeed , 0) + PROPERTY( float , bloodFlow_MotorCtlSpeed , 0) + PROPERTY( float , bloodFlow_MotorCtlCurrent, 0) + PROPERTY( float , bloodFlow_PWMDutyCycle , 0) + + VIEW_DEC(VTreatmentBloodFlow, BloodFlowData) + +}; + +} Index: sources/view/vtreatmentdialysateflow.cpp =================================================================== diff -u --- sources/view/vtreatmentdialysateflow.cpp (revision 0) +++ sources/view/vtreatmentdialysateflow.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,30 @@ +/*! + * + * 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 vtreatmentflows.cpp + * date 3/3/2020 + * author Behrouz NematiPour + * + */ +#include "vtreatmentdialysateflow.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VTreatmentDialysateFlow, DialysateFlowData) + +void VTreatmentDialysateFlow::onActionReceive(const DialysateFlowData &vData) +{ + dialysateFlow_FlowSetPoint (vData.mFlowSetPoint ); + dialysateFlow_MeasuredFlow (vData.mMeasuredFlow ); + dialysateFlow_RotorSpeed (vData.mRotorSpeed ); + dialysateFlow_MotorSpeed (vData.mMotorSpeed ); + dialysateFlow_MotorCtlSpeed (vData.mMotorCtlSpeed ); + dialysateFlow_MotorCtlCurrent (vData.mMotorCtlCurrent); + dialysateFlow_PWMDutyCycle (vData.mPWMDutyCycle ); +} Index: sources/view/vtreatmentdialysateflow.h =================================================================== diff -u --- sources/view/vtreatmentdialysateflow.h (revision 0) +++ sources/view/vtreatmentdialysateflow.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,42 @@ +/*! + * + * 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 vtreatmentflows.h + * date 3/3/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "mmodel.h" +#include "vview.h" + +// namespace +namespace Gui { + +class VTreatmentDialysateFlow : public QObject +{ + Q_OBJECT + + PROPERTY( qint32 , dialysateFlow_FlowSetPoint , 0) + PROPERTY( float , dialysateFlow_MeasuredFlow , 0) + PROPERTY( float , dialysateFlow_RotorSpeed , 0) + PROPERTY( float , dialysateFlow_MotorSpeed , 0) + PROPERTY( float , dialysateFlow_MotorCtlSpeed , 0) + PROPERTY( float , dialysateFlow_MotorCtlCurrent, 0) + PROPERTY( float , dialysateFlow_PWMDutyCycle , 0) + + VIEW_DEC(VTreatmentDialysateFlow, DialysateFlowData) + +}; + +} Index: sources/view/vtreatmenttime.cpp =================================================================== diff -u --- sources/view/vtreatmenttime.cpp (revision 0) +++ sources/view/vtreatmenttime.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,26 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, + * IN PART OR IN WHOLE, + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * file vtreatmenttime.cpp + * date 3/6/2020 + * author Behrouz NematiPour + * + */ +#include "vtreatmenttime.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VTreatmentTime, TreatmentTimeData) + +void VTreatmentTime::onActionReceive(const TreatmentTimeData &vData) +{ + time_Total (vData.mTotal ); + time_Elapsed (vData.mElapsed ); + time_Remaining (vData.mRemaining ); +} Index: sources/view/vtreatmenttime.h =================================================================== diff -u --- sources/view/vtreatmenttime.h (revision 0) +++ sources/view/vtreatmenttime.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,37 @@ +/*! + * + * 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 vtreatmenttime.h + * date 3/6/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "mmodel.h" +#include "vview.h" + +// namespace +namespace Gui { + +class VTreatmentTime : public QObject +{ + Q_OBJECT + + PROPERTY( quint32 , time_Total , 0) + PROPERTY( quint32 , time_Elapsed , 0) + PROPERTY( quint32 , time_Remaining , 0) + + VIEW_DEC(VTreatmentTime, TreatmentTimeData) + +}; +} Index: sources/view/vtreatmentultrafiltration.cpp =================================================================== diff -u --- sources/view/vtreatmentultrafiltration.cpp (revision 0) +++ sources/view/vtreatmentultrafiltration.cpp (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,30 @@ +/*! + * + * 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 vtreatmentultrafiltration.cpp + * date 3/5/2020 + * author Behrouz NematiPour + * + */ +#include "vtreatmentultrafiltration.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VTreatmentUltrafiltration, OutletFlowData) + +void VTreatmentUltrafiltration::onActionReceive(const OutletFlowData &vData) +{ + ultrafiltration_RefUFVol ( vData.mRefUFVol ); + ultrafiltration_MeasUFVol ( vData.mMeasUFVol ); + ultrafiltration_RotorSpeed ( vData.mRotorSpeed ); + ultrafiltration_MotorSpeed ( vData.mMotorSpeed ); + ultrafiltration_MotorCtlSpeed ( vData.mMotorCtlSpeed ); + ultrafiltration_MotorCtlCurrent ( vData.mMotorCtlCurrent ); + ultrafiltration_PWMDtCycle ( vData.mPWMDtCycle ); +} Index: sources/view/vtreatmentultrafiltration.h =================================================================== diff -u --- sources/view/vtreatmentultrafiltration.h (revision 0) +++ sources/view/vtreatmentultrafiltration.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,41 @@ +/*! + * + * 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 vtreatmentultrafiltration.h + * date 3/5/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "mmodel.h" +#include "vview.h" + +// namespace +namespace Gui { + +class VTreatmentUltrafiltration : public QObject +{ + Q_OBJECT + + PROPERTY( float, ultrafiltration_RefUFVol , 0) + PROPERTY( float, ultrafiltration_MeasUFVol , 0) + PROPERTY( float, ultrafiltration_RotorSpeed , 0) + PROPERTY( float, ultrafiltration_MotorSpeed , 0) + PROPERTY( float, ultrafiltration_MotorCtlSpeed , 0) + PROPERTY( float, ultrafiltration_MotorCtlCurrent, 0) + PROPERTY( float, ultrafiltration_PWMDtCycle , 0) + + VIEW_DEC(VTreatmentUltrafiltration, OutletFlowData) + +}; +} Index: sources/view/vview.h =================================================================== diff -u --- sources/view/vview.h (revision 0) +++ sources/view/vview.h (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) @@ -0,0 +1,55 @@ +/*! + * + * 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 + * date 3/9/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +//--------------------------------------------------------------------------------// +//--------------------------------------------------------------------------------// +// The child declaration in header +#define VIEW_DEC(vCLASS, vDATATYPE) \ +private: \ + void initConnections(); \ +public: \ + explicit vCLASS(QObject *parent = nullptr); \ +private Q_SLOTS: \ + void onActionReceive (const vDATATYPE &vData); \ +private: +//--------------------------------------------------------------------------------// +// The child definition in cpp +#define VIEW_DEF(vCLASS, vDATATYPE) \ +using namespace Gui; \ +vCLASS::vCLASS(QObject *parent) : QObject(parent) { \ + initConnections(); \ +} \ +void vCLASS::initConnections() { \ + ACTION_RECEIVE_BRIDGE_CONNECTION( \ + _GuiController, vDATATYPE); \ +} +//--------------------------------------------------------------------------------// +//--------- Please add the view type to the lists below to register them ---------// +//--------------------------------------------------------------------------------// +#include "vtreatmentbloodflow.h" +#include "vtreatmentdialysateflow.h" +#include "vtreatmentultrafiltration.h" +#include "vtreatmenttime.h" +#include "valarmstatus.h" +#include "vpoweroff.h" +//--------------------------------------------------------------------------------// +#define REGISTER_VIEW_TYPES \ + REGISTER_TYPE( VTreatmentBloodFlow ) \ + REGISTER_TYPE( VTreatmentDialysateFlow ) \ + REGISTER_TYPE( VTreatmentUltrafiltration ) \ + REGISTER_TYPE( VTreatmentTime ) \ + REGISTER_TYPE( VAlarmStatus ) \ + REGISTER_TYPE( VPowerOff ) +