Index: TD_Institutional_Records/loader.py =================================================================== diff -u -raba2a4ae8f32915dba9a208c621435d8920a0880 -rc3941c2f98ef15de30ccac6bb2a88d644f24e946 --- TD_Institutional_Records/loader.py (.../loader.py) (revision aba2a4ae8f32915dba9a208c621435d8920a0880) +++ TD_Institutional_Records/loader.py (.../loader.py) (revision c3941c2f98ef15de30ccac6bb2a88d644f24e946) @@ -229,7 +229,7 @@ self.setup_spinbox(self.sbUfVolumeMin, 0.0, 0.0, 0.8, 0.1) self.setup_spinbox(self.sbUfVolumeMax, 0.8, 0.0, 0.8, 0.1) self.setup_spinbox(self.sbUfVolumeDef, 0.0, 0.0, 0.8, 0.1) - intervalList = ["0", "5", "10", "15", "30", "60"] + intervalList = ["0", "5", "10", "15", "20","30", "60"] self.cbVitalsInterval.addItems(intervalList) self.setup_spinbox(self.sbRincebackVolumeMin, 200, 200, 400, 10) self.setup_spinbox(self.sbRincebackVolumeMax, 400, 200, 400, 10) Index: TD_Pre_Treatment/interface.ui =================================================================== diff -u -rf20bc39761ccafd83ad8295d0f43c843e5fd10aa -rc3941c2f98ef15de30ccac6bb2a88d644f24e946 --- TD_Pre_Treatment/interface.ui (.../interface.ui) (revision f20bc39761ccafd83ad8295d0f43c843e5fd10aa) +++ TD_Pre_Treatment/interface.ui (.../interface.ui) (revision c3941c2f98ef15de30ccac6bb2a88d644f24e946) @@ -6,7 +6,7 @@ 0 0 - 754 + 751 561 @@ -18,102 +18,43 @@ - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Reason - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 16777215 - - - - Validate - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - + + + - Blood Flow Rate + Heparin Stop Time + + + + Dialyzer Type + + + + + + + Blood Pressure Measure Interval + + + + + + + Saline Bolus Volume + + + - 100 + 50 16777215 @@ -128,18 +69,18 @@ - - + + - Dialysate Flow Rate + Treatment Duration - - + + - 100 + 50 16777215 @@ -154,18 +95,11 @@ - - - - Treatment Duration - - - - - + + - 100 + 50 16777215 @@ -180,18 +114,18 @@ - - + + - Saline Bolus Volume + Acid Concentrate - - + + - 100 + 50 16777215 @@ -206,18 +140,11 @@ - - - - Heparin Stop Time - - - - - + + - 100 + 50 16777215 @@ -232,18 +159,25 @@ - - + + - Heparin Type + Bicarbonate Concentrate - - + + + + Blood Flow Rate + + + + + - 100 + 50 16777215 @@ -258,18 +192,37 @@ - - + + - Acid Concentrate + Dialysate Flow Rate + + + + + 50 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + - 100 + 50 16777215 @@ -284,18 +237,30 @@ - - - - Bicarbonate Concentrate + + + + + 50 + 16777215 + + + -2147483647 + + + 2147483647 + + + 3 + - - + + - 100 + 50 16777215 @@ -310,77 +275,469 @@ - - + + - Dialyzer Type + Heparin Type - - + + + + + 0 + 0 + + + + + 75 + 0 + + 100 16777215 - - -2147483647 + + false - - 2147483647 + + QFrame::WinPanel - - 3 + + QFrame::Sunken + + - + + + Qt::AlignCenter + - - + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + - Blood Pressure Measure Interval + - + + Qt::AlignCenter + - - + + + + + 0 + 0 + + + + + 75 + 0 + + 100 16777215 - - -2147483647 + + false - - 2147483647 + + QFrame::WinPanel - - 3 + + QFrame::Sunken + + - + + + Qt::AlignCenter + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + - - + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + - Rinseback Flow Rate + - + + Qt::AlignCenter + - - + + + + + 0 + 0 + + + + + 75 + 0 + + 100 16777215 + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + + 50 + 16777215 + + -2147483647 @@ -392,21 +749,139 @@ - - + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + - Rinseback Volume + - + + Qt::AlignCenter + - - + + + + + 0 + 0 + + + + + 75 + 0 + + 100 16777215 + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + Venous Pressure Limit Window + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + + + + + Heparin Bolus Volume + + + + + + + + 50 + 16777215 + + -2147483647 @@ -418,18 +893,30 @@ - - - - Arterial Pressure Limit Window + + + + + 50 + 16777215 + + + -2147483647 + + + 2147483647 + + + 3 + - - + + - 100 + 50 16777215 @@ -444,18 +931,37 @@ - - + + + + + 50 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + - Venous Pressure Limit Window + Heparin Dispensing Rate - - + + - 100 + 50 16777215 @@ -470,30 +976,85 @@ + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + Venous Pressure Limit Asymtrc - - + + + + + 0 + 0 + + + + + 75 + 0 + + 100 16777215 - - -2147483647 + + false - - 2147483647 + + QFrame::WinPanel - - 3 + + QFrame::Sunken + + - + + + Qt::AlignCenter + @@ -503,37 +1064,62 @@ - - + + + + Dialysate Temp + + + + + + + + 0 + 0 + + + + + 75 + 0 + + 100 16777215 - - -2147483647 + + false - - 2147483647 + + QFrame::WinPanel - - 3 + + QFrame::Sunken + + - + + + Qt::AlignCenter + - - + + - Dialysate Temp + Arterial Pressure Limit Window - - + + - 100 + 50 16777215 @@ -548,18 +1134,55 @@ - - + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 100 + 16777215 + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + - Heparin Dispensing Rate + - + + Qt::AlignCenter + + + + + Rinseback Volume + + + - 100 + 50 16777215 @@ -574,18 +1197,11 @@ - - - - Heparin Bolus Volume - - - - - + + - 100 + 50 16777215 @@ -600,25 +1216,130 @@ + + + + Rinseback Flow Rate + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Reason + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 16777215 + + + + Validate + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - - - + + + + + 0 + 0 + + + - 50 - 16777215 + 0 + 0 - - 900 + + false + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + @@ -634,18 +1355,18 @@ - - - - Qt::Horizontal - - + + + - 40 - 20 + 50 + 16777215 - + + 900 + + @@ -673,36 +1394,18 @@ - - - - - 0 - 0 - + + + + Qt::Horizontal - + - 0 - 0 + 40 + 20 - - false - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - Qt::AlignCenter - - + @@ -719,44 +1422,63 @@ - - - - - 0 - 0 - + + + + + 10 + - - - 352 - 0 - + + color: rgb(238, 238, 236); +background-color:rgb(173, 127, 168) - - - 16777215 - 16777215 - + + 69 :[0x4500] Pre-Treatment + + Qt::AlignCenter + + + + + 10 color: rgb(238, 238, 236); -background-color: rgb(92, 53, 102); - +background-color:rgb(173, 127, 168) - 146 : [0x9200] : Auto Load + 53:[0x3500] Create Rx Qt::AlignCenter + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color:rgb(173, 127, 168) + + + Start Treatment + + + Qt::AlignCenter + + + @@ -845,69 +1567,64 @@ - - - - - 10 - + + + + + 0 + 0 + - - color: rgb(238, 238, 236); -background-color:rgb(173, 127, 168) + + + 352 + 0 + - - 69 :[0x4500] Pre-Treatment + + + 16777215 + 16777215 + - - Qt::AlignCenter - - - - - 10 color: rgb(238, 238, 236); -background-color:rgb(173, 127, 168) +background-color: rgb(92, 53, 102); + - Start Treatment + 146 : [0x9200] : Auto Load Qt::AlignCenter - - - - - 10 - - - - color: rgb(238, 238, 236); -background-color:rgb(173, 127, 168) - - - 53:[0x3500] Create Rx - - - Qt::AlignCenter - - - - - + + + + Start Treatment + + + + + + + Reason + + + + + Qt::Horizontal @@ -919,13 +1636,6 @@ - - - - Start Treatment - - - @@ -951,8 +1661,8 @@ - - + + Qt::Horizontal @@ -983,15 +1693,8 @@ - - - - Reason - - - - - + + Qt::Horizontal Index: TD_Pre_Treatment/loader.py =================================================================== diff -u -rf20bc39761ccafd83ad8295d0f43c843e5fd10aa -rc3941c2f98ef15de30ccac6bb2a88d644f24e946 --- TD_Pre_Treatment/loader.py (.../loader.py) (revision f20bc39761ccafd83ad8295d0f43c843e5fd10aa) +++ TD_Pre_Treatment/loader.py (.../loader.py) (revision c3941c2f98ef15de30ccac6bb2a88d644f24e946) @@ -3,7 +3,11 @@ """ # Python import os +import can +import struct + + # Qt from PySide2 import QtWidgets from PySide2.QtCore import Slot @@ -17,9 +21,11 @@ from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes from leahi_dialin.common.td_defs import TDStandbyStates -from leahi_dialin.protocols import CAN -from leahi_dialin.common.msg_defs import MsgIds +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions + class Loader(DynamicLoader): """ The ui loader class @@ -30,7 +36,6 @@ self.can_interface = self.td_interface.can_interface super().__init__(os.path.dirname(__file__)) - if self.can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id create_tx_request_message_id = MsgIds.MSG_ID_UI_INITIATE_TREATMENT_WORKFLOW.value @@ -45,6 +50,11 @@ self.can_interface.register_receiving_publication_function(channel_id, start_tx_request_message_id, self.handle_start_tx_request) + + validate_request_message_id = MsgIds.MSG_ID_UI_TREATMENT_PARAMS_TO_VALIDATE.value + self.can_interface.register_receiving_publication_function(channel_id, + validate_request_message_id, + self.handle_validate_request) def _init_loader(self): """ @@ -87,6 +97,28 @@ self.spnHeparinDispensingRateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnHeparinDispensingRateRejectReason' ) self.spnHeparinBolusVolumeRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnHeparinBolusVolumeRejectReason' ) + self.lbBloodFlowRate = self.find_widget(QtWidgets.QLabel , 'lbBloodFlowRateValue' ) + self.lbDialysateFlowRate = self.find_widget(QtWidgets.QLabel , 'lbDialysateFlowRateValue' ) + self.lbTreatmentDuration = self.find_widget(QtWidgets.QLabel , 'lbTreatmentDurationValue' ) + self.lbSalineBolusVolume = self.find_widget(QtWidgets.QLabel , 'lbSalineBolusVolumeValue' ) + self.lbHeparinStopTime = self.find_widget(QtWidgets.QLabel , 'lbHeparinStopTimeValue' ) + self.lbHeparinType = self.find_widget(QtWidgets.QLabel , 'lbHeparinTypeValue' ) + self.lbAcidConcentrate = self.find_widget(QtWidgets.QLabel , 'lbAcidConcentrateValue' ) + self.lbBicarbonateConcentrate = self.find_widget(QtWidgets.QLabel , 'lbBicarbonateConcentrateValue' ) + self.lbDialyzerType = self.find_widget(QtWidgets.QLabel , 'lbDialyzerTypeValue' ) + self.lbBloodPressureMeasureInterval = self.find_widget(QtWidgets.QLabel , 'lbBloodPressureMeasureIntervalValue' ) + self.lbRinsebackFlowRate = self.find_widget(QtWidgets.QLabel , 'lbRinsebackFlowRateValue' ) + self.lbRinsebackVolume = self.find_widget(QtWidgets.QLabel , 'lbRinsebackVolumeValue' ) + self.lbArterialPressureLimitWindow = self.find_widget(QtWidgets.QLabel , 'lbArterialPressureLimitWindowValue' ) + self.lbVenousPressureLimitWindow = self.find_widget(QtWidgets.QLabel , 'lbVenousPressureLimitWindowValue' ) + self.lbVenousPressureLimitAsymtrc = self.find_widget(QtWidgets.QLabel , 'lbVenousPressureLimitAsymtrcValue' ) + self.lbTransmembranePressureLimitWindow = self.find_widget(QtWidgets.QLabel , 'lbTransmembranePressureLimitWindowValue' ) + self.lbDialysateTemp = self.find_widget(QtWidgets.QLabel , 'lbDialysateTempValue' ) + self.lbHeparinDispensingRate = self.find_widget(QtWidgets.QLabel , 'lbHeparinDispensingRateValue' ) + self.lbHeparinBolusVolume = self.find_widget(QtWidgets.QLabel , 'lbHeparinBolusVolumeValue' ) + + + def _init_widgets(self): """ initializes the widgets' properties @@ -244,3 +276,41 @@ @return: None """ self.lbStartTreatment.setText("Start Tx Requested") + + @Slot() + def handle_validate_request(self, message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + message = message['message'] + self.index = MsgFieldPositions.START_POS_FIELD_1 + self.lbBloodFlowRate .setText(str(self.getIntValue(message))) + self.lbDialysateFlowRate .setText(str(self.getIntValue(message))) + self.lbTreatmentDuration .setText(str(self.getIntValue(message))) + self.lbSalineBolusVolume .setText(str(self.getIntValue(message))) + self.lbHeparinStopTime .setText(str(self.getIntValue(message))) + self.lbHeparinType .setText(str(self.getIntValue(message))) + self.lbAcidConcentrate .setText(str(self.getIntValue(message))) + self.lbBicarbonateConcentrate .setText(str(self.getIntValue(message))) + self.lbDialyzerType .setText(str(self.getIntValue(message))) + self.lbBloodPressureMeasureInterval .setText(str(self.getIntValue(message))) + self.lbRinsebackFlowRate .setText(str(self.getIntValue(message))) + self.lbRinsebackVolume .setText(str(self.getIntValue(message))) + self.lbArterialPressureLimitWindow .setText(str(self.getIntValue(message))) + self.lbVenousPressureLimitWindow .setText(str(self.getIntValue(message))) + self.lbVenousPressureLimitAsymtrc .setText(str(self.getIntValue(message))) + self.lbTransmembranePressureLimitWindow .setText(str(self.getIntValue(message))) + self.lbDialysateTemp .setText(f"{self.getFloatValue(message):.1f}") + self.lbHeparinDispensingRate .setText(f"{self.getFloatValue(message):.1f}") + self.lbHeparinBolusVolume .setText(f"{self.getFloatValue(message):.1f}") + + + def getIntValue (self, message): + val,self.index = conversions.bytearray_to_integer( message, self.index) + return val + + + def getFloatValue (self, message): + val,self.index = conversions.bytearray_to_float( message, self.index) + return val \ No newline at end of file