Index: denali.pro =================================================================== diff -u -r0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c -r06d10ee1174f0947a01087554f3da3109b47aef6 --- denali.pro (.../denali.pro) (revision 0e528e5f706308c7b0e8f22a4d9dbb5b5715db7c) +++ denali.pro (.../denali.pro) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -108,6 +108,7 @@ sources/gui/guiview.h \ sources/gui/guicontroller.h \ \ # ---------- Views ---------- + sources/view/VEventSpy.h \ sources/view/hd/data/VHDTreatmentStatesData.h \ sources/view/vview.h \ sources/view/vpoweroff.h \ @@ -210,6 +211,7 @@ sources/gui/guiview.cpp \ sources/gui/guicontroller.cpp \ \ # ---------- Views ---------- + sources/view/VEventSpy.cpp \ sources/view/hd/data/VHDTreatmentStatesData.cpp \ sources/view/vpoweroff.cpp \ \ # ---------- Views - Alarm Index: denali.pro.user =================================================================== diff -u -r2fe4e09cd7e36bc092b88118d40c504b815e9854 -r06d10ee1174f0947a01087554f3da3109b47aef6 --- denali.pro.user (.../denali.pro.user) (revision 2fe4e09cd7e36bc092b88118d40c504b815e9854) +++ denali.pro.user (.../denali.pro.user) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -1122,15 +1122,6 @@ 1 - dwarf - - cpu-cycles - - - 250 - -F - true - 4096 false false 1000 @@ -1423,15 +1414,6 @@ 1 - dwarf - - cpu-cycles - - - 250 - -F - true - 4096 false false 1000 Index: denali.qrc =================================================================== diff -u -r7ed86349cdad43d311f776a69ed54c2023265e53 -r06d10ee1174f0947a01087554f3da3109b47aef6 --- denali.qrc (.../denali.qrc) (revision 7ed86349cdad43d311f776a69ed54c2023265e53) +++ denali.qrc (.../denali.qrc) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -68,6 +68,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 Index: sources/canbus/caninterface.cpp =================================================================== diff -u -r618891879f5cdc68e37ee68eea005afb76dd4e5b -r06d10ee1174f0947a01087554f3da3109b47aef6 --- sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 618891879f5cdc68e37ee68eea005afb76dd4e5b) +++ sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -367,8 +367,11 @@ case QCanBusDevice::ConnectionError: case QCanBusDevice::ConfigurationError: case QCanBusDevice::UnknownError: - _canStatus = _canDevice->errorString(); - LOG_DEBUG(QString("%1 - %2").arg(_erFrameCount).arg(_canStatus)); + // log the error each 10K frame and if error is different + if (_canStatus != _canDevice->errorString() || !(_erFrameCount % 100000)) { + _canStatus = _canDevice->errorString(); + LOG_DEBUG(QString("%1 - %2").arg(_erFrameCount).arg(_canStatus)); + } break; default: Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -r618891879f5cdc68e37ee68eea005afb76dd4e5b -r06d10ee1174f0947a01087554f3da3109b47aef6 --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 618891879f5cdc68e37ee68eea005afb76dd4e5b) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -328,12 +328,13 @@ */ void FrameInterface::appendHead(Can_Id vCan_Id, const QByteArray &vData) { - Frame frame = Frame(vCan_Id, vData); // coco begin validated: has been manually tested by sending over 4000 frames and not received by any other node. if (_txFrameList.count() >= _txFrameList_Max) { LOG_DEBUG(QString("Transmit buffer overflow of %1").arg(_txFrameList_Max)); return; // coco end } + + Frame frame = Frame(vCan_Id, vData); _txFrameList.append(frame); } Index: sources/gui/guiglobals.cpp =================================================================== diff -u -ree50b509107a743f6133a33371e18646ff9c10b2 -r06d10ee1174f0947a01087554f3da3109b47aef6 --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision ee50b509107a743f6133a33371e18646ff9c10b2) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -20,6 +20,7 @@ // Project #include "logger.h" #include "guiview.h" +#include "VEventSpy.h" // Project #include "MModel.h" @@ -56,7 +57,7 @@ #include "VTreatmentAdjustmentSaline.h" namespace Gui { - QQuickView *_viewer = nullptr; + MainView *_viewer = nullptr; /*! * \brief registerTypes @@ -72,6 +73,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. @@ -85,8 +87,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"); @@ -97,19 +103,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 application . // So it had been manually tested. - 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())); } @@ -118,9 +124,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 -ree50b509107a743f6133a33371e18646ff9c10b2 -r06d10ee1174f0947a01087554f3da3109b47aef6 --- sources/gui/guiglobals.h (.../guiglobals.h) (revision ee50b509107a743f6133a33371e18646ff9c10b2) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -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 Index: sources/gui/qml/components/DebugDataColumn.qml =================================================================== diff -u --- sources/gui/qml/components/DebugDataColumn.qml (revision 0) +++ sources/gui/qml/components/DebugDataColumn.qml (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -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 ManagerHome.qml + * \author (last) Behrouz NematiPour + * \date (last) 22-Mar-2020 + * \author (original) Behrouz NematiPour + * \date (original) 21-Oct-2019 + * + */ + +// Qt +import QtQuick 2.12 + +// Project +import Gui.Actions 0.1; + +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +Column { id: _root + property var model: [] + property string title: "Title" + property int fontPixelSizeTitle: 38 + property int fontPixelSizeText : 38 + property string textObjectName: "_DebugDataColumn" + + width : 150 + spacing : -10 + + Text { id: _title + text : _root.title + width : _root.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: fontPixelSizeTitle + font.underline: true + } + Repeater { id: _repeater + model: _root.model + Text { + objectName: _root.textObjectName + index + text: modelData + width: _root.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: fontPixelSizeText + } + } +} Index: sources/gui/qml/pages/ManagerHome.qml =================================================================== diff -u -red5d989264015440d9da6d0830679394a323cf55 -r06d10ee1174f0947a01087554f3da3109b47aef6 --- sources/gui/qml/pages/ManagerHome.qml (.../ManagerHome.qml) (revision ed5d989264015440d9da6d0830679394a323cf55) +++ sources/gui/qml/pages/ManagerHome.qml (.../ManagerHome.qml) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -17,7 +17,8 @@ import QtQuick 2.12 // Project -import Gui.Actions 0.1; +import Gui.Actions 0.1; +import Gui.VEventSpy 0.1; // Qml imports import "qrc:/globals" @@ -29,296 +30,228 @@ */ ScreenItem { id: _root - Text { id : _titleText - visible: true - anchors { - top : parent.top - left : parent.horizontalCenter - topMargin : (Variables.headerHeight - Variables.logoHeight) / 2 - horizontalCenter: parent.horizontalCenter - } - text: qsTr("~ DG ~") - horizontalAlignment: Text.horizontalCenter - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle + function col(idx, gap = 10) { + return idx * 150 + gap } - Column { id: _DGROPumpColumn - width : 150 - spacing : -5 - topPadding : 75 - leftPadding : 50 - Text { - id: _DGROPump_Title - text: qsTr(" ROPmp ") - width: _DGROPumpColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vDGROPump.pressure , - vDGROPump.flowRate .toFixed(2) , - vDGROPump.pwm .toFixed(2) - ] - Text { - objectName: "_DGROPumpData" + index - text: modelData - width: _DGROPumpColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } + function row(idx, gap = 10) { + return idx * 100 + gap } + DebugDataColumn { id: _DGROPumpColumn + x: col(0) + y: row(0) + title: qsTr(" ROPmp ") + model: [ + vDGROPump.pressure , + vDGROPump.flowRate .toFixed(2) , + vDGROPump.pwm .toFixed(2) + ] + textObjectName: "_DGROPumpData" + } - Column { id: _DGPressuresColumn - width : 150 - spacing : -5 - topPadding : 75 - leftPadding : 250 - Text { - id: _DGPressures_Title - text: qsTr(" Prssr ") - width: _DGPressuresColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vDGPressures.roInletPSI .toFixed(2) , - vDGPressures.roOutletPSI .toFixed(2) , - vDGPressures.drainInletPSI .toFixed(2) , - vDGPressures.drainOutletPSI .toFixed(2) - ] - Text { - objectName: "_DGPressuresData" + index - text: modelData - width: _DGPressuresColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } + DebugDataColumn { id: _DGDrainPumpColumn + x: col(1) + y: row(0) + title: qsTr(" DRPmp ") + model: [ + vDGDrainPump.rpm , + vDGDrainPump.dac , + ] + textObjectName: "_DGDrainPumpData" } - Column { id: _DGReservoirColumn - width : 150 - spacing : -5 - topPadding : 75 - leftPadding : 450 - Text { - id: _DGReservoir_Title - text: qsTr(" Rsrvr ") - width: _DGReservoirColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vDGReservoir.activeReservoir , - vDGReservoir.fillToVol , - vDGReservoir.drainToVol , - ] - Text { - objectName: "_DGReservoirData" + index - text: modelData - width: _DGReservoirColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } + DebugDataColumn { id: _DGPressuresColumn + x: col(2) + y: row(0) + title: qsTr(" Prssr ") + model: [ + vDGPressures.roInletPSI .toFixed(2) , + vDGPressures.roOutletPSI .toFixed(2) , + vDGPressures.drainInletPSI .toFixed(2) , + vDGPressures.drainOutletPSI .toFixed(2) + ] + textObjectName: "_DGPressuresData" } - Column { id: _DGHeatersColumn - width : 150 - spacing : -5 - topPadding : 75 - leftPadding : 650 - Text { - id: _DGHeaters_Title - text: qsTr(" Heatrs ") - width: _DGHeatersColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vDGHeaters.mainPrimaryDC , - vDGHeaters.smallPrimaryDC , - vDGHeaters.trimmerDC , - ] - Text { - objectName: "_DGHeatersData" + index - text: modelData - width: _DGHeatersColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } + DebugDataColumn { id: _DGReservoirColumn + x: col(3) + y: row(0) + title: qsTr(" Rsrvr ") + model: [ + vDGReservoir.activeReservoir , + vDGReservoir.fillToVol , + vDGReservoir.drainToVol , + ] + textObjectName: "_DGReservoirData" } - Column { id: _LoadCellReadingsColumn - width : 150 - spacing : -5 - topPadding : 75 - leftPadding : 850 - Text { - id: _LoadCellReading_Title - text: qsTr(" LoadCl ") - width: _LoadCellReadingsColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vDGLoadCellReadings.reservoir1Prim .toFixed(2) , - vDGLoadCellReadings.reservoir1Bkup .toFixed(2) , - vDGLoadCellReadings.reservoir2Prim .toFixed(2) , - vDGLoadCellReadings.reservoir2Bkup .toFixed(2) - ] - Text { - objectName: "_DGLoadCellReadingsData" + index - text: modelData - width: _LoadCellReadingsColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } + DebugDataColumn { id: _DGHeatersColumn + x: col(4) + y: row(0) + title: qsTr(" Heatrs ") + model: [ + vDGHeaters.mainPrimaryDC , + vDGHeaters.smallPrimaryDC , + vDGHeaters.trimmerDC , + ] + textObjectName: "_DGHeatersData" } - Column { id: _DGTemperaturesColumn - width : 150 - spacing : -5 - topPadding : 75 - leftPadding : 1050 - Text { - id: _DGTemperatures_Title - text: qsTr(" Tmprtr ") - width: _DGTemperaturesColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vDGTemperatures.inletPrimaryHeater .toFixed(2) , - vDGTemperatures.outletPrimaryHeater .toFixed(2) , - vDGTemperatures.conductivitySensor1 .toFixed(2) , - vDGTemperatures.conductivitySensor2 .toFixed(2) , - vDGTemperatures.outletRedundancy .toFixed(2) , - vDGTemperatures.inletDialysate .toFixed(2) , - vDGTemperatures.primaryHeaterThermoCouple .toFixed(2) , - vDGTemperatures.trimmerHeaterThermoCouple .toFixed(2) , - vDGTemperatures.primaryHeaterColdJunction .toFixed(2) , - vDGTemperatures.trimmerHeaterColdJunction .toFixed(2) , - vDGTemperatures.primaryHeaterInternal .toFixed(2) , - vDGTemperatures.trimmerHeaterInternal .toFixed(2) - ] - Text { - objectName: "_DGTemperaturesData" + index - text: modelData - width: _DGTemperaturesColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } + DebugDataColumn { id: _LoadCellReadingsColumn + x: col(5) + y: row(0) + title: qsTr(" LoadCl ") + model: [ + vDGLoadCellReadings.reservoir1Prim .toFixed(2) , + vDGLoadCellReadings.reservoir1Bkup .toFixed(2) , + vDGLoadCellReadings.reservoir2Prim .toFixed(2) , + vDGLoadCellReadings.reservoir2Bkup .toFixed(2) + ] + textObjectName: "_DGLoadCellReadingsData" } - // Row 2 - Column { id: _DGDrainPumpColumn - width : 150 - spacing : -5 - topPadding : 375 - leftPadding : 50 - Text { - id: _DGDrainPump_Title - text: qsTr(" DrnPmp ") - width: _DGDrainPumpColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vDGDrainPump.rpm , - vDGDrainPump.dac , - ] - Text { - objectName: "_DGDrainPumpData" + index - text: modelData - width: _DGDrainPumpColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } + DebugDataColumn { id: _DGTemperaturesColumn + x: col(6) + y: row(0) + title: qsTr(" Tmprtr ") + model: [ + vDGTemperatures.inletPrimaryHeater .toFixed(2) , + vDGTemperatures.outletPrimaryHeater .toFixed(2) , + vDGTemperatures.conductivitySensor1 .toFixed(2) , + vDGTemperatures.conductivitySensor2 .toFixed(2) , + vDGTemperatures.outletRedundancy .toFixed(2) , + vDGTemperatures.inletDialysate .toFixed(2) , + vDGTemperatures.primaryHeaterThermoCouple .toFixed(2) , + vDGTemperatures.trimmerHeaterThermoCouple .toFixed(2) , + vDGTemperatures.primaryHeaterColdJunction .toFixed(2) , + vDGTemperatures.trimmerHeaterColdJunction .toFixed(2) , + vDGTemperatures.primaryHeaterInternal .toFixed(2) , + vDGTemperatures.trimmerHeaterInternal .toFixed(2) + ] + textObjectName: "_DGTemperaturesData" } - // Row 3 - Column { id: _DGValvesStatesColumn - width : 300 - spacing : -5 - topPadding : 575 - leftPadding : 50 - Text { - id: _DGValvesStates_Title - text: qsTr(" Valves ") - width: _DGValvesStatesColumn.width - horizontalAlignment: Text.AlignLeft - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Text { - objectName: "_DGValvesStatesData" - text: vDGValvesStates.text - width: _DGValvesStatesColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } + // Next row + DebugDataColumn { id: _DGValvesStatesColumn + x: col(1) + y: row(2) + title: qsTr(" Valves ") + model: [ vDGValvesStates.text ] + textObjectName: "_DGValvesStatesData" } - Column { id: _DGOperationModeColumn - width : 300 - spacing : -5 - topPadding : 575 - leftPadding : 450 - Text { - id: _DGOperationMode_Title - text: qsTr(" Op Mode ") - width: _DGOperationModeColumn.width - horizontalAlignment: Text.AlignLeft - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true + DebugDataColumn { id: _DGOperationModeColumn + x: col(5) + y: row(2) + title: qsTr(" DG Mode ") + model: [ vDGOperationMode.text ] + textObjectName: "_DGOperationModeData" + } + + // --- HD --- + DebugDataColumn { id: _HDBloodFlowColumn + x: col(0) + y: row(3) + title: qsTr(" Blood ") + model: [ + 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) + ] + textObjectName: "_HDBloodFlowData" + } + + DebugDataColumn { id: _HDDialysateInletFlowColumn + x: col(1) + y: row(3) + title: qsTr(" Dlyst I ") + model: [ + 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) + ] + textObjectName: "_HDInletFlowData" + } + + DebugDataColumn { id: _HDDialysateOutletFlowColumn + x: col(2) + y: row(3) + title: qsTr(" Dlyst O ") + model: [ + vTreatmentUltrafiltration.ultrafiltration_RefUFVol .toFixed(2) , + vTreatmentUltrafiltration.ultrafiltration_MeasUFVol .toFixed(2) , + vTreatmentUltrafiltration.ultrafiltration_RotorSpeed .toFixed(2) , + vTreatmentUltrafiltration.ultrafiltration_MotorSpeed .toFixed(2) , + vTreatmentUltrafiltration.ultrafiltration_MotorCtlSpeed .toFixed(2) , + vTreatmentUltrafiltration.ultrafiltration_MotorCtlCurrent.toFixed(2) , + "%" + vTreatmentUltrafiltration.ultrafiltration_PWMDtCycle .toFixed(2) + ] + textObjectName: "_HDOutletFlowData" + } + + DebugDataColumn { id: _HDPressureOcclusionColumn + x: col(3) + y: row(3) + title: qsTr(" Prsr Oc ") + model: [ + vTreatmentPressureOcclusion.pressureocclusion_ArterialPressure .toFixed(2) , + vTreatmentPressureOcclusion.pressureocclusion_VenousPressure .toFixed(2) , + vTreatmentPressureOcclusion.pressureocclusion_BloodPumpOcclusion .toFixed(2) , + vTreatmentPressureOcclusion.pressureocclusion_DialysateInletPumpOcclusion .toFixed(2) , + vTreatmentPressureOcclusion.pressureocclusion_DialysateOutletPumpOcclusion .toFixed(2) + ] + textObjectName: "_PressureOcclusionData" + } + + DebugDataColumn { id: _HDOperationModeColumn + x: col(3) + y: row(2) + title: qsTr(" HD Mode ") + model: [ vHDOperationMode.text ] + textObjectName: "_HDOperationModeData" + } + + Text { id : _canbusFaultCountText + x: col(0) + y: row(6) + property int count: 0 + visible: true + text: qsTr("CAN Faults: %1").arg(count) + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: 38 + } + + Text { id : _mouseEventCountText + x: col(2) + y: row(6) + visible: true + text: String("Touch Count: %1,%2") + .arg(GuiEventSpy.touchCount /*.toString().padStart(4,'0')*/ ) + .arg(GuiEventSpy.touchPoints /*.toString().padStart(4,'0')*/ ) + horizontalAlignment: Text.AlignLeft + color: Colors.textMain + font.pixelSize: 38 + MouseArea { + anchors.fill: _mouseEventCountText + onClicked: GuiEventSpy.doTouchReset() } - Text { - objectName: "_DGOperationModeData" - text: vDGOperationMode.text - width: _DGOperationModeColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } } + Connections { target: _GuiView + onDidActionReceive: { + if (vAction === GuiActions.ID_CANBusFaultCount ) { + _canbusFaultCountText.count = vData[0] + } + } + } } Index: sources/gui/qml/pages/SettingsHome.qml =================================================================== diff -u -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 -r06d10ee1174f0947a01087554f3da3109b47aef6 --- sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) +++ sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -78,190 +78,6 @@ _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.NoData) } } - - Text { id : _canbusFaultCountText - property int count: 0 - visible: true - anchors { - top : parent.top - left : parent.left - topMargin : (Variables.headerHeight - Variables.logoHeight) / 2 - leftMargin : (Variables.headerHeight - Variables.logoHeight) / 2 - } - text: qsTr("CAN Faults : %1").arg(count) - horizontalAlignment: Text.AlignLeft - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - - Connections { target: _GuiView - onDidActionReceive: { - if (vAction === GuiActions.ID_CANBusFaultCount ) { - _canbusFaultCountText.count = vData[0] - } - } - } - - Column { id: _BloodFlowColumn - width : 150 - spacing : 20 - topPadding : 75 - leftPadding : 10 - Text { - id: _BloodFlow_Title - text: qsTr(" Blood ") - width: _BloodFlowColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - 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 - width: _BloodFlowColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } - } - - Column { id: _DialysateInletFlowColumn - width : 150 - spacing : 20 - topPadding : 75 - leftPadding : 200 - Text { - id: _DialysateInletFlow_Title - text: qsTr(" Dlyst I ") - width: _DialysateInletFlowColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - 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 - width: _DialysateInletFlowColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } - } - - Column { id: _DialysateOutletFlowColumn - width : 150 - spacing : 20 - topPadding : 75 - leftPadding : 400 - Text { - id: _DialysateOutletFlow_Title - text: qsTr(" Dlyst O ") - width: _DialysateOutletFlowColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vTreatmentUltrafiltration.ultrafiltration_RefUFVol .toFixed(2) , - vTreatmentUltrafiltration.ultrafiltration_MeasUFVol .toFixed(2) , - vTreatmentUltrafiltration.ultrafiltration_RotorSpeed .toFixed(2) , - vTreatmentUltrafiltration.ultrafiltration_MotorSpeed .toFixed(2) , - vTreatmentUltrafiltration.ultrafiltration_MotorCtlSpeed .toFixed(2) , - vTreatmentUltrafiltration.ultrafiltration_MotorCtlCurrent.toFixed(2) , - "%" + vTreatmentUltrafiltration.ultrafiltration_PWMDtCycle .toFixed(2) - ] - Text { - objectName: "_OutletFlowData" + index - text: modelData - width: _DialysateOutletFlowColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } - } - - Column { id: _PressureOcclusionColumn - width : 150 - spacing : 20 - topPadding : 75 - leftPadding : 600 - Text { - id: _PressureOcclusion_Title - text: qsTr(" Prsr Oc ") - width: _PressureOcclusionColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - font.underline: true - } - Repeater { - model: [ - vTreatmentPressureOcclusion.pressureocclusion_ArterialPressure .toFixed(2) , - vTreatmentPressureOcclusion.pressureocclusion_VenousPressure .toFixed(2) , - vTreatmentPressureOcclusion.pressureocclusion_BloodPumpOcclusion .toFixed(2) , - vTreatmentPressureOcclusion.pressureocclusion_DialysateInletPumpOcclusion .toFixed(2) , - vTreatmentPressureOcclusion.pressureocclusion_DialysateOutletPumpOcclusion .toFixed(2) - ] - Text { - objectName: "_PressureOcclusionData" + index - text: modelData - width: _PressureOcclusionColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } - } - - Column { id: _HDOperationModeColumn - width : 300 - spacing : -5 - topPadding : 625 - leftPadding : 10 - Row { - Text { - id: _HDOperationMode_Title - text: qsTr("Op Mode : ") - //width: _HDOperationModeColumn.width - horizontalAlignment: Text.AlignLeft - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - Text { - objectName: "_HDOperationModeData" - text: vHDOperationMode.text - //width: _HDOperationModeColumn.width - horizontalAlignment: Text.AlignRight - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle - } - } - } } /* Index: sources/view/VEventSpy.cpp =================================================================== diff -u --- sources/view/VEventSpy.cpp (revision 0) +++ sources/view/VEventSpy.cpp (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -0,0 +1,135 @@ +/*! + * + * 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 VEventSpy.cpp + * \date 8/21/2020 + * \author Behrouz NematiPour + * + */ +#include "VEventSpy.h" + +// Qt +#include +#include + +// Project +#include "guiglobals.h" +#include "logger.h" + +using namespace View; + +VEventSpy::VEventSpy(QObject *) +{ + initConnections(); +} + +void VEventSpy::initConnections() +{ + if (Gui::_viewer) { + QObject::connect(Gui::_viewer , SIGNAL( eventSpy(QEvent*)), + this , SLOT(onEventSpy(QEvent*))); + } +} + +void VEventSpy::onEventSpy(QEvent *vEvent) { + QEvent::Type mType = vEvent->type(); + switch (mType) { + + // Mouse + case QEvent::Type::MouseButtonDblClick : mouseEventSpy(vEvent, "mD"); break; + case QEvent::Type::MouseButtonPress : mouseEventSpy(vEvent, "mP"); break; + case QEvent::Type::MouseButtonRelease : mouseEventSpy(vEvent, "mR"); break; + case QEvent::Type::MouseMove : mouseEventSpy(vEvent, "mM"); break; + case QEvent::Type::MouseTrackingChange : mouseEventSpy(vEvent, "mT"); break; + + // Touch + case QEvent::Type::TouchBegin : touchEventSpy(vEvent, "tB"); break; + case QEvent::Type::TouchUpdate : touchEventSpy(vEvent, "tU"); break; + case QEvent::Type::TouchCancel : touchEventSpy(vEvent, "tC"); break; + case QEvent::Type::TouchEnd : touchEventSpy(vEvent, "tE"); break; + + default : + break; + + } + emit eventSpy(mType); +} + +/*! + * \brief VEventSpy::mouseEventSpy + * \param vEvent + * \param typeName + */ +void VEventSpy::mouseEventSpy(QEvent *vEvent, const QString &typeName) +{ + QMouseEvent *mouseEvent = static_cast(vEvent); + int x = mouseEvent->x(); + int y = mouseEvent->y(); + mouseCount( _mouseCount + 1 ); + mousePoint(QPoint(x, y)); + + QString btn; + switch (mouseEvent->button()) { + case Qt::LeftButton : btn = "L"; break; + case Qt::RightButton : btn = "R"; break; + case Qt::MiddleButton : btn = "M"; break; + case Qt::BackButton : btn = "B"; break; + case Qt::NoButton : btn = "_"; break; + default : break; + } + + QString mdf; + switch (mouseEvent->modifiers()) { + case Qt::NoModifier : mdf = "_"; break; + case Qt::ShiftModifier : mdf = "S"; break; + case Qt::ControlModifier: mdf = "C"; break; + case Qt::AltModifier : mdf = "A"; break; + case Qt::MetaModifier : mdf = "M"; break; + case Qt::KeypadModifier : mdf = "#"; break; + default : break; + } + LOG_DEBUG( btn + typeName + mdf + + QString(",%1,%2") + .arg(x, 4, 10, QChar('0')) + .arg(y, 4, 10, QChar('0'))); +} + +void VEventSpy::doMouseReset() { mouseCount(0); } + +/*! + * \brief VEventSpy::touchEventSpy + * \param vEvent + * \param typeName + */ +void VEventSpy::touchEventSpy(QEvent *vEvent, const QString &vTypeName) +{ + QTouchEvent *touchEvent = static_cast(vEvent); + const QList &points = touchEvent->touchPoints(); + QString logString; + int c = points.count(); + touchCount ( _touchCount + 1 ); + touchPoints( c ); + + logString += ',' + QString::number(c); + for (auto point : points) { + QString state; + switch (point.state()) { + case Qt::TouchPointPressed : state = "P"; break; // The touch point is now pressed. + case Qt::TouchPointMoved : state = "M"; break; // The touch point moved. + case Qt::TouchPointStationary : state = "S"; break; // The touch point did not move. + case Qt::TouchPointReleased : state = "R"; break; // The touch point was released. + default : break; + } + + QPointF pos = point.screenPos(); + logString += QString(",%1,%2,%3").arg(state).arg(pos.x()).arg(pos.y()); + } + LOG_DEBUG( vTypeName + logString ); +} + +void VEventSpy::doTouchReset() { touchCount(0); } Index: sources/view/VEventSpy.h =================================================================== diff -u --- sources/view/VEventSpy.h (revision 0) +++ sources/view/VEventSpy.h (revision 06d10ee1174f0947a01087554f3da3109b47aef6) @@ -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 VEventSpy.h + * \date 8/21/2020 + * \author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include +#include +#include + +// Project +#include "main.h" + +// define +#define _VEventSpy View::VEventSpy::I() + +// namespace +namespace View { + +class VEventSpy : public QObject { + Q_OBJECT + + // singleton + SINGLETON(VEventSpy) + + PROPERTY(quint64, touchCount , 0) + PROPERTY(quint64, touchPoints, 0) + + PROPERTY(quint64, mouseCount, 0) + PROPERTY(QPoint , mousePoint, QPoint()) + +private: + void initConnections(); + void mouseEventSpy(QEvent *vEvent, const QString &vTypeName); + void touchEventSpy(QEvent *vEvent, const QString &vTypeName); + +signals : + void countChanged(int vCount); + +signals: + void eventSpy(QEvent::Type vType ); + +private slots: + void onEventSpy(QEvent *vEvent); + +public slots: + void doMouseReset(); + void doTouchReset(); +}; + +}