Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 861 Bytes

File metadata and controls

43 lines (31 loc) · 861 Bytes

Serial Connection

It is a library for configuration and data transfer over a serial port.

Usage

The SerialConnection class must be initialized using the SerialDescription structure.

struct SerialDescription
{
    std::string portName;
    BaudRate    baudrate;
    DataBits    dataBits;
    Parity      parity;
    StopBits    stopBits;
};

Then it will be possible to write and read data.

long Read(std::string& data, int timeout) noexcept;
long Write(const std::string& data, int timeout) const noexcept;

How to build

CMake

#!/bin/bash
mkdir build && cd build
cmake ../ -DBUILD_EXAMPLE=ON && cmake --build .
cd ../

Use the BUILD_EXAMPLE option to build an example case.

License

This repository is released under version 2.0 of the Apache License.