serial_port_builder

Function serial_port_builder 

Source
pub fn serial_port_builder(
    device: &str,
    baud_rate: &BaudRate,
) -> SerialPortBuilder
Available on crate features tokio-rtu-sync or tokio-tcp-sync or tokio-rtu or tokio-tcp only.
Expand description

Creates and configures a tokio_serial::SerialPortBuilder for RTU communication.

This function sets up the standard communication parameters required by the R4DCB08 device: no parity, 8 data bits, and 1 stop bit.

Note that this function only creates and configures the builder. It does not open the serial port, and therefore does not perform any I/O and cannot fail. The actual connection is established when this builder is used by a tokio-modbus client constructor.

ยงArguments

  • device - The path to the serial port device (e.g., /dev/ttyUSB0 on Linux or COM3 on Windows).
  • baud_rate - The baud rate for the serial communication.