Index: sources/applicationcontroller.cpp =================================================================== diff -u -r6c59703781373f33cfec27eacf1f7e4ba1374626 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 6c59703781373f33cfec27eacf1f7e4ba1374626) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -110,6 +110,9 @@ connect(&_Logger , SIGNAL(didExport()), this , SLOT( onExport())); + connect(&_GuiController , SIGNAL(didAdjustBloodDialysateFlows(float,float)), + this , SLOT( onAdjustBloodDialysateFlows(float,float))); + ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(_MessageDispatcher) } @@ -229,6 +232,14 @@ emit didExport(); } +void ApplicationController::onAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow) +{ + QVariantList mData; + mData += vBloodFlow; + mData += vDialysateFlow; + onActionTransmit(GuiActionType::AdjustBloodDialysateReq, mData); +} + /*! * \brief ApplicationController::keepAlive * \details This is the message which has to be send over the CANBUS Index: sources/applicationcontroller.h =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/applicationcontroller.h (.../applicationcontroller.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/applicationcontroller.h (.../applicationcontroller.h) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -72,6 +72,8 @@ void onExportLog (); void onExport (); + void onAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow); + ACTION_RECEIVE_MODEL_BRIDGE_DEFINITIONS signals: @@ -83,5 +85,7 @@ void didUSBDriveRemove(); void didExport (); + + void didAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow); }; Index: sources/canbus/messageglobals.h =================================================================== diff -u -r3bdf58e8bee7d76eb19c1116738ff1e2c534ccc7 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 3bdf58e8bee7d76eb19c1116738ff1e2c534ccc7) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -51,7 +51,12 @@ {Gui::GuiActionType::DialysateOutletFlow, 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::TreatmentTime , 3 * 4 }, // 3 parameters each 4bytes {Gui::GuiActionType::PressureOcclusion , 5 * 4 }, // 5 parameters each 4bytes + // ---- + {Gui::GuiActionType::AdjustBloodDialysateReq , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::AdjustBloodDialysateRsp , 4 * 4 }, // 4 parameters each 4bytes + + // ---- {Gui::GuiActionType::String , 255 }, {Gui::GuiActionType::Acknow , 0 }, }; Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r3bdf58e8bee7d76eb19c1116738ff1e2c534ccc7 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 3bdf58e8bee7d76eb19c1116738ff1e2c534ccc7) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -85,6 +85,13 @@ } break; + + case Gui::GuiActionType::AdjustBloodDialysateReq: + if (vData.count()) { + vPayload = Format::fromVariant(vData); + } + break; + default: QString mActionIdHexString = Format::toHexString(vActionId); LOG_ERROR(tr("Unknown Message ID (UI) '%1'").arg(mActionIdHexString)); Index: sources/gui/guicontroller.cpp =================================================================== diff -u -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -273,3 +273,8 @@ emit didExportLog(); } // coco end + +void GuiController::doAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow) +{ + emit didAdjustBloodDialysateFlows(vBloodFlow, vDialysateFlow); +} Index: sources/gui/guicontroller.h =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/gui/guicontroller.h (.../guicontroller.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/gui/guicontroller.h (.../guicontroller.h) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -79,6 +79,14 @@ void didExportLog(); void didExport (); + +//// ----- Adjust Blood/Dialysate Flows +public slots: + void doAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow); +signals: + void didAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow); + + }; } Index: sources/gui/guiglobals.h =================================================================== diff -u -r35959dd708a5c4fdf02626306441e5a77e7f7782 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/gui/guiglobals.h (.../guiglobals.h) (revision 35959dd708a5c4fdf02626306441e5a77e7f7782) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -44,6 +44,9 @@ PressureOcclusion = 0x0900, // message 9 + AdjustBloodDialysateReq = 0x1700, + AdjustBloodDialysateRsp = 0x1800, + String = 0xFFFE, Acknow = 0xFFFF, Index: sources/gui/guiview.cpp =================================================================== diff -u -r296e0e140bfeb193a9f571873afa6934143b1075 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/gui/guiview.cpp (.../guiview.cpp) (revision 296e0e140bfeb193a9f571873afa6934143b1075) +++ sources/gui/guiview.cpp (.../guiview.cpp) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -62,6 +62,10 @@ // From UI : Export Log connect(this , SIGNAL(didExportLog()), &_GuiController, SLOT( doExportLog())); + + // ----- Adjust Blood/Dialysate Flows + connect(this , SIGNAL(didAdjustBloodDialysateFlows(float, float)), + &_GuiController, SLOT( doAdjustBloodDialysateFlows(float, float))); } /*! Index: sources/gui/guiview.h =================================================================== diff -u -rbb8f39a014644c70b832dd2a784f62fa9f6b6106 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/gui/guiview.h (.../guiview.h) (revision bb8f39a014644c70b832dd2a784f62fa9f6b6106) +++ sources/gui/guiview.h (.../guiview.h) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -62,5 +62,15 @@ void didExportLog(); void didExport (); + +// ----- Adjust Blood/Dialysate Flows +public slots: + void doAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow) { + emit didAdjustBloodDialysateFlows(vBloodFlow, vDialysateFlow); + } +signals: + void didAdjustBloodDialysateFlows(float vBloodFlow, float vDialysateFlow); + + }; } Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -rcd7de5f6d239a11615ba8c6c03339a10996486ca -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision cd7de5f6d239a11615ba8c6c03339a10996486ca) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -56,6 +56,7 @@ TreatmentAdjustmentFlow { id: _treatmentAdjustmentFlow onCloseClicked : close() + onConfirmClicked : _GuiView.doAdjustBloodDialysateFlows(bloodFlowRateValue, dialysateFlowRateValue) } TreatmentCreate { id: _treatmentCreate Index: sources/main.h =================================================================== diff -u -r7edbf109108511ddf6066758bdb7aa29f9d8fad3 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/main.h (.../main.h) (revision 7edbf109108511ddf6066758bdb7aa29f9d8fad3) +++ sources/main.h (.../main.h) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -50,6 +50,7 @@ extern bool gDisableHunhandledReport; //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// +#define DEBUG_PROPERTY_CHANGED(vVARIABLE) qDebug() << "#" << #vVARIABLE << v##vVARIABLE; #define PROPERTY(vTYPE , vVARIABLE , vDEFVALUE, vALWAYSEMIT ) \ Q_PROPERTY(vTYPE vVARIABLE \ READ vVARIABLE \ @@ -68,7 +69,7 @@ if ( vALWAYSEMIT \ || ! init \ || _##vVARIABLE != v##vVARIABLE ) { \ - qDebug() << "#" << #vVARIABLE << v##vVARIABLE; \ + DEBUG_PROPERTY_CHANGED(vVARIABLE) \ init = true; \ _##vVARIABLE = v##vVARIABLE; \ emit vVARIABLE##Changed( _##vVARIABLE ); \ Index: sources/utility/format.cpp =================================================================== diff -u -rbb8f39a014644c70b832dd2a784f62fa9f6b6106 -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/utility/format.cpp (.../format.cpp) (revision bb8f39a014644c70b832dd2a784f62fa9f6b6106) +++ sources/utility/format.cpp (.../format.cpp) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -13,6 +13,11 @@ */ #include "format.h" +// Qt + +// Project +#include + Format::Format() { } QString Format::toHexString(quint16 vValue, bool vWith0x, quint8 vLen) { @@ -47,6 +52,28 @@ return mData; } + if ( vData.type() == static_cast(QMetaType::Float) ) { + Types::F32 f32; + float value; + bool ok = false; + value = vData.toFloat(&ok); + if (ok) { + f32.value = value; + } else { + f32.value = 0; + } + Types::setValue(f32, mData); + return mData; + } + + if ( vData.type() == QVariant::List ) { + QVariantList list = vData.toList(); + for(auto item: list) { + mData += fromVariant(item); + } + return mData; + } + mData += vData.toUInt(); return mData; } Index: sources/utility/types.h =================================================================== diff -u -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a -rfef563aa317eb3e025e2dab0264e854f05a216d6 --- sources/utility/types.h (.../types.h) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) +++ sources/utility/types.h (.../types.h) (revision fef563aa317eb3e025e2dab0264e854f05a216d6) @@ -109,6 +109,9 @@ static bool getBits (const QByteArray &vData, int &vIndex, QBitArray &vFlags, int vLen); template < typename T > + static bool setValue(const T &vValue, QByteArray &vData); + + template < typename T > static T safeIncrement(T &vValue, quint8 vStep = 1) { // step can't be zero if (!vStep) vStep = 1; @@ -143,3 +146,14 @@ } return true; } + +template < typename T > +bool Types::setValue(const T &vValue, QByteArray &vData) { + int end = sizeof(T); + int i = 0; + while (i < end) { + vData[i] = vValue.bytes[i]; + i++; + } + return true; +}