GithubHelp home page GithubHelp logo

switch baudrate about iec62056-21 HOT 3 CLOSED

pwitab avatar pwitab commented on July 23, 2024
switch baudrate

from iec62056-21.

Comments (3)

Krolken avatar Krolken commented on July 23, 2024

Hi.

What are you trying to do? Why do you need to reopen the serialport?

from iec62056-21.

youserj avatar youserj commented on July 23, 2024

def switch_baudrate(self, baud: int) -> None:
"""
Creates a new serial port with the correct baudrate.

    :param baud:
    """
    if self.port is None:
        raise TransportError("Serial port is closed.")

    logger.info(f"Switching baudrate to: {baud}")
    self.port = self.port = serial.Serial(
         self.port_name,
         baudrate=baud,
         parity=serial.PARITY_EVEN,
         stopbits=serial.STOPBITS_ONE,
         bytesize=serial.SEVENBITS,
         writeTimeout=0,
         timeout=self.timeout,
         rtscts=False,
         dsrdtr=False,
         xonxoff=False,
     )

it metod from class SerialTransport

I use:
Port_struct['client'].connect()
Port_struct['client'].startup() #'/ XXX Z CR LF '
Port_struct['client'].ack_with_option_select('readout') #mode read ' ACK 0 Z 0 CR LF'

from iec62056-21.

Krolken avatar Krolken commented on July 23, 2024

Switching of baudrate is automatic. in ack_with_option_select.

If you want to do a standard-readout use the method client.standard_readout

def standard_readout(self):
        """
        Goes through the steps to read the standard readout response from the device.
        """
        self.startup()
        self.ack_with_option_select("readout")
        logger.info(f"Reading standard readout from device.")
        response = self.read_response()
        return response

from iec62056-21.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.