HLR  0.0.1
Serial.hpp
1 #ifndef KINEMATICS_RV2AJ_DRIVER_SERIAL_HPP
2 #define KINEMATICS_RV2AJ_DRIVER_SERIAL_HPP
3 
4 #include <string>
5 
6 namespace HLR
7 {
8 namespace Kinematics
9 {
10 namespace RV2AJ
11 {
13 class Serial
14 {
15 public:
17  Serial() = default;
18 
23  virtual ~Serial();
24 
29  Serial(const Serial& s) = delete;
30 
35  Serial(Serial&& s) = delete;
36 
42  Serial& operator=(const Serial& s) = delete;
43 
49  Serial& operator=(Serial&& s) = delete;
50 
60  void open(const std::string& dev);
61 
66  void close();
67 
72  bool opened() const;
73 
81  void write(const std::string& msg);
82 
83 private:
85  int fd = -1;
86 };
87 
88 } // namespace RV2AJ
89 } // namespace Kinematics
90 } // namespace HLR
91 
92 #endif // KINEMATICS_RV2AJ_DRIVER_SERIAL_HPP
Serial()=default
Constructor.
OO wrapper around POSIX serial devices.
Definition: Serial.hpp:13
void write(const std::string &msg)
Writes message to open serial device.
bool opened() const
Returns whether serial device is open.
virtual ~Serial()
Destructor.
void close()
Closes active serial device.
Serial & operator=(const Serial &s)=delete
Copy assignment operator, deleted.
void open(const std::string &dev)
Open specified serial device.