Index: denali.pro =================================================================== diff -u -r90bcc276f2a879169fef20e9168711cf906c0e54 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- denali.pro (.../denali.pro) (revision 90bcc276f2a879169fef20e9168711cf906c0e54) +++ denali.pro (.../denali.pro) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -49,6 +49,8 @@ common/MsgDefs.h \ \ # Main sources/main.h \ + sources/model/MDGDebugText.h \ + sources/model/MHDDebugText.h \ sources/threads.h \ sources/maintimer.h \ sources/applicationpost.h \ @@ -76,6 +78,7 @@ sources/model/hd/data/MTreatmentRangesData.h \ sources/model/hd/data/MTreatmentPressureOcclusionData.h \ sources/model/hd/data/MTreatmentStatesData.h \ + sources/model/hd/data/MHDOperationModeData.h \ \ # ---------- Models - DG - Data sources/model/dg/data/MDGDrainPumpData.h \ sources/model/dg/data/MDGHeatersData.h \ @@ -109,18 +112,18 @@ sources/view/dg/data/VDGReservoirData.h \ sources/view/dg/data/VDGTemperaturesData.h \ sources/view/dg/data/VDGValvesStatesData.h \ + \ sources/view/vview.h \ sources/view/vpoweroff.h \ sources/view/valarmstatus.h \ - \ + sources/view/VHDOperationModeData.h \ sources/view/vtreatmenttime.h \ sources/view/vtreatmentbloodflow.h \ sources/view/vtreatmentdialysateflow.h \ sources/view/vtreatmentultrafiltration.h \ sources/view/vtreatmentranges.h \ sources/view/vtreatmentpressureocclusion.h \ - \ - \ + \ # Treatment Adjustments sources/view/vtreatmentadjustmentresponsebase.h \ sources/view/vtreatmentadjustmentduration.h \ sources/view/vtreatmentadjustmentflows.h \ @@ -144,6 +147,8 @@ \ # common \ # Main main.cpp \ + sources/model/MDGDebugText.cpp \ + sources/model/MHDDebugText.cpp \ sources/threads.cpp \ sources/maintimer.cpp \ sources/applicationpost.cpp \ @@ -169,6 +174,7 @@ sources/model/hd/data/MTreatmentRangesData.cpp \ sources/model/hd/data/MTreatmentPressureOcclusionData.cpp \ sources/model/hd/data/MTreatmentStatesData.cpp \ + sources/model/hd/data/MHDOperationModeData.cpp \ \ # ---------- Models - DG - Data sources/model/dg/data/MDGDrainPumpData.cpp \ sources/model/dg/data/MDGHeatersData.cpp \ @@ -201,17 +207,17 @@ sources/view/dg/data/VDGReservoirData.cpp \ sources/view/dg/data/VDGTemperaturesData.cpp \ sources/view/dg/data/VDGValvesStatesData.cpp \ + \ sources/view/vpoweroff.cpp \ sources/view/valarmstatus.cpp \ - \ + sources/view/VHDOperationModeData.cpp \ sources/view/vtreatmenttime.cpp \ sources/view/vtreatmentbloodflow.cpp \ sources/view/vtreatmentdialysateflow.cpp \ sources/view/vtreatmentultrafiltration.cpp \ sources/view/vtreatmentranges.cpp \ sources/view/vtreatmentpressureocclusion.cpp \ - \ - \ + \ # Treatment Adjustments sources/view/vtreatmentadjustmentresponsebase.cpp \ sources/view/vtreatmentadjustmentduration.cpp \ sources/view/vtreatmentadjustmentflows.cpp \ Index: denali.pro.user =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- denali.pro.user (.../denali.pro.user) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ denali.pro.user (.../denali.pro.user) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -644,7 +644,7 @@ true QtProjectManager.QMakeBuildStep CONFIG+=tst_acknow CONFIG+=CodeCoverage - true + false true @@ -1031,7 +1031,7 @@ Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Project/application/denali.pro /home/denali/Project/application/denali.pro - -u + false false @@ -1052,7 +1052,7 @@ Qt 5.12.5 (iMX8) Qt 5.12.5 (iMX8) {5d6458ef-f917-4aef-a092-c77bbe106149} - 1 + 0 0 0 Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -r2437559b2d4cd4c2ac6a926b4f55652e55e1f616 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 2437559b2d4cd4c2ac6a926b4f55652e55e1f616) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -182,6 +182,7 @@ case eChlid_HD_Sync : // coco begin validated: The UI/DG communication has not been defined and implemented yet. case eChlid_DG_Alarm : + case eChlid_DG_UI : case eChlid_DG_Sync : // coco end //case eChlid_DG_UI : // has duplicate value as eChlid_DG_Alarm Index: sources/canbus/messagebuilder.cpp =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -14,6 +14,7 @@ #include "messagebuilder.h" // Qt +#include // Project #include "logger.h" @@ -259,7 +260,7 @@ vMessage.can_id = vCan_Id; vMessage.head = getHeader (mPayload); // keep header before taking it out of the payload. doesn't affect payload vMessage.sequence = getSequence (mPayload); - vMessage.actionId = getActionId (mPayload); + vMessage.actionId = static_cast(getActionId(mPayload)); vMessage.length = getLength (mPayload); vMessage.data = getData (mPayload, vMessage.length); vMessage.initialized = true; @@ -372,12 +373,11 @@ * \note Removes the 2 bytes of ActionID from vPayload * It starts from the first byte so those 2 bytes should be the first 2 bytes. */ -Gui::GuiActionType MessageBuilder::getActionId(QByteArray &vPayload) +quint16 MessageBuilder::getActionId(QByteArray &vPayload) { - quint16 mActionId; - mActionId = (vPayload[0] << 8) | vPayload[1]; + quint16 mActionId = vPayload.mid(0,eLenActionId).toHex().toUInt(0,16); vPayload = vPayload.mid(eLenActionId); - return static_cast(mActionId); + return mActionId; } /*! Index: sources/canbus/messagebuilder.h =================================================================== diff -u -r2437559b2d4cd4c2ac6a926b4f55652e55e1f616 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/canbus/messagebuilder.h (.../messagebuilder.h) (revision 2437559b2d4cd4c2ac6a926b4f55652e55e1f616) +++ sources/canbus/messagebuilder.h (.../messagebuilder.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -70,7 +70,7 @@ bool hasSyncByte ( QByteArray &vPayload); Sequence getSequence ( QByteArray &vPayload); QByteArray getHeader (const QByteArray &vPayload); - Gui::GuiActionType getActionId ( QByteArray &vPayload); + quint16 getActionId ( QByteArray &vPayload); int getLength ( QByteArray &vPayload); QByteArray getData (const QByteArray &vPayload, int vLen); Index: sources/canbus/messageglobals.h =================================================================== diff -u -r90bcc276f2a879169fef20e9168711cf906c0e54 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 90bcc276f2a879169fef20e9168711cf906c0e54) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -43,62 +43,68 @@ */ const QHash payloadLen { // ---- - {Gui::GuiActionType::ID_PowerOff , 1 }, - {Gui::GuiActionType::ID_PowerOffBroadcast , 0 }, - {Gui::GuiActionType::ID_KeepAlive , 255 }, // 0 => 255 to be able to run a multi-frame test. + {Gui::GuiActionType::ID_PowerOff , 1 }, + {Gui::GuiActionType::ID_ShuttingDown , 0 }, + {Gui::GuiActionType::ID_KeepAlive , 255 }, // 0 => 255 to be able to run a multi-frame test. // ----- - {Gui::GuiActionType::ID_TreatmentTime , 3 * 4 }, // 3 parameters each 4bytes - {Gui::GuiActionType::ID_BloodFlow , 7 * 4 }, // 7 parameters each 4bytes - {Gui::GuiActionType::ID_DialysateInletFlow , 7 * 4 }, // 7 parameters each 4bytes - {Gui::GuiActionType::ID_DialysateOutletFlow , 7 * 4 }, // 7 parameters each 4bytes - {Gui::GuiActionType::ID_PressureOcclusion , 5 * 4 }, // 5 parameters each 4bytes + {Gui::GuiActionType::ID_TreatmentTime , 3 * 4 }, // 3 parameters each 4bytes + {Gui::GuiActionType::ID_BloodFlow , 7 * 4 }, // 7 parameters each 4bytes + {Gui::GuiActionType::ID_DialysateInletFlow , 7 * 4 }, // 7 parameters each 4bytes + {Gui::GuiActionType::ID_DialysateOutletFlow , 7 * 4 }, // 7 parameters each 4bytes + {Gui::GuiActionType::ID_PressureOcclusion , 5 * 4 }, // 5 parameters each 4bytes // ---- - {Gui::GuiActionType::ID_DGROPumpData , 3 * 4 }, // 3 parameters each 4bytes - {Gui::GuiActionType::ID_DGPressuresData , 4 * 4 }, // 4 parameters each 4bytes - {Gui::GuiActionType::ID_DGDrainPumpData , 2 * 4 }, // 2 parameters each 4bytes - {Gui::GuiActionType::ID_DGOperationModeData , 1 * 4 }, // 1 parameter each 4bytes - {Gui::GuiActionType::ID_DGReservoirData , 3 * 4 }, // 3 parameters each 4bytes - {Gui::GuiActionType::ID_DGValvesStatesData , 1 * 2 }, // 1 parameters each 2bytes - {Gui::GuiActionType::ID_DGHeatersData , 3 * 4 }, // 3 parameters each 4bytes - {Gui::GuiActionType::ID_DGLoadCellReadingsData , 4 * 4 }, // 4 parameters each 4bytes - {Gui::GuiActionType::ID_DGTemperaturesData , 12 * 4 }, // 12 parameters each 4bytes + {Gui::GuiActionType::ID_HDOperationModeData , 1 * 4 }, // 1 parameter each 4bytes // ---- - {Gui::GuiActionType::ID_AlarmStatus , 4 * 4 + 2 }, // 4 parameters each 4bytes + 1 parameter 2bytes - {Gui::GuiActionType::ID_AlarmTriggered , 1 * 4 }, // 1 parameter each 4bytes - {Gui::GuiActionType::ID_AlarmCleared , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_DGROPumpData , 3 * 4 }, // 3 parameters each 4bytes + {Gui::GuiActionType::ID_DGPressuresData , 4 * 4 }, // 4 parameters each 4bytes + {Gui::GuiActionType::ID_DGDrainPumpData , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_DGOperationModeData , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_DGReservoirData , 3 * 4 }, // 3 parameters each 4bytes + {Gui::GuiActionType::ID_DGValvesStatesData , 1 * 2 }, // 1 parameters each 2bytes + {Gui::GuiActionType::ID_DGHeatersData , 3 * 4 }, // 3 parameters each 4bytes + {Gui::GuiActionType::ID_DGLoadCellReadingsData , 4 * 4 }, // 4 parameters each 4bytes + {Gui::GuiActionType::ID_DGTemperaturesData , 12 * 4 }, // 12 parameters each 4bytes // ---- - {Gui::GuiActionType::ID_TreatmentRanges , 6 * 4 }, // 6 parameters each 4bytes - {Gui::GuiActionType::ID_TreatmentState , 3 * 4 }, // 3 parameters each 4bytes + {Gui::GuiActionType::ID_AlarmStatus , 4 * 4 + 2 }, // 4 parameters each 4bytes + 1 parameter 2bytes + {Gui::GuiActionType::ID_AlarmTriggered , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_AlarmCleared , 1 * 4 }, // 1 parameter each 4bytes // ---- - {Gui::GuiActionType::ID_AdjustBloodDialysateReq , 2 * 4 }, // 2 parameters each 4bytes - {Gui::GuiActionType::ID_AdjustBloodDialysateRsp , 4 * 4 }, // 4 parameters each 4bytes + {Gui::GuiActionType::ID_TreatmentRanges , 6 * 4 }, // 6 parameters each 4bytes + {Gui::GuiActionType::ID_TreatmentStates , 3 * 4 }, // 3 parameters each 4bytes // ---- - {Gui::GuiActionType::ID_AdjustDurationReq , 1 * 4 }, // 1 parameter each 4bytes - {Gui::GuiActionType::ID_AdjustDurationRsp , 4 * 4 }, // 4 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustBloodDialysateReq , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustBloodDialysateRsp , 4 * 4 }, // 4 parameters each 4bytes // ---- - {Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_AdjustDurationReq , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_AdjustDurationRsp , 4 * 4 }, // 4 parameters each 4bytes // ---- - {Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq , 1 * 4 }, // 1 parameter each 4bytes - {Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp , 8 * 4 }, // 8 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq , 1 * 4 }, // 1 parameter each 4bytes // ---- - {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq , 2 * 4 }, // 2 parameters each 4bytes - {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp , 5 * 4 }, + {Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq , 1 * 4 }, // 1 parameter each 4bytes + {Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp , 8 * 4 }, // 8 parameters each 4bytes // ---- - {Gui::GuiActionType::ID_CANBusFaultCount , 1 }, - {Gui::GuiActionType::ID_RawData , 255 }, - {Gui::GuiActionType::ID_Acknow , 0 }, - {Gui::GuiActionType::ID_AcknowGeneric , 1 }, + {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp , 5 * 4 }, + // ---- + {Gui::GuiActionType::ID_CANBusFaultCount , 1 }, + {Gui::GuiActionType::ID_RawData , 255 }, + {Gui::GuiActionType::ID_Acknow , 0 }, + {Gui::GuiActionType::ID_AcknowGeneric , 1 }, + + {Gui::GuiActionType::ID_HDDebugText , 40 + 1 }, // ASCII text - 40 bytes + null term + {Gui::GuiActionType::ID_DGDebugText , 40 + 1 }, // ASCII text - 40 bytes + null term + }; /*! @@ -158,7 +164,7 @@ eChlid_UI_HD = 0x100, ///< UI => HD [Out] // UI lessens occasionally - eChlid_DG_UI = eChlid_DG_Alarm, ///< No direct channel has been defined between DG&UI, May be required for logging + eChlid_DG_UI = 0x070, ///< No direct channel has been defined between DG&UI, May be required for logging eChlid_UI_DG = eChlid_UI_Sync , ///< No direct channel has been defined between DG&UI, May be required for logging }; Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r36740a3ee8e7164e70d8627b057624ec0ef1eb8f -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 36740a3ee8e7164e70d8627b057624ec0ef1eb8f) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -257,8 +257,8 @@ // coco-begin-validated: Is a placeholder and There is no definition/implementation of DG communication with UI. case eChlid_DG_UI : - //case eChlid_DG_Alarm: - case eChlid_DG_Sync : ok = interpretMessage_DG(vMessage, vData); break; + case eChlid_DG_Alarm: + case eChlid_DG_Sync : ok = interpretMessage_DG(vMessage, vData); break; default: break; @@ -282,36 +282,38 @@ */ bool MessageInterpreter::interpretMessage_HD(const Message &vMessage, QVariantList &vData) { - bool ok = false; + bool ok = false; vData.clear(); - //qDebug() << vMessage.actionId; switch (vMessage.actionId) { // notice we are in receive mode // ----- Debug - case Gui::GuiActionType::ID_CANBusFaultCount : ok = canbusFaultCountData (vMessage, vData); break; + case Gui::GuiActionType::ID_CANBusFaultCount : ok = canbusFaultCountData (vMessage, vData); break; // ----- Datum - case Gui::GuiActionType::ID_TreatmentTime : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_TreatmentTime , Model::MTreatmentTime ); break; - case Gui::GuiActionType::ID_BloodFlow : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_BloodFlow , Model::MBloodFlow ); break; - case Gui::GuiActionType::ID_DialysateInletFlow : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DialysateInletFlow , Model::MDialysateFlow ); break; - case Gui::GuiActionType::ID_DialysateOutletFlow : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DialysateOutletFlow , Model::MOutletFlow ); break; - case Gui::GuiActionType::ID_TreatmentRanges : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_TreatmentRanges , Model::MTreatmentRanges ); break; - case Gui::GuiActionType::ID_PressureOcclusion : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_PressureOcclusion , Model::MPressureOcclusion ); break; - case Gui::GuiActionType::ID_TreatmentState : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_TreatmentState , Model::MTreatmentStates ); break; + case Gui::GuiActionType::ID_TreatmentTime : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_TreatmentTime , Model::MTreatmentTime ); break; + case Gui::GuiActionType::ID_BloodFlow : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_BloodFlow , Model::MBloodFlow ); break; + case Gui::GuiActionType::ID_DialysateInletFlow : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DialysateInletFlow , Model::MDialysateFlow ); break; + case Gui::GuiActionType::ID_DialysateOutletFlow : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DialysateOutletFlow , Model::MOutletFlow ); break; + case Gui::GuiActionType::ID_TreatmentRanges : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_TreatmentRanges , Model::MTreatmentRanges ); break; + case Gui::GuiActionType::ID_PressureOcclusion : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_PressureOcclusion , Model::MPressureOcclusion ); break; + case Gui::GuiActionType::ID_TreatmentStates : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_TreatmentStates , Model::MTreatmentStates ); break; // ----- Events - case Gui::GuiActionType::ID_Acknow : ok = true; break; - case Gui::GuiActionType::ID_PowerOff : ok = powerOff (vMessage, vData); break; - case Gui::GuiActionType::ID_PowerOffBroadcast : ok = true; LOG_EVENT("HD,PowerOff Warning"); break; - case Gui::GuiActionType::ID_AlarmStatus : ok = alarmStatus (vMessage, vData); break; - case Gui::GuiActionType::ID_AlarmTriggered : ok = alarmTriggered (vMessage, vData); break; - case Gui::GuiActionType::ID_AlarmCleared : ok = alarmCleared (vMessage, vData); break; + case Gui::GuiActionType::ID_HDOperationModeData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_HDOperationModeData , Model::MHDOperationMode ); break; + case Gui::GuiActionType::ID_HDDebugText : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_HDDebugText , Model::MHDDebugText ); break; + case Gui::GuiActionType::ID_Acknow : ok = true; break; // Needs more investigation for EMIT_RECEIVE_SIGNAL consistency + case Gui::GuiActionType::ID_PowerOff : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_PowerOff , Model::MPowerOff ); break; + case Gui::GuiActionType::ID_ShuttingDown : ok = true; LOG_EVENT("HD,ShuttingDown"); break; // Needs more investigation for EMIT_RECEIVE_SIGNAL consistency + case Gui::GuiActionType::ID_AlarmStatus : ok = alarmStatus (vMessage, vData); break; + case Gui::GuiActionType::ID_AlarmTriggered : ok = alarmTriggered (vMessage, vData); break; + case Gui::GuiActionType::ID_AlarmCleared : ok = alarmCleared (vMessage, vData); break; + // Adjustment Response Messages - case Gui::GuiActionType::ID_AdjustDurationRsp : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_AdjustDurationRsp , Model::MAdjustDurationResponse ); break; - case Gui::GuiActionType::ID_AdjustBloodDialysateRsp : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_AdjustBloodDialysateRsp , Model::MAdjustBloodDialysateResponse ); break; - case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq : ok = adjustUltrafiltrationState (vMessage, vData); break; - case Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp : ok = adjustUltrafiltrationEdit (vMessage, vData); break; - case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp: ok = adjustUltrafiltrationConfirm (vMessage, vData); break; + case Gui::GuiActionType::ID_AdjustDurationRsp : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_AdjustDurationRsp , Model::MAdjustDurationResponse ); break; + case Gui::GuiActionType::ID_AdjustBloodDialysateRsp : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_AdjustBloodDialysateRsp , Model::MAdjustBloodDialysateResponse ); break; + case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq : ok = adjustUltrafiltrationState (vMessage, vData); break; // Needs more investigation for EMIT_RECEIVE_SIGNAL consistency + case Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp : ok = adjustUltrafiltrationEdit (vMessage, vData); break; // Needs more investigation for EMIT_RECEIVE_SIGNAL consistency + case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp : ok = adjustUltrafiltrationConfirm (vMessage, vData); break; // Needs more investigation for EMIT_RECEIVE_SIGNAL consistency // unhandles messages: these will only be logged as received message // there has nothing been defined for these messages. @@ -337,25 +339,25 @@ bool MessageInterpreter::interpretMessage_DG(const Message &vMessage, QVariantList &vData) { bool ok = false; - QString mSenderID = "DG,"; vData.clear(); - switch (vMessage.actionId) { // notice we are in receive mode case Gui::GuiActionType::ID_DGCheckIn: ok = true; - LOG_EVENT(mSenderID + QString("DG,CheckIn," + QVariant(vData).toStringList().join(','))); + LOG_EVENT(QString("DG,CheckIn," + QVariant(vData).toStringList().join(','))); break; - case Gui::GuiActionType::ID_DGROPumpData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGROPumpData , Model::MDGROPump ); break; - case Gui::GuiActionType::ID_DGPressuresData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGPressuresData , Model::MDGPressures ); break; - case Gui::GuiActionType::ID_DGDrainPumpData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGDrainPumpData , Model::MDGDrainPump ); break; - case Gui::GuiActionType::ID_DGOperationModeData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGOperationModeData , Model::MDGOperationMode ); break; - case Gui::GuiActionType::ID_DGReservoirData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGReservoirData , Model::MDGReservoir ); break; - case Gui::GuiActionType::ID_DGValvesStatesData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGValvesStatesData , Model::MDGValvesStates ); break; - case Gui::GuiActionType::ID_DGHeatersData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGHeatersData , Model::MDGHeaters ); break; - case Gui::GuiActionType::ID_DGLoadCellReadingsData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGLoadCellReadingsData , Model::MDGLoadCellReadings ); break; - case Gui::GuiActionType::ID_DGTemperaturesData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGTemperaturesData , Model::MDGTemperatures ); break; + case Gui::GuiActionType::ID_DGROPumpData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGROPumpData , Model::MDGROPump ); break; + case Gui::GuiActionType::ID_DGPressuresData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGPressuresData , Model::MDGPressures ); break; + case Gui::GuiActionType::ID_DGDrainPumpData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGDrainPumpData , Model::MDGDrainPump ); break; + case Gui::GuiActionType::ID_DGOperationModeData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGOperationModeData , Model::MDGOperationMode ); break; + case Gui::GuiActionType::ID_DGReservoirData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGReservoirData , Model::MDGReservoir ); break; + case Gui::GuiActionType::ID_DGValvesStatesData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGValvesStatesData , Model::MDGValvesStates ); break; + case Gui::GuiActionType::ID_DGHeatersData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGHeatersData , Model::MDGHeaters ); break; + case Gui::GuiActionType::ID_DGLoadCellReadingsData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGLoadCellReadingsData , Model::MDGLoadCellReadings ); break; + case Gui::GuiActionType::ID_DGTemperaturesData : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGTemperaturesData , Model::MDGTemperatures ); break; + case Gui::GuiActionType::ID_DGDebugText : EMIT_RECEIVE_SIGNAL(Gui::GuiActionType::ID_DGDebugText , Model::MDGDebugText ); break; + // unhandles messages: these will only be logged as received message // there has nothing been defined for these messages. default : @@ -401,31 +403,6 @@ // ---------- ---------- ---------- ---------- ---------- - HD ---------- ---------- ---------- ---------- ---------- // /*! - * \brief MessageInterpreter::powerOff - * \details This method interprets Power Off message data - * in vMessage of type Message. - * \param vMessage - The vMessage of type Message which contains all the data, - * require to be interpreted. - * \param vData - Power Off data - * \return true if the data can be extracted as defined for Power Off Message ID - */ -bool MessageInterpreter::powerOff(const Message &vMessage, QVariantList &vData) -{ - // TODO : review other methods - bool ok = false; - if ( ! isValidMessage(vMessage, Gui::GuiActionType::ID_PowerOff) ) return ok; - - Model::MPowerOff mData; - ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); - - mData.toVariantList(vData); - emit didActionReceive(mData.data()); - - return ok; -} - -/*! * \brief MessageInterpreter::alarmStatus * \details This method interprets Alarm Status message data * in vMessage of type Message. Index: sources/canbus/messageinterpreter.h =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -56,7 +56,6 @@ // ----- Events // ----- - HD - bool powerOff (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; bool alarmStatus (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; bool alarmTriggered (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; bool alarmCleared (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; Index: sources/gui/guiglobals.cpp =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -34,6 +34,7 @@ #include "vtreatmentpressureocclusion.h" #include "vtreatmenttime.h" #include "vtreatmentranges.h" +#include "VHDOperationModeData.h" #include "VDGDrainPumpData.h" #include "VDGHeatersData.h" @@ -67,7 +68,7 @@ qRegisterMetaType ("GuiRequestReasons"); - // Note that this Models are not uded in the qml + // 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. REGISTER_MODEL_METATYPES Index: sources/gui/guiglobals.h =================================================================== diff -u -r90bcc276f2a879169fef20e9168711cf906c0e54 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/gui/guiglobals.h (.../guiglobals.h) (revision 90bcc276f2a879169fef20e9168711cf906c0e54) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -38,7 +38,7 @@ * *** Exactly as it is going to be shown/used in denali messages ***\n * *** then it can be compared exactly the way it is with no conversion.***\n */ - enum GuiActionsType_Enum /*: quint16 QML doesn't support enum types */ { + enum GuiActionsType_Enum /* : quint16 QML doesn't support enum types */ { ID_Unknown = 0x0000, ID_CANBusFaultCount = 0x9909, @@ -48,23 +48,28 @@ ID_Acknow = 0xFFFF, ID_AcknowGeneric = 0x0000, //< Generic Acknowledgment is not a unique message ID and inherits its Id from the actual message. Zero is a placeholder + ID_HDDebugText = 0xF1FF, + ID_DGDebugText = 0xF2FF, + ID_DGCheckIn = 0x0600, ID_KeepAlive = 0x0700, ID_PowerOff = 0x0100, - ID_PowerOffBroadcast = 0x0E00, + ID_ShuttingDown = 0x0E00, ID_TreatmentTime = 0x0D00, ID_BloodFlow = 0x0500, ID_DialysateInletFlow = 0x0800, ID_DialysateOutletFlow = 0x0B00, ID_TreatmentRanges = 0x1A00, // 26 ID_PressureOcclusion = 0x0900, - ID_TreatmentState = 0x0F00, // 15 + ID_TreatmentStates = 0x0F00, // 15 ID_AlarmStatus = 0x0200, ID_AlarmTriggered = 0x0300, ID_AlarmCleared = 0x0400, + ID_HDOperationModeData = 0x2500, // 37 + ID_DGROPumpData = 0x1F00, // 31 ID_DGPressuresData = 0x2000, // 32 ID_DGDrainPumpData = 0x2400, // 36 @@ -115,6 +120,10 @@ #include "MsgDefs.h" Q_ENUM(Request_Reject_Reasons) + #include "HDDefs.h" + Q_ENUM(HD_Op_Modes) + Q_ENUM(UF_Adjustments) + #include "DGDefs.h" Q_ENUM(DG_Op_Modes) }; @@ -128,8 +137,12 @@ typedef GuiActions::Request_Reject_Reasons GuiRequestReasons; + typedef GuiActions::HD_Op_Modes GuiHDOpModes; typedef GuiActions::DG_Op_Modes GuiDGOpModes; + typedef GuiActions::UF_Adjustments GuiUFAdjustment; + + void registerTypes(); void registerQmlTypes(); Index: sources/gui/qml/main.qml =================================================================== diff -u -r90bcc276f2a879169fef20e9168711cf906c0e54 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/gui/qml/main.qml (.../main.qml) (revision 90bcc276f2a879169fef20e9168711cf906c0e54) +++ sources/gui/qml/main.qml (.../main.qml) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -29,6 +29,7 @@ import VTreatmentTime 0.1; import VAlarmStatus 0.1; import VPowerOff 0.1; +import VHDOperationMode 0.1; import VTreatmentAdjustmentDuration 0.1; import VTreatmentAdjustmentFlows 0.1; @@ -66,14 +67,12 @@ onDidActionReceive: { //console.debug(vAction, vData) switch(vAction) { - case GuiActions.ID_PowerOffBroadcast: + case GuiActions.ID_ShuttingDown: _autoHideInfo.showDialog( qsTr("System is shutting down"), 5000 // if any error happens and shutdown is not successful then after 5 seconds dialog hides. ) break; - case GuiActions.ID_DGLoadCellReadingsData: - console.debug("ID_DGLoadCellReadingsData",vData) } } @@ -84,6 +83,7 @@ VAlarmStatus { id: vAlarmStatus } VPowerOff { id: vPowerOff } + VHDOperationMode { id: vHDOperationMode } VTreatmentBloodFlow { id: vTreatmentBloodFlow } VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } Index: sources/gui/qml/pages/SettingsHome.qml =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -74,7 +74,7 @@ } text.text: qsTr("Shutdown") button.onPressed: { - _GuiView.doActionTransmit(GuiActions.PowerOff, GuiActions.NoData) + _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.NoData) } } @@ -105,7 +105,7 @@ width : 150 spacing : 20 topPadding : 75 - leftPadding: 10 + leftPadding : 10 Text { id: _BloodFlow_Title text: qsTr(" Blood ") @@ -234,4 +234,29 @@ } } } + + 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: "_HDOperationMode" + text: vHDOperationMode.text + //width: _HDOperationModeColumn.width + horizontalAlignment: Text.AlignRight + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } + } + } } Index: sources/model/MAbstract.cpp =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/MAbstract.cpp (.../MAbstract.cpp) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ sources/model/MAbstract.cpp (.../MAbstract.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -18,6 +18,8 @@ using namespace Model; +// #define ROUND_FLOATS + /*! * \brief MAbstract::toVariantList * \details Currnet values of the model data will be listed in a QVariantList vData. @@ -38,7 +40,11 @@ QString mString = description(); for( const auto ¶meter : mParameters ) { if (parameter.type() == uint(QMetaType::Float)) // Qt has a mixed definition of QVariant::Type and QMetaType seems like a not fixed issue. +#ifdef ROUND_FLOATS mString += _delimiter + QString("%1").arg(parameter.toFloat(),0,'f',_precision); +#else + mString += _delimiter + parameter.toString(); +#endif else mString += _delimiter + parameter.toString(); Index: sources/model/MAbstract.h =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/MAbstract.h (.../MAbstract.h) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ sources/model/MAbstract.h (.../MAbstract.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -25,8 +25,8 @@ class MAbstract { private: - QString _delimiter = ","; - quint8 _precision = 2; + const char _delimiter = ','; + quint8 _precision = 2; protected: enum class Type_Enum { Index: sources/model/MDGDebugText.cpp =================================================================== diff -u --- sources/model/MDGDebugText.cpp (revision 0) +++ sources/model/MDGDebugText.cpp (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -0,0 +1,35 @@ +/*! + * + * 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 MDebugText.h + * \date 7/9/2020 + * \author Behrouz NematiPour + * + */ +#include "MDGDebugText.h" + +using namespace Model; + +QVariantList MDGDebugText::parameters() const { + return { + _data + }; +} + +bool MDGDebugText::fromByteArray(const QByteArray &vByteArray, int *) { + // since this is a varable length debug text, it is not required to check for length + // Qt simple conversion is used. + _data = qPrintable(vByteArray); // Has to be printable + return true ; +} + +MDGDebugText::Data MDGDebugText::data() const { + Data data; + data.text = _data; + return data; +} Index: sources/model/MDGDebugText.h =================================================================== diff -u --- sources/model/MDGDebugText.h (revision 0) +++ sources/model/MDGDebugText.h (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -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 MDebugText.h + * \date 7/9/2020 + * \author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; + +namespace Model { + +class MDGDebugText : public MAbstract { + + // friends + friend class ::tst_models; + +protected: + // DG Drain Pump Data (U32) Set pt. RPM (U32) DAC value + Type_Enum typeText () const override { return Type_Enum::eEvent; } + Unit_Enum unitText () const override { return Unit_Enum::eDG ; } + QString infoText () const override { return QString("Debug") ; } + QVariantList parameters() const override; + + QString _data; + +public: + struct Data { + QString text; + }; + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const; +}; + +} + +typedef Model::MDGDebugText::Data DGDebugTextData; Index: sources/model/MHDDebugText.cpp =================================================================== diff -u --- sources/model/MHDDebugText.cpp (revision 0) +++ sources/model/MHDDebugText.cpp (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -0,0 +1,35 @@ +/*! + * + * 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 MDebugText.h + * \date 7/9/2020 + * \author Behrouz NematiPour + * + */ +#include "MHDDebugText.h" + +using namespace Model; + +QVariantList MHDDebugText::parameters() const { + return { + _data + }; +} + +bool MHDDebugText::fromByteArray(const QByteArray &vByteArray, int *) { + // since this is a varable length debug text, it is not required to check for length + // Qt simple conversion is used. + _data = qPrintable(vByteArray); // Has to be printable + return true ; +} + +MHDDebugText::Data MHDDebugText::data() const { + Data data; + data.text = _data; + return data; +} Index: sources/model/MHDDebugText.h =================================================================== diff -u --- sources/model/MHDDebugText.h (revision 0) +++ sources/model/MHDDebugText.h (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -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 MDebugText.h + * \date 7/9/2020 + * \author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MAbstract.h" +#include "types.h" + +// forward declarations +class tst_models; + +namespace Model { + +class MHDDebugText : public MAbstract { + + // friends + friend class ::tst_models; + +protected: + // DG Drain Pump Data (U32) Set pt. RPM (U32) DAC value + Type_Enum typeText () const override { return Type_Enum::eEvent; } + Unit_Enum unitText () const override { return Unit_Enum::eHD ; } + QString infoText () const override { return QString("Debug") ; } + QVariantList parameters() const override; + + QString _data; + +public: + struct Data { + QString text; + }; + + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const; +}; + +} + +typedef Model::MHDDebugText::Data HDDebugTextData; Index: sources/model/MModel.h =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/MModel.h (.../MModel.h) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/model/MModel.h (.../MModel.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -16,16 +16,16 @@ #include "main.h" // models -#include "MAlarmStatusData.h" #include "MPowerOff.h" +#include "MAlarmStatusData.h" +#include "MAlarmTriggered.h" +#include "MAlarmCleared.h" #include "MTreatmentTimeData.h" #include "MTreatmentFlowsData.h" #include "MTreatmentOutletFlowData.h" #include "MTreatmentPressureOcclusionData.h" #include "MTreatmentRangesData.h" -#include "MAlarmTriggered.h" -#include "MAlarmCleared.h" #include "MTreatmentStatesData.h" #include "MDGDrainPumpData.h" @@ -38,12 +38,16 @@ #include "MDGTemperaturesData.h" #include "MDGValvesStatesData.h" -#include "MTreatmentAdjustBloodDialysateResponse.h" +#include "MHDDebugText.h" +#include "MDGDebugText.h" + +#include "MHDOperationModeData.h" +#include "MTreatmentAdjustRequests.h" #include "MTreatmentAdjustDurationResponse.h" +#include "MTreatmentAdjustBloodDialysateResponse.h" #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" -#include "MTreatmentAdjustRequests.h" /*! * \brief Message interpretation instruction @@ -122,7 +126,8 @@ REGISTER_METATYPE( TreatmentRangesData ) \ REGISTER_METATYPE( AlarmTriggeredData ) \ REGISTER_METATYPE( AlarmClearedData ) \ - REGISTER_METATYPE( TreatmentStateData ) \ + REGISTER_METATYPE( TreatmentStatesData ) \ + REGISTER_METATYPE( HDOperationModeData ) \ \ REGISTER_METATYPE( DGROPumpData ) \ REGISTER_METATYPE( DGPressuresData ) \ @@ -134,6 +139,9 @@ REGISTER_METATYPE( DGLoadCellReadingsData ) \ REGISTER_METATYPE( DGTemperaturesData ) \ \ + REGISTER_METATYPE( HDDebugTextData ) \ + REGISTER_METATYPE( DGDebugTextData ) \ + \ REGISTER_METATYPE( AdjustBloodDialysateRequestData ) \ REGISTER_METATYPE( AdjustDurationRequestData ) \ REGISTER_METATYPE( AdjustUltrafiltrationStateRequestData ) \ @@ -158,7 +166,8 @@ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, TreatmentRangesData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AlarmTriggeredData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AlarmClearedData ) \ - ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, TreatmentStateData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, TreatmentStatesData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, HDOperationModeData ) \ \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DGROPumpData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DGPressuresData ) \ @@ -170,6 +179,9 @@ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DGLoadCellReadingsData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DGTemperaturesData ) \ \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, HDDebugTextData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DGDebugTextData ) \ + \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustUltrafiltrationStateResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AdjustDurationResponseData ) \ @@ -194,7 +206,8 @@ ACTION_RECEIVE_BRIDGE_DEFINITION( TreatmentRangesData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AlarmTriggeredData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AlarmClearedData ) \ - ACTION_RECEIVE_BRIDGE_DEFINITION( TreatmentStateData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( TreatmentStatesData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( HDOperationModeData ) \ \ ACTION_RECEIVE_BRIDGE_DEFINITION( DGROPumpData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( DGPressuresData ) \ @@ -206,6 +219,9 @@ ACTION_RECEIVE_BRIDGE_DEFINITION( DGLoadCellReadingsData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( DGTemperaturesData ) \ \ + ACTION_RECEIVE_BRIDGE_DEFINITION( HDDebugTextData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( DGDebugTextData ) \ + \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustUltrafiltrationStateResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AdjustDurationResponseData ) \ @@ -244,7 +260,8 @@ ACTION_RECEIVE_SIGNAL( TreatmentRangesData ) \ ACTION_RECEIVE_SIGNAL( AlarmTriggeredData ) \ ACTION_RECEIVE_SIGNAL( AlarmClearedData ) \ - ACTION_RECEIVE_SIGNAL( TreatmentStateData ) \ + ACTION_RECEIVE_SIGNAL( TreatmentStatesData ) \ + ACTION_RECEIVE_SIGNAL( HDOperationModeData ) \ \ ACTION_RECEIVE_SIGNAL( DGROPumpData ) \ ACTION_RECEIVE_SIGNAL( DGPressuresData ) \ @@ -256,6 +273,9 @@ ACTION_RECEIVE_SIGNAL( DGLoadCellReadingsData ) \ ACTION_RECEIVE_SIGNAL( DGTemperaturesData ) \ \ + ACTION_RECEIVE_SIGNAL( HDDebugTextData ) \ + ACTION_RECEIVE_SIGNAL( DGDebugTextData ) \ + \ ACTION_RECEIVE_SIGNAL( AdjustUltrafiltrationStateResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustBloodDialysateResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustDurationResponseData ) \ Index: sources/model/MPowerOff.cpp =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/MPowerOff.cpp (.../MPowerOff.cpp) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/model/MPowerOff.cpp (.../MPowerOff.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -15,18 +15,12 @@ using namespace Model; -MPowerOff::MPowerOff() { } - -// ----- TreatmentTime ----- -QString MPowerOff::toString() const { - return QString(stringPrefix + ",%1") - .arg(_data.mStatus.value); +QVariantList MPowerOff::parameters() const { + return { + _data.mStatus .value + }; } -void MPowerOff::toVariantList(QVariantList &vData) const { - vData += _data.mStatus.value; -} - bool MPowerOff::fromByteArray(const QByteArray &vByteArray, int *vIndex) { int index = 0; // message data start position if (GetValue(vByteArray, index, _data.mStatus )) Index: sources/model/MPowerOff.h =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/MPowerOff.h (.../MPowerOff.h) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/model/MPowerOff.h (.../MPowerOff.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -17,31 +17,32 @@ #include // Project +#include "MAbstract.h" #include "types.h" namespace Model { -class MPowerOff { +class MPowerOff : public MAbstract { public: - QString stringPrefix = "PowerOff"; - struct Data { - quint8 mStatus = 0; - bool mShutDown = false; - }; + Type_Enum typeText () const override { return Type_Enum::eEvent; } + Unit_Enum unitText () const override { return Unit_Enum::eHD ; } + QString infoText () const override { return QString("PowerOff"); } + QVariantList parameters() const override; -private: struct { Types::U08 mStatus ; } _data; public: - MPowerOff(); + struct Data { + quint8 mStatus = 0; + bool mShutDown = false; + }; - QString toString ( ) const ; - void toVariantList ( QVariantList &vData ) const ; - bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr); + MPowerOff () { } - Data data() const; + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; }; } Index: sources/model/hd/adjustment/MTreatmentAdjustRequests.h =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -17,9 +17,11 @@ // Qt #include +//project +#include "guiglobals.h" + namespace Model { -#include "HDDefs.h" /*! * Simple request models @@ -94,8 +96,8 @@ class MAdjustUltrafiltrationConfirmReq : public MModel { public: enum Options : quint32 { - eDuration = UF_Adjustments::UF_ADJ_TREATMENT_TIME, - eRate = UF_Adjustments::UF_ADJ_UF_RATE, + eDuration = Gui::GuiActions::UF_ADJ_TREATMENT_TIME, + eRate = Gui::GuiActions::UF_ADJ_UF_RATE, }; float volume = 0; Options option = eDuration; Index: sources/model/hd/data/MHDOperationModeData.cpp =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/hd/data/MHDOperationModeData.cpp (.../MHDOperationModeData.cpp) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/model/hd/data/MHDOperationModeData.cpp (.../MHDOperationModeData.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -6,48 +6,30 @@ * IN PART OR IN WHOLE, * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file mloadcellreadings.cpp - * \date 6/10/2020 + * \file MHDOperationModeData.cpp + * \date 7/12/2020 * \author Behrouz NematiPour * */ -#include "mloadcellreadings.h" +#include "MHDOperationModeData.h" using namespace Model; -QString MLoadCellReadings::toString() const { - return QString(stringPrefix + ",%1,%2,%3,%4") - .arg(_data.mReservoir1Prim .value) - .arg(_data.mReservoir1Bkup .value) - .arg(_data.mReservoir2Prim .value) - .arg(_data.mReservoir2Bkup .value); +QVariantList MHDOperationMode::parameters() const { + return { + _data.mOpMode.value + }; } -void MLoadCellReadings::toVariantList(QVariantList &vData) const { - vData += _data.mReservoir1Prim .value; - vData += _data.mReservoir1Bkup .value; - vData += _data.mReservoir2Prim .value; - vData += _data.mReservoir2Bkup .value; -} - -bool MLoadCellReadings::fromByteArray(const QByteArray &vByteArray, int *vIndex) { +bool MHDOperationMode::fromByteArray(const QByteArray &vByteArray, int *vIndex) { int index = 0; // message data start position - if (GetValue(vByteArray, index, _data.mReservoir1Prim )) - if (GetValue(vByteArray, index, _data.mReservoir1Bkup )) - if (GetValue(vByteArray, index, _data.mReservoir2Prim )) - if (GetValue(vByteArray, index, _data.mReservoir2Bkup )) + if (GetValue(vByteArray, index, _data.mOpMode )) return true ; else { if(vIndex) *vIndex = index; return false; } - else { if(vIndex) *vIndex = index; return false; } - else { if(vIndex) *vIndex = index; return false; } - else { if(vIndex) *vIndex = index; return false; } } -MLoadCellReadings::Data MLoadCellReadings::data() const { +MHDOperationMode::Data MHDOperationMode::data() const { Data data; - data.mReservoir1Prim = _data.mReservoir1Prim .value; - data.mReservoir1Bkup = _data.mReservoir1Bkup .value; - data.mReservoir2Prim = _data.mReservoir2Prim .value; - data.mReservoir2Bkup = _data.mReservoir2Bkup .value; + data.mOpMode = _data.mOpMode.value; return data; } Index: sources/model/hd/data/MHDOperationModeData.h =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/hd/data/MHDOperationModeData.h (.../MHDOperationModeData.h) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/model/hd/data/MHDOperationModeData.h (.../MHDOperationModeData.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -6,8 +6,8 @@ * IN PART OR IN WHOLE, * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file mloadcellreadings.h - * \date 6/10/2020 + * \file MHDOperationModeData.h + * \date 7/12/2020 * \author Behrouz NematiPour * */ @@ -17,45 +17,40 @@ #include // Project +#include "MAbstract.h" #include "types.h" // forward declarations class tst_models; namespace Model { -class MLoadCellReadings { +class MHDOperationMode : public MAbstract { // friends friend class ::tst_models; -public: - QString stringPrefix = "Load Cell Readings"; - struct Data { - float mReservoir1Prim = 0; /*!< ArterialPressure value of type float extracted out */ - float mReservoir1Bkup = 0; /*!< VenousPressure value of type float extracted out */ - float mReservoir2Prim = 0; /*!< BloodPumpOcclusion value of type float extracted out */ - float mReservoir2Bkup = 0; /*!< DialysateInletPumpOcclusion value of type float extracted out */ - }; + // HD Operation Mode (U32) HD Op Mode + Type_Enum typeText () const override { return Type_Enum::eDatum; } + Unit_Enum unitText () const override { return Unit_Enum::eHD ; } + QString infoText () const override { return QString("OpMode"); } + QVariantList parameters() const override; -private: struct { - Types::F32 mReservoir1Prim ; - Types::F32 mReservoir1Bkup ; - Types::F32 mReservoir2Prim ; - Types::F32 mReservoir2Bkup ; + Types::U32 mOpMode ; } _data; public: - MLoadCellReadings () { } + struct Data { + quint32 mOpMode = 0; /*!< Reservoir1 Prim value of type float extracted out */ + }; - QString toString ( ) const ; - void toVariantList ( QVariantList &vData ) const ; - bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr); + MHDOperationMode () {} - Data data() const; + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr) override; + Data data ( ) const ; }; } -typedef Model::MLoadCellReadings::Data LoadCellReadingsData; +typedef Model::MHDOperationMode::Data HDOperationModeData; Index: sources/model/hd/data/MTreatmentStatesData.h =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/model/hd/data/MTreatmentStatesData.h (.../MTreatmentStatesData.h) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ sources/model/hd/data/MTreatmentStatesData.h (.../MTreatmentStatesData.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -56,4 +56,4 @@ } -typedef Model::MTreatmentStates::Data TreatmentStateData; +typedef Model::MTreatmentStates::Data TreatmentStatesData; Index: sources/storage/filehandler.cpp =================================================================== diff -u -r9d2940c9f09ace35e4e0501a61d46b6bdf789dab -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/storage/filehandler.cpp (.../filehandler.cpp) (revision 9d2940c9f09ace35e4e0501a61d46b6bdf789dab) +++ sources/storage/filehandler.cpp (.../filehandler.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -14,15 +14,12 @@ #include "filehandler.h" //Qt -#include +#include +#include #include -#include // Project -#include "storageglobals.h" -#include "logger.h" -#include "threads.h" // namespace using namespace Storage; @@ -45,9 +42,9 @@ bool FileHandler::write(const QString &vFileName, const QString &vContent, bool vAppend) { QFile file(vFileName); - QIODevice::OpenMode openMode = vAppend ? - QFile::Text | QFile::Append : - QFile::Text | QFile::WriteOnly; + QFile::OpenMode openMode = vAppend ? + QFile::Text | QFile::Append : + QFile::Text | QFile::WriteOnly; if (! file.open(openMode)) { errOut(QObject::tr("Can't open file for write (%1).Possible corrupted file system").arg(vFileName)); return false; @@ -96,10 +93,6 @@ arguments << "-r" << vSource << vDestination; int result = QProcess::execute(cp, arguments); - cp = "sync;sync;sync;"; - arguments.clear(); - QProcess::execute(cp, arguments); - return result; } // coco end Index: sources/storage/usbwatcher.cpp =================================================================== diff -u -r2437559b2d4cd4c2ac6a926b4f55652e55e1f616 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 2437559b2d4cd4c2ac6a926b4f55652e55e1f616) +++ sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -245,7 +245,7 @@ // has been tested manually bool ok; _usbDrive = vDevice.toLatin1().constData(); - ok = ::mount(_usbDrive, USB_Mount_Point, USB_File_System, 0, "") == 0; + ok = ::mount(_usbDrive, USB_Mount_Point, USB_File_System,MS_SYNCHRONOUS , "") == 0; if (ok) { _mounted = true; _removed = false; Index: sources/view/VHDOperationModeData.cpp =================================================================== diff -u --- sources/view/VHDOperationModeData.cpp (revision 0) +++ sources/view/VHDOperationModeData.cpp (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -0,0 +1,44 @@ +/*! + * + * 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 VHDOperationModeData.cpp + * \date 7/12/2020 + * \author Behrouz NematiPour + * + */ +#include "VHDOperationModeData.h" + +// Project +#include "guicontroller.h" + +VIEW_DEF(VHDOperationMode, HDOperationModeData) + +void VHDOperationMode::onActionReceive(const HDOperationModeData &vData) +{ + opMode ( vData.mOpMode ); +} + +QString VHDOperationMode::opModeText(GuiHDOpModes vEnum) +{ + // TEST : this code is the place holder for the alarms description mapping + // since it is another feature + // it returns the enum name for now + const QMetaObject *mo = qt_getEnumMetaObject(vEnum); + int enumIdx = mo->indexOfEnumerator(qt_getEnumName(vEnum)); + const char *key = mo->enumerator(enumIdx).valueToKey(vEnum); + if (key) + return qPrintable(key); + else + return QString("UNDEFINED [%1]").arg(vEnum); +} + +QString View::VHDOperationMode::text() +{ + QString text = opModeText(static_cast(opMode())); + return text; +} Index: sources/view/VHDOperationModeData.h =================================================================== diff -u --- sources/view/VHDOperationModeData.h (revision 0) +++ sources/view/VHDOperationModeData.h (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -0,0 +1,45 @@ +/*! + * + * 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 VHDOperationModeData.h + * \date 7/12/2020 + * \author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include + +// Project +#include "MModel.h" +#include "vview.h" +#include "guiglobals.h" + +// namespace +using namespace Gui; +namespace View { + +class VHDOperationMode : public QObject +{ + Q_OBJECT + + PROPERTY( quint32 , opMode , 0) + + VIEW_DEC(VHDOperationMode, HDOperationModeData) + + Q_PROPERTY(QString text READ text NOTIFY opModeChanged) + +private: + QString opModeText(GuiHDOpModes vEnum); + +public slots: + QString text(); + +}; +} Index: sources/view/vview.h =================================================================== diff -u -r6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5 -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- sources/view/vview.h (.../vview.h) (revision 6ae83fa9a1a3204864fc5b50fe906ac09e9c1ea5) +++ sources/view/vview.h (.../vview.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -101,6 +101,7 @@ REGISTER_TYPE( VTreatmentPressureOcclusion ) \ REGISTER_TYPE( VTreatmentTime ) \ REGISTER_TYPE( VTreatmentRanges ) \ + REGISTER_TYPE( VHDOperationMode ) \ \ REGISTER_TYPE( VDGDrainPump ) \ REGISTER_TYPE( VDGHeaters ) \ Index: unittests/tst_logging.cpp =================================================================== diff -u -r36740a3ee8e7164e70d8627b057624ec0ef1eb8f -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- unittests/tst_logging.cpp (.../tst_logging.cpp) (revision 36740a3ee8e7164e70d8627b057624ec0ef1eb8f) +++ unittests/tst_logging.cpp (.../tst_logging.cpp) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -115,12 +115,12 @@ QCOMPARE(mContent, ""); } -void tst_logging::logError_Unhandled_TreatmentState() +void tst_logging::logError_Unhandled_TreatmentStates() { gDisableUnhandledReport = false; Can::MessageInterpreter iMsg; Can::Message msg; - msg.actionId = Gui::GuiActionType::ID_TreatmentState; + msg.actionId = Gui::GuiActionType::ID_TreatmentStates; msg.data = {}; QVariantList vData {}; QVERIFY(iMsg.interpretMessage_HD(msg, vData)); Index: unittests/tst_logging.h =================================================================== diff -u -r36740a3ee8e7164e70d8627b057624ec0ef1eb8f -r15de0cd12dad1ea5107c52e5ed89280bc9e29b1d --- unittests/tst_logging.h (.../tst_logging.h) (revision 36740a3ee8e7164e70d8627b057624ec0ef1eb8f) +++ unittests/tst_logging.h (.../tst_logging.h) (revision 15de0cd12dad1ea5107c52e5ed89280bc9e29b1d) @@ -47,7 +47,7 @@ void logError_gDisableUnhandledReport_False(); void logError_gDisableUnhandledReport_True (); - void logError_Unhandled_TreatmentState(); + void logError_Unhandled_TreatmentStates(); void setLogPath_F(); void setLogPath_T();