unitelabs.bus.factories.serial_factory

Attributes

  • Name
    P
    Type
    Value

    = typing.TypeVar('P', bound=asyncio.Protocol)

    Description

Functions

  • create_serial_connection(
      protocol_factory : typing.Callable[..., P],
      port : str,
      baudrate : int,
      **kwargs
    ) -> tuple[Transport, P]

    Create a serial connection with the specified port.

    Parameters

    • Name
      protocol_factory
      Type
      typing.Callable[..., P]
      Default
      Description

      A callable that returns an instance of the protocol to be used.

    • Name
      port
      Type
      str
      Default
      Description

      The port of the serial device.

    • Name
      baudrate
      Type
      int
      Default
      = 9600
      Description

    • Name
      bytesize
      Type
      ByteSize
      Default
      = EIGHTBITS
      Description

    • Name
      parity
      Type
      Parity
      Default
      = NONE
      Description

    • Name
      stopbits
      Type
      StopBits
      Default
      = ONE
      Description

    • Name
      **kwargs
      Type
      Default
      = {}
      Description

      Additional keyword arguments to be passed to the `SerialTransport` constructor.

    Response

    Type
    tuple[Transport, P]
    Description

    A tuple containing the `SerialTransport` instance and the `Protocol` instance.

Copyright © 2024