Add can ui element

This commit is contained in:
2024-12-30 12:08:13 +01:00
parent 460bc09b2f
commit 5fdfb765de
6 changed files with 118 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include "UI_item.hpp"
#include <ctime>
#include <chrono>
#include "CAN_interface.hpp"
#define UI_CAN_TYPE std::string("UI_can")
class UI_can : public UI_item
{
public:
UI_can(std::string id, std::string text, Color fg_color, Color bg_color,
std::function<void(can_message_t msg)> on_send = nullptr);
UI_can(const json &j);
void add_can_message(can_message_t msg);
void from_json(const json &j) override;
json to_json() const override;
void can_send(can_message_t msg) override;
private:
std::function<void(can_message_t msg)> m_on_can_send = nullptr;
std::vector<can_message_t> m_can_messages;
};