1#ifndef BITSIM_SENSORS_BACKENDS_MQTT_INFRARED_BACKEND_H
2#define BITSIM_SENSORS_BACKENDS_MQTT_INFRARED_BACKEND_H
4#include "bitsim/bitsim_config.h"
60 void load(
const nlohmann::json &j)
override;
64 channel_.set_config(config);
84 bool receive(
const std::string &text);
86 bool is_alive()
const {
return channel_.is_alive(); }
96 bool accept_(
const std::string &text);
100 bool has_message_{
false};
Definition mqtt_subscriber.h:24
InfraredBackendBase(const std::string &backend_type)
Definition infrared_backend_base.h:108
void connect()
Connect to the broker, unless the subscriber already is.
Definition mqtt_infrared_backend.h:70
std::vector< real_t > read_values() override
Take the readings that have arrived.
Definition mqtt_infrared_backend.cpp:65
MQTT_InfraredBackend()
A backend that subscribes on its own, see connect(). Give it a topic with set_channel_config() or loa...
Definition mqtt_infrared_backend.cpp:18
const InfraredMessage & last_value_read() const noexcept
Definition mqtt_infrared_backend.h:93
void set_channel_config(const MQTT_SensorChannel::Config &config)
Definition mqtt_infrared_backend.h:62
static const std::string BACKEND_TYPE
Definition mqtt_infrared_backend.h:40
void load(const nlohmann::json &j) override
Read the settings, see InfraredBackendBase::load(). Also reads broker, topic and timeout [s],...
Definition mqtt_infrared_backend.cpp:31
bool is_alive() const
Definition mqtt_infrared_backend.h:86
const MQTT_SensorChannel & channel() const noexcept
Definition mqtt_infrared_backend.h:88
bool receive(const std::string &text)
Take one message, as read_values() does for each message that arrives. Use it to feed the backend wit...
Definition mqtt_infrared_backend.cpp:40
The topic a sensor on a board publishes its readings to.
Definition mqtt_sensor_channel.h:34
Definition camera_backend_base.h:19
Definition dc_motor_backend_base.h:9
Models a message from an array of infrared reflectance sensors, one value per element:
Definition infrared.h:31
Definition mqtt_sensor_channel.h:39