Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r074b32b5cc08f41f2d9ce0d021f2151b76bba5ad -r846a9ebc350e33be4affab3cc4c136248900015d --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 074b32b5cc08f41f2d9ce0d021f2151b76bba5ad) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 846a9ebc350e33be4affab3cc4c136248900015d) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file messageinterpreter.cpp - * \author (last) Peter Lucia - * \date (last) 29-Jun-2020 + * \author (last) Behrouz NematiPour + * \date (last) 20-Aug-2020 * \author (original) Behrouz NematiPour * \date (original) 13-Dec-2019 * @@ -39,8 +39,8 @@ /*! * \brief MessageInterpreter::notify * \details Checks and prepares the model with the Message Data - * Regarding the type of message logs the message recived. - * Notofies observers by emiting the didActionReceive( < Data > ) signal + * Regarding the type of message logs the message received. + * Notifies observers by emitting the didActionReceive( < Data > ) signal * \param vMessage - The Denali message * \param vID - The Message ID to be checked against * \param vModel - The appropriate model for the Message Data @@ -83,8 +83,8 @@ /*! * \brief MessageInterpreter::isPayloadLenValid - * \details Checks if the Data length has been defined for this type od messsage - * if not logs Undefind Data Length error + * \details Checks if the Data length has been defined for this type of message + * if not logs Undefined Data Length error * if defined checks if the correct length of data is provided for this type of message. * if not logs Incorrect Data Length error * otherwise returns true @@ -106,16 +106,21 @@ return true; } +/*! + * \brief MessageInterpreter::logInvalidLength + * \details Logs invalid data length for the message type vActionId + * \param vActionId - Message Type + */ void MessageInterpreter::logInvalidLength(const Gui::GuiActionType &vActionId) { QString mActionIdHexString = Format::toHexString(vActionId); - LOG_DEBUG(QString("Incorrect data length for trsansmit Message with ID '%1'") + LOG_DEBUG(QString("Incorrect data length for transmit message with ID '%1'") .arg(mActionIdHexString)); } /*! * \brief MessageInterpreter::validateMessage - * \details Validate the messgae by checking its type and data + * \details Validate the message by checking its type and data * \param vMessage - The message * \param vType - The type of the message to be checked against * \return true on valid massage @@ -148,7 +153,7 @@ /*! * \brief MessageInterpreter::logReceived - * \details Regarding the type of message logs the message recived. + * \details Regarding the type of message logs the message received. * \param vModel - the MAbstract model type */ void MessageInterpreter::logReceivedMessage(const Model::MAbstract &vModel) @@ -246,6 +251,12 @@ LOG_EVENT(AdjustUltrafiltrationConfirmRequestData::toString(vData)); } break; + case Gui::GuiActionType::ID_AdjustSalineReq: { + if ( ! count ) { logInvalidLength(vActionId); return false; } + vPayload = Format::fromVariant(vData); + LOG_EVENT(AdjustSalineRequestData::toString(vData)); + } break; + case Gui::GuiActionType::ID_AlarmSilenceReq: { if ( ! count ) { logInvalidLength(vActionId); return false; } vPayload = Format::fromVariant(vData); @@ -312,7 +323,7 @@ case eChlid_DG_HD : case eChlid_DG_UI : - // case eChlid_DG_Alarm: // commented out for now. Currentlyh there is no message in this category. + // case eChlid_DG_Alarm: // commented out for now. Currently there is no message in this category. case eChlid_DG_Sync : ok = interpretMessage_DG(vMessage, vData); break; default: @@ -351,6 +362,7 @@ case Gui::GuiActionType::ID_PressureOcclusion : ok = notify(vMessage, vData, Gui::GuiActionType::ID_PressureOcclusion ); break; case Gui::GuiActionType::ID_TreatmentStates : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentStates ); break; case Gui::GuiActionType::ID_PrimingData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_PrimingData ); break; + case Gui::GuiActionType::ID_Saline : ok = notify(vMessage, vData, Gui::GuiActionType::ID_Saline ); break; // ----- Events case Gui::GuiActionType::ID_HDOperationModeData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDOperationModeData ); break; @@ -366,6 +378,11 @@ // Adjustment Response Messages 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; + case Gui::GuiActionType::ID_AdjustSalineRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustSalineRsp ); break; + + // ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq); break; + // this message has been inherited from MAbstract and should use notify but since the response message is not standard can't use notify yet. + // when received gets payload len error and can't be interpreted. case Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq : ok = adjustUltrafiltrationState (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp : ok = adjustUltrafiltrationEdit (vMessage, vData); break; // TODO : implement notify<>() case Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp : ok = adjustUltrafiltrationConfirm (vMessage, vData); break; // TODO : implement notify<>() @@ -416,7 +433,7 @@ 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; - // unhandles messages: these will only be logged as received message + // unhandled messages: these will only be logged as received message // there has nothing been defined for these messages. default: printUnhandled (vMessage); @@ -554,7 +571,7 @@ Model::MAdjustUltrafiltrationStateResponse mData; ok = mData.fromByteArray(vMessage.data); - LOG_EVENT("HD," + mData.toString()); + LOG_EVENT(mData.toString()); mData.toVariantList(vData); emit didActionReceive(mData.data());