blob: 35b35beadb4bee8e77f80dc469fd354c43b7f98f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#pragma once
#include <string>
extern "C" {
#include <termios.h>
}
class serial
{
public:
serial(const std::string& port, speed_t baud);
~serial();
int write(const std::string& data) const;
int write(const char * const data, size_t len) const;
char read() const;
std::string read(size_t howmany) const;
private:
int m_fd;
struct termios m_settings;
};
|