initial commit
This commit is contained in:
24
include/adc_sweep/serial_port.hpp
Normal file
24
include/adc_sweep/serial_port.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace adc_sweep {
|
||||
|
||||
class SerialPort {
|
||||
public:
|
||||
SerialPort() = default;
|
||||
~SerialPort();
|
||||
|
||||
bool open_raw(const std::string& path, int baud, std::string& err);
|
||||
void close();
|
||||
bool is_open() const { return fd_ >= 0; }
|
||||
|
||||
ssize_t read_some(uint8_t* buf, size_t cap, std::string& err);
|
||||
|
||||
private:
|
||||
int fd_ = -1;
|
||||
};
|
||||
|
||||
} // namespace adc_sweep
|
||||
Reference in New Issue
Block a user