def ack_with_option_select(self, mode): """ After receiving the identification one needs to respond with an ACK including the different options for the session. The main usage is to control the mode. readout, programming, or manufacturer specific. The baudrate change used will be the one proposed by the device in the identification message. :param mode: """ mode_char = self.MODE_CONTROL_CHARACTER[mode] ack_message = messages.AckOptionSelectMessage( mode_char=mode_char, baud_char=self.switchover_baudrate_char) logger.info(f"Sending AckOptionsSelect message: {ack_message}") self.transport.send(ack_message.to_bytes()) self.rest()
def test_to_representation(self): aosm = messages.AckOptionSelectMessage(mode_char="1", baud_char="5") assert aosm.to_representation() == "\x06051\r\n"