########################################################################### # # Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file dialysate_generator.py # # @author (last) Sean Nash # @date (last) 11-Oct-2023 # @author (original) Peter Lucia # @date (original) 02-Apr-2020 # ############################################################################ from .accelerometer import DGAccelerometer from .alarms import DGAlarms from .calibration_record import DGCalibrationNVRecord from .chemical_disinfect import ChemicalDisinfect from .chemical_disinfect_flush import ChemicalDisinfectFlushMode from .concentrate_pumps import ConcentratePumps from .conductivity_sensors import ConductivitySensors from .constants import RESET, NO_RESET from .cpld import Cpld from .drain_pump import DGDrainPump from .fans import Fans from .dialysate_fill import DialysateFill from .flow_sensors import FlowSensors from .fluid_leak import DGFluidLeak from .flush import FlushMode from .gen_idle import GenIdle from .hd_proxy import DGHDProxy from .heat_disinfect import HeatDisinfect from .heat_disinfect_active_cool import HeatDisinfectActiveCool from .heaters import Heaters from .load_cells import DGLoadCells from .pressures import DGPressures from .reservoirs import DGReservoirs from .ro_pump import DGROPump from .rtc import DGRTC from .samplewater import DGSampleWater from .scheduled_runs_record import DGScheduledRunsNVRecord from .service_record import DGServiceNVRecord from .switches import DGSwitches from .system_record import DGSystemNVRecord from .temperatures import TemperatureSensors from .thermistors import Thermistors from .uv_reactors import UVReactors from .valves import DGValves from .voltages import DGVoltages from .events import DGEvents from .sw_configs import DGSoftwareConfigs from .usage_info_record import DGUsageNVRecord from .dg_test_configs import DGTestConfig from .ro_permeate_sample import ROPermeateSample from .drain import DGDrain from ..common.msg_defs import MsgIds, MsgFieldPositions from enum import unique from .constants import NO_RESET from ..protocols.CAN import DenaliCanMessenger, DenaliMessage, DenaliChannels from ..utils import * from ..utils.base import AbstractSubSystem, publish, LogManager, DialinEnum from ..utils.conversions import integer_to_bytearray, unsigned_short_to_bytearray @unique class DGOperationModes(DialinEnum): # DG operation modes DG_OP_MODE_FAULT = 0 DG_OP_MODE_SERVICE = 1 DG_OP_MODE_INIT_POST = 2 DG_OP_MODE_STANDBY = 3 DG_OP_MODE_STANDBY_SOLO = 4 DG_OP_MODE_GEN_IDLE = 5 DG_OP_MODE_FILL = 6 DG_OP_MODE_DRAIN = 7 DG_OP_MODE_FLUSH = 8 DG_OP_MODE_DISINFECT = 9 DG_OP_MODE_CHEMICAL_DISINFECT = 10 class DG(AbstractSubSystem): """ Dialysate Generator (DG) Dialin object API. It provides the basic interface to communicate with the DG firmware. """ # HD login password DG_LOGIN_PASSWORD = '123' SW_COMPATIBILITY_REV = 1 # DG version message field positions START_POS_MAJOR = DenaliMessage.PAYLOAD_START_INDEX END_POS_MAJOR = START_POS_MAJOR + 1 START_POS_MINOR = END_POS_MAJOR END_POS_MINOR = START_POS_MINOR + 1 START_POS_MICRO = END_POS_MINOR END_POS_MICRO = START_POS_MICRO + 1 START_POS_BUILD = END_POS_MICRO END_POS_BUILD = START_POS_BUILD + 2 # FPGA START_POS_FPGA_ID = END_POS_BUILD END_POS_FPGA_ID = START_POS_FPGA_ID + 1 START_POS_FPGA_MAJOR = END_POS_FPGA_ID END_POS_FPGA_MAJOR = START_POS_FPGA_MAJOR + 1 START_POS_FPGA_MINOR = END_POS_FPGA_MAJOR END_POS_FPGA_MINOR = START_POS_FPGA_MINOR + 1 START_POS_FPGA_LAB = END_POS_FPGA_MINOR END_POS_FPGA_LAB = START_POS_FPGA_LAB + 1 START_POS_COMPATIBILITY_REV = END_POS_FPGA_LAB END_POS_COMPATIBILITY_REV = START_POS_COMPATIBILITY_REV + 4 # DG sub_modes DG_POST_STATE_START = 0 # Start initialize & POST mode state DG_POST_STATE_FPGA = 1 # FPGA POST test state DG_POST_STATE_WATCHDOG = 2 # Watchdog POST test state DG_POST_STATE_TEMPERATURE_SENSORS = 3 # Temperature Sensors POST state DG_POST_STATE_HEATERS = 4 # Heaters POST state DG_POST_STATE_COMPLETED = 5 # POST completed successfully state DG_POST_STATE_FAILED = 6 # POST failed state NUM_OF_DG_POST_STATES = 7 # Number of initialize & POST mode states def __init__(self, can_interface="can0", log_level=None): """ Initializes the DG object For example: dg_object = DG(can_interface='can0') or dg_object = DG(can_interface="can0", log_level="DEBUG") Possible log levels: ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "CAN_ONLY", "PRINT_ONLY"] @param can_interface: string with can bus name, e.g. "can0" """ super().__init__() self._log_manager = LogManager(log_level=log_level, log_filepath=self.__class__.__name__ + ".log") self.logger = self._log_manager.logger # Create listener self.can_interface = DenaliCanMessenger(can_interface=can_interface, logger=self.logger) self.can_interface.start() self.callback_id = None # register handler for HD operation mode broadcast messages if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id msg_id = MsgIds.MSG_ID_DG_OP_MODE_DATA.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_dg_op_mode_sync) self.can_interface.register_receiving_publication_function(DenaliChannels.dg_sync_broadcast_ch_id, MsgIds.MSG_ID_DG_VERSION_REPONSE.value, self._handler_dg_version) self.callback_id = self.can_interface.register_transmitting_interval_message(INTERVAL_10s, self._send_dg_checkin_message) # initialize variables that will be populated by DG version response self.dg_version = None self.fpga_version = None # create properties self.dg_operation_mode = 0 # self.DG_OP_MODE_INIT_POST self.dg_operation_sub_mode = 0 self.dg_logged_in = False self.dg_set_logged_in_status(False) self.dg_no_transmit_msg_list = [0,0,0,0,0,0,0,0] self.dg_op_mode_timestamp = 0.0 self.dg_version_response_timestamp = 0.0 # Create command groups self.accel = DGAccelerometer(self.can_interface, self.logger) self.alarms = DGAlarms(self.can_interface, self.logger) self.calibration_record = DGCalibrationNVRecord(self.can_interface, self.logger) self.chemical_disinfect = ChemicalDisinfect(self.can_interface, self.logger) self.chemical_disinfect_flush = ChemicalDisinfectFlushMode(self.can_interface, self.logger) self.concentrate_pumps = ConcentratePumps(self.can_interface, self.logger) self.conductivity_sensors = ConductivitySensors(self.can_interface, self.logger) self.cpld = Cpld(self.can_interface, self.logger) self.dialysate_fill = DialysateFill(self.can_interface, self.logger) self.drain_pump = DGDrainPump(self.can_interface, self.logger) self.fans = Fans(self.can_interface, self.logger) self.flow_sensors = FlowSensors(self.can_interface, self.logger) self.fluid_leak = DGFluidLeak(self.can_interface, self.logger) self.flush = FlushMode(self.can_interface, self.logger) self.gen_idle = GenIdle(self.can_interface, self.logger) self.hd_proxy = DGHDProxy(self.can_interface, self.logger) self.heat_disinfect = HeatDisinfect(self.can_interface, self.logger) self.heat_disinfect_active_cool = HeatDisinfectActiveCool(self.can_interface, self.logger) self.heaters = Heaters(self.can_interface, self.logger) self.load_cells = DGLoadCells(self.can_interface, self.logger) self.pressures = DGPressures(self.can_interface, self.logger) self.reservoirs = DGReservoirs(self.can_interface, self.logger) self.ro_pump = DGROPump(self.can_interface, self.logger) self.rtc = DGRTC(self.can_interface, self.logger) self.samplewater = DGSampleWater(self.can_interface, self.logger) self.scheduled_runs_record = DGScheduledRunsNVRecord(self.can_interface, self.logger) self.service_record = DGServiceNVRecord(self.can_interface, self.logger) self.switches = DGSwitches(self.can_interface, self.logger) self.system_record = DGSystemNVRecord(self.can_interface, self.logger) self.temperatures = TemperatureSensors(self.can_interface, self.logger) self.thermistors = Thermistors(self.can_interface, self.logger) self.uv_reactors = UVReactors(self.can_interface, self.logger) self.valves = DGValves(self.can_interface, self.logger) self.voltages = DGVoltages(self.can_interface, self.logger) self.events = DGEvents(self.can_interface, self.logger) self.sw_configs = DGSoftwareConfigs(self.can_interface, self.logger) self.usage_record = DGUsageNVRecord(self.can_interface, self.logger) self.test_configs = DGTestConfig(self.can_interface, self.logger) self.ro_permeate_sample = ROPermeateSample(self.can_interface, self.logger) self.drain = DGDrain(self.can_interface, self.logger) def __del__(self): self.can_interface.transmit_interval_dictionary[self.callback_id].stop() def get_version(self): """ Gets the DG version. Assumes DG version has already been requested. @return: The hd version string """ return self.dg_version def get_fpga_version(self): """ Gets the fpga version from the DG @return: The FPGA version """ return self.fpga_version def get_operation_mode(self): """ Gets the operation mode @return: The operation mode """ return self.dg_operation_mode def get_operation_sub_mode(self): """ Gets the operation sub mode @return: The operation sub mode """ return self.dg_operation_sub_mode def get_dg_logged_in(self): """ Gets the logged in status of the DG @return: True if DG is logged in, False if not """ return self.dg_logged_in def get_dg_blocked_msg_list(self): """ Gets the current list of message IDs that HD will prevent transmission of. @return: List of message IDs blocked from transmission """ return self.dg_no_transmit_msg_list @publish(["dg_logged_in"]) def dg_set_logged_in_status(self, logged_in: bool = False): """ Callback for DG logged in status change. @param logged_in boolean logged in status for DG @return: none """ self.dg_logged_in = logged_in @publish(["dg_version_response_timestamp","dg_version", "fpga_version"]) def _handler_dg_version(self, message,timestamp): """ Handler for response from DG regarding its version. @param message: response message from HD regarding valid treatment parameter ranges.\n U08 Major \n U08 Minor \n U08 Micro \n U16 Build \n @return: None if unsuccessful, the version string if unpacked successfully """ major = struct.unpack('B', bytearray(message['message'][self.START_POS_MAJOR:self.END_POS_MAJOR])) minor = struct.unpack('B', bytearray(message['message'][self.START_POS_MINOR:self.END_POS_MINOR])) micro = struct.unpack('B', bytearray(message['message'][self.START_POS_MICRO:self.END_POS_MICRO])) build = struct.unpack('H', bytearray(message['message'][self.START_POS_BUILD:self.END_POS_BUILD])) fpga_id = struct.unpack('B', bytearray( message['message'][self.START_POS_FPGA_ID:self.END_POS_FPGA_ID])) fpga_major = struct.unpack('B', bytearray( message['message'][self.START_POS_FPGA_MAJOR:self.END_POS_FPGA_MAJOR])) fpga_minor = struct.unpack('B', bytearray( message['message'][self.START_POS_FPGA_MINOR:self.END_POS_FPGA_MINOR])) fpga_lab = struct.unpack('B', bytearray( message['message'][self.START_POS_FPGA_LAB:self.END_POS_FPGA_LAB])) compatibility = struct.unpack('I', bytearray( message['message'][self.START_POS_COMPATIBILITY_REV:self.END_POS_COMPATIBILITY_REV])) if all([len(each) > 0 for each in [major, minor, micro, build]]): self.dg_version = f"v{major[0]}.{minor[0]}.{micro[0]}-{build[0]}-{compatibility[0]}" self.logger.debug(f"DG VERSION: {self.dg_version}") if all([len(each) > 0 for each in [fpga_major, fpga_minor, fpga_id, fpga_lab]]): self.fpga_version = f"ID: {fpga_id[0]} v{fpga_major[0]}.{fpga_minor[0]}.{fpga_lab[0]}" self.logger.debug(f"DG FPGA VERSION: {self.fpga_version}") self.dg_version_response_timestamp = timestamp @publish(["dg_op_mode_timestamp","dg_operation_mode", "dg_operation_sub_mode"]) def _handler_dg_op_mode_sync(self, message, timestamp=0.0): """ Handles published DG operation mode messages. Current DG operation mode is captured for reference. @param message: published DG operation mode broadcast message @return: None """ mode = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1])) smode = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2])) self.dg_operation_mode = mode[0] self.dg_operation_sub_mode = smode[0] self.dg_op_mode_timestamp = timestamp def cmd_log_in_to_dg(self, resend: bool = False) -> int: """ Constructs and sends a login command via CAN bus. Login required before \n other commands can be sent to the DG. @param resend: (bool) if False (default), try to login once. Otherwise, tries to login indefinitely @return: 1 if logged in, 0 if log in failed """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_TESTER_LOGIN_REQUEST.value, payload=list(map(int, map(ord, self.DG_LOGIN_PASSWORD)))) self.logger.info("Logging in to the DG...") # Send message received_message = self.can_interface.send(message, resend=resend) if received_message is not None: if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: self.logger.info("Successfully logged in to the DG.") self.dg_set_logged_in_status(True) self._send_dg_checkin_message() # Timer starts interval first self.can_interface.transmit_interval_dictionary[self.callback_id].start() else: self.logger.error("Log In Failed.") return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.error("Timeout!!!!") return False def cmd_ui_request_dg_version(self) -> None: """ Constructs and sends the ui request for version message """ major = unsigned_byte_to_bytearray(0) minor = unsigned_byte_to_bytearray(0) micro = unsigned_byte_to_bytearray(0) build = short_to_bytearray(0) compatibility = integer_to_bytearray(self.SW_COMPATIBILITY_REV) payload = major + minor + micro + build + compatibility message = DenaliMessage.build_message(channel_id=DenaliChannels.ui_sync_broadcast_ch_id, message_id=MsgIds.MSG_ID_FW_VERSIONS_REQUEST.value, payload=payload) self.logger.debug("Sending Dialin request for version to DG") self.can_interface.send(message, 0) def cmd_dg_set_operation_mode(self, new_mode: int = 0) -> int: """ Constructs and sends a set operation mode request command via CAN bus. Constraints: Must be logged into DG. Transition from current to requested op mode must be legal. For transitioning to POST again, you can only be in Standby Mode or Solo Mode @param new_mode: ID of operation mode to transition to (see DGOpModes enum for options) @return: 1 if successful, zero otherwise """ payload = integer_to_bytearray(new_mode) message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_SET_OP_MODE_REQUEST.value, payload=payload) self.logger.debug("Requesting DG mode change to " + str(new_mode)) # Send message received_message = self.can_interface.send(message) if received_message is not None: if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: self.logger.debug("Success: Mode change accepted") else: self.logger.debug("Failure: Mode change rejected.") return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("DG mode change request Timeout!!!!") return False def cmd_dg_safety_shutdown_override(self, active: bool = True, reset: int = NO_RESET) -> int: """ Constructs and sends an DG safety shutdown override command via CAN bus. @param active: boolean - True to activate safety shutdown, False to deactivate @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise """ if active: sft = 1 else: sft = 0 rst = integer_to_bytearray(reset) saf = integer_to_bytearray(sft) payload = rst + saf message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_SAFETY_SHUTDOWN_OVERRIDE.value, payload=payload) self.logger.debug("overriding DG safety shutdown") # Send message received_message = self.can_interface.send(message) if received_message is not None: if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: self.logger.debug("Safety shutdown signal overridden") else: self.logger.debug("Safety shutdown signal override failed.") return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") return False def cmd_dg_software_reset_request(self) -> None: """ Constructs and sends an DG software reset request via CAN bus. Constraints: Must be logged into DG. @return: None """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_SOFTWARE_RESET_REQUEST.value) self.logger.debug("requesting DG software reset") # Send message self.can_interface.send(message, 0) self.logger.debug("Sent request to DG to reset...") self.dg_set_logged_in_status(False) def cmd_dg_op_mode_broadcast_interval_override(self, ms:int=250, reset:int=NO_RESET) -> int: """ Constructs and sends the DG op mode broadcast interval override command Constraints: Must be logged into DG. Given interval must be non-zero and a multiple of the DG general task interval (50 ms). @param ms: integer - interval (in ms) to override with @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise """ if not check_broadcast_interval_override_ms(ms): return False rst = integer_to_bytearray(reset) mis = integer_to_bytearray(ms) payload = rst + mis message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_OP_MODE_PUBLISH_INTERVAL_OVERRIDE.value, payload=payload) self.logger.debug("override DG op. mode broadcast interval") # Send message received_message = self.can_interface.send(message) # If there is content... if received_message is not None: if reset == RESET: str_res = "reset back to normal: " else: str_res = str(ms) + " ms: " self.logger.debug("DG op. mode broadcast interval overridden to " + str_res + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") return False def cmd_block_dg_message_transmissions(self, msg1: int = 0, msg2: int = 0, msg3: int = 0, msg4: int = 0, msg5: int = 0, msg6: int = 0, msg7: int = 0, msg8: int = 0): """ Constructs and sends a block dg message transmission request Constraints: Must be logged into DG. @param msg1: integer - 1st message ID to block DG from transmitting @param msg2: integer - 2nd message ID to block DG from transmitting @param msg3: integer - 3rd message ID to block DG from transmitting @param msg4: integer - 4th message ID to block DG from transmitting @param msg5: integer - 5th message ID to block DG from transmitting @param msg6: integer - 6th message ID to block DG from transmitting @param msg7: integer - 7th message ID to block DG from transmitting @param msg8: integer - 8th message ID to block DG from transmitting @return: 1 if successful, zero otherwise """ # Save blocked message(s) list self.dg_no_transmit_msg_list[0] = msg1 self.dg_no_transmit_msg_list[1] = msg2 self.dg_no_transmit_msg_list[2] = msg3 self.dg_no_transmit_msg_list[3] = msg4 self.dg_no_transmit_msg_list[4] = msg5 self.dg_no_transmit_msg_list[5] = msg6 self.dg_no_transmit_msg_list[6] = msg7 self.dg_no_transmit_msg_list[7] = msg8 # Build message payload m1 = unsigned_short_to_bytearray(msg1) m2 = unsigned_short_to_bytearray(msg2) m3 = unsigned_short_to_bytearray(msg3) m4 = unsigned_short_to_bytearray(msg4) m5 = unsigned_short_to_bytearray(msg5) m6 = unsigned_short_to_bytearray(msg6) m7 = unsigned_short_to_bytearray(msg7) m8 = unsigned_short_to_bytearray(msg8) payload = m1 + m2 + m3 + m4 + m5 + m6 + m7 + m8 message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_BLOCK_MESSAGE_TRANSMISSION.value, payload=payload) self.logger.debug("request DG block transmission of message(s)") # Send message received_message = self.can_interface.send(message) # If there is content... if received_message is not None: self.logger.debug("Given messages blocked." + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") return False def _send_dg_checkin_message(self) -> int: """ Constructs and sends an DG Dialin check in message to the DG. @return: none """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_DIALIN_CHECK_IN.value) self.can_interface.send(message) return True def cmd_dg_ram_status_override(self, ram_reg: int = 0, status: int = 0, reset: int = NO_RESET) -> int: """ Constructs and sends the RAM status override command Constraints: Must be logged into DG. RAM Status Bits: SERR 0x00000001 Bit 0 - Single-bit error in TCRAM Module Error Status Register ADDR_DEC_FAIL 0x00000004 Bit 2 - Address decode failed in TCRAM Module Error Status Register ADDR_COMP_LOGIC_FAIL 0x00000010 Bit 4 - Address decode logic element failed in TCRAM Module Error Status Register DERR 0x00000020 Bit 5 - Multiple bit error in TCRAM Module Error Status Register RADDR_PAR_FAIL 0x00000100 Bit 8 - Read Address Parity Failure in TCRAM Module Error Status Register WADDR_PAR_FAIL 0x00000200 Bit 9 - Write Address Parity Failure in TCRAM Module Error Status Register @param ram_reg: integer - the RAM regsiter. 0 or 1 @param status: integer - bitmap of the status values listed aboves @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise """ rst = integer_to_bytearray(reset) reg = integer_to_bytearray(ram_reg) sts = integer_to_bytearray(status & 0x0000FFFF) payload = rst + sts + reg message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_RAM_STATUS_OVERRIDE.value, payload=payload) self.logger.debug(f"Overriding RAM Status Register {reg} to {str(sts)}") # Send message received_message = self.can_interface.send(message) # If there is content... if received_message is not None: # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") return False def cmd_dg_pending_ack_override(self, pending_ack_channel: int = 0, reset: int = NO_RESET) -> int: """ Constructs and sends an DG pending ack override command via CAN bus. Constraints: Must be logged into DG. Will prevent receiving ACK messages from being registered. Used to trigger ALARM_ID_DG_CAN_MESSAGE_NOT_ACKED after retries are sent. Use 1 for HD CAN messages Alarm. @param pending_ack_channel: integer - 1 for HD Channel ACK @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise """ rst = integer_to_bytearray(reset) pack = integer_to_bytearray(pending_ack_channel) payload = rst + pack message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_CAN_RECEIVE_ACK_MESSAGE_OVERRIDE.value, payload=payload) self.logger.debug("overriding DG Pending ACK") # Send message received_message = self.can_interface.send(message) # If there is content... if received_message is not None: # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") return False