25 lines
		
	
	
		
			504 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			504 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| #include <string>
 | |
| #include <termios.h>
 | |
| 
 | |
| class SerialPort {
 | |
| private:
 | |
|     const int device;
 | |
|     termios configuration, oldConfiguration;
 | |
| 
 | |
|     void SetAttributes(const speed_t baudrate = B115200);
 | |
| 
 | |
| protected:
 | |
| public:
 | |
|     std::string ReadLine();
 | |
| 
 | |
|     SerialPort(const int fd);
 | |
| 
 | |
|     ~SerialPort();
 | |
| 
 | |
|     SerialPort(const SerialPort &) = delete;
 | |
|     SerialPort(SerialPort &&) = delete;
 | |
|     SerialPort & operator=(const SerialPort &) = delete;
 | |
|     SerialPort & operator=(SerialPort &&) = delete;
 | |
| };
 |