Index: leahi_dialin/common/msg_ids.py =================================================================== diff -u -r2f5eb156493bb326016ef7b921d1b05debfc5f3b -r97ed582bfa36a429c4ebe75390e5c0b3c79c8730 --- leahi_dialin/common/msg_ids.py (.../msg_ids.py) (revision 2f5eb156493bb326016ef7b921d1b05debfc5f3b) +++ leahi_dialin/common/msg_ids.py (.../msg_ids.py) (revision 97ed582bfa36a429c4ebe75390e5c0b3c79c8730) @@ -133,6 +133,10 @@ MSG_ID_DD_DATE_AND_TIME_RESPONSE = 0x6F MSG_ID_FP_RO_REJECTION_RATIO_DATA = 0x71 MSG_ID_DD_PISTON_PUMP_CONTROL_DATA = 0xF0 + MSG_ID_TD_HEPARIN_REQUEST = 0x8A + MSG_ID_TD_HEPARIN_RESPONSE = 0x8B + MSG_ID_TD_HEPARIN_DATA = 0x8C + MSG_ID_DD_PISTON_PUMP_CONTROL_DATA = 0xF0 MSG_ID_TD_TESTER_LOGIN_REQUEST = 0x8000 MSG_ID_TD_SOFTWARE_RESET_REQUEST = 0x8001 Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u -r29ea9a036d8c311257581ac1ffb8a390df6f3ec8 -r97ed582bfa36a429c4ebe75390e5c0b3c79c8730 --- leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 29ea9a036d8c311257581ac1ffb8a390df6f3ec8) +++ leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 97ed582bfa36a429c4ebe75390e5c0b3c79c8730) @@ -397,38 +397,34 @@ self.can_interface.send(message, 0) - def td_saline( self, - target_volume : int , - cumulative_volume : float , - bolus_volume : float , - state : int ): + def td_heparin( self, + target : float , + cumulative : float , + time_remaining : int ): """ - Broadcasts the current TD Saline data (Msg ID: 0x3D, 61) + Broadcasts the current TD Heparin data (Msg ID: 0xXX, XX) Args: - @param target_volume (int ) : Saline target volume - @param cumulative_volume (float) : Saline cumulative volume - @param bolus_volume (float) : Saline bolus set volume - @param state (int ) : Saline bolus state + @param target (float) : Heparin target volume + @param cumulative (float) : Heparin cumulative volume + @param time_remaining (int) : Heparin time remaining @return: None """ if not self.can_enabled: raise ValueError("CAN Interface is not enabled") - payload = conversions.unsigned_integer_to_bytearray(target_volume ) - payload += conversions.float_to_bytearray (cumulative_volume ) - payload += conversions.float_to_bytearray (bolus_volume ) - payload += conversions.unsigned_integer_to_bytearray(state ) + payload = conversions.float_to_bytearray (target ) + payload += conversions.float_to_bytearray (cumulative ) + payload += conversions.unsigned_integer_to_bytearray(time_remaining ) message = CAN.DenaliMessage.build_message( channel_id=CAN.DenaliChannels.td_sync_broadcast_ch_id, - message_id=msg_ids.MsgIds.MSG_ID_TD_SALINE_BOLUS_DATA.value, + message_id=msg_ids.MsgIds.MSG_ID_TD_HEPARIN_DATA.value, payload=payload) self.can_interface.send(message, 0) - def td_vitals( self, systolic : int , diastolic : int , @@ -456,6 +452,37 @@ payload=payload) self.can_interface.send(message, 0) + def td_saline( self, + target_volume : int , + cumulative_volume : float , + bolus_volume : float , + state : int ): + """ + Broadcasts the current TD Saline data (Msg ID: 0x3D, 61) + Args: + @param target_volume (int ) : Saline target volume + @param cumulative_volume (float) : Saline cumulative volume + @param bolus_volume (float) : Saline bolus set volume + @param state (int ) : Saline bolus state + @return: None + """ + + if not self.can_enabled: + raise ValueError("CAN Interface is not enabled") + + + payload = conversions.unsigned_integer_to_bytearray(target_volume ) + payload += conversions.float_to_bytearray (cumulative_volume ) + payload += conversions.float_to_bytearray (bolus_volume ) + payload += conversions.unsigned_integer_to_bytearray(state ) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_sync_broadcast_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_SALINE_BOLUS_DATA.value, + payload=payload) + + self.can_interface.send(message, 0) + def td_ultrafiltration( self, set_volume : float , target_rate : float , @@ -680,6 +707,22 @@ payload=payload) self.can_interface.send(message, 0) + def td_heparin_adjustment_response(self,vRejectionReason: int): + """ + the heparin adjustment response message method(Msg ID: 0xXX, XXX) + Args: + None + @return: None + """ + payload = conversions.integer_to_bytearray(1 if vRejectionReason == 0 else 0) + payload += conversions.integer_to_bytearray(vRejectionReason) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_HEPARIN_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + def td_Treatment_Parameters_CreateRx(self, vRejectionReason: int): """ TD response to in initiate Treatment and enter Create Rx (Msg ID: 0x46, 70)