Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r036a75d76ab01912646a480b935d97187a231a19 -rc8a6bfae0f88b45e3783632c868235077e4cbeec --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 036a75d76ab01912646a480b935d97187a231a19) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision c8a6bfae0f88b45e3783632c868235077e4cbeec) @@ -26,6 +26,7 @@ #include "Compatible.h" #include "CpldInterface.h" #include "DDInterface.h" +#include "FpgaTD.h" #include "LevelSensors.h" #include "Messaging.h" #include "ModeTxParams.h" @@ -87,6 +88,7 @@ /// Message handling function lookup table static const U16 MSG_FUNCTION_HANDLER_LOOKUP[] = { + MSG_ID_FW_VERSIONS_REQUEST, MSG_ID_DD_OP_MODE_DATA, MSG_ID_DD_PRESSURES_DATA, MSG_ID_UI_TREATMENT_PARAMS_TO_VALIDATE, @@ -138,12 +140,15 @@ MSG_ID_TD_BLOOD_PUMP_MEASURED_ROTOR_SPEED_OVERRIDE_REQUEST, MSG_ID_TD_BLOOD_PUMP_ROTOR_COUNT_OVERRIDE_REQUEST, MSG_ID_TD_TMP_PRESSURE_OVERRIDE_REQUEST, + MSG_ID_TD_REQ_CURRENT_TREATMENT_PARAMETERS, + MSG_ID_TD_SET_TREATMENT_PARAMETER, MSG_ID_TD_OP_MODE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, MSG_ID_TD_OP_MODE_OVERRIDE_REQUEST }; /// Message handling function table static const MsgFuncPtr MSG_FUNCTION_HANDLERS[] = { + &handleVersionRequestMessage, &setDDOpMode, &setDialysatePressure, &validateAndSetTreatmentParameters, @@ -195,6 +200,8 @@ &testMeasuredBloodPumpRotorSpeedOverride, &testBloodPumpRotorCountOverride, &testTMPOverride, + &testTxParamsRequest, + &testSetTreatmentParameter, &testSetOpModePublishIntervalOverride, &testSetOperationMode }; @@ -209,6 +216,9 @@ /// List of message IDs that are requested not to be transmitted. static BLOCKED_MSGS_DATA_T blockedMessagesForXmit = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/// UI version information +static UI_VERSIONS_T uiVersionRecord = { 0, 0, 0, 0, 0 }; + // ********** private function prototypes ********** static MsgFuncPtr getMsgHandler( U16 msgID ); @@ -461,7 +471,44 @@ } } +/*********************************************************************//** + * @brief + * The handleVersionRequestMessage function handles a UI request for TD + * version information. + * @details \b Message \b Sent: MSG_ID_TD_VERSION_REPONSE + * @details \b Inputs: none + * @details \b Outputs: UI version info. + * @param message Pointer to the UI version request message which contains + * the UI version information as well. + * @return TRUE if request handled successfully, FALSE if not + *************************************************************************/ +BOOL handleVersionRequestMessage( MESSAGE_T *message ) +{ + BOOL result = FALSE; + if ( message->hdr.payloadLen == sizeof( UI_VERSIONS_T ) ) + { + TD_VERSIONS_T tdVersionRecord; + + // Record UI version information + memcpy( (U08*)(&uiVersionRecord), &message->payload, sizeof( UI_VERSIONS_T ) ); + + // Build TD version record + tdVersionRecord.major = TD_VERSION_MAJOR; + tdVersionRecord.minor = TD_VERSION_MINOR; + tdVersionRecord.micro = TD_VERSION_MICRO; + tdVersionRecord.build = TD_VERSION_BUILD; + getFPGAVersions( &tdVersionRecord.fpgaId, &tdVersionRecord.fpgaMajor, &tdVersionRecord.fpgaMinor, &tdVersionRecord.fpgaLab ); + tdVersionRecord.compatibilityRev = SW_COMPATIBILITY_REV; + + // Send TD version information + result = sendMessage( MSG_ID_TD_VERSION_REPONSE, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&tdVersionRecord, sizeof( TD_VERSIONS_T ) ); + } + + return result; +} + + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // ***********************************************************************