unitelabs.bus.factories
Packages
Attributes
- Name
__all__
- Type
- Value
= [ "create_serial_connection", "TransportFactory", "create_usb_connection", "open_usb_connection" ]
- Description
Functions
create_serial_connection(
- protocol_factory : typing.Callable[..., P],
- port : str,
- baudrate : int,
- bytesize : ByteSize,
- parity : Parity,
- stopbits : StopBits,
- **kwargs
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
**kwargs
- Type
- Default
- = {}
- Description
Additional keyword arguments to be passed to the `SerialTransport` constructor.
Response
create_usb_connection(
- protocol_factory : typing.Callable[..., P],
- vendor : int,
- product : int,
- **kwargs
Create a USB connection with a device based on specified `vendor` and `product` IDs.
Parameters
- Name
protocol_factory
- Type
- typing.Callable[..., P]
- Default
- Description
A callable that returns an instance of the protocol to be used.
- Name
vendor
- Type
- int
- Default
- Description
The vendor ID of the USB device.
- Name
product
- Type
- int
- Default
- Description
The product ID of the USB device.
- Name
**kwargs
- Type
- Default
- = {}
- Description
Additional keyword arguments to be passed to the `UsbTransport` constructor.
Response
open_usb_connection(
- vendor : int,
- product : int,
- **kwargs
Establish a USB connection with a device based on specified `vendor` and `product` IDs.
Parameters
- Name
vendor
- Type
- int
- Default
- Description
The vendor ID of the USB device.
- Name
product
- Type
- int
- Default
- Description
The product ID of the USB device.
- Name
**kwargs
- Type
- Default
- = {}
- Description
Additional keyword arguments to be passed to the `UsbTransport` constructor.
Response
- Type
- tuple[asyncio.streams.StreamReader, asyncio.streams.StreamWriter]
- Description
A tuple containing the `asyncio.streams.StreamReader` and `asyncio.streams.StreamWriter` instances for the USB connection.
Classes
TransportFactory
Interface representing a factory for creating transports.
- Bases
- typing.Protocol
Methods