Index: sources/canbus/messageglobals.h =================================================================== diff -u -r426208cdb707400759bdc663b871ece9d1208aed -r56eea041fb0995182b3d3ea0c0ac19e4933a2d3d --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 426208cdb707400759bdc663b871ece9d1208aed) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 56eea041fb0995182b3d3ea0c0ac19e4933a2d3d) @@ -37,6 +37,7 @@ */ const QHash payloadLen { {Gui::GuiActionType::PowerOff , 1 }, + {Gui::GuiActionType::PowerOffBroadcast , 0 }, {Gui::GuiActionType::KeepAlive , 0 }, {Gui::GuiActionType::BloodFlow , 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::DialysateInletFlow , 7 * 4 }, // 7 parameters each 4bytes Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r426208cdb707400759bdc663b871ece9d1208aed -r56eea041fb0995182b3d3ea0c0ac19e4933a2d3d --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 426208cdb707400759bdc663b871ece9d1208aed) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 56eea041fb0995182b3d3ea0c0ac19e4933a2d3d) @@ -129,9 +129,12 @@ void MessageInterpreter::printUnhandled(const Message &vMessage) { QString mActionIdHexString = Format::toHexString(vMessage.actionId, false, eLenMessageIDDigits); - qDebug() << "WARNG :" << tr("Unhandled Message ID (HD)"); - qDebug().noquote() << QString(mActionIdHexString + " " + vMessage.data.toHex('.')).toLatin1(); - qDebug() << ""; + QString logMessage = tr("Unhandled Message ID (HD)") + '\n' + + QString("%1 # %2 %3") + .arg(vMessage.can_id,3,16,QChar('0')) + .arg(mActionIdHexString) + .arg(QString(vMessage.data.toHex('.'))); + LOG_ERROR(logMessage); } /*! @@ -149,7 +152,7 @@ */ bool MessageInterpreter::interpretMessage_HD(const Message &vMessage, QVariantList &vData) { - bool ok = true; + bool ok = false; vData.clear(); switch (vMessage.actionId) { // notice we are in receive mode @@ -166,6 +169,10 @@ ok = true; break; + case Gui::GuiActionType::PowerOffBroadcast: + ok = true; + break; + case Gui::GuiActionType::BloodFlow: ok = bloodFlowData (vMessage, vData); break; @@ -188,12 +195,20 @@ case Gui::GuiActionType::AlarmTriggered: printUnhandled (vMessage); + ok = true; break; case Gui::GuiActionType::AlarmCleared: printUnhandled (vMessage); + ok = true; break; + + case Gui::GuiActionType::PressureOcclusion: + printUnhandled (vMessage); + ok = true; + break; + default: printUnhandled (vMessage); break; Index: sources/gui/guiglobals.h =================================================================== diff -u -r426208cdb707400759bdc663b871ece9d1208aed -r56eea041fb0995182b3d3ea0c0ac19e4933a2d3d --- sources/gui/guiglobals.h (.../guiglobals.h) (revision 426208cdb707400759bdc663b871ece9d1208aed) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision 56eea041fb0995182b3d3ea0c0ac19e4933a2d3d) @@ -36,11 +36,14 @@ DialysateInletFlow = 0x0800, DialysateOutletFlow = 0x0B00, TreatmentTime = 0x0D00, + PowerOffBroadcast = 0x0E00, AlarmStatus = 0x0200, AlarmTriggered = 0x0300, AlarmCleared = 0x0400, + PressureOcclusion = 0x0900, + String = 0xFFFE, Acknow = 0xFFFF, Index: sources/gui/qml/dialogs/AutoHideInfo.qml =================================================================== diff -u -r1b060ccba8bfccf34d6a7a5ddd6d94eb6d149829 -r56eea041fb0995182b3d3ea0c0ac19e4933a2d3d --- sources/gui/qml/dialogs/AutoHideInfo.qml (.../AutoHideInfo.qml) (revision 1b060ccba8bfccf34d6a7a5ddd6d94eb6d149829) +++ sources/gui/qml/dialogs/AutoHideInfo.qml (.../AutoHideInfo.qml) (revision 56eea041fb0995182b3d3ea0c0ac19e4933a2d3d) @@ -36,4 +36,10 @@ width: parent.width text: message } + + function showDialog(vMessage, vDuration) { + _root.message = vMessage + _root.autoHideDuration = vDuration + _root.open() + } } Index: sources/gui/qml/main.qml =================================================================== diff -u -r1b060ccba8bfccf34d6a7a5ddd6d94eb6d149829 -r56eea041fb0995182b3d3ea0c0ac19e4933a2d3d --- sources/gui/qml/main.qml (.../main.qml) (revision 1b060ccba8bfccf34d6a7a5ddd6d94eb6d149829) +++ sources/gui/qml/main.qml (.../main.qml) (revision 56eea041fb0995182b3d3ea0c0ac19e4933a2d3d) @@ -40,12 +40,28 @@ onDidActionReceive: { //console.debug(vData) switch(vAction) { + case GuiActions.PowerOffBroadcast: + _autoHideInfo.showDialog( + qsTr("System is shutting down"), + 5000 // if there is any error happening then after 5 seconds dialog hides. + ) + break; + case GuiActions.PowerOff: - if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Command) + if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Command) { _powerOffDialog.open() - if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Timeout) + } + if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Timeout) { _powerOffDialog.close() + } + if (vData[GuiActions.PowerOff_ShowHide] === GuiActions.Rejected) { + _autoHideInfo.showDialog( + qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() + 1000 // if there is any error happening then after 5 seconds dialog hides. + ) + } break; + } } } @@ -73,9 +89,7 @@ } // 4 - Modals - AutoHideInfo { id: _autoHideInfo - message : "System is shutting down" - } + AutoHideInfo { id: _autoHideInfo } PowerOff { id: _powerOffDialog onAccepted: {