aboutsummaryrefslogtreecommitdiff
path: root/source/lib/include/wanda/command.hpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2022-09-16 23:28:09 +0200
committerFelix Morgner <felix.morgner@gmail.com>2022-09-16 23:28:09 +0200
commitf4d9880d3c9555b48affad727589ef5c093b1841 (patch)
treea5552b5a33000a527748ac1c72ca366476af0936 /source/lib/include/wanda/command.hpp
parent64922e213ac731279cf3341253e67509adb2dfc8 (diff)
downloadwanda-f4d9880d3c9555b48affad727589ef5c093b1841.tar.xz
wanda-f4d9880d3c9555b48affad727589ef5c093b1841.zip
source: clean up structure
Diffstat (limited to 'source/lib/include/wanda/command.hpp')
-rw-r--r--source/lib/include/wanda/command.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/source/lib/include/wanda/command.hpp b/source/lib/include/wanda/command.hpp
new file mode 100644
index 0000000..67938de
--- /dev/null
+++ b/source/lib/include/wanda/command.hpp
@@ -0,0 +1,46 @@
+#ifndef WANDA_COMMAND_HPP
+#define WANDA_COMMAND_HPP
+
+#include "wanda/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 \ No newline at end of file