aboutsummaryrefslogtreecommitdiff
path: root/src/command.hpp
blob: afc6a6f4eca627f6a6bae1a78860c032c8681161 (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
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef WANDA_COMMAND_HPP
#define WANDA_COMMAND_HPP

#include "message.hpp"

#include <optional>
#include <string>
#include <vector>

namespace wanda
{
  /**
   * @brief An enum to describe different command IDs
   */
  enum struct command_id : char
  {
    change,  //< Change the wallpaper
  };

  /**
   * @brief A simple type to represent commands transported through the control connection
   */
  struct command
  {
    command_id const id;
    std::vector<std::string> const arguments;

    /**
     * @brief Convert the command to a message for transmission to a remote endpoint
     */
    std::optional<wanda::message> message() const;
  };

  /**
   * @brief Extract a command from a message
   */
  std::optional<command> make_command(message message);

  /**
   * @brief A simple factory to create a "Change wallpaper" command
   */
  command make_change_command();

}  // namespace wanda

#endif