serial_com.h
Go to the documentation of this file.
1 //
2 // Created by sub on 18/12/17.
3 //
4 
5 #ifndef RIC_INTERFACE_SERIALCOM_H
6 #define RIC_INTERFACE_SERIALCOM_H
7 
8 #include "ric_exception.h"
9 #include <termios.h>
10 #include <fcntl.h>
11 #include <unistd.h>
12 
13 typedef unsigned char byte;
14 
15 #include <string>
16 
17 
18 class SerialCom
19 {
20 
21 private:
23  baudrate_;
24  void setAttributes();
25 
26 
27 public:
28  ~SerialCom(){ ::close(file_handle_); }
29  void connect(std::string port, int baudrate);
30  bool send(const byte buff[], size_t size);
31  int read(byte buff[], size_t size);
32  int read();
33 
34 };
35 
36 
37 
38 #endif //RIC_INTERFACE_SERIALCOM_H
int file_handle_
Definition: serial_com.h:22
void setAttributes()
Definition: serial_com.cpp:23
int read()
Definition: serial_com.cpp:76
int baudrate_
Definition: serial_com.h:22
bool send(const byte buff[], size_t size)
Definition: serial_com.cpp:85
~SerialCom()
Definition: serial_com.h:28
uint8_t byte
Definition: crc8.h:11
void connect(std::string port, int baudrate)
Definition: serial_com.cpp:6
unsigned char byte
Definition: serial_com.h:13


ric_interface
Author(s):
autogenerated on Wed Jan 3 2018 03:48:20