diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-05-17 17:58:38 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-05-17 17:58:38 +0200 |
| commit | 577fc0845718ed8ad5bebf02a277c0579a817f77 (patch) | |
| tree | 3d1cdc53c426a0ba60a7996619a7b787850bb3b3 /source/lib/include/wanda/proto/command.hpp | |
| parent | de5bf7ca3b7a2bf6be35b86486b00dc6a071b950 (diff) | |
| download | wanda-develop.tar.xz wanda-develop.zip | |
Diffstat (limited to 'source/lib/include/wanda/proto/command.hpp')
| -rw-r--r-- | source/lib/include/wanda/proto/command.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source/lib/include/wanda/proto/command.hpp b/source/lib/include/wanda/proto/command.hpp new file mode 100644 index 0000000..c8dae65 --- /dev/null +++ b/source/lib/include/wanda/proto/command.hpp @@ -0,0 +1,46 @@ +#ifndef WANDA_PROTO_COMMAND_HPP +#define WANDA_PROTO_COMMAND_HPP + +#include "wanda/proto/message.hpp" + +#include <optional> +#include <string> +#include <vector> + +namespace wanda::proto +{ + /** + * @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::proto::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::proto + +#endif
\ No newline at end of file |
