Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r68aefeff8890cdfa956c7bfdf0d4505b4ac25cb7 -r031a5ae459c0b73d8b95e6cb8a484309846c1b46 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 68aefeff8890cdfa956c7bfdf0d4505b4ac25cb7) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 031a5ae459c0b73d8b95e6cb8a484309846c1b46) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Behrouz NematiPour -* @date (last) 07-Dec-2021 +* @author (last) Michael Garthwaite +* @date (last) 18-Feb-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -1803,8 +1803,7 @@ payload.alarmsFlags |= ( almStatus.noResume ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_RESUME) : 0 ); payload.alarmsFlags |= ( almStatus.noRinseback ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_RINSEBACK) : 0 ); payload.alarmsFlags |= ( almStatus.noEndTreatment ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_END_TREATMENT) : 0 ); - payload.alarmsFlags |= ( almStatus.noNewTreatment ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_NEW_TREATMENT) : 0 ); - payload.alarmsFlags |= ( almStatus.usrACKRequired ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_USER_MUST_ACK) : 0 ); + payload.alarmsFlags |= ( almStatus.ok ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_OK_BUTTON_ONLY) : 0 ); payload.alarmsFlags |= ( almStatus.alarmsToEscalate ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_TO_ESCALATE) : 0 ); payload.alarmsFlags |= ( almStatus.alarmsSilenced ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_SILENCED) : 0 ); payload.alarmsFlags |= ( almStatus.lampOn ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_LAMP_ON) : 0 ); @@ -2615,6 +2614,8 @@ return result; } + + /*********************************************************************//** * @brief * The handleChangeUFSettingsRequest function handles a ultrafiltration @@ -5496,6 +5497,38 @@ } /*********************************************************************//** + * @brief + * The handleTestSyringePumpHeprinBolusTargetRateOverrideRequest function handles a + * request to override the syringe pump heprin bolus target rate. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpHeprinBolusTargetRateOverrideRequest( 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 = testSetHeprinBolusTargetRateOverride( payload.state.f32 ); + } + else + { + result = testResetHeprinBolusTargetRateOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief * The handleSetHDSystemRecord function handles a request to set the HD * system data record. @@ -6780,4 +6813,48 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestCurrentTreamtmentParametersRequest function handles a + * request to retrieve the current treatment parameters. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestCurrentTreamtmentParametersRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = TRUE; + // ACK request + result = testSendCurrentTreatmentParameters(); + } + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The sendTestCurrentTreatmentParametersResponse function constructs a current + * treatment parameter response message to the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: current treatment prameters response msg constructed and queued. + * @param data response data record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendTestCurrentTreatmentParametersResponse(CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T current_params) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_RES_CURRENT_TREATMENT_PARAMETERS; + msg.hdr.payloadLen = sizeof(CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T); + memcpy(payloadPtr, ¤t_params, sizeof(CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T)); + + return serializeMessage(msg, COMM_BUFFER_OUT_CAN_PC, ACK_REQUIRED ); +} + /**@}*/