Thunderbots Project
Loading...
Searching...
No Matches
uart_communication.h
1#pragma once
2
3#include <boost/asio.hpp>
4#include <boost/function.hpp>
5
6/*
7 * Interface for Uart Communication
8 */
10{
11 public:
12 enum FlushType
13 {
14 flush_receive = TCIFLUSH, // flushes data received but not read
15 flush_send = TCOFLUSH, // flushes data written but not transmitted
16 flush_both = TCIOFLUSH // flushes both data received but not read and data
17 // written but not transmitted
18 };
19
20 UartCommunication() = default;
21
22 virtual ~UartCommunication() = default;
23
24 UartCommunication(const UartCommunication &) = delete;
25
26 UartCommunication &operator=(const UartCommunication &) = delete;
27
33 virtual bool serialWrite(const std::vector<unsigned char> &write_val) = 0;
34
40 virtual std::vector<unsigned char> serialRead(size_t num_read_bytes) = 0;
41
47 virtual bool flushSerialPort(FlushType flush_type) = 0;
48};
Definition uart_communication.h:10
virtual bool serialWrite(const std::vector< unsigned char > &write_val)=0
virtual std::vector< unsigned char > serialRead(size_t num_read_bytes)=0
virtual bool flushSerialPort(FlushType flush_type)=0