Flair
Framework Libre Air
Unix_SerialPort.h
Go to the documentation of this file.
1 // %flair:license{
2 // This file is part of the Flair framework distributed under the
3 // CECILL-C License, Version 1.0.
4 // %flair:license}
13 #ifndef UNIX_SERIALPORT_H
14 #define UNIX_SERIALPORT_H
15 
16 #include <SerialPort.h>
17 #include <termios.h> /* POSIX terminal control definitions */
18 
19 namespace flair {
20 namespace core {
26 class Unix_SerialPort : public SerialPort {
27 
28 public:
39  Unix_SerialPort(const Object *parent, std::string port_name,
40  std::string device);
41 
47 
54  void SetBaudrate(int baudrate);
55 
63  void SetRxTimeout(Time timeout_ns);
64 
73  ssize_t Write(const void *buf, size_t nbyte);
74 
83  ssize_t Read(void *buf, size_t nbyte);
84 
89  void FlushInput(void);
90 
91 private:
92  int fd;
93  struct termios options;
94 };
95 } // end namespace core
96 } // end namespace flair
97 
98 #endif // UNIX_SERIALPORT_H
void SetRxTimeout(Time timeout_ns)
Set RX timeout.
Base class for all Framework's classes.
Definition: Object.h:83
namespace of the flair Framework
Definition: Ahrs.h:19
void SetBaudrate(int baudrate)
Set baudrate.
unsigned long long Time
Time definition, in ns.
Definition: Object.h:55
Definition: Unix_SerialPort.h:26
Base class for serial port.
Definition: SerialPort.h:25
void FlushInput(void)
Flush input datas.
ssize_t Write(const void *buf, size_t nbyte)
Write datas.
Unix_SerialPort(const Object *parent, std::string port_name, std::string device)
Constructor.
ssize_t Read(void *buf, size_t nbyte)
Read datas.
Base class for serial port.