Index: sources/model/mmodel.h =================================================================== diff -u -r595ed1fbe8066960afd4c8fea168208e81b173d9 -r35959dd708a5c4fdf02626306441e5a77e7f7782 --- sources/model/mmodel.h (.../mmodel.h) (revision 595ed1fbe8066960afd4c8fea168208e81b173d9) +++ sources/model/mmodel.h (.../mmodel.h) (revision 35959dd708a5c4fdf02626306441e5a77e7f7782) @@ -20,8 +20,86 @@ #include "mtreatmenttime.h" #include "mtreatmentflows.h" #include "mtreatmentoutletflow.h" +#include "mtreatmentpressureocclusion.h" #include "mpoweroff.h" +/*! + * \brief Message interpretation instruction + * \details This comment explains how to add a Denali Message in Denali UI Application + * + * 1 - Look at the message structure in the "message list.xlsx" + * + * 2 - MSG ID : + * Add an enum for the message in the guiglobals.h : GuiActionsType_Enum + * and assign a correct message value to it. + * example : MSG ID = 9 => + * \code{.cpp} + * PressureOcclusion = 0x0900, //(little endian) + * \endcode + * + * 3 - MSG Payload Len : + * Add a line in the "messageglobals.h" in paloadLen hash table + * to define the required payload length of the message + * + * 4 - Model Implementation : + * Implement a model like MPressureOcclusion by copy/paste the closest model .h/.cpp file + * and adding it to project and modify to fit the new model. + * + * 5 - Register Model : + * Add the required lines like the other models in the mmodel.h file. + * + * 6 - Populate/Interpret Model Data : + * Copy/Paste one of the other implementations of the Messages setter/getter. + * example : be careful about the type. + * in the header should be like: + * \code{.cpp} + * bool getPressureOcclusionData (const Message &vMessage, Model::MPressureOcclusion &vData) __attribute_warn_unused_result__; + * bool pressureOcclusionData (const Message &vMessage, QVariantList &vData) __attribute_warn_unused_result__; + * \endcode + * in the implementation should be like: + * \code{.cpp} + * bool MessageInterpreter::getPressureOcclusionData(const Message &vMessage, Model::MPressureOcclusion &vData) + * { + * if ( vMessage.actionId != Gui::GuiActionType::PressureOcclusion ) { + * return false; + * } + * + * if ( vMessage.data.length() < payloadLen[Gui::GuiActionType::PressureOcclusion] ) { + * QString mActionIdHexString = Format::toHexString(vMessage.actionId); + * LOG_ERROR(tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString)); + * return false; + * } + * + * vData.fromByteArray(vMessage.data); + * + * return true; + * } + * + * bool MessageInterpreter::pressureOcclusionData(const Message &vMessage, QVariantList &vData) + * { + * bool ok; + * Model::MPressureOcclusion mData; + * ok = getPressureOcclusionData(vMessage, mData); + * LOG_DATUM(mData.toString()); + * + * if (ok) { + * mData.toVariantList(vData); + * emit didActionReceive(mData.data()); + * } + * return ok; + * } + * \endcode + * + * Add a case in MessageInterpreter::interpretMessage_HD for that message id Enum + * with lines like : + * \code{.cpp} + * case Gui::GuiActionType::PressureOcclusion: + * ok = pressureOcclusionData (vMessage, vData); + * break; + * \endcode + * + */ + //--------------------------------------------------------------------------------// //-------- Please add the model type to the lists below to register them ---------// //--------------------------------------------------------------------------------// @@ -30,6 +108,7 @@ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, DialysateFlowData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, OutletFlowData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, TreatmentTimeData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, PressureOcclusionData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, AlarmStatusData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(vSOURCE, PowerOffData ) //--------------------------------------------------------------------------------// @@ -38,6 +117,7 @@ ACTION_RECEIVE_BRIDGE_DEFINITION( DialysateFlowData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( OutletFlowData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( TreatmentTimeData ) \ + ACTION_RECEIVE_BRIDGE_DEFINITION( PressureOcclusionData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( AlarmStatusData ) \ ACTION_RECEIVE_BRIDGE_DEFINITION( PowerOffData ) //--------------------------------------------------------------------------------// @@ -46,6 +126,7 @@ REGISTER_METATYPE( DialysateFlowData ) \ REGISTER_METATYPE( OutletFlowData ) \ REGISTER_METATYPE( TreatmentTimeData ) \ + REGISTER_METATYPE( PressureOcclusionData ) \ REGISTER_METATYPE( AlarmStatusData ) \ REGISTER_METATYPE( AlarmStatusFlag ) \ REGISTER_METATYPE( PowerOffData ) @@ -55,6 +136,7 @@ ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, DialysateFlowData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, OutletFlowData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, TreatmentTimeData ) \ + ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, PressureOcclusionData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, AlarmStatusData ) \ ACTION_RECEIVE_BRIDGE_CONNECTION(_interpreter, PowerOffData ) //--------------------------------------------------------------------------------// @@ -63,6 +145,7 @@ ACTION_RECEIVE_SIGNAL( DialysateFlowData ) \ ACTION_RECEIVE_SIGNAL( OutletFlowData ) \ ACTION_RECEIVE_SIGNAL( TreatmentTimeData ) \ + ACTION_RECEIVE_SIGNAL( PressureOcclusionData ) \ ACTION_RECEIVE_SIGNAL( AlarmStatusData ) \ ACTION_RECEIVE_SIGNAL( PowerOffData ) //--------------------------------------------------------------------------------//