Index: dialin/common/msg_defs.py =================================================================== diff -u -r1fd5bc0ed97d0d90223fa78ec195dd7636712c5b -r8ba3986f8fe9ef801c9f592a37f90933effbd34d --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 1fd5bc0ed97d0d90223fa78ec195dd7636712c5b) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision 8ba3986f8fe9ef801c9f592a37f90933effbd34d) @@ -26,6 +26,8 @@ MSG_DIALIN_ID_HD_SYSTEM_USAGE_RESPONSE = 0x8A MSG_DIALIN_ID_DG_SYSTEM_USAGE_RESPONSE = 0x8C MSG_DIALIN_ID_HD_DISINFECT_STATE = 0x7E + MSG_DIALIN_ID_HD_VERSION_REQUEST = 0x9E + MSG_DIALIN_ID_UI_POST_REPORT_VERSION = 0x9F ACK_NOT_REQUIRED = [ Index: dialin/hd/valves.py =================================================================== diff -u -r2e392c92d55178f457a67423ba8c503a86dcf3c8 -r8ba3986f8fe9ef801c9f592a37f90933effbd34d --- dialin/hd/valves.py (.../valves.py) (revision 2e392c92d55178f457a67423ba8c503a86dcf3c8) +++ dialin/hd/valves.py (.../valves.py) (revision 8ba3986f8fe9ef801c9f592a37f90933effbd34d) @@ -291,7 +291,7 @@ self.logger.debug("Opening air trap valve timeout!!") return False - @_publish(["valves_status"]) + @_publish(["valves_status", "hd_air_trap_status"]) def _handler_hd_valves_sync(self, message): """ Handles published HD valves data messages. HD valves data are captured Index: dialin/ui/hd_simulator.py =================================================================== diff -u -rdf207aa2b33d777cf082539d8b6547f4e97b5999 -r8ba3986f8fe9ef801c9f592a37f90933effbd34d --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision df207aa2b33d777cf082539d8b6547f4e97b5999) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 8ba3986f8fe9ef801c9f592a37f90933effbd34d) @@ -82,6 +82,9 @@ self.can_interface.register_receiving_publication_function(DenaliChannels.ui_sync_broadcast_ch_id, MsgIdsDialin.MSG_DIALIN_ID_UI_SYSTEM_USAGE_REQUEST.value, self._handler_system_usage_response) + self.can_interface.register_receiving_publication_function(DenaliChannels.ui_to_hd_ch_id, + MsgIdsDialin.MSG_DIALIN_ID_UI_POST_REPORT_VERSION.value, + self._handler_ui_post_ui_version_compatibility) self.alarms_simulator = HDAlarmsSimulator(self.can_interface, self.logger) self.treatment_parameter_rejections = TreatmentParameterRejections() @@ -1904,7 +1907,6 @@ message = DenaliMessage.build_message(channel_id= DenaliChannels.hd_to_ui_ch_id, message_id=message_id, payload=payload) - self.can_interface.send(message, 0) def cmd_ack_send_hd(self, seq: int) -> None: @@ -1918,3 +1920,42 @@ seq=seq) self.can_interface.send(message, 0) + + def cmd_send_power_on_self_test_version_request(self) -> None: + """ + Sends the power on self test version request + + @return: None + """ + + payload = bytearray() + message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_sync_broadcast_ch_id, + message_id=MsgIdsDialin.MSG_DIALIN_ID_HD_VERSION_REQUEST.value, + payload=payload) + self.can_interface.send(message, 0) + + def _handler_ui_post_ui_version_compatibility(self, message: dict) -> None: + """ + Handles the UI's reporting of its version during the power on self tests + + @param message: The message data + @return: None + """ + + ui_major = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] + ui_minor = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] + ui_micro = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] + ui_build = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] + ui_compatibility = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] + self.logger.debug("UI version power on self test received: " + "Major: {0} " + "Minor: {1} " + "Micro: {2} " + "Build: {3} " + "Compat: {4} " + .format(ui_major, ui_minor, ui_micro, ui_build, ui_compatibility)) Index: dialin/ui/hd_simulator_alarms.py =================================================================== diff -u -r46342bac3e23428e90666525bb5a89c4532da945 -r8ba3986f8fe9ef801c9f592a37f90933effbd34d --- dialin/ui/hd_simulator_alarms.py (.../hd_simulator_alarms.py) (revision 46342bac3e23428e90666525bb5a89c4532da945) +++ dialin/ui/hd_simulator_alarms.py (.../hd_simulator_alarms.py) (revision 8ba3986f8fe9ef801c9f592a37f90933effbd34d) @@ -37,6 +37,7 @@ class Alarms: + # TODO: this should be generated from FW # ALARM_ID = (priority, alarmID, escalates in, silent_espires_in, flags) ALARM_ID_NO_ALARM = (NONE, 0, 0, 0, 0) ALARM_ID_SOFTWARE_FAULT = (HIGH, 1, 0, 0, 0) Index: tests/peter/test_POST.py =================================================================== diff -u -rb31694e714c45e0678632ab11efbcdcf6dbf6e96 -r8ba3986f8fe9ef801c9f592a37f90933effbd34d --- tests/peter/test_POST.py (.../test_POST.py) (revision b31694e714c45e0678632ab11efbcdcf6dbf6e96) +++ tests/peter/test_POST.py (.../test_POST.py) (revision 8ba3986f8fe9ef801c9f592a37f90933effbd34d) @@ -25,9 +25,12 @@ NUM_HD_TESTS = 8 NUM_DG_TESTS = 6 -hd_sim = HDSimulator() +hd_sim = HDSimulator(log_level="DEBUG") dg_sim = DGSimulator() +# prompts UI to report version for the HD's version compatibility self test +hd_sim.cmd_send_power_on_self_test_version_request() + for _ in range(40): hd_sim.cmd_set_hd_operation_mode_data(HDOpModes.MODE_INIT.value, HDOpSubModes.SUBMODE_START.value) sleep(0.25)