move to internal can wrapper and external can_interface
This commit is contained in:
2026-02-14 14:32:39 +01:00
parent e7c4f3956a
commit 7618789717
3 changed files with 7 additions and 6 deletions
+2 -2
View File
@@ -11,7 +11,7 @@
using json = nlohmann::json; using json = nlohmann::json;
#include "CAN_wrapper.hpp" #include "CAN_interface.hpp"
Q_FORWARD_DECLARE_OBJC_CLASS(UI_item); Q_FORWARD_DECLARE_OBJC_CLASS(UI_item);
#endif #endif
@@ -33,7 +33,7 @@ class Communication
* @brief Array of CAN interfaces * @brief Array of CAN interfaces
* *
*/ */
std::unique_ptr<CAN_Wrapper> can_if[3] = {nullptr, nullptr, nullptr}; std::unique_ptr<CAN_Interface> can_if[3] = {nullptr, nullptr, nullptr};
/** /**
* @brief Array of UART interfaces * @brief Array of UART interfaces
* *
+3 -2
View File
@@ -21,7 +21,7 @@ Simulators::Simulators(uint16_t port, QStringList can_devs, QStringList uart_dev
count++; count++;
if (can_dev.isEmpty()) if (can_dev.isEmpty())
continue; continue;
m_com->can_if[count - 1] = std::make_unique<CAN_Wrapper>(this); m_com->can_if[count - 1] = std::make_unique<CAN_Interface>(this);
m_com->can_if[count - 1]->connect_to_dev(can_dev); 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)) 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(); m_com->uart_if[count - 1]->deleteLater();
continue; continue;
} }
+2 -2
View File
@@ -3,8 +3,8 @@
EXPORT_SIM(Can_Debugger); EXPORT_SIM(Can_Debugger);
Can_Debugger::Can_Debugger(Communication *com, QObject *parent) 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()), : Simulator_base("Can Debugger", com, std::chrono::milliseconds(100), parent),
m_can_ui(Color::Black, Color::White) m_wrapper(new CAN_Wrapper(com->can_if[0].get(), this)), m_can_ui(Color::Black, Color::White)
{ {
PUSH_UI_ITEM(m_can_ui); PUSH_UI_ITEM(m_can_ui);