Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r8e7d30d231de616b58a765d98495ba34010781c8 -rc9aa3971be05f25a7b0d7124e57cc60617c90ad7 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 8e7d30d231de616b58a765d98495ba34010781c8) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision c9aa3971be05f25a7b0d7124e57cc60617c90ad7) @@ -1,14 +1,19 @@ #include // for memcpy() +#include "BoostPump.h" #include "Compatible.h" +#include "Level.h" #include "Messaging.h" #include "OperationModes.h" #include "PAL.h" +#include "Pressure.h" +//#include "PressureSensor.h" +#include "ROPump.h" #include "SystemCommRO.h" #include "Utilities.h" +#include "Valves.h" - /** * @addtogroup Messaging * @{ @@ -31,29 +36,64 @@ static const COMM_BUFFER_T tdResponseBuffers[ NUM_OF_COMM_BUFFERS ] = { COMM_BUFFER_NOT_USED, ///< CAN message boxes start at 1 so we will not use this buffer - COMM_BUFFER_OUT_CAN_RO_ALARM, - COMM_BUFFER_OUT_CAN_RO_2_DD, - COMM_BUFFER_IN_CAN_TD_ALARM, - COMM_BUFFER_IN_CAN_DD_ALARM, - COMM_BUFFER_IN_CAN_UI_ALARM, - COMM_BUFFER_IN_CAN_DD_2_RO, - COMM_BUFFER_IN_CAN_TD_BROADCAST, - COMM_BUFFER_IN_CAN_DD_BROADCAST, - COMM_BUFFER_IN_CAN_UI_BROADCAST, - COMM_BUFFER_OUT_CAN_RO_BROADCAST, + COMM_BUFFER_OUT_CAN_RO_ALARM, ///< Buffer for responding to incoming TD alarm messages + COMM_BUFFER_OUT_CAN_RO_ALARM, ///< Buffer for responding to incoming DD alarm messages + COMM_BUFFER_NOT_USED, ///< Buffer for outgoing RO alarm messages so no response buffer + COMM_BUFFER_OUT_CAN_RO_ALARM, ///< Buffer for responding to incoming UI alarm messages + COMM_BUFFER_OUT_CAN_RO_2_DD, ///< Buffer for responding to incoming DD to RO messages + COMM_BUFFER_NOT_USED, ///< Buffer for outgoing RO to DD messages so no response buffer + COMM_BUFFER_OUT_CAN_RO_BROADCAST, ///< Buffer for responding to incoming TD broadcast messages + COMM_BUFFER_OUT_CAN_RO_BROADCAST, ///< Buffer for responding to incoming DD broadcast messages + COMM_BUFFER_NOT_USED, ///< Buffer for outgoing RO broadcast messages so no response buffer + COMM_BUFFER_OUT_CAN_RO_BROADCAST, ///< Buffer for responding to incoming UI broadcast messages COMM_BUFFER_OUT_CAN_PC, ///< Buffer for responding to incoming PC to RO messages + COMM_BUFFER_NOT_USED, ///< Buffer for outgoing RO to PC messages so no response buffer }; typedef BOOL (*MsgFuncPtr)( MESSAGE_T* ); /// Message handling function lookup table static const U16 MSG_FUNCTION_HANDLER_LOOKUP[] = { - MSG_ID_TESTER_LOGIN_REQUEST, + MSG_ID_RO_TESTER_LOGIN_REQUEST, + MSG_ID_RO_SOFTWARE_RESET_REQUEST, + MSG_ID_RO_SEND_TEST_CONFIGURATION, + MSG_ID_RO_VALVE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, + MSG_ID_RO_VALVE_CMD_STATE_OVERRIDE_REQUEST, + MSG_ID_RO_VALVE_SENSED_STATE_OVERRIDE_REQUEST, + MSG_ID_RO_BOOST_PUMP_SET_PWM_REQUEST, + MSG_ID_RO_BOOST_PUMP_READ_PWM_OVERRIDE_REQUEST, + MSG_ID_RO_BOOST_PUMP_SPEED_OVERRIDE_REQUEST, + MSG_ID_RO_BOOST_PUMPS_PUBLISH_INTERVAL_OVERRIDE_REQUEST, + MSG_ID_RO_PRESSURE_OVERRIDE_REQUEST, + MSG_ID_RO_PRESSURE_TEMP_OVERRIDE_REQUEST, + MSG_ID_RO_PRESSURE_READ_COUNT_OVERRIDE_REQUEST, + MSG_ID_RO_PRESSURE_ERROR_COUNT_OVERRIDE_REQUEST, + MSG_ID_RO_PRESSURE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, + MSG_ID_RO_DEBUG_EVENT, + MSG_ID_RO_LEVEL_PUBLISH_INTERVAL_OVERRIDE_REQUEST, + MSG_ID_RO_LEVEL_OVERRIDE_REQUEST }; /// Message handling function table static const MsgFuncPtr MSG_FUNCTION_HANDLERS[] = { - &handleTesterLogInRequest + &handleTesterLogInRequest, + &handleROSoftwareResetRequest, + &handleROTestConfiguration, + &testValvesStatesPublishIntervalOverride, + &testValveStateOverride, + &testValveSensedStateOverride, + &testSetBoostPumpPWM, + &testBoostPumpPWMOverride, + &testBoostPumpRPMOverride, + &testROPumpDataPublishIntervalOverride, + &testPressureSensorReadingsOverride, + &testPressureSensorTemperatureReadingsOverride, + &testPressureSensorReadCounterOverride, + &testPressureSensorErrorCounterOverride, + &testPressureSensorDataPublishIntervalOverride, + &handleUnhandledMsg, + &testLevelsDataPublishIntervalOverride, + &testLevelStateOverride }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLERS) / sizeof(MsgFuncPtr)) @@ -67,8 +107,9 @@ // ********** private function prototypes ********** -static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); +static MsgFuncPtr getMsgHandler( U16 msgID ); +static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); /*********************************************************************//** * @brief @@ -279,6 +320,19 @@ } } +/*********************************************************************//** + * @brief + * The handleUnhandledMsg function handles messages that are not handled (yet or ever). + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Incoming message to not handle + * @return FALSE (indicating message not handled). + *************************************************************************/ +BOOL handleUnhandledMsg( MESSAGE_T *message ) +{ + return FALSE; // message not handled or handling for message not implemented yet +} + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** @@ -569,4 +623,22 @@ return result; } +/*********************************************************************//** + * @brief + * The handleROTestConfiguration function handles a request to set an RO test + * configuration flag. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the set test configuration message to handle + * @return TRUE if test configuration flag set successfully, FALSE if not. + *************************************************************************/ +BOOL handleROTestConfiguration( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // TODO - implement. + + return result; +} + /**@}*/