Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r9ce06772b2f651c57144327e6cbf886e2bc22dee -r021e6ea5f99fd6da424d8ab81d6a106f2cb41294 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 9ce06772b2f651c57144327e6cbf886e2bc22dee) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 021e6ea5f99fd6da424d8ab81d6a106f2cb41294) @@ -416,7 +416,7 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); return result; -} +} /*********************************************************************//** * @brief @@ -767,6 +767,25 @@ /*********************************************************************//** * @brief + * The handleAlarmClear function handles a clear alarm message from the HD. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleAlarmClear( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U32 alarmId; + + memcpy(&alarmId, message->payload, sizeof( U32 ) ); + clearAlarm( (ALARM_ID_T)alarmId ); + } +} + +/*********************************************************************//** + * @brief * The handleSetDialysateTemperatureCmd function handles a dialysate temperature * set points message from the HD. * @details Inputs: none @@ -878,6 +897,36 @@ /*********************************************************************//** * @brief + * The broadcastFilterFlushData function sends out the filter flush progress data. + * @details Inputs: none + * @details Outputs: filter flush data msg constructed and queued + * @param timeout flush filter timeout (in sec) + * @param countdown flush filter timeout count down (in sec) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastFilterFlushData( U32 timeout, U32 countdown ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_FILTER_FLUSH_PROGRESS; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &timeout, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &countdown, 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_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The broadcastHeatDisinfectData function sends out the heat disinfect * mode data. * @details Inputs: none @@ -905,6 +954,7 @@ } /*********************************************************************//** + * @brief * The sendCommandResponseMsg function constructs a command response to HD * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -996,13 +1046,21 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == sizeof( U32 ) ) + if ( message->hdr.payloadLen == sizeof( FILL_CMD_T ) ) { - U32 fillToVolumeMl; + FILL_CMD_T fillCmd; result = TRUE; - memcpy( &fillToVolumeMl, message->payload, sizeof( U32 ) ); - startFillCmd( fillToVolumeMl ); + memcpy( &fillCmd, message->payload, sizeof( FILL_CMD_T ) ); + + if ( DG_CMD_START == fillCmd.cmd ) + { + startFillCmd( fillCmd.fillToVolumeMl ); + } + else + { + stopFillCmd(); + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); @@ -1102,12 +1160,13 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == 0 ) + if ( message->hdr.payloadLen == sizeof( U32 ) ) { - if ( DG_MODE_STAN == getCurrentOperationMode() ) - { - result = requestWaterSample(); - } + SAMPLE_WATER_CMD_T sampleWaterCmd; + + result = TRUE; + memcpy( &sampleWaterCmd, message->payload, sizeof( U32 ) ); + waterSampleCommandHandler( sampleWaterCmd ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result );