Serial Endpoint Plugin

Serial protocol plugin allows for serial port communication.

Configuration

The following configuration can be set:

SettingTypeDefaultDescription
PortNamestring(first port)Name of serial port
BaudRatei329600Baud rate
ParitystirngNoneParity (either None, Odd, Even, Mark, or Space)
DataBitsi328Number of data bits (usually always 8)
StopBitsf641Number of stop bits (either 1, 1.5, or 2)
EOLstringCRLFEnd of line characters (either CRLF, LF, or CR)

Example: Basic setup

The following example sets the host.

@Serial {
    PortName /dev/ttyUSB0
}

Example: Advanced setup

The following example sets all configurable properties.

@Serial {
    PortName /dev/ttyUSB0
    BaudRate 115200
    Parity   None
    DataBits 8
    StopBits 1
    EOL      CR
}

Outgoing Message “Discard”

This outgoing message will discard all currently buffered data.

Example

No parameters are expecting and there is no corresponding response.

Discard >>Serial

Outgoing Message “WriteBytes”

This outgoing message will write provided bytes.

DataTypeDefaultDescription
BytesbytesBytes to write

Example: Basic

We can send message without any extra paramters.

Send >Serial {
    Bytes (hex)414243
}

Outgoing Message “WriteLine”

This outgoing message will write provided text followed by EOL.

DataTypeDefaultDescription
TextstringText to write

Example: Basic

We can send message without any extra paramters.

Send >Serial {
    Text ABC
}

Example: Empty line

We can override any parameter (other than Host) in the outgoing message.

Send >Serial

Incoming Message “ReadBytes”

Reads bytes from serial port.

DataTypeDefaultDescription
.Countint32Number of bytes to read
BytesbytesBytes to write

Example: Basic

Successful response.

ReadLine <Serial {
    Bytes (hex)"414243"
}

Example: Read Specific Number of Bytes

Successful response.

ReadLine <Serial {
    .Count 2
}

Incoming Message “ReadLine”

Reads data from serial port until the EOL character is reached.

DataTypeDefaultDescription
TextstringText read

Example: Basic

Successful response.

ReadLine <Serial {
    Text ABC
}