Serial Endpoint Plugin
Serial protocol plugin allows for serial port communication.
Configuration
The following configuration can be set:
| Setting | Type | Default | Description |
|---|---|---|---|
| PortName | string | (first port) | Name of serial port |
| BaudRate | i32 | 9600 | Baud rate |
| Parity | stirng | None | Parity (either None, Odd, Even, Mark, or Space) |
| DataBits | i32 | 8 | Number of data bits (usually always 8) |
| StopBits | f64 | 1 | Number of stop bits (either 1, 1.5, or 2) |
| EOL | string | CRLF | End 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.
| Data | Type | Default | Description |
|---|---|---|---|
| Bytes | bytes | Bytes 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.
| Data | Type | Default | Description |
|---|---|---|---|
| Text | string | Text 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.
| Data | Type | Default | Description |
|---|---|---|---|
| .Count | int32 | Number of bytes to read | |
| Bytes | bytes | Bytes 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.
| Data | Type | Default | Description |
|---|---|---|---|
| Text | string | Text read |
Example: Basic
Successful response.
ReadLine <Serial {
Text ABC
}