Index: dialin/hd/treatment.py =================================================================== diff -u -rfc66ba65a8746c71b2f7688acce29b3a779dbdf8 -rb781efb6e6c21894714199e9dbfb1c3ac2576e1c --- dialin/hd/treatment.py (.../treatment.py) (revision fc66ba65a8746c71b2f7688acce29b3a779dbdf8) +++ dialin/hd/treatment.py (.../treatment.py) (revision b781efb6e6c21894714199e9dbfb1c3ac2576e1c) @@ -104,6 +104,9 @@ msg_id = MsgIds.MSG_ID_HD_RECIRC_PROGRESS.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_recirculate_data_sync) + msg_id = MsgIds.MSG_ID_HD_TREATMENT_STOP_TIMER_DATA.value + self.can_interface.register_receiving_publication_function(channel_id, msg_id, + self._handler_treatment_stop_timer_data_sync) # treatment duration data self.treatment_time_prescribed = 0 @@ -135,6 +138,9 @@ # re-circulation status self.recirc_timeout_secs = 0 self.recirc_countdown_secs = 0 + # treatment stop status + self.treatment_stop_timeout_secs = 0 + self.treatment_stop_timeout_coundown_secs = 0 def reset(self) -> None: """ @@ -483,6 +489,23 @@ self.recirc_timeout_secs = tmo[0] self.recirc_countdown_secs = cdn[0] + @publish(["treatment_stop_timeout_secs", "treatment_stop_timeout_coundown_secs"]) + def _handler_treatment_stop_timer_data_sync(self, message) -> None: + """ + Handles published treatment stop progress data messages. + + @param message: published treatment stop progress data message + @return: None + """ + + tmo = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1])) + cnd = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2])) + + self.treatment_stop_timeout_secs = tmo[0] + self.treatment_stop_timeout_coundown_secs = cnd[0] + def cmd_set_treatment_param_blood_flow_rate(self, flow: int) -> int: """ Constructs and sends the set blood flow rate treatment parameter command.