Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rf5d4fecd7b937ddf8e8b4ef3372541e79c7a44fc -r5bcaad82c0fdd66fda6db24a023d7128c4eb93ae --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision f5d4fecd7b937ddf8e8b4ef3372541e79c7a44fc) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 5bcaad82c0fdd66fda6db24a023d7128c4eb93ae) @@ -1210,7 +1210,7 @@ break; case MSG_ID_UI_INSTITUTIONAL_RECORD_REQUEST: - sendInstitutionalRecordToUI( message ); + handleSendInstitutionalRecordToUI( message ); break; // NOTE: this always must be the last case Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r257fca8c33c53999f384d84f1ed31f1772155e52 -r5bcaad82c0fdd66fda6db24a023d7128c4eb93ae --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 257fca8c33c53999f384d84f1ed31f1772155e52) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5bcaad82c0fdd66fda6db24a023d7128c4eb93ae) @@ -65,6 +65,35 @@ } BLOCKED_MSGS_DATA_T; #pragma pack(pop) +typedef struct +{ + U32 minBloodFlowMLPM; ///< Min blood flow in mL/min. + U32 maxBloodFlowMLPM; ///< Max blood flow in mL/min. + U32 minDialysateFlowMLPM; ///< Min dialysate flow in mL/min. + U32 maxDialysateFlowMLPM; ///< Max dialysate flow in mL/min. + U32 minTxDurationMIN; ///< Min treatment duration in minutes. + U32 maxTxDurationMIN; ///< Max treatment duration in minutes. + U32 minStopHeparinDispBeforeTxEndMIN; ///< Min stop heparin dispense before treatment end in minutes. + U32 maxStopHeparinDispBeforeTxEndMIN; ///< Max stop heparin dispense before treatment end in minutes. + U32 minSalineBolusVolumeML; ///< Min saline bolus volume in milliliters. + U32 maxSalineBolusVolumeML; ///< Max saline bolus volume in milliliters. + F32 minDialysateTempC; ///< Min dialysate temperature in C. + F32 maxDialysateTempC; ///< Max dialysate temperature in C. + S32 minArtPressLimitWindowMMHG; ///< Min arterial pressure limit window in mmHg. + S32 maxArtPressLimitWindowMMHG; ///< Max arterial pressure limit window in mmHg. + S32 minVenPressLimitWindowMMHG; ///< Min venous pressure limit window in mmHg. + S32 maxVenPressLimitWindowMMHG; ///< Max venous pressure limit window in mmHg. + S32 minVenAsymPressLimitMMHG; ///< Min venous asymmetric pressure limit in mmHg. + S32 maxVenAsymPressLimitMMHG; ///< Max venous asymmetric pressure limit in mmHg. + F32 minUFVolumeL; ///< Min ultrafiltration volume in mL. + F32 maxUFVolumeL; ///< Max ultrafiltration volume in mL. + F32 minHeparinDispRateMLPHR; ///< Min heparin dispense rate in mL/hr. + F32 maxHeparinDispRateMLPHR; ///< Max heparin dispense rate in mL/hr. + F32 minHeparinBolusVolumeML; ///< Min heparin bolus volume in mL. + F32 maxHeparinBolusVolumeML; ///< Max heparin bolus volume in mL. + U32 enableChemicalDisinfect; ///< Enable/disable chemical disinfect. +} HD_INSTITUTIONAL_LOCAL_RECORD_T; + // ********** private data ********** static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether an external tester (connected PC) has sent a valid login message. @@ -78,6 +107,7 @@ static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ); +static void sendInstitutionalRecordToUI( MESSAGE_T* message, HD_INSTITUTIONAL_LOCAL_RECORD_T* instit ); /*********************************************************************//** * @brief @@ -3595,71 +3625,56 @@ /*********************************************************************//** * @brief - * The sendInstitutionalRecordToUI function sends the institutional record to UI + * The handleSendInstitutionalRecordToUI function sends the institutional record to UI * @details Inputs: none * @details Outputs: none * @param message a pointer to the message to handle * @return none *************************************************************************/ -void sendInstitutionalRecordToUI( MESSAGE_T* message ) +void handleSendInstitutionalRecordToUI( MESSAGE_T* message ) { - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - if ( 0 == message->hdr.payloadLen ) { - typedef struct - { - U32 minBloodFlowMLPM; - U32 maxBloodFlowMLPM; - U32 minDialysateFlowMLPM; - U32 maxDialysateFlowMLPM; - U32 minTxDurationMIN; - U32 maxTxDurationMIN; - U32 minStopHeparinDispBeforeTxEndMIN; - U32 maxStopHeparinDispBeforeTxEndMIN; - U32 minSalineBolusVolumeML; - U32 maxSalineBolusVolumeML; - F32 minDialysateTempC; - F32 maxDialysateTempC; - S32 minArtPressLimitWindowMMHG; - S32 maxArtPressLimitWindowMMHG; - S32 minVenPressLimitWindowMMHG; - S32 maxVenPressLimitWindowMMHG; - S32 minVenAsymPressLimitMMHG; - S32 maxVenAsymPressLimitMMHG; - F32 minUFVolumeL; - F32 maxUFVolumeL; - F32 minHeparinDispRateMLPHR; - F32 maxHeparinDispRateMLPHR; - F32 minHeparinBolusVolumeML; - F32 maxHeparinBolusVolumeML; - U32 enableChemicalDisinfect; - } HD_INSTITUTIONAL_LOCAL_RECORD_T; - - U32 accept = 1; - U32 reason = 0; HD_INSTITUTIONAL_RECORD_T hdInstitutionalRecord; HD_INSTITUTIONAL_LOCAL_RECORD_T hdInstitutionalLocalRecord; getNVRecord2Driver( GET_INSTITUTIONAL_RECORD, (U08*)&hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - memcpy( &hdInstitutionalLocalRecord, &hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ) - sizeof( U32 ) - sizeof( U16 ) ); + memcpy( &hdInstitutionalLocalRecord, &hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ) ); - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_INSTITUTIONAL_RECORD_RESPONSE; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ); + sendInstitutionalRecordToUI( message, &hdInstitutionalLocalRecord ); + } +} - memcpy( payloadPtr, &accept, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &reason, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &hdInstitutionalLocalRecord, sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ) ); +/*********************************************************************//** + * @brief + * The sendInstitutionalRecordToUI function sends the institutional record to UI + * @details Inputs: none + * @details Outputs: none + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +static void sendInstitutionalRecordToUI( MESSAGE_T* message, HD_INSTITUTIONAL_LOCAL_RECORD_T* instit ) +{ + MESSAGE_T msg; - // 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_HD_2_UI, ACK_NOT_REQUIRED ); - } + U08 *payloadPtr = msg.payload; + U32 accept = 1; + U32 reason = 0; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_INSTITUTIONAL_RECORD_RESPONSE; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ); + + memcpy( payloadPtr, &accept, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &reason, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, instit, sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ) ); + + // 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_HD_2_UI, ACK_NOT_REQUIRED ); } Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rf5d4fecd7b937ddf8e8b4ef3372541e79c7a44fc -r5bcaad82c0fdd66fda6db24a023d7128c4eb93ae --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision f5d4fecd7b937ddf8e8b4ef3372541e79c7a44fc) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5bcaad82c0fdd66fda6db24a023d7128c4eb93ae) @@ -559,7 +559,7 @@ void handleReceiveROPermeateSampleReadyToDispenseFromDG( MESSAGE_T* message ); // MSG_ID_UI_INSTITUTIONAL_RECORD_REQUEST -void sendInstitutionalRecordToUI( MESSAGE_T* message ); +void handleSendInstitutionalRecordToUI( MESSAGE_T* message ); // *********** public test support message functions **********