-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsinterface.h
More file actions
52 lines (37 loc) · 1 KB
/
rsinterface.h
File metadata and controls
52 lines (37 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//This is an open source non-commercial project. Dear PVS-Studio, please check it.
#ifndef RS_INTERFACE_H
#define RS_INTERFACE_H
#include <iostream>
#include <map>
#include <cstring>
#include "serial/iserial.h"
#include "const.h"
#include "iinterface.h"
#include "paramsrs.h"
#ifdef _WIN32
#include "serial/winserial.h"
using namespace win_serial;
#else
#include "serial/linuxserial.h"
#endif
class RSInterface : public IInterface
{
public:
RSInterface(TypeParams _params, PtrSerial _serial);
~RSInterface() override;
const std::string name() override
{ return std::string("RS"); }
bool open() override;
bool close() override;
/* timeout - micro seconds*/
int read(char *data, int size, int timeout) override;
int write(const char *data, int size) override;
int putCharWakeup(unsigned char symbol);
private:
bool isFirstByte = false;
int _channelId;
termios newtio0;
TypeParamsRS params;
PtrSerial serial;
};
#endif // RS_INTERFACE_H