#pragma once
#include "rawdata.h"
#include <myapp/logging/logger.h>
#include <functional>
#include <memory>
#include <string>

namespace myapp::modbus {

class raw_tcp_server
{
public:
	static std::shared_ptr<raw_tcp_server> create(
		std::shared_ptr<logging::logger>,
		std::string const& connection_string);

	virtual ~raw_tcp_server() = default;

	virtual void listen(int backlog) = 0;
	virtual void poll() = 0;

	using data_handler_t = std::function<std::unique_ptr<raw_data>(/* const */ raw_data&)>;
	virtual void set_data_handler(data_handler_t) noexcept = 0;
};

} /* namespace myapp::modbus */
