Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r9187b3bc0167642cfb350a372654e4cfc0be046b -re226d05ea339805934c2ebbaba108e7b03d5a001 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 9187b3bc0167642cfb350a372654e4cfc0be046b) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision e226d05ea339805934c2ebbaba108e7b03d5a001) @@ -46,8 +46,7 @@ * \return true on successful check and prepare. */ template -bool MessageInterpreter::notify(const Message &vMessage, QVariantList &vData, Gui::GuiActionType vIdCheck) -{ +bool MessageInterpreter::notify(const Message &vMessage, QVariantList &vData, Gui::GuiActionType vIdCheck) { bool ok = false; TModel tModel; if ( ! isValidMessage(vMessage, vIdCheck) ) return ok; @@ -71,8 +70,7 @@ * \param vType - The type of the message to be checked against * \return true on correct type */ -bool MessageInterpreter::isType(const Message &vMessage, Gui::GuiActionType vType) const -{ +bool MessageInterpreter::isType(const Message &vMessage, Gui::GuiActionType vType) const { if ( vMessage.actionId != vType ) { return false; } @@ -90,8 +88,7 @@ * \param vType - The type of the message to be checked against * \return true on correct data length for the type vType */ -bool MessageInterpreter::isPayloadLenValid(const Message &vMessage, Gui::GuiActionType vType) const -{ +bool MessageInterpreter::isPayloadLenValid(const Message &vMessage, Gui::GuiActionType vType) const { QString mActionIdHexString = Format::toHexString(vMessage.actionId); if ( ! payloadLen.contains(vType) ) { LOG_DEBUG(QString("Undefined data length for received Message with ID '%1'").arg(mActionIdHexString)); @@ -109,8 +106,7 @@ * \details Logs invalid data length for the message type vActionId * \param vActionId - Message Type */ -void MessageInterpreter::logInvalidLength(const Gui::GuiActionType &vActionId) -{ +void MessageInterpreter::logInvalidLength(const Gui::GuiActionType &vActionId) { QString mActionIdHexString = Format::toHexString(vActionId); LOG_DEBUG(QString("Incorrect data length for transmit message with ID '%1'") .arg(mActionIdHexString)); @@ -123,8 +119,7 @@ * \param vType - The type of the message to be checked against * \return true on valid massage */ -bool MessageInterpreter::isValidMessage(const Message &vMessage, Gui::GuiActionType vType) const -{ +bool MessageInterpreter::isValidMessage(const Message &vMessage, Gui::GuiActionType vType) const { if ( ! isType (vMessage, vType) ) return false; if ( ! isPayloadLenValid(vMessage, vType) ) return false; return true; @@ -137,8 +132,7 @@ * is known to the interpreter but has not been handled/implemented. * \param vMessage - The message contains Unhandled Message ID */ -void MessageInterpreter::printUnhandled(const Message &vMessage) const -{ +void MessageInterpreter::printUnhandled(const Message &vMessage) const { if ( gDisableUnhandledReport ) return; QString mActionIdHexString = Format::toHexString(vMessage.actionId, false, eLenMessageIDDigits); QString logMessage = tr("Unhandled Message ID (HD)") + '\n' + @@ -154,8 +148,7 @@ * \details Regarding the type of message logs the message received. * \param vModel - the MAbstract model type */ -void MessageInterpreter::logReceivedMessage(const Model::MAbstract &vModel) -{ +void MessageInterpreter::logReceivedMessage(const Model::MAbstract &vModel) { switch (vModel.typeText()) { case Model::MAbstract::Type_Enum::eDatum: LOG_DATUM(vModel.toString()); @@ -178,8 +171,7 @@ * \return true if the vActionId is valid. * This return value will be used later for error handling. */ -bool MessageInterpreter::interpretMessage(const Gui::GuiActionType &vActionId, const QVariantList &vData, QByteArray &vPayload) -{ +bool MessageInterpreter::interpretMessage(const Gui::GuiActionType &vActionId, const QVariantList &vData, QByteArray &vPayload) { bool ok = true; QString mSenderID = "UI,"; @@ -276,8 +268,7 @@ * \return true if the message channel is in the range which can be interpreted, false otherwise. * This return value will be used later to emit MessageDispatcher::didActionReceive signal or not */ -bool MessageInterpreter::interpretMessage(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::interpretMessage(const Message &vMessage, QVariantList &vData) { bool ok = false; switch (vMessage.can_id) { case eChlid_HD_UI : @@ -309,8 +300,7 @@ * \return true if the message CANBUS channel is in the range which can be interpreted, false otherwise. * This return value will be used later to emit MessageDispatcher::didActionReceive signal or not */ -bool MessageInterpreter::interpretMessage_HD(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::interpretMessage_HD(const Message &vMessage, QVariantList &vData) { bool ok = false; vData.clear(); switch (vMessage.actionId) { // notice we are in receive mode @@ -372,8 +362,7 @@ * \return true if the message CANBUS channel is in the range which can be interpreted, false otherwise. * This return value will be used later to emit MessageDispatcher::didActionReceive signal or not */ -bool MessageInterpreter::interpretMessage_DG(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::interpretMessage_DG(const Message &vMessage, QVariantList &vData) { bool ok = false; vData.clear(); switch (vMessage.actionId) { // notice we are in receive mode @@ -392,13 +381,13 @@ 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_DGAccelerometerData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGAccelerometerData ); break; // unhandled messages: these will only be logged as received message // there has nothing been defined for these messages. default: printUnhandled (vMessage); break; - } return ok; @@ -416,8 +405,7 @@ * \param vData - Fault Count data * \return true if the data can be extracted as defined for Fault Count Message ID */ -bool MessageInterpreter::canbusFaultCountData(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::canbusFaultCountData(const Message &vMessage, QVariantList &vData) { // TODO : review other methods bool ok = false; if ( ! isValidMessage(vMessage, Gui::GuiActionType::ID_CANBusFaultCount) ) return ok; @@ -431,6 +419,7 @@ // coco end vData += mCanBUSFaultCount.value; } + return ok; } @@ -470,8 +459,7 @@ * \param vData - Alarm Triggered data * \return true if the data can be extracted as defined for Alarm Triggered Message ID */ -bool MessageInterpreter::alarmTriggered(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::alarmTriggered(const Message &vMessage, QVariantList &vData) { // TODO : review other methods bool ok = false; if ( ! isValidMessage(vMessage, Gui::GuiActionType::ID_AlarmTriggered) ) return ok; @@ -495,8 +483,7 @@ * \param vData - Alarm Cleared data * \return true if the data can be extracted as defined for Alarm Cleared Message ID */ -bool MessageInterpreter::alarmCleared(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::alarmCleared(const Message &vMessage, QVariantList &vData) { // TODO : review other methods bool ok = false; if ( ! isValidMessage(vMessage, Gui::GuiActionType::ID_AlarmCleared) ) return ok; @@ -522,8 +509,7 @@ * \param vData - Treatment Ultrafiltration State Adjustment Response data * \return true if the data can be extracted as defined for Treatment Ultrafiltration State Adjustment Response Message ID */ -bool MessageInterpreter::adjustUltrafiltrationState(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::adjustUltrafiltrationState(const Message &vMessage, QVariantList &vData) { bool ok = false; // TODO : In HD the Ultrafiltration State change shall have the rejection reason like other responses. if ( ! isType (vMessage, Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq) ) return ok; @@ -548,8 +534,7 @@ * \param vData - Treatment Ultrafiltration Volume Adjustment Response data * \return true if the data can be extracted as defined for Treatment Ultrafiltration Volume Adjustment Response Message ID */ -bool MessageInterpreter::adjustUltrafiltrationEdit(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::adjustUltrafiltrationEdit(const Message &vMessage, QVariantList &vData) { bool ok = false; if ( ! isValidMessage(vMessage, Gui::GuiActionType::ID_AdjustUltrafiltrationEditRsp) ) return ok; @@ -572,8 +557,7 @@ * \param vData - Treatment Ultrafiltration Volume Adjustment Confirm Response data * \return true if the data can be extracted as defined for Treatment Ultrafiltration Volume Adjustment Confirm Response Message ID */ -bool MessageInterpreter::adjustUltrafiltrationConfirm(const Message &vMessage, QVariantList &vData) -{ +bool MessageInterpreter::adjustUltrafiltrationConfirm(const Message &vMessage, QVariantList &vData) { bool ok = false; if ( ! isValidMessage(vMessage, Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmRsp) ) return ok;