change Event can_clear to clear

make this a bit more general, that it can be used for more then only can
This commit is contained in:
2026-02-14 14:32:18 +01:00
parent 0f1d6aa592
commit 7cb93ec14d
9 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ void UI_can::clear_receive_buffer()
emit ui_changed(); emit ui_changed();
} }
void UI_can::can_clear() void UI_can::clear()
{ {
clear_send_buffer(); clear_send_buffer();
clear_receive_buffer(); clear_receive_buffer();
+1 -1
View File
@@ -31,7 +31,7 @@ class UI_can : public UI_item
json to_json(size_t id) const override; json to_json(size_t id) const override;
void can_send(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload) override; void can_send(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload) override;
void can_clear() override; void clear() override;
signals: signals:
void send(QCanBusFrame msg); void send(QCanBusFrame msg);
+1 -1
View File
@@ -168,7 +168,7 @@ void UI_item::can_send(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload)
UNUSED(payload); UNUSED(payload);
}; };
void UI_item::can_clear() void UI_item::clear()
{ {
} }
+1 -1
View File
@@ -46,7 +46,7 @@ class UI_item : public QObject
virtual void set_selected(size_t selected); virtual void set_selected(size_t selected);
virtual void set_value(double value); virtual void set_value(double value);
virtual void can_send(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload); virtual void can_send(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload);
virtual void can_clear(); virtual void clear();
signals: signals:
void ui_changed(); void ui_changed();
+1 -1
View File
@@ -1059,5 +1059,5 @@ void Simulator_base::setup_can_ui(QWidget *item, size_t index)
m_web_socket->send_event(Web_socket_wrapper::Event::can_send, index, id, dlc, payload); m_web_socket->send_event(Web_socket_wrapper::Event::can_send, index, id, dlc, payload);
}); });
connect(can, &Can_Transceive::can_clear, this, connect(can, &Can_Transceive::can_clear, this,
[=, this] { m_web_socket->send_event(Web_socket_wrapper::Event::can_clear, index); }); [=, this] { m_web_socket->send_event(Web_socket_wrapper::Event::clear, index); });
} }
+1 -1
View File
@@ -77,7 +77,7 @@ void Web_socket_wrapper::send_event(Event e, size_t id)
switch (e) switch (e)
{ {
case Event::clicked: case Event::clicked:
case Event::can_clear: case Event::clear:
j["event"]["id"] = id; j["event"]["id"] = id;
m_web_socket->sendTextMessage(QString(j.dump().data())); m_web_socket->sendTextMessage(QString(j.dump().data()));
break; break;
+1 -1
View File
@@ -27,7 +27,7 @@ class Web_socket_wrapper : public QObject
text_changed, text_changed,
selected, selected,
can_send, can_send,
can_clear, clear,
ui_changed, ui_changed,
end, end,
begin = 0 begin = 0
+2 -2
View File
@@ -120,9 +120,9 @@ void Simulators::event_handler(json event)
(std::array<uint8_t, 8>)event.at("payload")); (std::array<uint8_t, 8>)event.at("payload"));
break; break;
} }
case Event::can_clear: { case Event::clear: {
SPDLOG_DEBUG("Event {}: {}", type, (size_t)event.at("id")); SPDLOG_DEBUG("Event {}: {}", type, (size_t)event.at("id"));
invoke_active_simulator()->get_UI_item(event.at("id"))->can_clear(); invoke_active_simulator()->get_UI_item(event.at("id"))->clear();
break; break;
} }
default: { default: {
+1 -1
View File
@@ -39,7 +39,7 @@ class Simulators : public QObject
text_changed, text_changed,
selected, selected,
can_send, can_send,
can_clear, clear,
ui_changed, ui_changed,
end, end,
begin = 0 begin = 0