Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -rfea9457eb78e1c39fa4eb35780d2ac7c43f12ce0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision fea9457eb78e1c39fa4eb35780d2ac7c43f12ce0) @@ -40,33 +40,38 @@ #include "Utilities.h" #include "Valves.h" #include "WatchdogMgmt.h" + +/** + * @addtogroup SystemCommMessages + * @{ + */ // ********** private definitions ********** -#define ACK_REQUIRED TRUE -#define ACK_NOT_REQUIRED FALSE +#define ACK_REQUIRED TRUE ///< Require an ACK. +#define ACK_NOT_REQUIRED FALSE ///< Not require an ACK. #ifdef DEBUG_ENABLED #define DEBUG_EVENT_MAX_TEXT_LEN 40 #endif // ********** private data ********** -static BOOL testerLoggedIn = FALSE; -static volatile U16 nextSeqNo = 1; +static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether tester logged in or not. +static volatile U16 nextSeqNo = 1; ///< Next sequence number. // ********** private function prototypes ********** static U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); -/************************************************************************* - * @brief serializeMessage - * The serializeMessage function serializes a given message into a given \n - * array of bytes. A sequence # is added to the message here and the ACK \n - * bit of the sequence # is set if ACK is required per parameter. A sync byte \n - * is inserted at the beginning of the message and an 8-bit CRC is appended to \n +/*********************************************************************//** + * @brief + * The serializeMessage function serializes a given message into a given + * array of bytes. A sequence # is added to the message here and the ACK + * bit of the sequence # is set if ACK is required per parameter. A sync byte + * is inserted at the beginning of the message and an 8-bit CRC is appended to * the end of the message. The message is queued for transmission in the given buffer. * @details * Inputs : none @@ -78,7 +83,7 @@ *************************************************************************/ static U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ) { - BOOL result = 0; + BOOL result = FALSE; BOOL error = FALSE; U32 msgSize = 0; U32 sizeMod, sizePad; @@ -143,10 +148,10 @@ return result; } - -/************************************************************************* - * @brief sendACKMsg - * The sendACKMsg function constructs and queues for transmit an ACK message \n + +/*********************************************************************//** + * @brief + * The sendACKMsg function constructs and queues for transmit an ACK message * for a given received message. * @details * Inputs : none @@ -173,12 +178,11 @@ return result; } - -/************************************************************************* - * @brief sendTestAckResponseMsg - * The sendTestAckResponseMsg function constructs a simple response \n - * message for a handled test message and queues it for transmit on the \n - * appropriate UART channel. + +/*********************************************************************//** + * @brief + * The sendTestAckResponseMsg function constructs a simple response message for + * a handled test message and queues it for transmit on the appropriate UART channel. * @details * Inputs : none * Outputs : response message constructed and queued for transmit. @@ -203,14 +207,15 @@ return result; } + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** - -/************************************************************************* - * @brief broadcastAlarmTriggered - * The broadcastAlarmTriggered function constructs an alarm triggered msg to \n + +/*********************************************************************//** + * @brief + * The broadcastAlarmTriggered function constructs an alarm triggered msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none @@ -242,10 +247,10 @@ return result; } - -/************************************************************************* - * @brief broadcastAlarmCleared - * The broadcastAlarmCleared function constructs an alarm cleared msg to be \n + +/*********************************************************************//** + * @brief + * The broadcastAlarmCleared function constructs an alarm cleared msg to be * broadcast and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none @@ -271,10 +276,10 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The broadcastAccelData function constructs an accelerometer data msg to \n + * The broadcastAccelData function constructs an accelerometer data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none @@ -319,10 +324,10 @@ return result; } -/************************************************************************* - * @brief broadcastRTCEpoch - * The broadcastRTCEpoch function constructs an epoch msg to \n - * be broadcast and queues the msg for transmit on the appropriate CAN channel. +/*********************************************************************//** + * @brief + * The broadcastRTCEpoch function constructs an epoch msg to be broadcast + * and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none * Outputs : RTC time and date in epoch @@ -347,10 +352,10 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The broadcastDGHDOperationMode function constructs a DG operation mode \n + * The broadcastDGHDOperationMode function constructs a DG operation mode * broadcast message and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none @@ -379,8 +384,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastLoadCellData function sends out load cell data. * @details @@ -416,8 +421,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastValvesStates function sends out DG valves states. * @details @@ -445,8 +450,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastHeatersData function sends out DG heaters data * @details @@ -480,8 +485,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastROPumpData function sends out RO pump data. * @details @@ -515,8 +520,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastDrainPumpData function sends out RO pump data. * @details @@ -548,8 +553,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastPressureSensorsData function sends out DG pressure data. * @details @@ -584,9 +589,9 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); return result; -} - -/************************************************************************* +} + +/*********************************************************************//** * @brief * The broadcastReservoirData function broadcasts the DG reservoir data. * @details @@ -620,14 +625,15 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastTemperatureSensorsData function sends out DG temperature - * sensors data - * Inputs : heaters data - * Outputs : temperatur sensors data msg constructed and queued - * @param sensorsValue sensors value array + * sensors data. + * Inputs : none + * Outputs : temperature sensors data message constructed and queued + * @param sensorsValue sensors value array + * @param byteLength payload length in bytes * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL broadcastTemperatureSensorsData ( U08 *sensorsValue, U32 byteLength ) @@ -649,18 +655,18 @@ return result; } - -/************************************************************************* +/*********************************************************************//** * @brief * The broadcastConductivityData function sends out conductivity data. * @details * Inputs : none - * Outputs : conductivity data msg constructed and queued - * @param cpi: water inlet conductivity data. - * @param cpo : water outlet conductivity data. + * Outputs : conductivity data message constructed and queued + * @param roRejectionRatio RO rejection ratio + * @param cpi water inlet conductivity data + * @param cpo water outlet conductivity data * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastConductivityData( F32 cpi, F32 cpo ) +BOOL broadcastConductivityData( F32 roRejectionRatio, F32 cpi, F32 cpo ) { BOOL result; MESSAGE_T msg; @@ -672,6 +678,7 @@ msg.hdr.msgID = MSG_ID_DG_CONDUCTIVITY_DATA; msg.hdr.payloadLen = sizeof( CONDUCTIVITY_DATA_T ); + payload.roRejectionRatio = roRejectionRatio; payload.cpi = cpi; payload.cpo = cpo; @@ -687,10 +694,10 @@ // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handlePowerOffWarning function handles a power off warning message \n + * The handlePowerOffWarning function handles a power off warning message * from the HD. * @details * Inputs : none @@ -705,10 +712,10 @@ signalPowerOffWarning(); } } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleSetDialysateTemperatureCmd function handles a dialysate temperature \n + * The handleSetDialysateTemperatureCmd function handles a dialysate temperature * set points message from the HD. * @details * Inputs : none @@ -731,8 +738,8 @@ } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleFWVersionCmd function handles a FW version request message. * @details @@ -765,10 +772,10 @@ // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleSwitchReservoirCmd function handles a switch reservoirs command \n + * The handleSwitchReservoirCmd function handles a switch reservoirs command * from the HD. * @details * Inputs : none @@ -793,8 +800,8 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleFillCmd function handles a fill command from the HD. * @details @@ -818,8 +825,8 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleDrainCmd function handles a drain command from the HD. * @details @@ -844,10 +851,10 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleStartStopTreatmentMsg function handles a treatment start/stop \n + * The handleStartStopTreatmentMsg function handles a treatment start/stop * message from the HD. * @details * Inputs : none @@ -877,10 +884,10 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleStartStopTrimmerHeaterCmd function handles a trimmer heater start/stop \n + * The handleStartStopTrimmerHeaterCmd function handles a trimmer heater start/stop * command message from the HD. * @details * Inputs : none @@ -910,8 +917,8 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleSampleWaterCmd function handles a sample water command from the HD. * @details @@ -934,9 +941,9 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* - * @brief handleSetRTCTimestamp + +/*********************************************************************//** + * @brief * The handleSetRTCTimestamp function handles a request to write time and * date to RTC * @details @@ -961,8 +968,8 @@ // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleStartStopPrimaryHeater function handles a request start or * stop the primary heater @@ -997,15 +1004,16 @@ return result; } + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ + - #ifdef DEBUG_ENABLED - /************************************************************************* - * @brief sendDebugData + /*********************************************************************//** + * @brief * The sendDebugData function sends debug data out to the PC port. * @details * Inputs : none @@ -1023,8 +1031,8 @@ return result; } - - /************************************************************************* + + /*********************************************************************//** * @brief * The sendDebugDataToUI function sends debug string to the UI for logging. * @details @@ -1052,10 +1060,10 @@ } } #endif - -/************************************************************************* - * @brief isTestingActivated - * The isTestingActivated function determines whether a tester has successfully \n + +/*********************************************************************//** + * @brief + * The isTestingActivated function determines whether a tester has successfully * logged in to activate testing functionality. * @details * Inputs : testerLoggedIn @@ -1066,12 +1074,11 @@ { return testerLoggedIn; } - -/************************************************************************* - * @brief sendTestAckResponseMsg - * The sendTestAckResponseMsg function constructs a simple response \n - * message for a handled test message and queues it for transmit on the \n - * appropriate UART channel. + +/*********************************************************************//** + * @brief + * The sendTestAckResponseMsg function constructs a simple response message for + * a handled test message and queues it for transmit on the appropriate UART channel. * @details * Inputs : none * Outputs : response message constructed and queued for transmit. @@ -1095,11 +1102,10 @@ return result; } - -/************************************************************************* - * @brief handleTesterLogInRequest - * The handleTesterLogInRequest function handles a request to login as a \n - * tester. + +/*********************************************************************//** + * @brief + * The handleTesterLogInRequest function handles a request to login as a tester. * @details * Inputs : none * Outputs : message handled @@ -1121,251 +1127,668 @@ // respond to would be tester sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, testerLoggedIn ); } - -/************************************************************************* - * @brief handleTestWatchdogCheckInStateOverrideRequest - * The handleTestWatchdogCheckInStateOverrideRequest function handles a \n + +/*********************************************************************//** + * @brief + * The handleTestWatchdogCheckInStateOverrideRequest function handles a * request to override the check-in status of a given task. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestWatchdogCheckInStateOverrideRequest, testSetWatchdogTaskCheckInOverride, testResetWatchdogTaskCheckInOverride ) - -/************************************************************************* - * @brief handleTestAlarmStateOverrideRequest - * The handleTestAlarmStateOverrideRequest function handles a request to \n +void handleTestWatchdogCheckInStateOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetWatchdogTaskCheckInOverride( payload.index, (BOOL)(payload.state.u32) ); + } + else + { + result = testResetWatchdogTaskCheckInOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestAlarmStateOverrideRequest function handles a request to * override the active status of a given alarm. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestAlarmStateOverrideRequest, testSetAlarmStateOverride, testResetAlarmStateOverride ) - -/************************************************************************* +void handleTestAlarmStateOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetAlarmStateOverride( payload.index, payload.state.u32 ); + } + else + { + result = testResetAlarmStateOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestLoadCellOverrideRequest function handles a request to \n + * The handleTestLoadCellOverrideRequest function handles a request to * override the value read from the given load cell. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestLoadCellOverrideRequest, testSetLoadCellOverride, testResetLoadCellOverride ) - -/************************************************************************* +void handleTestLoadCellOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetLoadCellOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetLoadCellOverride( payload.index ); + } + } + + //respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief * The handleTestTemperatureSensorsOverrideRequest function handles a - * request to override a temperatures sensor's value + * request to override a temperatures sensor's value. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestTemperatureSensorsOverrideRequest, \ - testSetMeasuredTemperatureOverride, testResetMeasuredTemperatureOverride ) - -/************************************************************************* +void handleTestTemperatureSensorsOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetMeasuredTemperatureOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetMeasuredTemperatureOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief -* The handleTestTemperatureSensorsDataPublishOverrideRequest function handles \n -* a request to override the publish interval of temperature sensors data +* The handleTestTemperatureSensorsDataPublishOverrideRequest function handles +* a request to override the publish interval of temperature sensors data. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestTemperatureSensorsDataPublishOverrideRequest, \ - testSetTemperatureSensorsPublishIntervalOverride, testResetTemperatureSensorsPublishIntervalOverride ) +void handleTestTemperatureSensorsDataPublishOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetTemperatureSensorsPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetTemperatureSensorsPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} -/************************************************************************* +/*********************************************************************//** * @brief - * The handleTestHeatersDataPublishOverrideRequest function handles \n - * a request to override the publish interval of heaters data + * The handleTestHeatersDataPublishOverrideRequest function handles + * a request to override the publish interval of heaters data. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHeatersDataPublishOverrideRequest, \ - testSetHeatersPublishIntervalOverride, testResetHeatersPublishIntervalOverride ) - -/************************************************************************* +void handleTestHeatersDataPublishOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetHeatersPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetHeatersPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestLoadCellDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestLoadCellDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for load cell data. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestLoadCellDataBroadcastIntervalOverrideRequest, testSetLoadCellDataPublishIntervalOverride, testResetLoadCellDataPublishIntervalOverride ) - -/************************************************************************* +void handleTestLoadCellDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetLoadCellDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetLoadCellDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestPressureSensorOverrideRequest function handles a request to \n + * The handleTestPressureSensorOverrideRequest function handles a request to * override the value read from the given pressure sensor. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestPressureSensorOverrideRequest, testSetDGPressureSensorOverride, testResetDGPressureSensorOverride ) - -/************************************************************************* +void handleTestPressureSensorOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetDGPressureSensorOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetDGPressureSensorOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestPressureDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestPressureDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for load cell data. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestPressureDataBroadcastIntervalOverrideRequest, testSetPressuresDataPublishIntervalOverride, testResetPressuresDataPublishIntervalOverride ) - -/************************************************************************* +void handleTestPressureDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetPressuresDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetPressuresDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestROPumpSetPointOverrideRequest function handles a request to \n + * The handleTestROPumpSetPointOverrideRequest function handles a request to * override the RO pump pressure set point (in PSI). * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestROPumpSetPointOverrideRequest, testSetTargetROPumpPressureOverride, testResetTargetROPumpPressureOverride ) - -/************************************************************************* +void handleTestROPumpSetPointOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetTargetROPumpPressureOverride( payload.state.u32 ); + } + else + { + result = testResetTargetROPumpPressureOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestROMeasuredFlowOverrideRequest function handles a request to \n + * The handleTestROMeasuredFlowOverrideRequest function handles a request to * override the RO flow rate. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestROMeasuredFlowOverrideRequest, testSetMeasuredROFlowRateOverride, testResetMeasuredROFlowRateOverride ) - -/************************************************************************* +void handleTestROMeasuredFlowOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetMeasuredROFlowRateOverride( payload.state.f32 ); + } + else + { + result = testResetMeasuredROFlowRateOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestROPumpDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestROPumpDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for RO pump data. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestROPumpDataBroadcastIntervalOverrideRequest, testSetROPumpDataPublishIntervalOverride, testResetROPumpDataPublishIntervalOverride ) - -/************************************************************************* +void handleTestROPumpDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetROPumpDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetROPumpDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestDrainPumpSetPointOverrideRequest function handles a request to \n + * The handleTestDrainPumpSetPointOverrideRequest function handles a request to * override the drain pump speed set point (in RPM). * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDrainPumpSetPointOverrideRequest, testSetTargetDrainPumpSpeedOverride, testResetTargetDrainPumpSpeedOverride ) - -/************************************************************************* +void handleTestDrainPumpSetPointOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetTargetDrainPumpSpeedOverride( payload.state.u32 ); + } + else + { + result = testResetTargetDrainPumpSpeedOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestDrainPumpDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestDrainPumpDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for drain pump data. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDrainPumpDataBroadcastIntervalOverrideRequest, testSetDrainPumpDataPublishIntervalOverride, testResetDrainPumpDataPublishIntervalOverride ) - -/************************************************************************* +void handleTestDrainPumpDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetDrainPumpDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetDrainPumpDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestValveStateOverrideRequest function handles a request to \n + * The handleTestValveStateOverrideRequest function handles a request to * override the state value read from the given valve. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestValveStateOverrideRequest, testSetValveStateOverride, testResetValveStateOverride ) - -/************************************************************************* +void handleTestValveStateOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetValveStateOverride( payload.index, payload.state.u32 ); + } + else + { + result = testResetValveStateOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestValvesStatesPublishIntervalOverrideRequest function handles \n + * The handleTestValvesStatesPublishIntervalOverrideRequest function handles * a request to override the publish interval of valves states from the given valve. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestValvesStatesPublishIntervalOverrideRequest, testSetValvesStatesPublishIntervalOverride, testResetValvesStatesPublishIntervalOverride ) - -/************************************************************************* +void handleTestValvesStatesPublishIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetValvesStatesPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetValvesStatesPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestDGSafetyShutdownOverrideRequest function handles a \n + * The handleTestDGSafetyShutdownOverrideRequest function handles a * request to override the safety shutdown signal. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDGSafetyShutdownOverrideRequest, testSetSafetyShutdownOverride, testResetSafetyShutdownOverride ) +void handleTestDGSafetyShutdownOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; -/************************************************************************* + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSafetyShutdownOverride( payload.state.u32 ); + } + else + { + result = testResetSafetyShutdownOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestDGAccelOverrideRequest function handles a request to \n + * The handleTestDGAccelOverrideRequest function handles a request to * override the measured accelerometer sensor readings. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDGAccelOverrideRequest, testSetAccelAxisOverride, testResetAccelAxisOverride ) +void handleTestDGAccelOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; -/************************************************************************* + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetAccelAxisOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetAccelAxisOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestDGAccelMaxOverrideRequest function handles a request to \n + * The handleTestDGAccelMaxOverrideRequest function handles a request to * override the measured accelerometer sensor maximum readings. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDGAccelMaxOverrideRequest, testSetAccelMaxOverride, testResetAccelMaxOverride ) +void handleTestDGAccelMaxOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; -/************************************************************************* + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetAccelMaxOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetAccelMaxOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief - * The handleTestDGAccelBroadcastIntervalOverrideRequest function handles a \n + * The handleTestDGAccelBroadcastIntervalOverrideRequest function handles a * request to override the broadcast interval for accelerometer data messages. * @details * Inputs : none * Outputs : message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDGAccelBroadcastIntervalOverrideRequest, testSetAccelDataPublishIntervalOverride, testResetAccelDataPublishIntervalOverride ) +void handleTestDGAccelBroadcastIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; -/************************************************************************* + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetAccelDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetAccelDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief * The handleSetAccelCalibration function handles a request to set * accelerometer calibration factors. @@ -1391,27 +1814,70 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestSetConductivityOverrideRequest function handles a * request to override a conductivity sensor's value * @details * Inputs : none * Outputs : message handled - * @param message : a pointer to the message to handle + * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestSetConductivityOverrideRequest, testSetConductivityOverride, testResetConductivityOverride ) +void handleTestSetConductivityOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; -/************************************************************************* + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetConductivityOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetConductivityOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief * The handleTestSetConductivityDataPublishIntervalOverrideRequest function * handles a request to override the publish interval of conductivity sensors data * @details * Inputs : none * Outputs : message handled -* @param message : a pointer to the message to handle +* @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestSetConductivityDataPublishIntervalOverrideRequest, \ - testSetConductivityDataPublishIntervalOverride, testResetConductivityDataPublishIntervalOverride ) +void handleTestSetConductivityDataPublishIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetConductivityDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetConductivityDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/**@}*/