Major wip refactor

Allow running without gui
Remove serialPortMultiplexer broadcast use
Add TcpServer and TcpClient
Introduce the concept of an item source
This commit is contained in:
Carl Philipp Klemm 2026-03-01 14:39:27 +01:00
parent cbeb8d49a7
commit 6d742e60db
38 changed files with 928 additions and 825 deletions

View file

@ -2,7 +2,7 @@
#include <vector>
#include <memory>
#include "item.h"
#include "src/sensors/sensor.h"
#include "itemsource.h"
#include <QJsonObject>
@ -10,7 +10,7 @@ class ItemStore: public QObject
{
Q_OBJECT
private:
std::vector< std::shared_ptr<Item> > items_;
std::vector<std::shared_ptr<Item> > items_;
public:
@ -22,6 +22,9 @@ public:
return &items_;
}
std::shared_ptr<Item> getItem(uint32_t id);
void registerItemSource(ItemSource* source);
void store(QJsonObject &json);
void load(const QJsonObject &json);
@ -31,11 +34,20 @@ signals:
void itemDeleted(ItemData item);
void itemAdded(std::weak_ptr<Item> Item);
void itemUpdated(std::weak_ptr<Item> Item);
void sigRefresh();
public slots:
void removeItem(const ItemData& item);
void addItem(std::shared_ptr<Item> item);
void addItems(const std::vector<std::shared_ptr<Item>>& itemsIn);
void itemStateChanged(const ItemData& item);
void addItem(std::shared_ptr<Item> item, bool inform = true);
void addItems(const std::vector<std::shared_ptr<Item>>& itemsIn, bool inform = true);
void updateItems(std::vector<ItemData> items, bool inform = true);
void updateItem(const ItemData& item, bool inform = true);
void refresh();
private slots:
void itemUpdateSlot(ItemData data);
};
extern ItemStore globalItems;