Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -re85815f8334417aa2ffac8bc366d25ed72ab4e1e -ra74a984a7059f75d86ad87d6d9499bd8f94cc976 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e85815f8334417aa2ffac8bc366d25ed72ab4e1e) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a74a984a7059f75d86ad87d6d9499bd8f94cc976) @@ -42,6 +42,7 @@ { U08 confirmed; // 1 = confirmed, 0 = rejected/timed out } OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T; + typedef struct { U32 alarmState; // 0 = no alarms, 1 = low priority, 2 = medium priority, 3 = high priority @@ -71,6 +72,14 @@ F32 doPumpOcclusion; } PRESSURE_OCCLUSION_DATA_T; +typedef struct +{ + F32 res1PrimaryLoadCell; + F32 res1BackupLoadCell; + F32 res2PrimaryLoadCell; + F32 res2BackupLoadCell; +} LOAD_CELL_READINGS_PAYLOAD_T; + #pragma pack(pop) // ********** private data ********** @@ -235,6 +244,34 @@ } /************************************************************************* + * @brief handleDGCheckIn + * The handleDGCheckIn function handles a check-in from the DG. + * @details + * Inputs : none + * Outputs : check in the DG with the SystemComm module. + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGCheckIn( MESSAGE_T *message ) +{ + checkInFromDG(); +} + +/************************************************************************* + * @brief handleUICheckIn + * The handleUICheckIn function handles a check-in from the UI. + * @details + * Inputs : none + * Outputs : check in the UI with the SystemComm module. + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUICheckIn( MESSAGE_T *message ) +{ + checkInFromUI(); +} + +/************************************************************************* * @brief handleOffButtonConfirmMsgFromUI * The handleOffButtonConfirmMsgFromUI function handles a response to an \n * off button message to the UI. @@ -253,6 +290,24 @@ } /************************************************************************* + * @brief + * The handleLoadCellReadingsFromDG function handles a load cell readings \n + * message from the DG. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleLoadCellReadingsFromDG( MESSAGE_T *message ) +{ + LOAD_CELL_READINGS_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(LOAD_CELL_READINGS_PAYLOAD_T) ); + setNewLoadCellReadings( payload.res1PrimaryLoadCell, payload.res1BackupLoadCell, payload.res2PrimaryLoadCell, payload.res2BackupLoadCell ); +} + +/************************************************************************* * @brief broadcastAlarmStatus * The broadcastAlarmStatus function constructs an alarm status msg to \n * be broadcast and queues the msg for transmit on the appropriate CAN channel. @@ -449,6 +504,35 @@ } /************************************************************************* + * @brief broadcastDialInFlowData + * The broadcastDialInFlowData function constructs a dialysate outlet flow data \n + * msg to be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details + * Inputs : none + * Outputs : dialysate out flow data msg constructed and queued. + * @param dialOutFlowData : Pointer to the dialysate out flow data record. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastDialOutFlowData( DIAL_OUT_FLOW_DATA_T *dialOutFlowData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // 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 + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/************************************************************************* * @brief broadcastPresOcclData * The broadcastPresOcclData function constructs a pres/occl data msg to \n * be broadcast and queues the msg for transmit on the appropriate CAN channel. @@ -517,36 +601,8 @@ return result; } -/************************************************************************* - * @brief handleDGCheckIn - * The handleDGCheckIn function handles a check-in from the DG. - * @details - * Inputs : none - * Outputs : check in the DG with the SystemComm module. - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleDGCheckIn( MESSAGE_T *message ) -{ - checkInFromDG(); -} /************************************************************************* - * @brief handleUICheckIn - * The handleUICheckIn function handles a check-in from the UI. - * @details - * Inputs : none - * Outputs : check in the UI with the SystemComm module. - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleUICheckIn( MESSAGE_T *message ) -{ - checkInFromUI(); -} - - -/************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/