Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u -r5a50ff3c3ba355fffc616bfc85eb7b312b58b702 -r0be6cfc8a7360df173e2b54a4e54382df6611c8d --- leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 5a50ff3c3ba355fffc616bfc85eb7b312b58b702) +++ leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 0be6cfc8a7360df173e2b54a4e54382df6611c8d) @@ -659,7 +659,51 @@ payload=payload) self.can_interface.send(message, 0) + def td_tx_state(self, + sub_mode : int, + blood_prime_state : int, + dialysis_state : int, + isolated_uf_state : int, + tx_stop_state : int, + tx_rinseback_state : int, + tx_recirculate_state : int, + tx_end_state : int, + tx_saline_state : int, + tx_heparin_state : int) -> None: + """A general method to send any standard response message, by it's id and list of parameters. + Args: + sub_mode (int): Treatment Submode + blood_prime_state (int): Treatment Blood Prime State + dialysis_state (int): Treatment dialysis state + isolated_uf_state (int): Treatment Isolated UF state + tx_stop_state (int): Treatment Stop state + tx_rinseback_state (int): Treatment Rinseback State + tx_recirculate_state (int): Treatment Recirculate State + tx_end_state (int): Treatment End state + tx_saline_state (int): Saline Bolus state + tx_heparin_state (int): Heparin 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(blood_prime_state ) + payload += conversions.unsigned_integer_to_bytearray(dialysis_state ) + payload += conversions.unsigned_integer_to_bytearray(isolated_uf_state ) + payload += conversions.unsigned_integer_to_bytearray(tx_stop_state ) + payload += conversions.unsigned_integer_to_bytearray(tx_rinseback_state ) + payload += conversions.unsigned_integer_to_bytearray(tx_recirculate_state ) + payload += conversions.unsigned_integer_to_bytearray(tx_end_state ) + payload += conversions.unsigned_integer_to_bytearray(tx_saline_state ) + payload += conversions.unsigned_integer_to_bytearray(tx_heparin_state ) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_sync_broadcast_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_TREATMENT_STATE_DATA.value, + payload=payload) + + self.can_interface.send(message, 0) + def cmd_send_general_response(self, message_id: int, accepted: int, reason: int, is_pure_data: bool = False, has_parameters: bool = False,