test new format
This commit is contained in:
29
tty_protocol_writer.h
Normal file
29
tty_protocol_writer.h
Normal file
@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class TtyProtocolWriter {
|
||||
public:
|
||||
explicit TtyProtocolWriter(std::string path);
|
||||
~TtyProtocolWriter();
|
||||
|
||||
TtyProtocolWriter(const TtyProtocolWriter&) = delete;
|
||||
TtyProtocolWriter& operator=(const TtyProtocolWriter&) = delete;
|
||||
TtyProtocolWriter(TtyProtocolWriter&& other) noexcept;
|
||||
TtyProtocolWriter& operator=(TtyProtocolWriter&& other) noexcept;
|
||||
|
||||
void emit_packet_start() const;
|
||||
void emit_step(uint16_t index, int16_t ch1_avg, int16_t ch2_avg) const;
|
||||
|
||||
const std::string& path() const;
|
||||
|
||||
private:
|
||||
void write_frame(uint16_t word0, uint16_t word1, uint16_t word2, uint16_t word3) const;
|
||||
void close_fd() noexcept;
|
||||
|
||||
std::string path_;
|
||||
#ifndef _WIN32
|
||||
int fd_ = -1;
|
||||
#endif
|
||||
};
|
||||
Reference in New Issue
Block a user