Index: TD_TreatmentAdjustmentsIsolatedUF/interface.ui =================================================================== diff -u -rae1930d3e2a41d3862a9e77e4607aaf6b896665e -rce7678d9c7df4aef343ebd86b5a7a2b1d3599fd6 --- TD_TreatmentAdjustmentsIsolatedUF/interface.ui (.../interface.ui) (revision ae1930d3e2a41d3862a9e77e4607aaf6b896665e) +++ TD_TreatmentAdjustmentsIsolatedUF/interface.ui (.../interface.ui) (revision ce7678d9c7df4aef343ebd86b5a7a2b1d3599fd6) @@ -6,8 +6,8 @@ 0 0 - 442 - 400 + 426 + 501 @@ -24,23 +24,8 @@ &3 Treatment/Adjustments/&6 Isolated UF - - - 5 - - - 5 - - - 5 - - - 5 - - - 5 - - + + @@ -66,7 +51,7 @@ - + QFrame::StyledPanel @@ -228,7 +213,7 @@ - + @@ -527,7 +512,7 @@ - + QFrame::StyledPanel @@ -662,6 +647,141 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + + 0 + 0 + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + 187: [0xBB00]: State Response + + + Qt::AlignCenter + + + + + + + Send + + + + + + + Reset + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Req [0xBA00] + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 10 + + + + QFrame::Box + + + QFrame::Raised + + + -- + + + Qt::AlignCenter + + + + + + + Reject Reason + + + + + + + Qt::AlignCenter + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + Index: TD_TreatmentAdjustmentsIsolatedUF/loader.py =================================================================== diff -u -ra7779af44ced3be6e30e4d4d67125d171a641d09 -rce7678d9c7df4aef343ebd86b5a7a2b1d3599fd6 --- TD_TreatmentAdjustmentsIsolatedUF/loader.py (.../loader.py) (revision a7779af44ced3be6e30e4d4d67125d171a641d09) +++ TD_TreatmentAdjustmentsIsolatedUF/loader.py (.../loader.py) (revision ce7678d9c7df4aef343ebd86b5a7a2b1d3599fd6) @@ -44,13 +44,22 @@ CAN.CanChannels.ui_to_td_ch_id, MsgIds.MSG_ID_UI_ISOLATED_UF_CONFIRM_REQUEST.value, self.handle_confirm_request) + self.can_interface.register_receiving_publication_function( + CAN.CanChannels.ui_to_td_ch_id, + MsgIds.MSG_ID_UI_ISO_UF_STATE_REQUEST.value, + self.handle_state_request) def _init_loader(self): """ finds and creates widgets :return: none """ + self.cmdStrings = [ + "Pause", + "Resume", + "End", + ] self.tbDurationRspSend = self.find_widget(QtWidgets.QToolButton , 'tbDurationRspSend' ) self.tbDurationRspReset = self.find_widget(QtWidgets.QToolButton , 'tbDurationRspReset' ) self.lbDurationReq = self.find_widget(QtWidgets.QLabel , 'lbDurationReq' ) @@ -75,7 +84,12 @@ self.lbConfirmReqTimestamp = self.find_widget(QtWidgets.QLabel , 'lbConfirmReqTimestamp' ) self.sbConfirmRspRejectReason = self.find_widget(QtWidgets.QSpinBox , 'sbConfirmRspRejectReason' ) + self.pbSendState = self.find_widget(QtWidgets.QToolButton , 'pbSendState' ) + self.pbResetState = self.find_widget(QtWidgets.QToolButton , 'pbResetState' ) + self.lbStateReq = self.find_widget(QtWidgets.QLabel , 'lbStateReq' ) + self.spnStateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnStateRejectReason' ) + def _init_connections(self): """ initializes the widgets connections @@ -92,10 +106,13 @@ self.slVolumeRspDuration .valueChanged .connect(lambda value: self.lbVolumeRspDuration.setText(f"{value}")) self.slVolumeRspRate .valueChanged .connect(lambda value: self.lbVolumeRspRate.setText(f"{value}")) - self.tbConfirmRspSend .clicked .connect(self.do_confirm_response) - self.tbConfirmRspReset .clicked .connect(self.init_confirm_response) + self.tbConfirmRspSend .clicked .connect(self.do_confirm_response) + self.tbConfirmRspReset .clicked .connect(self.init_confirm_response) + self.pbSendState .clicked .connect(self.do_state_response) + self.pbResetState .clicked .connect(self.init_state_response) + @Slot() def _init_widgets(self): """ @@ -105,9 +122,20 @@ self.init_duration_response() self.init_volume_response() self.init_confirm_response() + self.init_state_response() @Slot() + def init_state_response(self): + """ + slot for initializing isolated UF stae change response + :return: none + """ + self.lbStateReq .setText("-- --") + self.spnStateRejectReason .setValue(0) + + + @Slot() def init_duration_response(self): """ slot for initializing isolated UF duration change response @@ -219,6 +247,20 @@ @Slot() + def handle_state_request(self, message, timestamp = 0.0): + """ + slot called when the user requests isolated UF confirmation + :return: none + """ + print("hjere") + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + value,index = conversions.bytearray_to_integer(message, index) + cmdString = self.cmdStrings[value] if value >= 0 and value < len(self.cmdStrings) else "" + self.lbStateReq.setText(f"{cmdString} ({value})") + + + @Slot() def do_confirm_response(self): """ slot for sending isolated UF confirm response @@ -227,3 +269,15 @@ self.td_interface.td_isolated_uf_confirm_response( vRejectionReason = self.sbConfirmRspRejectReason.value() ) + + + @Slot() + def do_state_response(self): + """ + slot for UF confirm + :return: none + """ + self.td_interface.td_isolated_state_response( self.spnStateRejectReason.value() ) + self.init_state_response() + +