mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
server
build able but not implemented
This commit is contained in:
+30
-2
@@ -9,10 +9,24 @@ find_package(Qt6 REQUIRED COMPONENTS Core WebSockets SerialBus Network)
|
|||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
qt_add_executable(server)
|
qt_add_executable(server)
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCES "*.[hc]pp")
|
set_target_properties(
|
||||||
|
server
|
||||||
|
PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,--export-dynamic"
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE CANSOURCES "CAN/*.[hc]pp")
|
||||||
|
|
||||||
target_sources(server PRIVATE
|
target_sources(server PRIVATE
|
||||||
${SOURCES}
|
${CANSOURCES}
|
||||||
|
main.cpp
|
||||||
|
message_parser.cpp
|
||||||
|
simulator_base.cpp
|
||||||
|
simulator_base.hpp
|
||||||
|
simulators.cpp
|
||||||
|
simulators.hpp
|
||||||
|
websocket.cpp
|
||||||
|
websocket.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(server PRIVATE $<$<CONFIG:Debug>:
|
target_compile_options(server PRIVATE $<$<CONFIG:Debug>:
|
||||||
@@ -42,3 +56,17 @@ target_link_libraries(server PRIVATE
|
|||||||
cpp_templates
|
cpp_templates
|
||||||
${GPIOD_LIB}
|
${GPIOD_LIB}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
file(GLOB_RECURSE sims "simulators/*.cpp")
|
||||||
|
|
||||||
|
# Loop through each .cpp file and create a library for it
|
||||||
|
foreach(sim ${sims})
|
||||||
|
# Extract the base name of the file (without the directory and extension)
|
||||||
|
get_filename_component(LIB_NAME ${sim} NAME_WE)
|
||||||
|
|
||||||
|
# Create a library for each .cpp file
|
||||||
|
add_library(sim_${LIB_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.hpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.cpp)
|
||||||
|
target_link_libraries(sim_${LIB_NAME} PRIVATE Qt::SerialBus magic_enum::magic_enum nlohmann_json::nlohmann_json)
|
||||||
|
target_include_directories(sim_${LIB_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/CAN ${CMAKE_SOURCE_DIR}/UI ${CMAKE_SOURCE_DIR}/external/color)
|
||||||
|
endforeach()
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
#include "simulators.hpp"
|
#include "simulators.hpp"
|
||||||
#include "can_debugger.hpp"
|
|
||||||
#include "cvs_i10.hpp"
|
|
||||||
#include "test_sim.hpp"
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
Simulators::Simulators(uint16_t port, QString can_dev, QString uart_dev, QObject *parent)
|
Simulators::Simulators(uint16_t port, QString can_dev, QString uart_dev, QObject *parent)
|
||||||
@@ -31,8 +28,8 @@ Simulators::Simulators(uint16_t port, QString can_dev, QString uart_dev, QObject
|
|||||||
m_com.c_if1 = m_can_wrapper;
|
m_com.c_if1 = m_can_wrapper;
|
||||||
m_com.s_if1 = m_serial;
|
m_com.s_if1 = m_serial;
|
||||||
|
|
||||||
INSERT_SIMULATOR(Test_Sim);
|
// Insert Debug sims here
|
||||||
INSERT_SIMULATOR(Can_Debugger);
|
// INSERT_SIMULATOR(TEST_SIM);
|
||||||
|
|
||||||
connect(m_server, &Websocket::on_message, this, [this](QWebSocket *conn, QString message) {
|
connect(m_server, &Websocket::on_message, this, [this](QWebSocket *conn, QString message) {
|
||||||
QString response = message_parser(message);
|
QString response = message_parser(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user