aboutsummaryrefslogtreecommitdiff
path: root/src/commander.hpp
blob: 70b231d8fe504c180599aa9d8f3f98463878d8a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef WANDA_COMMANDER_HPP
#define WANDA_COMMANDER_HPP

#include "control_connection.hpp"
#include "message.hpp"

#include <boost/asio.hpp>
#include <boost/system/error_code.hpp>

#include <filesystem>
#include <string>

namespace wanda
{

struct commander : wanda::control_connection::listener
{
  commander(boost::asio::io_service &service, std::filesystem::path socket);

  void start();
  void send(message message);

  void on_error(wanda::control_connection::pointer connection, boost::system::error_code error) override;
  void on_received(wanda::control_connection::pointer connection, message message) override;

private:
  boost::asio::io_service & m_service;
  wanda::control_connection::protocol::endpoint m_endpoint;
  wanda::control_connection::protocol::socket m_socket;
  wanda::control_connection::pointer m_connection;
};

} // namespace wanda
#endif