navigate.model.devices.device_types.SerialDevice
- class navigate.model.devices.device_types.SerialDevice(device_name: str, port: str = '', baudrate: int = 115200, timeout: float = 0.25, **kwargs)
Bases:
object
SerialDevice - Parent serial device class.
- __init__(device_name: str, port: str = '', baudrate: int = 115200, timeout: float = 0.25, **kwargs) → None
Initialize SerialDevice class.
- Parameters:
device_name (str) – Name of the device, used as a unique identifier.
port (str, optional) – Serial port to connect to the device, by default an empty string.
baudrate (int, optional) – Baud rate for the serial connection, by default 115200.
timeout (float, optional) – Timeout for the serial connection in seconds, by default 0.25.
Methods
__init__
(device_name[, port, baudrate, timeout])Initialize SerialDevice class.
connect
(port[, baudrate, timeout])Connect to serial device.
Disconnect from serial device.
Attributes
Name of the device, used as a unique identifier.
Unique identifier for the device, serial_ followed by the port.
- connect(port: str, baudrate: int = 115200, timeout: float = 0.25) → object
Connect to serial device.
- Parameters:
port (str) – Serial port to connect to the device.
baudrate (int, optional) – Baud rate for the serial connection, by default 115200.
timeout (float, optional) – Timeout for the serial connection in seconds, by default 0.25.
- Returns:
The serial connection object if successful, otherwise None.
- Return type:
serial.Serial
- disconnect() → None
Disconnect from serial device.
- device_name
Name of the device, used as a unique identifier.
- Type:
str