28 lines
488 B
C++
28 lines
488 B
C++
#ifndef SERIAL_PORT_H
|
|
#define SERIAL_PORT_H
|
|
|
|
#include <boost/asio/read.hpp>
|
|
#include <boost/asio/serial_port.hpp>
|
|
#include <string>
|
|
#include <iostream>
|
|
#include "datatypes.h"
|
|
|
|
|
|
using boost::asio::async_read;
|
|
using boost::asio::dynamic_buffer;
|
|
|
|
class serial_port
|
|
{
|
|
public:
|
|
serial_port(const std::string & device);
|
|
TransCheck read_frame();
|
|
|
|
private:
|
|
void flush();
|
|
boost::asio::io_context ioContext;
|
|
boost::asio::serial_port port{ioContext};
|
|
|
|
};
|
|
|
|
#endif // SERIAL_PORT_H
|