🔥 Remove json from sensor implementations

This commit is contained in:
Rune Harlyk
2026-01-03 13:03:55 +01:00
committed by nikguin04
parent fa332995f9
commit 4c6b0c316d
8 changed files with 7 additions and 143 deletions
-20
View File
@@ -1,30 +1,10 @@
#pragma once
#include <ArduinoJson.h>
struct SensorMessageBase {
bool success;
virtual void toJson(JsonVariant v) const = 0;
virtual void fromJson(JsonVariantConst v) = 0;
virtual ~SensorMessageBase() = default;
};
template <class T>
class SensorBase {
static_assert(std::is_base_of<SensorMessageBase, T>::value, "T must inherit from SensorMessageBase");
public:
SensorBase() {}
virtual bool initialize() = 0;
virtual bool update() = 0;
virtual void getResults(JsonVariant &root) { _msg.toJson(root); }
virtual T getResult() { return _msg; }
virtual bool isActive() { return _msg.success; }
protected: