Index: MainTreatmentData/interface.ui =================================================================== diff -u -r767c7999a57c41783d0269ec5ba296caf5278295 -r45e91bf76f061c2f9cffd9c96ca338437a27b8e5 --- MainTreatmentData/interface.ui (.../interface.ui) (revision 767c7999a57c41783d0269ec5ba296caf5278295) +++ MainTreatmentData/interface.ui (.../interface.ui) (revision 45e91bf76f061c2f9cffd9c96ca338437a27b8e5) @@ -6,8 +6,8 @@ 0 0 - 736 - 366 + 732 + 387 @@ -19,8 +19,8 @@ &3 Treatment/&1 Main treatment - - + + @@ -60,754 +60,753 @@ + + + + - - - - - - - - 0 - 0 - - - - - 352 - 0 - - - - - 10 - - - - false - - - color: rgb(238, 238, 236); + + + + 180 + 0 + + + + + 50 + 16777215 + + + + State + + + Qt::AlignJustify|Qt::AlignVCenter + + + + + + + + 50 + 16777215 + + + + 1000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + Current Delivered Volume + + + + + + + 10000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + Saline Bolus Req[0x5E00] + + + + + + + + + + 180 + 0 + + + + Target Volume + + + + + + + 10000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + + 0 + 0 + + + + + 352 + 0 + + + + + 10 + + + + false + + + color: rgb(238, 238, 236); background-color: rgb(92, 53, 102); - - - 61 : [0x3D00] : Saline Bolus - - - Qt::AlignCenter - - - - - - - - - - 180 - 0 - - - - Target Volume - - - - - - - 10000 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - Cumulative Volume - - - - - - - 10000 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - Current Delivered Volume - - - - - - - 10000 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - - - - 180 - 0 - - - - - 50 - 16777215 - - - - State - - - Qt::AlignJustify|Qt::AlignVCenter - - - - - - - - 50 - 16777215 - - - - 1000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + 61 : [0x3D00] : Saline Bolus + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + + + 0 + 0 + + + + + 352 + 0 + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + 62 : [0x3E00] : Ultrafiltration + + + Qt::AlignCenter + + + + + + + + + + 180 + 0 + + + + Set Volume L + + - - - - - - - 0 - 0 - - - - - 352 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - color: rgb(238, 238, 236); + + + + 1000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + + + + 180 + 0 + + + + Target Rate L/Hr + + + + + + + 1000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + + + + 180 + 0 + + + + Volume Delivered L + + + + + + + 200 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + + + + 180 + 0 + + + + State + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 180 + 0 + + + + Max Delivery + + + + + + + 20.000000000000000 + + + 2.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + 0 + 0 + + + + + 352 + 0 + + + + + 16777215 + 16777215 + + + + + 10 + + + + color: rgb(238, 238, 236); background-color: rgb(92, 53, 102); - - - 59 : [0x3B00] : Treament Time - - - Qt::AlignCenter - - - - - - - - - - 180 - 0 - - - - TX Duration - - - - - - - 480 - - - 15 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - - - - 180 - 0 - - - - Elapsed Time - - - - - - - 480 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - Qt::Vertical - - - - 20 - 60 - - - - - + + + 79 : [0x4F00] : Set Point Data + + + Qt::AlignCenter + + + + + + + + + + 180 + 0 + + + + Blood Flow + + - - - - - - - 0 - 0 - - - - - 352 - 0 - - - - - 10 - - - - color: rgb(238, 238, 236); -background-color: rgb(92, 53, 102); - - - 62 : [0x3E00] : Ultrafiltration - - - Qt::AlignCenter - - - - - - - - - - 180 - 0 - - - - Set Volume L - - - - - - - 1000 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - - - - 180 - 0 - - - - Target Rate L/Hr - - - - - - - 1000 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - - - - 180 - 0 - - - - Volume Delivered L - - - - - - - 200 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 0 - - - - - - - - - - - - 180 - 0 - - - - State - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 180 - 0 - - - - Max Delivery - - - - - - - 20.000000000000000 - - - 2.000000000000000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + + 900 + + - - - - - - - 0 - 0 - - - - - 352 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - color: rgb(238, 238, 236); + + + + + + + + + 180 + 0 + + + + Dial Flow + + + + + + + 900 + + + + + + + + + + + + 180 + 0 + + + + Dial Temp + + + + + + + 100.000000000000000 + + + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + + + + + 0 + 0 + + + + + 352 + 0 + + + + + 16777215 + 16777215 + + + + + 10 + + + + color: rgb(238, 238, 236); background-color: rgb(92, 53, 102); - - - 79 : [0x4F00] : Set Point Data - - - Qt::AlignCenter - - - - - - - - - - 180 - 0 - - - - Blood Flow - - - - - - - 900 - - - - - - - - - - - - 180 - 0 - - - - Dial Flow - - - - - - - 900 - - - - - - - - - - - - 180 - 0 - - - - Dial Temp - - - - - - - 100.000000000000000 - - - - - - - - - Qt::Vertical - - - - 20 - 10 - - - - - + + + 59 : [0x3B00] : Treament Time + + + Qt::AlignCenter + + + + + + + + + + 180 + 0 + + + + TX Duration + + + + + + 480 + + + 15 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + + 180 + 0 + + + + Elapsed Time + + + + + + + 480 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + Qt::Vertical + + + + 20 + 60 + + + + - + + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + Cumulative Volume + + + + + + + 10000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + Qt::Vertical @@ -820,6 +819,25 @@ + + + + false + + + QFrame::WinPanel + + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + + @@ -843,82 +861,82 @@ - TargetVolumeSlider + DurationSlider valueChanged(int) - label_8 + label_14 setNum(int) - 306 + 666 82 - 362 + 721 83 - CumulativeVolumeSlider + ElapsedSlider valueChanged(int) - label_9 + label_15 setNum(int) - 306 + 666 107 - 362 + 721 108 - SalineCurrDeliveredVolumeSlider + TargetVolumeSlider valueChanged(int) - label_10 + label_8 setNum(int) 306 - 132 + 82 362 - 133 + 83 - DurationSlider + CumulativeVolumeSlider valueChanged(int) - label_14 + label_9 setNum(int) - 666 - 82 + 306 + 107 - 721 - 83 + 362 + 108 - ElapsedSlider + SalineCurrDeliveredVolumeSlider valueChanged(int) - label_15 + label_10 setNum(int) - 666 - 107 + 306 + 132 - 721 - 108 + 362 + 133 Index: MainTreatmentData/loader.py =================================================================== diff -u -r76ebec60ce80e9a637fadc3d93dd9c21bad5d61f -r45e91bf76f061c2f9cffd9c96ca338437a27b8e5 --- MainTreatmentData/loader.py (.../loader.py) (revision 76ebec60ce80e9a637fadc3d93dd9c21bad5d61f) +++ MainTreatmentData/loader.py (.../loader.py) (revision 45e91bf76f061c2f9cffd9c96ca338437a27b8e5) @@ -3,6 +3,8 @@ """ # Python import os +import can +import struct # Qt from PySide2 import QtCore, QtWidgets @@ -12,22 +14,31 @@ 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.common.td_defs import TDOpModes from leahi_dialin.common.td_defs import TDStandbyStates # hd Simulator from leahi_dialin.ui.td_messaging import TD_Messaging - class Loader(DynamicLoader): """ The TD Air Trap 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: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_SALINE_BOLUS_REQUEST.value + self.can_interface.register_receiving_publication_function(channel_id, + message_id, + self.handle_solution_infusion_request) def _init_loader(self): """ @@ -60,7 +71,9 @@ self.UF_tgt_rate_label = self.find_widget(QtWidgets.QLabel , 'targetufLabel' ) self.UF_vol_del_label = self.find_widget(QtWidgets.QLabel , 'ufvolumeDeliveredlabel' ) self.UF_set_vol_label = self.find_widget(QtWidgets.QLabel , 'setufvolumeLabel' ) + self.lbBolusStart = self.find_widget(QtWidgets.QLabel , 'lbBolusStart' ) + def _init_connections(self): """ initializes the widgets connections @@ -88,6 +101,16 @@ self.dial_flow_st_pt .valueChanged.connect(self.do_tx_set_point_data) self.dial_temp_st_pt .valueChanged.connect(self.do_tx_set_point_data) + + def handle_solution_infusion_request(self, message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + response = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] + self.lbBolusStart .setText( str(response ) ) + @Slot() def _init_widgets(self): """ @@ -204,4 +227,4 @@ self.do_saline_data() self.do_uf_data() self.do_tx_time_data() - self.do_tx_set_point_data() \ No newline at end of file + self.do_tx_set_point_data()