From 4f0f4a9d9d2f1a1430839121682c514be22cc641 Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Tue, 25 Jun 2024 07:26:47 +0000
Subject: [PATCH] added cista

---
 /dev/null             |    1 -
 .gitignore            |    1 -
 .gitmodules           |    3 +++
 .vscode/settings.json |    5 +++++
 external/cista        |    1 +
 src/Command.h         |    7 +++----
 CMakeLists.txt        |    7 +++++--
 7 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index 52dc43d..17c4ea6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
 build
-external
 # Compiled Object files
 *.slo
 *.lo
diff --git a/.gitmodules b/.gitmodules
index 6df70f1..c20c342 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
 [submodule "external/serio"]
 	path = external/serio
 	url = https://github.com/ShahriarRezghi/serio.git
+[submodule "external/cista"]
+	path = external/cista
+	url = https://github.com/felixguendling/cista.git
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..d8cb326
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+    "files.associations": {
+        "string": "cpp"
+    }
+}
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c34cc0..0750efc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,8 @@
 include_directories(${CMAKE_SOURCE_DIR}/src)
 include_directories(${CMAKE_SOURCE_DIR}/plugins)
 
+add_subdirectory(external/serio)
+
 # Main server executable
 add_executable(server
     src/main.cpp
@@ -21,7 +23,8 @@
 )
 
 # Link libraries
-target_link_libraries(server msgpack nlohmann_json::nlohmann_json)
-
+target_link_libraries(server ${SERIO_LIBRARIES} nlohmann_json::nlohmann_json)
+target_include_directories(server PUBLIC ${SERIO_INCLUDE_DIRS})
+message(STATUS "Serio: \n\t${SERIO_LIBRARIES} \n\t${SERIO_INCLUDE_DIRS}")
 # Add the plugins subdirectory
 add_subdirectory(src/plugins)
diff --git a/external/cista b/external/cista
new file mode 160000
index 0000000..d372b0b
--- /dev/null
+++ b/external/cista
@@ -0,0 +1 @@
+Subproject commit d372b0b671be02968a16083c4bd2b7318ee6af65
diff --git a/external/serio b/external/serio
deleted file mode 160000
index e53edeb..0000000
--- a/external/serio
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e53edeb6104718040088fa39c325d272565c00b1
diff --git a/src/Command.h b/src/Command.h
index 4a3ca8f..8a1b474 100644
--- a/src/Command.h
+++ b/src/Command.h
@@ -1,7 +1,7 @@
 #ifndef COMMAND_H
 #define COMMAND_H
 
-#include <msgpack.h>
+#include <serio/serio.h>
 #include <string>
 #include <unordered_map>
 
@@ -10,6 +10,7 @@
     PluginRegistered = 1000,
     PluginList = 1001
 };
+SERIO_REGISTER(CommandType::PluginRegistered, CommandType::PluginList)
 
 // Map the CommandType enum to its string representation
 static const std::unordered_map<CommandType, std::string> CommandTypeToString = {
@@ -17,15 +18,13 @@
     {CommandType::PluginList, "PluginList"}
 };
 
-MSGPACK_ADD_ENUM(CommandType::PluginList)
 
-MSGPACK_ADD_ENUM(CommandType::PluginRegistered)
 
 struct Command {
     CommandType commandType;
     std::string payload;
 
-    MSGPACK_DEFINE(commandType, payload);
+    SERIO_REGISTER(commandType, payload);
 };
 
 #endif // COMMAND_H

--
Gitblit v1.9.3