serial_comm.h
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <termios.h>
3 #include <sys/ioctl.h>
4 #include <unistd.h>
5 #include <fcntl.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <limits.h>
9 #include <iostream>
10 #include <string>
11 #include <cstring>
12 #include <linux/serial.h>
13 
14 #define MAX_LENGTH 128
15 
16 namespace milvus
17 {
18  class SerialComm
19  {
20  public:
22  SerialComm();
24  ~SerialComm();
25 
26  int open_port(std::string port_name, int baudrate, std::string mode_s);
27  int close_port();
28  int poll_comport(unsigned char *, int);
29  int send_byte(unsigned char);
30  int send_buf(unsigned char *, int);
31  void cputs(const char *);
32  int is_dcd_enabled();
33  int is_cts_enabled();
34  int is_dsr_enabled();
35  void enable_dtr();
36  void disable_dtr();
37  void enable_rts();
38  void disable_rts();
39 
40 
41  private:
43  int fd_;
45  int baud_;
46  std::string port_name_;
47  struct termios new_port_settings, old_port_settings;
48  int error;
49  };
50 
51 }
int send_byte(unsigned char)
~SerialComm()
Destructor.
Definition: serial_comm.cpp:14
int poll_comport(unsigned char *, int)
int send_buf(unsigned char *, int)
int fd_
File descriptor.
Definition: serial_comm.h:43
std::string port_name_
Definition: serial_comm.h:46
int baud_
Baud rate.
Definition: serial_comm.h:45
struct termios new_port_settings old_port_settings
Definition: serial_comm.h:47
int open_port(std::string port_name, int baudrate, std::string mode_s)
Definition: serial_comm.cpp:18
SerialComm()
Constructor.
Definition: serial_comm.cpp:10
void cputs(const char *)


mrp2_hardware
Author(s): Akif Hacinecipoglu
autogenerated on Mon Feb 28 2022 22:53:03