Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 -rc414ee882e06359e06b48b1939a90784ae028aa5 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c414ee882e06359e06b48b1939a90784ae028aa5) @@ -15,7 +15,7 @@ * ***************************************************************************/ -#include // for memcpy() +#include // For memcpy() #include "reg_system.h" @@ -84,15 +84,15 @@ U32 sizeMod, sizePad; U32 i; U08 crc; - U08 data[ MAX_ACK_MSG_SIZE ]; // byte array to populate with message data + U08 data[ MAX_ACK_MSG_SIZE ]; // Byte array to populate with message data - // prefix data with message sync byte + // Prefix data with message sync byte data[ msgSize++ ] = MESSAGE_SYNC_BYTE; - // set sequence # and ACK bit (unless this is an ACK to a received message) - if ( msg.hdr.msgID != MSG_ID_ACK ) + // Set sequence # and ACK bit (unless this is an ACK to a received message) + if ( msg.hdr.msgID != MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK ) { - // thread protect next sequence # access & increment + // Thread protect next sequence # access & increment _disable_IRQ(); msg.hdr.seqNo = nextSeqNo; nextSeqNo = INC_WRAP( nextSeqNo, MIN_MSG_SEQ_NO, MAX_MSG_SEQ_NO ); @@ -103,21 +103,21 @@ } } - // calculate message CRC + // Calculate message CRC crc = crc8( (U08*)(&msg), sizeof( MESSAGE_HEADER_T ) + msg.hdr.payloadLen ); - // serialize message header data + // Serialize message header data memcpy( &data[ msgSize ], &( msg.hdr ), sizeof( MESSAGE_HEADER_T ) ); msgSize += sizeof( MESSAGE_HEADER_T ); - // serialize message payload (only used bytes per payloadLen field) + // Serialize message payload (only used bytes per payloadLen field) memcpy( &data[ msgSize ], &( msg.payload ), msg.hdr.payloadLen ); msgSize += msg.hdr.payloadLen; - // add 8-bit CRC + // Add 8-bit CRC data[ msgSize++ ] = crc; - // pad with zero bytes to get length a multiple of CAN_MESSAGE_PAYLOAD_SIZE (8) + // Pad with zero bytes to get length a multiple of CAN_MESSAGE_PAYLOAD_SIZE (8) sizeMod = msgSize % CAN_MESSAGE_PAYLOAD_SIZE; sizePad = ( sizeMod == 0 ? 0 : CAN_MESSAGE_PAYLOAD_SIZE - sizeMod ); for ( i = 0; i < sizePad; i++ ) @@ -126,7 +126,7 @@ } #ifndef DISABLE_ACK_ERRORS - // if ACK required, add to pending ACK list + // If ACK required, add to pending ACK list if ( TRUE == ackReq ) { if ( FALSE == addMsgToPendingACKList( &msg, buffer, data, msgSize ) ) @@ -139,7 +139,7 @@ if ( FALSE == error ) { - // add serialized message data to appropriate out-going comm buffer + // Add serialized message data to appropriate out-going comm buffer result = addToCommBuffer( buffer, data, msgSize ); } @@ -160,16 +160,16 @@ BOOL result; MESSAGE_T msg; - // create a message record + // Create a message record blankMessage( &msg ); - // send ACK back with same seq. #, but w/o ACK bit + // Send ACK back with same seq. #, but w/o ACK bit msg.hdr.seqNo = message->hdr.seqNo * -1; // ACK messages always have this ID - msg.hdr.msgID = MSG_ID_ACK; + msg.hdr.msgID = MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK; // ACK messages always have no payload msg.hdr.payloadLen = 0; - // serialize and queue the message for transmit on broadcast channel + // Serialize and queue the message for transmit on broadcast channel result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -192,13 +192,13 @@ BOOL result; MESSAGE_T msg; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = msgID; msg.hdr.payloadLen = sizeof( U08 ); msg.payload[ 0 ] = (U08)ack; - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, buffer, ACK_NOT_REQUIRED ); return result; @@ -222,13 +222,13 @@ BOOL result; MESSAGE_T msg; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_OFF_BUTTON_PRESS; msg.hdr.payloadLen = sizeof( U08 ); msg.payload[ 0 ] = cmd; - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); return result; @@ -257,7 +257,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_UF_SETTINGS_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( F32 ) + sizeof( U32 ) + sizeof( S32 ) + sizeof( F32 ) + sizeof( F32 ) + sizeof( F32 ); @@ -278,7 +278,7 @@ payloadPtr += sizeof( F32 ); memcpy( payloadPtr, &oldUFRate_mL_min, sizeof( F32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -304,7 +304,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_UF_SETTINGS_CHANGE_CONFIRMATION_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( F32 ) + sizeof( U32 ) + sizeof( F32 ); @@ -319,7 +319,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &ufRate_mL_min, sizeof( F32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -344,7 +344,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_TREATMENT_TIME_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( U32 ) + sizeof( F32 ); @@ -357,7 +357,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &volume_mL, sizeof( F32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -382,7 +382,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_BLOOD_DIAL_RATE_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ); @@ -395,7 +395,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &dialRate, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -417,14 +417,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_PRESSURE_LIMITS_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( PRESSURE_LIMIT_CHANGE_RESPONSE_T ); memcpy( payloadPtr, (U08*)data, sizeof( PRESSURE_LIMIT_CHANGE_RESPONSE_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -450,7 +450,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_TREATMENT_PARAM_CHANGE_RANGES; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( F32 ) + sizeof( F32 ) + sizeof( U32 ) + sizeof( U32 ); @@ -467,7 +467,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &maxDialRate, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -489,7 +489,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS; msg.hdr.payloadLen = sizeof( F32 ) + sizeof( F32 ); @@ -498,7 +498,7 @@ payloadPtr += sizeof( F32 ); memcpy( payloadPtr, &trimmer, sizeof( F32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); return result; @@ -519,14 +519,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_SWITCH_RESERVOIR_CMD; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &activeReservoir, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); return result; @@ -547,14 +547,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_FILL_CMD; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &fillToVolumeMl, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); return result; @@ -566,23 +566,25 @@ * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG drain command msg constructed and queued. - * @param drainToVolumeMl volume (in mL) to drain the inactive reservoir to + * @param drainToVolumeMl volume (in mL) to drain the inactive reservoir to + * @param tareLoadCells set to TRUE if inactive reservoir load cells should be + * tared after draining * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendDGDrainCommand( U32 drainToVolumeMl ) +BOOL sendDGDrainCommand( DRAIN_RESERVOIR_CMD_PAYLOAD_T *payload ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_DRAIN_CMD; - msg.hdr.payloadLen = sizeof( U32 ); + msg.hdr.payloadLen = sizeof( DRAIN_RESERVOIR_CMD_PAYLOAD_T ); - memcpy( payloadPtr, &drainToVolumeMl, sizeof( U32 ) ); + memcpy( payloadPtr, payload, sizeof( DRAIN_RESERVOIR_CMD_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); return result; @@ -603,14 +605,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_STARTING_STOPPING_TREATMENT_CMD; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( payloadPtr, &start, sizeof( BOOL ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); return result; @@ -632,14 +634,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( payloadPtr, &start, sizeof( BOOL ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); return result; @@ -658,12 +660,12 @@ BOOL result; MESSAGE_T msg; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_SAMPLE_WATER_CMD; msg.hdr.payloadLen = 0; - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); return result; @@ -693,7 +695,7 @@ U08 *payloadPtr = msg.payload; ACCEL_DATA_PAYLOAD_T payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_ACCELEROMETER_DATA; msg.hdr.payloadLen = sizeof( ACCEL_DATA_PAYLOAD_T ); @@ -709,7 +711,7 @@ memcpy( payloadPtr, &payload, sizeof( ACCEL_DATA_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -731,29 +733,32 @@ U08 *payloadPtr = msg.payload; ALARM_COMP_STATUS_PAYLOAD_T payload; - // create a message record + // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_ALARM_STATUS; - msg.hdr.payloadLen = sizeof( ALARM_COMP_STATUS_PAYLOAD_T ); - payload.alarmState = (U32)almStatus.alarmsState; - payload.alarmTop = (U32)almStatus.alarmTop; - payload.silenceExpiresIn = almStatus.alarmsSilenceExpiresIn; - payload.escalatesIn = almStatus.alarmsEscalatesIn; - payload.alarmsFlags = ( almStatus.systemFault ? BIT_BY_POS(0) : 0 ); - payload.alarmsFlags |= ( almStatus.stop ? BIT_BY_POS(1) : 0 ); - payload.alarmsFlags |= ( almStatus.noClear ? BIT_BY_POS(2) : 0 ); - payload.alarmsFlags |= ( almStatus.noResume ? BIT_BY_POS(3) : 0 ); - payload.alarmsFlags |= ( almStatus.noRinseback ? BIT_BY_POS(4) : 0 ); - payload.alarmsFlags |= ( almStatus.noEndTreatment ? BIT_BY_POS(5) : 0 ); - payload.alarmsFlags |= ( almStatus.noNewTreatment ? BIT_BY_POS(6) : 0 ); - payload.alarmsFlags |= ( almStatus.bypassDialyzer ? BIT_BY_POS(7) : 0 ); - payload.alarmsFlags |= ( almStatus.alarmsToEscalate ? BIT_BY_POS(8) : 0 ); - payload.alarmsFlags |= ( almStatus.alarmsSilenced ? BIT_BY_POS(9) : 0 ); - payload.alarmsFlags |= ( almStatus.lampOn ? BIT_BY_POS(10) : 0 ); + msg.hdr.msgID = MSG_ID_ALARM_STATUS; + msg.hdr.payloadLen = sizeof( ALARM_COMP_STATUS_PAYLOAD_T ); + payload.alarmState = (U32)almStatus.alarmsState; + payload.alarmTop = (U32)almStatus.alarmTop; + payload.silenceExpiresIn = almStatus.alarmsSilenceExpiresIn; + payload.escalatesIn = almStatus.alarmsEscalatesIn; + + payload.alarmsFlags = ( almStatus.systemFault ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_SYSTEM_FAULT) : 0 ); + payload.alarmsFlags |= ( almStatus.stop ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_STOP) : 0 ); + payload.alarmsFlags |= ( almStatus.noClear ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_CLEAR) : 0 ); + 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.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 ); + payload.alarmsFlags |= ( almStatus.topAlarmConditionnDetected ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_TOP_CONDITION) : 0 ); + memcpy( payloadPtr, &payload, sizeof( ALARM_COMP_STATUS_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_ALARM, ACK_NOT_REQUIRED ); return result; @@ -770,19 +775,19 @@ * @param almData2 2nd data associated with alarm * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastAlarmTriggered( U16 alarm, ALARM_DATA_T almData1, ALARM_DATA_T almData2 ) +BOOL broadcastAlarmTriggered( U32 alarm, ALARM_DATA_T almData1, ALARM_DATA_T almData2 ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_ALARM_TRIGGERED; - msg.hdr.payloadLen = sizeof( U16 ) + sizeof( U32 ) * 2 * 2; // 2 alarm data recs w/ 2 32-bit values each + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) * 2 * 2; // 2 alarm data recs w/ 2 32-bit values each - memcpy( payloadPtr, &alarm, sizeof( U16 ) ); - payloadPtr += sizeof( U16 ); + memcpy( payloadPtr, &alarm, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &almData1.dataType, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &almData1.data, sizeof( U32 ) ); @@ -791,7 +796,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &almData2.data, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_ALARM, ACK_REQUIRED ); return result; @@ -806,23 +811,52 @@ * @param alarm ID of alarm cleared * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastAlarmCleared( U16 alarm ) +BOOL broadcastAlarmCleared( U32 alarm ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_ALARM_CLEARED; - msg.hdr.payloadLen = sizeof( U16 ); + msg.hdr.payloadLen = sizeof( U32 ); - memcpy( payloadPtr, &alarm, sizeof( U16 ) ); + memcpy( payloadPtr, &alarm, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_ALARM, ACK_REQUIRED ); return result; +} + +/*********************************************************************//** + * @brief + * The broadcastAlarmConditionCleared function constructs an alarm condition + * cleared msg to be broadcast and queues the msg for transmit on the + * appropriate CAN channel. + * @details Inputs: none + * @details Outputs: alarm condition cleared msg constructed and queued. + * @param alarm ID of alarm that has had its condition cleared + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastAlarmConditionCleared( U32 alarm ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_ALARM_CONDITION_CLEARED; + msg.hdr.payloadLen = sizeof( U32 ); + + memcpy( payloadPtr, &alarm, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_ALARM, ACK_REQUIRED ); + + return result; } /*********************************************************************//** @@ -840,14 +874,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_BLOOD_FLOW_DATA; msg.hdr.payloadLen = sizeof( BLOOD_PUMP_STATUS_PAYLOAD_T ); memcpy( payloadPtr, bloodData, sizeof( BLOOD_PUMP_STATUS_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -868,14 +902,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DIALYSATE_FLOW_DATA; msg.hdr.payloadLen = sizeof( DIALIN_PUMP_STATUS_PAYLOAD_T ); memcpy( payloadPtr, dialInData, sizeof( DIALIN_PUMP_STATUS_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -896,14 +930,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DIALYSATE_OUT_FLOW_DATA; msg.hdr.payloadLen = sizeof( DIAL_OUT_FLOW_DATA_T ); memcpy( payloadPtr, dialOutFlowData, sizeof( DIAL_OUT_FLOW_DATA_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -924,14 +958,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_PRESSURE_OCCLUSION_DATA; msg.hdr.payloadLen = sizeof( PRESSURE_OCCLUSION_DATA_T ); memcpy( payloadPtr, &data, sizeof( PRESSURE_OCCLUSION_DATA_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -952,14 +986,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_RTC_EPOCH; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &epoch, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -983,7 +1017,7 @@ U08 *payloadPtr = msg.payload; TREATMENT_TIME_DATA_T payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_TREATMENT_TIME; msg.hdr.payloadLen = sizeof( TREATMENT_TIME_DATA_T ); @@ -994,7 +1028,7 @@ memcpy( payloadPtr, &payload, sizeof( TREATMENT_TIME_DATA_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1018,18 +1052,19 @@ U08 *payloadPtr = msg.payload; TREATMENT_STATE_DATA_T payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_TREATMENT_STATE; msg.hdr.payloadLen = sizeof( TREATMENT_STATE_DATA_T ); payload.treatmentSubMode = subMode; payload.uFState = uFState; payload.salineBolusState = salineBolusState; + payload.heparinState = 0; // TODO - add this later memcpy( payloadPtr, &payload, sizeof( TREATMENT_STATE_DATA_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1048,12 +1083,12 @@ BOOL result; MESSAGE_T msg; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_POWER_OFF_WARNING; msg.hdr.payloadLen = 0; - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1074,7 +1109,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_OP_MODE; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); @@ -1083,7 +1118,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &subMode, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1103,14 +1138,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_VALVES_DATA; msg.hdr.payloadLen = sizeof( HD_VALVE_DATA_T ); memcpy( payloadPtr, valveData, sizeof( HD_VALVE_DATA_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1130,14 +1165,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_SALINE_BOLUS_DATA; msg.hdr.payloadLen = sizeof( SALINE_BOLUS_DATA_PAYLOAD_T ); memcpy( payloadPtr, &data, sizeof( SALINE_BOLUS_DATA_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1159,7 +1194,7 @@ U32 lower = (U32)lowerLevel; U32 upper = (U32)upperLevel; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_AIR_TRAP_DATA; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); @@ -1168,7 +1203,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &upper, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1181,14 +1216,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_CAN_ERROR_COUNT; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &count, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; @@ -1235,14 +1270,14 @@ *************************************************************************/ void handleAlarmTriggered( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == ( sizeof( U16 ) + sizeof( U32 ) * 2 * 2 ) ) // 2 data records w/ 2 U32s each + if ( message->hdr.payloadLen == ( sizeof( U32 ) + sizeof( U32 ) * 2 * 2 ) ) // 2 data records w/ 2 U32s each { U08 *payloadPtr = message->payload; - U16 alarmID; + U32 alarmID; ALARM_DATA_T alm1, alm2; - memcpy( &alarmID, payloadPtr, sizeof( U16 ) ); - payloadPtr += sizeof( U16 ); + memcpy( &alarmID, payloadPtr, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); memcpy( &alm1.dataType, payloadPtr, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( &alm1.data, payloadPtr, sizeof( U32 ) ); @@ -1260,28 +1295,82 @@ /*********************************************************************//** * @brief - * The handleAlarmCleared function handles a cleared alarm event message. + * The handleAlarmCleared function handles a cleared alarm condition event message. * @details Inputs: none - * @details Outputs: alarm cleared. + * @details Outputs: alarm condition is cleared. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleAlarmCleared( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == sizeof( U16 ) ) + if ( message->hdr.payloadLen == sizeof( U32 ) ) { U08 *payloadPtr = message->payload; - U16 alarmID; + U32 alarmID; - memcpy( &alarmID, payloadPtr, sizeof( U16 ) ); + memcpy( &alarmID, payloadPtr, sizeof( U32 ) ); if ( (ALARM_ID_T)alarmID < NUM_OF_ALARM_IDS ) { - clearAlarm( (ALARM_ID_T)alarmID ); + clearAlarmCondition( (ALARM_ID_T)alarmID ); } } } - + +/*********************************************************************//** + * @brief + * The handleUIAlarmSilenceRequest function handles an alarm silence request + * message. + * @details Inputs: none + * @details Outputs: alarm silence command is handled. + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUIAlarmSilenceRequest( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U08 *payloadPtr = message->payload; + U32 cmd; + + memcpy( &cmd, payloadPtr, sizeof( U32 ) ); + + signalAlarmSilence( cmd ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleAlarmUserAction function handles a user alarm action event message. + * @details Inputs: none + * @details Outputs: selected action initiated. + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleAlarmUserAction( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U08 *payloadPtr = message->payload; + U32 action; + + memcpy( &action, payloadPtr, sizeof( U32 ) ); + + if ( (ALARM_USER_ACTION_T)action < NUMBER_OF_ALARM_USER_ACTIONS ) + { + signalAlarmUserActionInitiated( (ALARM_USER_ACTION_T)action ); + } + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + /*********************************************************************//** * @brief * The handleOffButtonConfirmMsgFromUI function handles a response to an @@ -1481,7 +1570,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_UF_PAUSE_RESUME_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( U32 ); @@ -1492,7 +1581,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &ufState, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -1517,15 +1606,15 @@ memcpy( &cmd, message->payload, sizeof(U32) ); - if ( 0 == cmd ) // initiate treatment (go to treatment params mode) + if ( 0 == cmd ) // Initiate treatment (go to treatment params mode) { result = signalUserStartingTreatment(); } - else if ( 1 == cmd ) // cancel treatment (return from aborted treatment params mode) + else if ( 1 == cmd ) // Cancel treatment (return from aborted treatment params mode) { result = signalUserCancelTreatment(); } - else if ( 2 == cmd ) // start treatment + else if ( 2 == cmd ) // Start treatment { result = signalUserBeginningTreatment(); } @@ -1551,7 +1640,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_START_TREATMENT_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); @@ -1560,7 +1649,7 @@ payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &reason, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -1603,14 +1692,14 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_TREATMENT_END_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; @@ -1689,7 +1778,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_NEW_TREATMENT_PARAMS_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + byteLength; @@ -1698,12 +1787,71 @@ payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, rejectReasons, byteLength ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; } +/*********************************************************************//** + * @brief + * The handleUFVolumeSetRequest function handles a UF volume treatment parameter + * set and validate request message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUFVolumeSetRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(F32) ) + { + F32 uFVolumeMl; + + memcpy( &uFVolumeMl, message->payload, sizeof(F32) ); + + result = validateAndSetUFVolume( uFVolumeMl ); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); +} + +/*********************************************************************//** + * @brief + * The sendUFVolumeSetResponseMsg function constructs a UF volume treatment parameter + * response to the UI and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: UF volume treatment parameter response msg constructed and queued. + * @param accepted T/F - is UF volume setting accepted? + * @param rejectReasons reason UF volume setting was rejected (if not accepted) + * @param uFVolumeMl UF volume (in mL) value that is now in place + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendUFVolumeSetResponseMsg( BOOL accepted, U32 reason, F32 uFVolumeMl ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SET_UF_VOLUME_PARAMETER_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( F32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &reason, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &uFVolumeMl, sizeof( F32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); + + return result; +} + /*********************************************************************//** * @brief * The handleChangeUFSettingsRequest function handles a ultrafiltration @@ -1882,7 +2030,7 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_SALINE_BOLUS_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( U32 ); @@ -1893,15 +2041,15 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &bolusVol, sizeof( U32 ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief - * The handleDGOpMode function handles a DG broadcast of it's current mode. + * The handleDGOpMode function handles a DG broadcast of its current mode. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for transmit. * @param message a pointer to the message to handle. @@ -1941,22 +2089,22 @@ HD_VERSIONS_T payload; U08 *payloadPtr = msg.payload; - // populate payload + // Populate payload payload.major = (U08)HD_VERSION_MAJOR; payload.minor = (U08)HD_VERSION_MINOR; payload.micro = (U08)HD_VERSION_MICRO; payload.build = (U16)HD_VERSION_BUILD; getFPGAVersions( &payload.fpgaId, &payload.fpgaMajor, &payload.fpgaMinor, &payload.fpgaLab ); - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_VERSION; msg.hdr.payloadLen = sizeof( HD_VERSIONS_T ); - // fill message payload + // Fill message payload memcpy( payloadPtr, &payload, sizeof( HD_VERSIONS_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // 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_REQUIRED ); } @@ -1981,7 +2129,7 @@ { BOOL result; - // add serialized message data to appropriate comm buffer + // Add serialized message data to appropriate comm buffer result = addToCommBuffer( COMM_BUFFER_OUT_UART_PC, dbgData, len ); return result; @@ -2002,15 +2150,15 @@ U32 txtLen = strlen( (char*)str ); U08 *payloadPtr = msg.payload; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_DEBUG_EVENT; - msg.hdr.payloadLen = DEBUG_EVENT_MAX_TEXT_LEN + 1; // add 1 byte for null terminator + msg.hdr.payloadLen = DEBUG_EVENT_MAX_TEXT_LEN + 1; // Add 1 byte for null terminator if ( txtLen <= DEBUG_EVENT_MAX_TEXT_LEN ) { memcpy( payloadPtr, str, txtLen + 1 ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // 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 ); } } @@ -2045,13 +2193,13 @@ BOOL result; MESSAGE_T msg; - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = msgID; msg.hdr.payloadLen = sizeof( U08 ); msg.payload[ 0 ] = (U08)ack; - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); return result; @@ -2068,18 +2216,18 @@ *************************************************************************/ void handleTesterLogInRequest( MESSAGE_T *message ) { - // verify pass code + // Verify pass code // TODO - placeholder - how do we want to authenticate tester? if ( ( 3 == message->hdr.payloadLen ) && ( 0x31 == message->payload[ 0 ] ) && ( 0x32 == message->payload[ 1 ] ) && ( 0x33 == message->payload[ 2 ] ) ) { testerLoggedIn = TRUE; - checkInFromUI(); // allow tasks to begin normal processing when tester has logged in + checkInFromUI(); // Allow tasks to begin normal processing when tester has logged in } else { testerLoggedIn = FALSE; } - // respond to would be tester + // Respond to would be tester sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, testerLoggedIn ); } @@ -2097,7 +2245,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2112,7 +2260,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2130,7 +2278,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = 0; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2144,7 +2292,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2162,7 +2310,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = 0; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2176,7 +2324,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2194,7 +2342,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -2208,7 +2356,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2226,7 +2374,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -2240,7 +2388,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2258,7 +2406,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -2272,44 +2420,12 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief - * The handleTestAlarmStatusBroadcastIntervalOverrideRequest function handles a request to - * override the broadcast interval for alarm status. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleTestAlarmStatusBroadcastIntervalOverrideRequest( 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 = testSetAlarmStatusPublishIntervalOverride( payload.state.u32 ); - } - else - { - result = testResetAlarmStatusPublishIntervalOverride(); - } - } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief * The handleTestBloodFlowSetPointOverrideRequest function handles a request to * override the set point for the blood flow rate (mL/min). * @details Inputs: none @@ -2322,14 +2438,14 @@ OVERRIDE_PUMP_SET_PT_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) ); result = testSetTargetBloodFlowRateOverride( payload.setPt, payload.ctrlMode ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2347,7 +2463,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2361,7 +2477,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2379,7 +2495,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2393,7 +2509,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2411,7 +2527,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2425,7 +2541,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2443,7 +2559,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2457,7 +2573,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2475,7 +2591,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2489,7 +2605,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2507,7 +2623,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2521,7 +2637,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2539,7 +2655,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2553,7 +2669,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2571,14 +2687,14 @@ OVERRIDE_PUMP_SET_PT_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) ); result = testSetTargetDialInFlowRateOverride( payload.setPt, payload.ctrlMode ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2596,14 +2712,14 @@ OVERRIDE_PUMP_SET_PT_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) ); result = testSetTargetDialOutFlowRateOverride( payload.setPt, payload.ctrlMode ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2621,7 +2737,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2635,7 +2751,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2653,7 +2769,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2667,7 +2783,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2685,7 +2801,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2699,7 +2815,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2717,7 +2833,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2731,7 +2847,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2749,7 +2865,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2763,7 +2879,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2781,7 +2897,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2795,7 +2911,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2813,7 +2929,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2827,7 +2943,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2845,7 +2961,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2859,7 +2975,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2877,7 +2993,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2891,7 +3007,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2909,7 +3025,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2923,7 +3039,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2941,7 +3057,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2955,7 +3071,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2973,7 +3089,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -2987,7 +3103,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3005,7 +3121,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3019,7 +3135,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3049,7 +3165,7 @@ result = setRTCTimestamp( seconds, minutes, hours, days, months, years ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3067,7 +3183,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3081,7 +3197,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3100,7 +3216,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3114,7 +3230,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3133,7 +3249,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3147,7 +3263,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3166,7 +3282,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3180,7 +3296,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3199,7 +3315,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3213,7 +3329,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3231,7 +3347,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3245,7 +3361,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3263,7 +3379,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3277,7 +3393,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3295,7 +3411,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -3309,7 +3425,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3327,7 +3443,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3341,7 +3457,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3359,7 +3475,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -3373,7 +3489,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3391,7 +3507,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -3405,7 +3521,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3423,7 +3539,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3437,7 +3553,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3454,7 +3570,7 @@ { BOOL result = FALSE; - // verify payload length + // Verify payload length if ( message->hdr.payloadLen == sizeof(ACCEL_CAL_PAYLOAD_T) ) { ACCEL_CAL_PAYLOAD_T payload; @@ -3463,7 +3579,7 @@ result = setAccelCalibration( payload.xOffset, payload.yOffset, payload.zOffset ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3480,7 +3596,7 @@ { BOOL result = FALSE; - // verify payload length + // Verify payload length if ( message->hdr.payloadLen == sizeof(LINEAR_F32_CAL_PAYLOAD_T) ) { LINEAR_F32_CAL_PAYLOAD_T payload; @@ -3489,7 +3605,7 @@ result = setBloodFlowCalibration( payload.gain, payload.offset ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3506,7 +3622,7 @@ { BOOL result = FALSE; - // verify payload length + // Verify payload length if ( message->hdr.payloadLen == sizeof(LINEAR_F32_CAL_PAYLOAD_T) ) { LINEAR_F32_CAL_PAYLOAD_T payload; @@ -3515,7 +3631,7 @@ result = setDialInFlowCalibration( payload.gain, payload.offset ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3532,7 +3648,7 @@ { BOOL result = FALSE; - // verify payload length + // Verify payload length if ( message->hdr.payloadLen == sizeof(CRITICAL_DATAS_T) + sizeof(CRITICAL_DATAS_T) ) { CRITICAL_DATAS_T payload[2]; @@ -3541,7 +3657,7 @@ result = testSetTreatmentParameter( (TREATMENT_PARAM_T)payload[0].uInt, payload[1] ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3557,7 +3673,7 @@ { BOOL result = FALSE; - // verify payload length + // Verify payload length if ( message->hdr.payloadLen == sizeof(U32) ) { U32 valve; @@ -3568,7 +3684,7 @@ result = TRUE; } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3586,7 +3702,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3600,7 +3716,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3627,7 +3743,7 @@ result = TRUE; } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3645,7 +3761,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -3659,7 +3775,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3678,7 +3794,7 @@ OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T) ); @@ -3692,7 +3808,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } #endif @@ -3711,7 +3827,7 @@ TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); @@ -3725,7 +3841,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3743,7 +3859,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify payload length + // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); @@ -3757,7 +3873,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3774,20 +3890,20 @@ { BOOL result = FALSE; - // verify payload length + // Verify payload length if ( 0 == message->hdr.payloadLen ) { - // tester must be logged in + // Tester must be logged in if ( TRUE == isTestingActivated() ) - { // s/w reset of processor - result = TRUE; // reset will prevent this from getting transmitted though + { // S/w reset of processor + result = TRUE; // Reset will prevent this from getting transmitted though #ifndef _VECTORCAST_ - systemREG1->SYSECR = (0x2) << 14; // reset processor + systemREG1->SYSECR = (0x2) << 14; // Reset processor #endif } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3810,7 +3926,7 @@ result = homeBloodPump(); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3833,7 +3949,7 @@ result = homeDialInPump(); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3856,7 +3972,7 @@ result = homeDialOutPump(); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3884,7 +4000,7 @@ result = TRUE; } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3908,23 +4024,23 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // get calibration data + // Get calibration data result = getCalibrationData( &cal ); if ( TRUE == result ) { - // create a message record + // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_CALIBRATION_DATA; msg.hdr.payloadLen = sizeof( CALIBRATION_DATA_T ); memcpy( payloadPtr, &cal, sizeof( CALIBRATION_DATA_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3951,7 +4067,7 @@ result = testResetCalibrationData( key ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); }