Index: firmware/App/Services/Messaging.c =================================================================== diff -u -rb05bbd09d430425d907779b02feadde8addc8c79 -r289696b3b5e15120cfecbe447ff45ef093959056 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision b05bbd09d430425d907779b02feadde8addc8c79) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 289696b3b5e15120cfecbe447ff45ef093959056) @@ -30,7 +30,6 @@ #include "FpgaTD.h" #include "LevelSensors.h" #include "Messaging.h" -#include "ModeTxParams.h" #include "ModeStandby.h" #include "OperationModes.h" #include "PAL.h" @@ -40,6 +39,8 @@ #include "StateTxPaused.h" #include "Switches.h" #include "SystemCommTD.h" +#include "Temperatures.h" +#include "TxParams.h" #include "Utilities.h" #include "Valve3Way.h" #include "Valves.h" @@ -97,7 +98,12 @@ /// Message handling function lookup table static const MSG_HANDLER_LOOKUP_T MSG_FUNCTION_HANDLER_LOOKUP[] = { + { MSG_ID_ALARM_TRIGGERED, &handleAlarmTriggered }, + { MSG_ID_ALARM_CONDITION_CLEARED, &handleAlarmConditionCleared }, + { MSG_ID_UI_ALARM_USER_ACTION_REQUEST, &handleAlarmUserAction }, + { MSG_ID_UI_ACTIVE_ALARMS_LIST_REQUEST, &handleActiveAlarmListRequest }, { MSG_ID_FW_VERSIONS_REQUEST, &handleVersionRequestMessage }, + { MSG_ID_UI_CHECK_IN, &handleUICheckIn }, { MSG_ID_DD_OP_MODE_DATA, &setDDOpMode }, { MSG_ID_DD_PRESSURES_DATA, &setDialysatePressure }, { MSG_ID_UI_TREATMENT_PARAMS_TO_VALIDATE, &validateAndSetTreatmentParameters }, @@ -112,7 +118,7 @@ { MSG_ID_TD_VOLTAGE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testVoltageDataPublishIntervalOverride }, { MSG_ID_TD_VOLTAGE_OVERRIDE_REQUEST, &testVoltageOverride }, { MSG_ID_TD_PRESSURE_OVERRIDE_REQUEST, &testPressureSensorOverride }, - { MSG_ID_TD_PRESSURE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testSwitchesDataPublishIntervalOverride }, + { MSG_ID_TD_PRESSURE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testPressuresDataPublishIntervalOverride }, { MSG_ID_TD_AIR_PUMP_SET_STATE_REQUEST, &testSetAirPump }, { MSG_ID_TD_AIR_PUMP_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testAirPumpDataPublishIntervalOverride }, { MSG_ID_TD_SWITCHES_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testSwitchesDataPublishIntervalOverride }, @@ -154,7 +160,22 @@ { MSG_ID_TD_OP_MODE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testSetOpModePublishIntervalOverride }, { MSG_ID_TD_OP_MODE_OVERRIDE_REQUEST, &testSetOperationMode }, { MSG_ID_TD_EJECTOR_MOTOR_SET_SPEED_REQUEST, &testSetEjectorMotorSpeed }, - { MSG_ID_TD_EJECTOR_COMMAND, &testEjectorCommand } + { MSG_ID_TD_EJECTOR_COMMAND, &testEjectorCommand }, + { MSG_ID_TD_SET_AIR_TRAP_CONTROL, &testSetAirTrapControl }, + { MSG_ID_TD_HOME_BLOOD_PUMP, &testHomeBloodPump }, + { MSG_ID_TD_BLOOD_FLOW_ALPHA_Y_INTERCEPT_OVERRIDE_REQUEST, &testBPFlowAlphaYInterceptOverride }, + { MSG_ID_TD_BLOOD_FLOW_WEAR_A_TERM_OVERRIDE_REQUEST, &testBPFlowWearATermOverride }, + { MSG_ID_TD_BLOOD_FLOW_WEAR_B_TERM_OVERRIDE_REQUEST, &testBPFlowWearBTermOverride }, + { MSG_ID_TD_SET_TEST_CONFIGURATION, &testSetTestConfiguration }, + { MSG_ID_TD_GET_TEST_CONFIGURATION, &testGetTestConfiguration }, + { MSG_ID_TD_RESET_ALL_TEST_CONFIGURATIONS, &testResetAllTestConfigurations }, + { MSG_ID_TD_HARD_STOP_BLOOD_PUMP, &testHardStopBloodPump }, + { MSG_ID_TD_AIR_PUMP_POWER_RAISE_OVERRIDE_REQUEST, &testAirPumpPowerRaiseOverride }, + { MSG_ID_TD_AIR_PUMP_POWER_LOWER_OVERRIDE_REQUEST, &testAirPumpPowerLowerOverride }, + { MSG_ID_TD_BARO_MFG_CRC_OVERRIDE, &testBaroPressureMFGCRCOverride }, + { MSG_ID_TD_BARO_PRESSURE_OVERRIDE, &testBaroPressureOverride }, + { MSG_ID_TD_TEMPERATURE_OVERRIDE, &testTemperatureOverride }, + { MSG_ID_TD_TEMPERATURE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testTemperatureDataPublishIntervalOverride }, }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLER_LOOKUP) / sizeof(MSG_HANDLER_LOOKUP_T)) @@ -411,10 +432,11 @@ // ACK/NAK request if ( message->hdr.msgID < MSG_ID_FIRST_TD_TESTER_MESSAGE ) { - if ( respBuffer != COMM_BUFFER_NOT_USED ) - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, respBuffer, ack ); - } + // Already ACK'd msg if required prior to this function +// if ( respBuffer != COMM_BUFFER_NOT_USED ) +// { +// sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, respBuffer, ack ); +// } } else { @@ -595,6 +617,19 @@ /*********************************************************************//** * @brief + * The handleUICheckIn function handles a Ui check in message. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Pointer to the UI check-in message + * @return TRUE if check-in successful, FALSE if not + *************************************************************************/ +BOOL handleUICheckIn( MESSAGE_T *message ) +{ + return TRUE; // no specific handling required. +} + +/*********************************************************************//** + * @brief * The handleTesterLogInRequest function handles a Dialin request to login. * @details \b Inputs: none * @details \b Outputs: Dialin logged in if request is authenticated. @@ -646,4 +681,87 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetTestConfiguration function handles a request to set a + * test configuration. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return TRUE if command accepted, FALSE if rejected + *************************************************************************/ +BOOL testSetTestConfiguration( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( sizeof( TEST_CONFIG_PAYLOAD_T ) == message->hdr.payloadLen ) + { + TEST_CONFIG_PAYLOAD_T payload; + + // copy message payload to local variable + memcpy( (U08*)&payload, &message->payload[0], sizeof( TEST_CONFIG_PAYLOAD_T ) ); + + // Verify given test configuration is valid + if ( payload.config < NUM_OF_TEST_CONFIGS ) + { + result = TRUE; + if ( FALSE == payload.reset ) + { + setTestConfig( (TEST_CONFIG_T)payload.config ); + } + else + { + resetTestConfig( (TEST_CONFIG_T)payload.config ); + } + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testGetTestConfiguration function handles a request to get a + * test configuration. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL testGetTestConfiguration( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = sendTestConfigStatusToDialin(); + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetTestConfiguration function handles a request to reset all + * test configurations. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL testResetAllTestConfigurations( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = resetAllTestConfigs(); + } + + return result; +} + /**@}*/