move to communication struct
This commit is contained in:
2026-02-14 14:31:12 +01:00
parent 47578eb677
commit e9bec527a6
8 changed files with 24 additions and 14 deletions
+11 -3
View File
@@ -7,6 +7,15 @@
#include <QTimer>
#define PUSH_UI_ITEM(item) push_ui_item(&item)
struct Communication
{
CAN_Wrapper* c_if1 = nullptr;
CAN_Wrapper* c_if2 = nullptr;
QSerialPort* s_if1 = nullptr;
QSerialPort* s_if2 = nullptr;
QSerialPort* s_if3 = nullptr;
QSerialPort* s_if4 = nullptr;
};
class Simulator_base : public QObject
{
@@ -18,7 +27,7 @@ class Simulator_base : public QObject
* @param name The name of the simulator
* @param interval The interval of the timer (default is 100ms)
*/
Simulator_base(std::string name, CAN_Wrapper *can_wrapper = nullptr, QSerialPort *serial = nullptr,
Simulator_base(std::string name, Communication* comms,
std::chrono::milliseconds interval = std::chrono::milliseconds(100), QObject *parent = nullptr);
/**
@@ -108,6 +117,5 @@ class Simulator_base : public QObject
std::vector<UI_item *> m_UI_items;
QTimer *m_timer;
std::chrono::milliseconds m_interval;
CAN_Wrapper *m_can_wrapper;
QSerialPort *m_serial;
Communication* m_com;
};