From 7618789717da539aa4bc0b8f10b5bea3e653f7e0 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Tue, 28 Oct 2025 09:34:05 +0100 Subject: [PATCH] server move to internal can wrapper and external can_interface --- server/simulator_base.hpp | 4 ++-- server/simulators.cpp | 5 +++-- server/simulators/can_debugger.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/simulator_base.hpp b/server/simulator_base.hpp index 2c49612..74f0155 100644 --- a/server/simulator_base.hpp +++ b/server/simulator_base.hpp @@ -11,7 +11,7 @@ using json = nlohmann::json; -#include "CAN_wrapper.hpp" +#include "CAN_interface.hpp" Q_FORWARD_DECLARE_OBJC_CLASS(UI_item); #endif @@ -33,7 +33,7 @@ class Communication * @brief Array of CAN interfaces * */ - std::unique_ptr can_if[3] = {nullptr, nullptr, nullptr}; + std::unique_ptr can_if[3] = {nullptr, nullptr, nullptr}; /** * @brief Array of UART interfaces * diff --git a/server/simulators.cpp b/server/simulators.cpp index dc86b64..1254423 100644 --- a/server/simulators.cpp +++ b/server/simulators.cpp @@ -21,7 +21,7 @@ Simulators::Simulators(uint16_t port, QStringList can_devs, QStringList uart_dev count++; if (can_dev.isEmpty()) continue; - m_com->can_if[count - 1] = std::make_unique(this); + m_com->can_if[count - 1] = std::make_unique(this); m_com->can_if[count - 1]->connect_to_dev(can_dev); } @@ -42,7 +42,8 @@ Simulators::Simulators(uint16_t port, QStringList can_devs, QStringList uart_dev if (!m_com->uart_if[count - 1]->open(QIODevice::ReadWrite)) { - SPDLOG_CRITICAL("UART: /dev/{} {}", m_com->uart_if[count - 1]->portName().toStdString(), m_com->uart_if[count - 1]->errorString().toStdString()); + SPDLOG_CRITICAL("UART: /dev/{} {}", m_com->uart_if[count - 1]->portName().toStdString(), + m_com->uart_if[count - 1]->errorString().toStdString()); m_com->uart_if[count - 1]->deleteLater(); continue; } diff --git a/server/simulators/can_debugger.cpp b/server/simulators/can_debugger.cpp index 6153b9c..d48349c 100644 --- a/server/simulators/can_debugger.cpp +++ b/server/simulators/can_debugger.cpp @@ -3,8 +3,8 @@ EXPORT_SIM(Can_Debugger); Can_Debugger::Can_Debugger(Communication *com, QObject *parent) - : Simulator_base("Can Debugger", com, std::chrono::milliseconds(100), parent), m_wrapper(com->can_if[0].get()), - m_can_ui(Color::Black, Color::White) + : Simulator_base("Can Debugger", com, std::chrono::milliseconds(100), parent), + m_wrapper(new CAN_Wrapper(com->can_if[0].get(), this)), m_can_ui(Color::Black, Color::White) { PUSH_UI_ITEM(m_can_ui);