PySerial¶
driver: jumpstarter.drivers.pyserial.driver.PySerial
The methods of this client are dynamic, and they are generated from
the methods
field of the exporter driver configuration.
Driver configuration¶
export:
my_serial:
type: "jumpstarter.drivers.pyserial.driver.PySerial"
config:
url: "/dev/ttyUSB0"
baudrate: 115200
Config parameters¶
Parameter |
Description |
Type |
Required |
Default |
---|---|---|---|---|
url |
The serial port to connect to, in pyserial format |
str |
yes |
|
baudrate |
The baudrate to use for the serial connection |
int |
no |
115200 |
PySerialClient API¶
Examples¶
Using expect with a context manager
with pyserialclient.pexpect() as session:
session.sendline("Hello, world!")
session.expect("Hello, world!")
Using expect without a context manager
session = pyserialclient.open()
session.sendline("Hello, world!")
session.expect("Hello, world!")
session.close()
Using a simple BlockingStream with a context manager
with pyserialclient.stream() as stream:
stream.write(b"Hello, world!")
data = stream.read(13)
Using a simple BlockingStream without a context manager
stream = pyserialclient.open_stream()
stream.write(b"Hello, world!")
data = stream.read(13)
stream.close()