#pragma once
#include <myapp/modbus/device.h>
#include <vector>

namespace myapp::modbus::devices {

class relay485 final : public device
{
public:
    explicit relay485(std::string name, int slave_id, std::shared_ptr<connection>, std::shared_ptr<logging::logger>);
    void initialize() override;
    std::string handle_command_impl(std::string const&) override;

    void turn_relay_on(int ch);
    void turn_relay_off(int ch);

private:
    void relay_status_update(std::vector<uint16_t> const&);

private:
    std::vector<bool> relay_status_;
    poll::task_t relay_status_poll_;
};

} /* namespace myapp::modbus::devices */
