25 lines
431 B
C++
25 lines
431 B
C++
#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
|