Index: TD_TreatmentAdjustmentSetPoints/interface.ui =================================================================== diff -u --- TD_TreatmentAdjustmentSetPoints/interface.ui (revision 0) +++ TD_TreatmentAdjustmentSetPoints/interface.ui (revision 8d7cdcc5840c87ec57089901eccfa4043af37a5d) @@ -0,0 +1,1410 @@ + + + ui_interface + + + + 0 + 0 + 821 + 461 + + + + + 100000 + 100000 + + + + + 10 + + + + &3 Treatment/&8 Set Points Adjustments + + + + 5 + + + 5 + + + 5 + + + 5 + + + 5 + + + + + 2 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + + 11 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + Set Points + + + Qt::AlignCenter + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Blood Flow Rate + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + Qt::Horizontal + + + + + + + + 40 + 0 + + + + -- + + + Qt::AlignCenter + + + + + + + + + Dialysate Flow Rate + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + Qt::Horizontal + + + + + + + + 40 + 0 + + + + -- + + + Qt::AlignCenter + + + + + + + + + Dialysate Temperature + + + + + + + Acid Concentrate + + + + + + + Bicarb Concentrate + + + + + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + 1000 + + + 1 + + + Qt::Horizontal + + + + + + + + 40 + 0 + + + + -- + + + Qt::AlignCenter + + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 135 : [0x8700] : Set Points Request + + + Qt::AlignCenter + + + + + + + Copy + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Blood Flow Rate (mL/min) + + + + + + + QFrame::Box + + + QFrame::Sunken + + + -- + + + Qt::AlignCenter + + + + + + + Dialysate Flow Rate (mL/min) + + + + + + + Dialysate Temperature (°C) + + + + + + + Acid Concentrate + + + + + + + Bicarb Concentrate + + + + + + + QFrame::Box + + + QFrame::Sunken + + + -- + + + Qt::AlignCenter + + + + + + + QFrame::Box + + + QFrame::Sunken + + + -- + + + Qt::AlignCenter + + + + + + + QFrame::Box + + + QFrame::Sunken + + + -- + + + Qt::AlignCenter + + + + + + + QFrame::Box + + + QFrame::Sunken + + + -- + + + Qt::AlignCenter + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 136 : [0x8800] : Set Points Response + + + Qt::AlignCenter + + + + + + + Send + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Rejection Reason + + + + + + + Qt::AlignCenter + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 0 + 0 + + + + + + + + + + 2 + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + + 0 + 25 + + + + + 11 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + Blood Flow Rate + + + Qt::AlignCenter + + + + + + + Reset + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 137 : [0x8900] : Blood Flow Rate Request + + + Qt::AlignCenter + + + + + + + Copy + + + + + + + + 10 + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 0 + 0 + + + + + 10 + + + + QFrame::Box + + + QFrame::Raised + + + -- + + + Qt::AlignCenter + + + + + + + Blood Flow Rate (mL/min) + + + + + + + + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 138 : [0x8A00] : Blood Flow Rate Response + + + Qt::AlignCenter + + + + + + + Send + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Rejection Reason + + + + + + + + 0 + 0 + + + + Qt::AlignCenter + + + 100 + + + + + + + + + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + + 0 + 25 + + + + + 11 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + Dialysate Flow Rate + + + Qt::AlignCenter + + + + + + + Reset + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 139 : [0x8B00] : Dialysate Flow Rate Request + + + Qt::AlignCenter + + + + + + + Copy + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Dialysate Flow Rate (mL/min) + + + + + + + + 0 + 0 + + + + QFrame::Box + + + QFrame::Sunken + + + -- + + + Qt::AlignCenter + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 140 : [0x8C00] : Dialysate Flow Rate Response + + + Qt::AlignCenter + + + + + + + Send + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Rejection Reason + + + + + + + + 0 + 0 + + + + Qt::AlignCenter + + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + + 0 + 25 + + + + + 11 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + Dialysate Temperature + + + Qt::AlignCenter + + + + + + + Reset + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 141 : [0x8D00] : Dialysate Temperature Request + + + Qt::AlignCenter + + + + + + + Copy + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Dialysate Temperature (°C) + + + + + + + + 0 + 0 + + + + QFrame::Box + + + QFrame::Sunken + + + -- + + + Qt::AlignCenter + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 142 : [0x8E00] : Dialysate Temperature Response + + + Qt::AlignCenter + + + + + + + Send + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Rejection Reason + + + + + + + + 0 + 0 + + + + Qt::AlignCenter + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 0 + 0 + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 0 + 0 + + + + + + + + + + + Index: TD_TreatmentAdjustmentSetPoints/loader.py =================================================================== diff -u --- TD_TreatmentAdjustmentSetPoints/loader.py (revision 0) +++ TD_TreatmentAdjustmentSetPoints/loader.py (revision 8d7cdcc5840c87ec57089901eccfa4043af37a5d) @@ -0,0 +1,362 @@ +""" + Treatment Adjustment Pressure Limits UI Loader +""" +# Python +import os +import can +import struct + +# Qt +from PySide2 import QtCore, QtWidgets +from PySide2.QtCore import Slot + +# parent +from engine.dynamicloader import DynamicLoader + +# plugin specific +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions + +# TD simulator +from leahi_dialin.ui.td_messaging import TD_Messaging + +class Loader(DynamicLoader): + """ + Treatment Adjustment Pressure Limits UI Loader + """ + + def __init__(self): + self.td_interface = TD_Messaging() + self.can_interface = self.td_interface.can_interface + super().__init__(os.path.dirname(__file__)) + + if self.can_interface is not None: + self.can_interface.register_receiving_publication_function( + CAN.DenaliChannels.ui_to_td_ch_id, + MsgIds.MSG_ID_UI_TREATMENT_SET_POINTS_CHANGE_REQUEST.value, + self.handle_set_points_change_request) + self.can_interface.register_receiving_publication_function( + CAN.DenaliChannels.ui_to_td_ch_id, + MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST.value, + self.handle_blood_flow_change_request) + self.can_interface.register_receiving_publication_function( + CAN.DenaliChannels.ui_to_td_ch_id, + MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_REQUEST.value, + self.handle_dialysate_flow_change_request) + self.can_interface.register_receiving_publication_function( + CAN.DenaliChannels.ui_to_td_ch_id, + MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_REQUEST.value, + self.handle_dialysate_temperature_change_request) + + + def _init_loader(self): + """ + finds and creates widgets + :return: none + """ + self.tbSetPointsReset = self.find_widget(QtWidgets.QToolButton , 'tbSetPointsReset' ) + self.slSetPointsBloodFlowRate = self.find_widget(QtWidgets.QSlider , 'slSetPointsBloodFlowRate' ) + self.lbSetPointsBloodFlowRate = self.find_widget(QtWidgets.QLabel , 'lbSetPointsBloodFlowRate' ) + self.slSetPointsDialysateFlowRate = self.find_widget(QtWidgets.QSlider , 'slSetPointsDialysateFlowRate' ) + self.lbSetPointsDialysateFlowRate = self.find_widget(QtWidgets.QLabel , 'lbSetPointsDialysateFlowRate' ) + self.slSetPointsDialysateTemperature = self.find_widget(QtWidgets.QSlider , 'slSetPointsDialysateTemperature' ) + self.lbSetPointsDialysateTemperature = self.find_widget(QtWidgets.QLabel , 'lbSetPointsDialysateTemperature' ) + self.sbSetPointsAcidConcentrate = self.find_widget(QtWidgets.QSpinBox , 'sbSetPointsAcidConcentrate' ) + self.sbSetPointsBicarbConcentrate = self.find_widget(QtWidgets.QSpinBox , 'sbSetPointsBicarbConcentrate' ) + + self.tbSetPointsReqCopy = self.find_widget(QtWidgets.QToolButton , 'tbSetPointsReqCopy' ) + self.tbSetPointsReqReset = self.find_widget(QtWidgets.QToolButton , 'tbSetPointsReqReset' ) + self.lbSetPointsReqBloodFlowRate = self.find_widget(QtWidgets.QLabel , 'lbSetPointsReqBloodFlowRate' ) + self.lbSetPointsReqDialysateFlowRate = self.find_widget(QtWidgets.QLabel , 'lbSetPointsReqDialysateFlowRate' ) + self.lbSetPointsReqDialysateTemperature = self.find_widget(QtWidgets.QLabel , 'lbSetPointsReqDialysateTemperature' ) + self.lbSetPointsReqAcidConcentrate = self.find_widget(QtWidgets.QLabel , 'lbSetPointsReqAcidConcentrate' ) + self.lbSetPointsReqBicarbConcentrate = self.find_widget(QtWidgets.QLabel , 'lbSetPointsReqBicarbConcentrate' ) + + self.tbSetPointsRspSend = self.find_widget(QtWidgets.QToolButton , 'tbSetPointsRspSend' ) + self.tbSetPointsRspReset = self.find_widget(QtWidgets.QToolButton , 'tbSetPointsRspReset' ) + self.sbSetPointsRspRejectionReason = self.find_widget(QtWidgets.QSpinBox , 'sbSetPointsRspRejectionReason' ) + + self.tbBloodFlowRateReset = self.find_widget(QtWidgets.QToolButton , 'tbBloodFlowRateReset' ) + + self.tbBloodFlowRateReqCopy = self.find_widget(QtWidgets.QToolButton , 'tbBloodFlowRateReqCopy' ) + self.tbBloodFlowRateReqReset = self.find_widget(QtWidgets.QToolButton , 'tbBloodFlowRateReqReset' ) + self.lbBloodFlowRateReq = self.find_widget(QtWidgets.QLabel , 'lbBloodFlowRateReq' ) + + self.tbBloodFlowRateRspSend = self.find_widget(QtWidgets.QToolButton , 'tbBloodFlowRateRspSend' ) + self.tbBloodFlowRateRspReset = self.find_widget(QtWidgets.QToolButton , 'tbBloodFlowRateRspReset' ) + self.sbBloodFlowRateRspRejectionReason = self.find_widget(QtWidgets.QSpinBox , 'sbBloodFlowRateRspRejectionReason' ) + + self.tbDialysateFlowRateReset = self.find_widget(QtWidgets.QToolButton , 'tbDialysateFlowRateReset' ) + + self.tbDialysateFlowRateReqCopy = self.find_widget(QtWidgets.QToolButton , 'tbDialysateFlowRateReqCopy' ) + self.tbDialysateFlowRateReqReset = self.find_widget(QtWidgets.QToolButton , 'tbDialysateFlowRateReqReset' ) + self.lbDialysateFlowRateReq = self.find_widget(QtWidgets.QLabel , 'lbDialysateFlowRateReq' ) + + self.tbDialysateFlowRateRspSend = self.find_widget(QtWidgets.QToolButton , 'tbDialysateFlowRateRspSend' ) + self.tbDialysateFlowRateRspReset = self.find_widget(QtWidgets.QToolButton , 'tbDialysateFlowRateRspReset' ) + self.sbDialysateFlowRateRspRejectionReason = self.find_widget(QtWidgets.QSpinBox , 'sbDialysateFlowRateRspRejectionReason' ) + + self.tbDialysateTemperatureReset = self.find_widget(QtWidgets.QToolButton , 'tbDialysateTemperatureReset' ) + + self.tbDialysateTemperatureReqCopy = self.find_widget(QtWidgets.QToolButton , 'tbDialysateTemperatureReqCopy' ) + self.tbDialysateTemperatureReqReset = self.find_widget(QtWidgets.QToolButton , 'tbDialysateTemperatureReqReset' ) + self.lbDialysateTemperatureReq = self.find_widget(QtWidgets.QLabel , 'lbDialysateTemperatureReq' ) + + self.tbDialysateTemperatureRspSend = self.find_widget(QtWidgets.QToolButton , 'tbDialysateTemperatureRspSend' ) + self.tbDialysateTemperatureRspReset = self.find_widget(QtWidgets.QToolButton , 'tbDialysateTemperatureRspReset' ) + self.sbDialysateTemperatureRspRejectionReason = self.find_widget(QtWidgets.QSpinBox , 'sbDialysateTemperatureRspRejectionReason') + + + def _init_connections(self): + """ + initializes the widgets connections + :return: none + """ + self.tbSetPointsReset .clicked .connect(self.do_set_points_reset ) + self.slSetPointsBloodFlowRate .valueChanged .connect(lambda value: self.lbSetPointsBloodFlowRate.setText(f"{value}") ) + self.slSetPointsDialysateFlowRate .valueChanged .connect(lambda value: self.lbSetPointsDialysateFlowRate.setText(f"{value}") ) + self.slSetPointsDialysateTemperature .valueChanged .connect(lambda value: self.lbSetPointsDialysateTemperature.setText(f"{value/10:.1f}") ) + + self.tbSetPointsReqCopy .clicked .connect(self.do_set_points_request_copy ) + self.tbSetPointsReqReset .clicked .connect(self.do_set_points_request_reset ) + + self.tbSetPointsRspSend .clicked .connect(self.do_set_points_response_send ) + self.tbSetPointsRspReset .clicked .connect(self.do_set_points_response_reset ) + + self.tbBloodFlowRateReset .clicked .connect(self.do_blood_flow_rate_reset ) + + self.tbBloodFlowRateReqCopy .clicked .connect(self.do_blood_flow_rate_request_copy ) + self.tbBloodFlowRateReqReset .clicked .connect(self.do_blood_flow_rate_request_reset ) + + self.tbBloodFlowRateRspSend .clicked .connect(self.do_blood_flow_rate_response_send ) + self.tbBloodFlowRateRspReset .clicked .connect(self.do_blood_flow_rate_response_reset ) + + self.tbDialysateFlowRateReset .clicked .connect(self.do_dialysate_flow_rate_reset ) + + self.tbDialysateFlowRateReqCopy .clicked .connect(self.do_dialysate_flow_rate_request_copy ) + self.tbDialysateFlowRateReqReset .clicked .connect(self.do_dialysate_flow_rate_request_reset ) + + self.tbDialysateFlowRateRspSend .clicked .connect(self.do_dialysate_flow_rate_response_send ) + self.tbDialysateFlowRateRspReset .clicked .connect(self.do_dialysate_flow_rate_response_reset ) + + self.tbDialysateTemperatureReset .clicked .connect(self.do_dialysate_temperature_reset ) + + self.tbDialysateTemperatureReqCopy .clicked .connect(self.do_dialysate_temperature_request_copy ) + self.tbDialysateTemperatureReqReset .clicked .connect(self.do_dialysate_temperature_request_reset ) + + self.tbDialysateTemperatureRspSend .clicked .connect(self.do_dialysate_temperature_response_send ) + self.tbDialysateTemperatureRspReset .clicked .connect(self.do_dialysate_temperature_response_reset ) + + + def _init_widgets(self): + """ + initializes the widgets' properties + :return: none + """ + self.do_set_points_reset() + + + @Slot() + def do_set_points_reset(self): + self.slSetPointsBloodFlowRate .setValue ( 0 ) + self.lbSetPointsBloodFlowRate .setText ( "--" ) + self.slSetPointsDialysateFlowRate .setValue ( 0 ) + self.lbSetPointsDialysateFlowRate .setText ( "--" ) + self.slSetPointsDialysateTemperature .setValue ( 0 ) + self.lbSetPointsDialysateTemperature .setText ( "--" ) + self.sbSetPointsAcidConcentrate .setValue ( 0 ) + self.sbSetPointsBicarbConcentrate .setValue ( 0 ) + + self.do_set_points_request_reset() + self.do_set_points_response_reset() + + @Slot() + def do_set_points_request_copy(self): + self.slSetPointsBloodFlowRate .setValue ( self.convert_to_int ( self.lbSetPointsReqBloodFlowRate.text() ) ) + self.slSetPointsDialysateFlowRate .setValue ( self.convert_to_int ( self.lbSetPointsReqDialysateFlowRate.text() ) ) + self.slSetPointsDialysateTemperature .setValue ( self.convert_to_float ( self.lbSetPointsReqDialysateTemperature.text() ) * 10 ) + self.sbSetPointsAcidConcentrate .setValue ( self.convert_to_int ( self.lbSetPointsReqAcidConcentrate.text() ) ) + self.sbSetPointsBicarbConcentrate .setValue ( self.convert_to_int ( self.lbSetPointsReqBicarbConcentrate.text() ) ) + + @Slot() + def do_set_points_request_reset(self): + self.lbSetPointsReqBloodFlowRate .setText("--") + self.lbSetPointsReqDialysateFlowRate .setText("--") + self.lbSetPointsReqDialysateTemperature .setText("--") + self.lbSetPointsReqAcidConcentrate .setText("--") + self.lbSetPointsReqBicarbConcentrate .setText("--") + + + @Slot() + def handle_set_points_change_request(self, message, timestamp = 0.0): + """ + Called when the user requests set points change from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + param1,index = conversions.bytearray_to_integer (message, index) + param2,index = conversions.bytearray_to_integer (message, index) + param3,index = conversions.bytearray_to_float (message, index) + param4,index = conversions.bytearray_to_integer (message, index) + param5,index = conversions.bytearray_to_integer (message, index) + + self.lbSetPointsReqBloodFlowRate .setText( f"{param1}" ) + self.lbSetPointsReqDialysateFlowRate .setText( f"{param2}" ) + self.lbSetPointsReqDialysateTemperature .setText( f"{param3:.1f}" ) + self.lbSetPointsReqAcidConcentrate .setText( f"{param4}" ) + self.lbSetPointsReqBicarbConcentrate .setText( f"{param5}" ) + + + @Slot() + def do_set_points_response_send(self): + self.td_interface.td_treatment_set_points_change_response( + self.sbSetPointsRspRejectionReason .value() , + self.slSetPointsBloodFlowRate .value() , + self.slSetPointsDialysateFlowRate .value() , + self.slSetPointsDialysateTemperature .value() / 10 , + self.sbSetPointsAcidConcentrate .value() , + self.sbSetPointsBicarbConcentrate .value() + ) + + + @Slot() + def do_set_points_response_reset(self): + self.sbSetPointsRspRejectionReason .setValue(0) + + + @Slot() + def do_blood_flow_rate_reset(self): + self.do_blood_flow_rate_request_reset() + self.do_blood_flow_rate_response_reset() + + + @Slot() + def do_blood_flow_rate_request_copy(self): + self.slSetPointsBloodFlowRate.setValue(self.convert_to_int(self.lbBloodFlowRateReq.text())) + + + @Slot() + def do_blood_flow_rate_request_reset(self): + self.lbBloodFlowRateReq.setText("--") + + + @Slot() + def handle_blood_flow_change_request(self, message, timestamp = 0.0): + """ + Called when the user requests blood flow rate change from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + value,index = conversions.bytearray_to_integer (message, index) + self.lbBloodFlowRateReq.setText(f"{value}") + + + @Slot() + def do_blood_flow_rate_response_send(self): + self.td_interface.td_treatment_set_point_blood_flow_rate_change_response( + self.sbBloodFlowRateRspRejectionReason .value(), + self.slSetPointsBloodFlowRate .value() + ) + + + @Slot() + def do_blood_flow_rate_response_reset(self): + self.sbBloodFlowRateRspRejectionReason.setValue(0) + + + @Slot() + def do_dialysate_flow_rate_reset(self): + self.do_dialysate_flow_rate_request_reset() + self.do_dialysate_flow_rate_response_reset() + + + @Slot() + def do_dialysate_flow_rate_request_copy(self): + self.slSetPointsDialysateFlowRate.setValue(self.convert_to_int(self.lbDialysateFlowRateReq.text())) + + + @Slot() + def do_dialysate_flow_rate_request_reset(self): + self.lbDialysateFlowRateReq.setText("--") + + + @Slot() + def handle_dialysate_flow_change_request(self, message, timestamp = 0.0): + """ + Called when the user requests dialysate flow rate change from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + value,index = conversions.bytearray_to_integer (message, index) + self.lbDialysateFlowRateReq.setText(f"{value}") + + + @Slot() + def do_dialysate_flow_rate_response_send(self): + self.td_interface.td_treatment_set_point_dialysate_flow_rate_change_response( + self.sbDialysateFlowRateRspRejectionReason .value(), + self.slSetPointsDialysateFlowRate .value() + ) + + + @Slot() + def do_dialysate_flow_rate_response_reset(self): + self.sbDialysateFlowRateRspRejectionReason.setValue(0) + + + @Slot() + def do_dialysate_temperature_reset(self): + self.do_dialysate_temperature_request_reset() + self.do_dialysate_temperature_response_reset() + + + @Slot() + def do_dialysate_temperature_request_copy(self): + self.slSetPointsDialysateTemperature.setValue(self.convert_to_int(self.lbDialysateTemperatureReq.text()) * 10) + + + @Slot() + def do_dialysate_temperature_request_reset(self): + self.lbDialysateTemperatureReq.setText("--") + + + @Slot() + def handle_dialysate_temperature_change_request(self, message, timestamp = 0.0): + """ + Called when the user requests dialysate temperature change from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + value,index = conversions.bytearray_to_integer (message, index) + self.lbDialysateTemperatureReq.setText(f"{value:.1f}") + + + @Slot() + def do_dialysate_temperature_response_send(self): + self.td_interface.td_treatment_set_point_dialysate_temperature_change_response( + self.sbDialysateTemperatureRspRejectionReason .value(), + self.slSetPointsDialysateTemperature .value() / 10 + ) + + + @Slot() + def do_dialysate_temperature_response_reset(self): + self.sbDialysateTemperatureRspRejectionReason.setValue(0) + + + def convert_to_float(self, value): + try: + return float(value) + except ValueError: + return 0.0 + + def convert_to_int(self, value): + try: + return int(value) + except ValueError: + return 0