Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u -reb3e8ec85b8c2cfd7215d762117c617b8084be45 -rb99f09d45edf4ba0d0c9b3dfb46869fed368b20b --- leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision eb3e8ec85b8c2cfd7215d762117c617b8084be45) +++ leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision b99f09d45edf4ba0d0c9b3dfb46869fed368b20b) @@ -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 , @@ -663,6 +690,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)