#pragma once

#include <termios.h>

// base class
#include "CComm.h"

class CSerial final : public CComm
{
public:
	CSerial();
	~CSerial();

	bool Open(void *p) override;
	void Close() override;

	error_t Receive() override;
	size_t Transmit(const uint8_t *buf, size_t toWriteBytes) override;

private:
	static void *ThreadFunc(void *p);

	bool terminated_;
	int com_fd_;
	termios prev_config_;
};
