Index: sources/canbus/MessageInterpreter.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -r2d37cfe6593a90633a9db1fa5136f8fc43b56188 --- sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 2d37cfe6593a90633a9db1fa5136f8fc43b56188) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2022 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 MessageInterpreter.cpp - * \author (last) Peter Lucia - * \date (last) 15-Oct-2020 - * \author (original) Behrouz NematiPour - * \date (original) 26-Aug-2020 + * \file MessageInterpreter.cpp + * \author (last) Behrouz NematiPour + * \date (last) 17-Dec-2021 + * \author (original) Behrouz NematiPour + * \date (original) 26-Aug-2020 * */ #include "MessageInterpreter.h" @@ -173,10 +173,10 @@ if ( gDisableUnhandledReport ) return; QString mActionIdHexString = Format::toHexString(vMessage.actionId, false, eLenMessageIDDigits); QString logMessage = tr("Unhandled Message ID (HD)") + '\n' + - QString("%1 # %2 %3") + QString("%1 # %2 %3") .arg(int(vMessage.can_id), 3, 16, QChar('0')) .arg(mActionIdHexString) - .arg(QString(vMessage.data.toHex('.'))); + .arg(QString(vMessage.data.toHex('.'))).toUpper(); LOG_DEBUG(logMessage); } @@ -226,7 +226,8 @@ if ( length ) { // this message has a variable length vPayload = Format::fromVariant(vData[0]); } - // DEBUG: LOG_EVENT_UI(QString("CheckIn")); + // DEBUG: + LOG_EVENT_UI(QString("CheckIn")); break; case Gui::GuiActionType::ID_RawData: // len: 255, can have any len @@ -400,15 +401,16 @@ // ----- Debug case Gui::GuiActionType::ID_CANBusFaultCount : ok = canbusFaultCountData (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_HDDebugText : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDDebugText ); break; + case Gui::GuiActionType::ID_HDGeneralEvent : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDGeneralEvent ); break; // ----- Events case Gui::GuiActionType::ID_Acknow : ok = true; break; // TODO : implement notify<>() case Gui::GuiActionType::ID_PowerOff : ok = notify(vMessage, vData, Gui::GuiActionType::ID_PowerOff ); break; case Gui::GuiActionType::ID_ShuttingDown : ok = true; LOG_EVENT("HD,ShuttingDown"); break; // TODO : implement notify<>() // ----- POST - case Gui::GuiActionType::ID_HDPostSingleResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostSingleResultData ); break; - case Gui::GuiActionType::ID_HDPostFinalResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostFinalResultData ); break; + case Gui::GuiActionType::ID_HDPostSingleResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostSingleResultData ); break; + case Gui::GuiActionType::ID_HDPostFinalResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostFinalResultData ); break; // ----- Settings case Gui::GuiActionType::ID_AdjustVersionsHDReq : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustVersionsHDReq ); break; @@ -427,6 +429,9 @@ // ----- Datum case Gui::GuiActionType::ID_HDAccelerometerData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDAccelerometerData ); break; case Gui::GuiActionType::ID_HDSyringePumpData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDSyringePumpData ); break; + case Gui::GuiActionType::ID_HDAirBubbleData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDAirBubbleData ); break; + case Gui::GuiActionType::ID_HDAirTrapData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDAirTrapData ); break; + case Gui::GuiActionType::ID_HDBloodLeakData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDBloodLeakData ); break; // ----- Datum - Treatment case Gui::GuiActionType::ID_TreatmentRanges : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentRanges ); break; @@ -456,6 +461,7 @@ case Gui::GuiActionType::ID_Rinseback : ok = notify(vMessage, vData, Gui::GuiActionType::ID_Rinseback ); break; case Gui::GuiActionType::ID_Recirculate : ok = notify(vMessage, vData, Gui::GuiActionType::ID_Recirculate ); break; case Gui::GuiActionType::ID_BloodPrime : ok = notify(vMessage, vData, Gui::GuiActionType::ID_BloodPrime ); break; + case Gui::GuiActionType::ID_TreatmentStop : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentStop ); break; // ----- In-Treatment Adjust case Gui::GuiActionType::ID_AdjustDurationRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustDurationRsp ); break; case Gui::GuiActionType::ID_AdjustBloodDialysateRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustBloodDialysateRsp ); break; @@ -541,7 +547,9 @@ case Gui::GuiActionType::ID_DGLoadCellReadingsData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGLoadCellReadingsData ); break; case Gui::GuiActionType::ID_DGTemperaturesData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGTemperaturesData ); break; case Gui::GuiActionType::ID_DGDebugText : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGDebugText ); break; + case Gui::GuiActionType::ID_DGGeneralEvent : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGGeneralEvent ); break; case Gui::GuiActionType::ID_DGAccelerometerData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGAccelerometerData ); break; + case Gui::GuiActionType::ID_DGConductivityData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGConductivityData ); break; // ----- Datum - Pre-Treatment progress case Gui::GuiActionType::ID_DGFilterFlushData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGFilterFlushData ); break; // ----- Datum - Disinfection @@ -643,6 +651,25 @@ } /*! + * \brief MessageInterpreter::updateUnhandledMessages + * \return this method is converting the general settings messages/unhandled group of settings to the message interpreter specific map structure. + * it is done for performance to keep the lookup table shorter and faster. + * This method is called by the chain of events when Application controller is done reading the settings and emits it didSettingsDone, + * which Message dispatcher is listening to will call this function in its signal handler slot. + */ +void MessageInterpreter::updateUnhandledMessages() +{ + // DEBUG: qDebug() << _Settings.groups("messages/unhandled"); + for(const auto group: _Settings.groups("Messages/Unhandled")) { + // DEBUG: qDebug() << _Settings.keys(group); + bool ok; + quint16 id = QString(group).toUInt(&ok,16); + if (!ok) continue; + _messageList[ id ] = _Settings.keys(group); + } +} + +/*! * \brief MessageInterpreter::logUnhandledMessage * \details Search in the list of the unhandled messages and tries to extract the data and log it. * \param vMessage - the received message.