Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r2ad5befab1030c921a87df8ef8848082b19d10de -r3f2bb2c7793f68d26138308c8dc48e69d251f5a2 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 2ad5befab1030c921a87df8ef8848082b19d10de) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3f2bb2c7793f68d26138308c8dc48e69d251f5a2) @@ -2842,6 +2842,47 @@ /*********************************************************************//** * @brief + * The handleDGSwitchChanged function handles a DG switch change + * message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGSwitchChanged( MESSAGE_T *message ) +{ + U32 expPayloadSize = sizeof(U32) + sizeof(U32); + + if ( expPayloadSize == message->hdr.payloadLen ) + { + U32 switchId; + U32 newstate; + U32 oldstate = (U32)0; + + memcpy( &switchId, &message->payload[0], sizeof(U32) ); + memcpy( &newstate, &message->payload[sizeof(U32)], sizeof(U32) ); + + if ((U32)0 == newstate) + { + oldstate = 1; + } + if ((U32)0 == switchId) + { + sendTreatmentLogEventData( CONCENTRATE_CAP_SWITCH_CHANGED_EVENT, (F32)oldstate, (F32)newstate ); + } + if ((U32)1 == switchId) + { + sendTreatmentLogEventData( DIALYSATE_CAP_SWITCH_CHANGED_EVENT, (F32)oldstate, (F32)newstate ); + } + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief * The handleSalineBolusRequest function handles a saline bolus request * message from the UI. * @details Inputs: none