Index: dialin/ui/dg_simulator.py =================================================================== diff -u -r46342bac3e23428e90666525bb5a89c4532da945 -r4d32882a7d9092d5c7bb179f33e1de5ce087f54d --- dialin/ui/dg_simulator.py (.../dg_simulator.py) (revision 46342bac3e23428e90666525bb5a89c4532da945) +++ dialin/ui/dg_simulator.py (.../dg_simulator.py) (revision 4d32882a7d9092d5c7bb179f33e1de5ce087f54d) @@ -30,7 +30,9 @@ console_out:bool=False, passive_mode:bool=False): super().__init__() + DGSimulator.instance_count = DGSimulator.instance_count + 1 + self._log_manager = _LogManager(log_level=log_level, log_filepath=self.__class__.__name__ + ".log") self.logger = self._log_manager.logger self.console_out = console_out @@ -42,7 +44,7 @@ self.can_interface.start() if self.can_interface is not None: - channel_id = DenaliChannels.ui_to_hd_ch_id + channel_id = DenaliChannels.ui_to_dg_ch_id self.can_interface.register_receiving_publication_function(channel_id, MsgIds.MSG_ID_UI_DG_SET_RTC_REQUEST.value, self._handler_set_rtc_request) @@ -498,6 +500,21 @@ self.can_interface.send(message, 0) + def cmd_send_serial_dg_data(self, vSerial: str ): + """ + the dg version serial response message method + :param vSerial: serial number + :return: None + """ + + payload = bytes(vSerial, 'ascii') + b'\x00' + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_to_ui_ch_id, + message_id=MsgIds.MSG_ID_DG_SERIAL_NUMBER.value, + payload=payload) + + self.can_interface.send(message, 0) + @staticmethod def build_dg_debug_text(vText): """ @@ -510,7 +527,7 @@ msg = messageBuilder.buildMessage(GuiActionType.DGDebugText, 1 * (message_length + 1), False, txt) return messageBuilder.toFrames(msg) - def cmd_send_pre_treatment_filter_flush_progress_data(self, total, countdown): + def cmd_send_dg_pre_treatment_filter_flush_progress_data(self, total, countdown): """ send the pretreatment filter flush progress data :param accepted: (U32) Total time in second @@ -593,7 +610,7 @@ self.can_interface.send(message, 0) - def cmd_send_general_dg_response(self, message_id: int, accepted: int, reason: int, + def cmd_send_dg_general_response(self, message_id: int, accepted: int, reason: int, is_pure_data: bool = False, has_parameters: bool = False, parameters_payload: any = 0x00) -> None: @@ -622,7 +639,7 @@ self.can_interface.send(message, 0) - def cmd_send_general_dg_progress_data(self, message_id: int, total: int, countdown: int) -> None: + def cmd_send_sg_general_progress_data(self, message_id: int, total: int, countdown: int) -> None: """ a general method t send any standard progress data message, by it's id :param message_id: the id of the message @@ -639,7 +656,7 @@ self.can_interface.send(message, 0) - def cmd_ack_send_dg(self, seq: int) -> None: + def cmd_send_dg_ack(self, seq: int) -> None: """ sending dg ack message by the sequence seq :param seq: the message sequence number Index: dialin/ui/hd_simulator.py =================================================================== diff -u -r46342bac3e23428e90666525bb5a89c4532da945 -r4d32882a7d9092d5c7bb179f33e1de5ce087f54d --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 46342bac3e23428e90666525bb5a89c4532da945) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 4d32882a7d9092d5c7bb179f33e1de5ce087f54d) @@ -19,7 +19,6 @@ import time from . import messageBuilder -from .hd_simulator_alarms import HDAlarmsSimulator from ..common import * from ..protocols.CAN import (DenaliMessage, DenaliCanMessenger, @@ -30,7 +29,7 @@ class HDSimulator(_AbstractSubSystem): NUM_TREATMENT_PARAMETERS = 18 - instanceCount = 0 + instance_count = 0 def __init__(self, can_interface:str="can0", log_level:bool= None, @@ -44,7 +43,7 @@ @param console_out: (bool) If True, write each dialin message to the console. """ super().__init__() - HDSimulator.instanceCount = HDSimulator.instanceCount + 1 + HDSimulator.instance_count = HDSimulator.instance_count + 1 self._log_manager = _LogManager(log_level=log_level, log_filepath=self.__class__.__name__ + ".log") self.logger = self._log_manager.logger @@ -82,7 +81,6 @@ 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.alarms_simulator = HDAlarmsSimulator(self.can_interface, self.logger) self.treatment_parameter_rejections = TreatmentParameterRejections() @@ -1458,13 +1456,22 @@ self.can_interface.send(message, 0) - def alarm(self) -> HDAlarmsSimulator: + def cmd_send_serial_hd_data(self, vSerial: str ): """ - Gets the alarm simulator object - @return: (HDAlarmsSimulator) the alarms simulator + the hd version serial response message method + :param vSerial: serial number + :return: None """ - return self.alarms_simulator + payload = bytes(vSerial, 'ascii') + b'\x00' + + message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, + message_id=MsgIds.MSG_ID_HD_SERIAL_NUMBER.value, + payload=payload) + + self.can_interface.send(message, 0) + + def cmd_send_pre_treatment_state_data(self, sub_mode, water_sample_state, @@ -1859,7 +1866,7 @@ # ------------------------------------------------ GENERAL MESSAGES ------------------------------------------------ - def cmd_send_general_hd_response(self, message_id: int, accepted: int, reason: int, + def cmd_send_hd_general_response(self, message_id: int, accepted: int, reason: int, is_pure_data: bool = False, has_parameters: bool = False, parameters_payload: any = 0x00) -> None: @@ -1888,7 +1895,7 @@ self.can_interface.send(message, 0) - def cmd_send_general_hd_progress_data(self, message_id: int, total: int, countdown: int) -> None: + def cmd_send_hd_general_progress_data(self, message_id: int, total: int, countdown: int) -> None: """ a general method t send any standard progress data message, by it's id :param message_id: the id of the message @@ -1905,7 +1912,7 @@ self.can_interface.send(message, 0) - def cmd_ack_send_hd(self, seq: int) -> None: + def cmd_send_hd_ack(self, seq: int) -> None: """ sending hd ack message by the sequence seq :param seq: the message sequence number Index: dialin/ui/hd_simulator_alarms.py =================================================================== diff -u -r46342bac3e23428e90666525bb5a89c4532da945 -r4d32882a7d9092d5c7bb179f33e1de5ce087f54d --- dialin/ui/hd_simulator_alarms.py (.../hd_simulator_alarms.py) (revision 46342bac3e23428e90666525bb5a89c4532da945) +++ dialin/ui/hd_simulator_alarms.py (.../hd_simulator_alarms.py) (revision 4d32882a7d9092d5c7bb179f33e1de5ce087f54d) @@ -103,14 +103,14 @@ class HDAlarmsSimulator(_AbstractSubSystem): - instanceCount = 0 + instance_count = 0 def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ @param can_interface: Denali Can Messenger object """ super().__init__() - HDAlarmsSimulator.instanceCount = HDAlarmsSimulator.instanceCount + 1 + HDAlarmsSimulator.instance_count = HDAlarmsSimulator.instance_count + 1 self.can_interface = can_interface self.logger = logger