serialtools.bus module

class serialtools.bus.BusCreator

Bases: object

add_arguments(parser: ArgumentParser, *, rx_only: bool = False) None
auto_create_virtual_bus

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

baudrate

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

bytesize

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

create_args(*, port: str | None = None, baudrate: int | None = None, virtual: bool | None = None, rx_only: bool = False, timeout_in_s: float | None = None) Namespace
create_bus(args: Namespace, *, config_id: ConfigId | None = None) Serial | ReadFromFileBus | WriteToFileBus
dsrdtr

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

parity

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

port

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

rtscts

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

stopbits

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

virtual

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

vport

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

vport_other

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

xonxoff

A setting which can have different values for different objects.

This class implements the descriptor protocol to return one of the values in values depending on a config_id attribute of the owning object if an instance of this class is accessed as an instance attribute. If there is no value for the config_id in values value is returned instead. If the owning instance does not have a config_id attribute an AttributeError is raised.

In the config file a group can be opened with [config-id]. Then all following set commands set the value for the specified config id.

class serialtools.bus.ReadFromFileBus(fn: str | TextIO)

Bases: object

Parameters:

fn – file name of file containing data to be read. Data is in the output format of serialtools dump, hex values separated by spaces and optionally lines starting with a time stamps in parentheses.

cancel_read() None
cancel_write() None
close() None
read(n: int) bytes
timestamp: datetime | None = None
write(data: bytes) None
class serialtools.bus.ReadFromParameterBus(content: str)

Bases: ReadFromFileBus

Parameters:

fn – file name of file containing data to be read. Data is in the output format of serialtools dump, hex values separated by spaces and optionally lines starting with a time stamps in parentheses.

class serialtools.bus.WriteToFileBus(f: str | TextIO | None, *, break_time_ms: int)

Bases: object

cancel_read() None
cancel_write() None
close() None
read(n: int) bytes
timestamp: datetime | None = None
write(data: bytes) None
serialtools.bus.bus_creator = <serialtools.bus.BusCreator object>

Use this to create a new bus

serialtools.bus.get_timestamp(bus: Serial | ReadFromFileBus | WriteToFileBus) datetime | None