Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u -r36636063d8db4e2792ee5002ae2f92e2b41c4bcd -r4e55e6d9f6f0be9c7bd903159b7784ea0562fcd9 --- leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 36636063d8db4e2792ee5002ae2f92e2b41c4bcd) +++ leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 4e55e6d9f6f0be9c7bd903159b7784ea0562fcd9) @@ -2001,6 +2001,7 @@ payload=payload) self.can_interface.send(message, 0) + def td_tx_state(self, sub_mode : int, blood_prime_state : int, @@ -2047,6 +2048,46 @@ self.can_interface.send(message, 0) + def td_pre_tx_state(self, + sub_mode : int, + install_state : int, + self_test_dry_state : int, + prime_state : int, + recirculate_state : int, + confirm_rx_state : int, + heparin_setup_state : int, + patient_connection_state: int) -> None: + """A general method to send any standard response message, by it's id and list of parameters. (Msg ID: 0xB7, 60) + Args: + sub_mode (int): Treatment Submode + install_state (int): Pre-Treatment install_state + self_test_dry_state (int): Pre-Treatment self_test_dry_state + prime_state (int): Pre-Treatment prime_state + recirculate_state (int): Pre-Treatment recirculate_state + confirm_rx_state (int): Pre-Treatment confirm_rx_state + heparin_setup_state (int): Pre-Treatment heparin_setup_state + patient_connection_state (int): Pre-Treatment patient_connection_state + """ + if not self.can_enabled: + raise ValueError("CAN Interface is not enabled") + + payload = conversions.unsigned_integer_to_bytearray(sub_mode ) + payload += conversions.unsigned_integer_to_bytearray(install_state ) + payload += conversions.unsigned_integer_to_bytearray(self_test_dry_state ) + payload += conversions.unsigned_integer_to_bytearray(prime_state ) + payload += conversions.unsigned_integer_to_bytearray(recirculate_state ) + payload += conversions.unsigned_integer_to_bytearray(confirm_rx_state ) + payload += conversions.unsigned_integer_to_bytearray(heparin_setup_state ) + payload += conversions.unsigned_integer_to_bytearray(patient_connection_state ) + + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_sync_broadcast_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_PRE_TREATMENT_STATE_DATA.value, + payload=payload) + + self.can_interface.send(message, 0) + + def td_treatment_log_alarm(self, alarm_id: int, parameter1: float, parameter2: float) -> None: """ send the treatment log data