Ferenc Szontágh
2024-06-25 4f0f4a9d9d2f1a1430839121682c514be22cc641
added cista
4 files modified
2 files added
1 files deleted
25 ■■■■■ changed files
.gitignore 1 ●●●● patch | view | raw | blame | history
.gitmodules 3 ●●●●● patch | view | raw | blame | history
.vscode/settings.json 5 ●●●●● patch | view | raw | blame | history
CMakeLists.txt 7 ●●●● patch | view | raw | blame | history
external/cista @ d372b0 1 ●●●● patch | view | raw | blame | history
external/serio 1 ●●●● patch | view | raw | blame | history
src/Command.h 7 ●●●●● patch | view | raw | blame | history
.gitignore
@@ -1,5 +1,4 @@
build
external
# Compiled Object files
*.slo
*.lo
.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
.vscode/settings.json
New file
@@ -0,0 +1,5 @@
{
    "files.associations": {
        "string": "cpp"
    }
}
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)
external/cista
New file
@@ -0,0 +1 @@
Subproject commit d372b0b671be02968a16083c4bd2b7318ee6af65
external/serio
File was deleted
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