Index: leahi_dialin/td/proxies/ui_proxy.py =================================================================== diff -u -rcfdfc19e474ebf53bc80809a9e6fc19171d6ada1 -r914620537399ff9ecc4925fc56f8b8be567d184e --- leahi_dialin/td/proxies/ui_proxy.py (.../ui_proxy.py) (revision cfdfc19e474ebf53bc80809a9e6fc19171d6ada1) +++ leahi_dialin/td/proxies/ui_proxy.py (.../ui_proxy.py) (revision 914620537399ff9ecc4925fc56f8b8be567d184e) @@ -7,19 +7,20 @@ # # @file ui_proxy.py # -# @author (last) Micahel Garthwaite -# @date (last) 18-Aug-2023 +# @author (last) Zoltan Miskolci +# @date (last) 08-Jan-2026 # @author (original) Peter Lucia # @date (original) 02-Apr-2020 # ############################################################################ + import struct from logging import Logger -from leahi_dialin.td.modules.constants import ACCEPTED, REJECTED +from leahi_dialin.common.constants import ACCEPTED from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions, RequestRejectReasons from leahi_dialin.protocols.CAN import DenaliMessage, DenaliCanMessenger, DenaliChannels -from leahi_dialin.utils.base import AbstractSubSystem, publish +from leahi_dialin.utils.base import AbstractSubSystem from leahi_dialin.utils.conversions import integer_to_bytearray, unsigned_byte_to_bytearray, float_to_bytearray, \ short_to_bytearray @@ -37,7 +38,6 @@ @param can_interface: the Denali CAN interface object """ - super().__init__() self.can_interface = can_interface self.logger = logger @@ -98,6 +98,7 @@ self.uf_pause_resume_rr = 0 self.uf_pause_resume_timestamp = 0 + def _handler_tx_parameters_val_resp_sync(self, message: dict, timestamp=0.0) -> None: """ Handles treatment parameters validation response from the TD. Treatment parameters acceptance and rejection @@ -141,6 +142,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_16:MsgFieldPositions.END_POS_FIELD_16]))[0] self.tx_params_validate_timestamp = timestamp + def _handler_uf_val_resp_sync(self, message: dict, timestamp=0.0) -> None: """ Handles ultrafiltration volume validation response from the TD. Ultrafiltration volume acceptance and @@ -158,6 +160,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] self.uf_volume_timestamp = timestamp + def _handler_initiate_treatment_resp_sync(self, message: dict, timestamp=0.0) -> None: """ Handles inititate treatment response from the TD. Treatment acceptance and rejection @@ -173,6 +176,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] self.initiate_tx_timestamp = timestamp + def _handler_uf_pause_resp_sync(self, message: dict, timestamp=0.0) -> None: """ Handles ultrafiltration pause response from the TD. Ultrafiltration pause acceptance and rejection @@ -188,6 +192,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] self.uf_pause_resume_timestamp = timestamp + def cmd_send_ui_treatment_param_data(self, blood_flow_rate: int, dialysate_flow_rate: int, treatment_duration: int, @@ -233,7 +238,6 @@ :return: None """ - bld = integer_to_bytearray(blood_flow_rate) dia = integer_to_bytearray(dialysate_flow_rate) dur = integer_to_bytearray(treatment_duration) @@ -304,6 +308,7 @@ self.logger.debug("Sending UI Initiate Treatment Workflow.") self.can_interface.send(message, 0) + def cmd_send_ui_confirmed_treatment_parameters (self, accepted: int = ACCEPTED ) -> None: """ Constructs and sends a UI confirmation of treatment parameters message. @@ -322,6 +327,7 @@ self.logger.debug("Sending UI Confirm Treatment Parameters.") self.can_interface.send(message, 0) + def cmd_send_ui_pause_resume_uf(self, accepted:int = ACCEPTED, rejection_reason:int = RequestRejectReasons.REQUEST_REJECT_REASON_NONE.value ) -> None: """ Constructs and sends a UI pause/resume ultrafiltration message. @@ -342,6 +348,7 @@ self.logger.debug("Sending UI Pause Resume UF request.") self.can_interface.send(message, 0) + def cmd_send_ui_validate_uf_volume (self, uf_volume: float = 0.0 ) -> None: """ Constructs and sends a UI validate ultrafiltration message. @@ -358,4 +365,4 @@ payload=payload) self.logger.debug("Sending UI Ultrafiltration volume to validate.") - self.can_interface.send(message, 0) \ No newline at end of file + self.can_interface.send(message, 0)