Serial communication library
更多...
#include <rmvl/core/serial.hpp>
Serial communication library
◆ SerialPort()
rm::SerialPort::SerialPort |
( |
const std::string & |
device = {} , |
|
|
int |
baud_rate = B115200 |
|
) |
| |
|
inlineexplicit |
Construct a new SerialPort object
- 参数
-
[in] | device | Device name, default is empty |
[in] | baud_rate | Baud rate, default B115200 |
◆ ~SerialPort()
rm::SerialPort::~SerialPort |
( |
| ) |
|
|
inline |
◆ close()
void rm::SerialPort::close |
( |
| ) |
|
◆ isOpened()
bool rm::SerialPort::isOpened |
( |
| ) |
const |
|
inline |
The serial is opened?
- 返回
- true
-
false
◆ open()
void rm::SerialPort::open |
( |
| ) |
|
Open the serial port, search all available devices automatically and try to open the first
◆ readStruct()
template<typename T >
std::vector<T> rm::SerialPort::readStruct |
( |
unsigned char |
head, |
|
|
unsigned char |
tail |
|
) |
| |
|
inline |
从串口读取结构体
- 模板参数
-
- 参数
-
- 返回
- std::vector<T> 读到的所有结构体
◆ writeStruct()
template<typename Tp >
bool rm::SerialPort::writeStruct |
( |
Tp & |
data_struct | ) |
|
|
inline |
Struct data write to serial port
- 模板参数
-
- 参数
-
- 返回
- 是否写入成功
该类的文档由以下文件生成: