#pragma once #include <string> #include <vector> #include <functional> #include "device/device_config.h" #ifndef MEASURED_PERIOD_MS #define MEASURED_PERIOD_MS 1000 #endif namespace qthing { namespace measured { typedef struct { const std::string *name; const std::string *type; const std::string *unit; const float value; } sensor_data_t; typedef std::function<float()> sensor_t; typedef std::function<void(std::vector<sensor_data_t>&)> backend_t; void registerBackend(backend_t new_backend); void registerSensor(std::string name, std::string type, std::string unit, sensor_t sensor); namespace backend { void mqtt(std::vector<qthing::measured::sensor_data_t>& data); } } }