Program Listing for File DdsWeatherData.hpp¶
↰ Return to documentation for file (sinspekto/DdsWeatherData.hpp
)
#pragma once
#include "sinspekto/QtToDds.hpp"
#include "QDateTime"
class DdsWeatherDataSubscriber : public QObject
{
Q_OBJECT
Q_PROPERTY(QString module_name READ module_name NOTIFY module_nameChanged)
Q_PROPERTY(QString type READ type NOTIFY typeChanged)
Q_PROPERTY(QString temp_trend READ temp_trend NOTIFY temp_trendChanged)
Q_PROPERTY(QString pressure_trend READ pressure_trend NOTIFY pressure_trendChanged)
Q_PROPERTY(double CO2 READ CO2 NOTIFY CO2Changed)
Q_PROPERTY(double noise READ noise NOTIFY noiseChanged)
Q_PROPERTY(double humidity READ humidity NOTIFY humidityChanged)
Q_PROPERTY(double temperature READ temperature NOTIFY temperatureChanged)
Q_PROPERTY(double pressure READ pressure NOTIFY pressureChanged)
Q_PROPERTY(unsigned int signal_strength READ signal_strength NOTIFY signal_strengthChanged)
Q_PROPERTY(unsigned int battery READ battery NOTIFY batteryChanged)
Q_PROPERTY(bool reachable READ reachable NOTIFY reachableChanged)
Q_PROPERTY(QDateTime sampleTime READ sampleTime NOTIFY sampleTimeChanged)
Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)
public:
explicit DdsWeatherDataSubscriber(QObject *parent = nullptr);
virtual ~DdsWeatherDataSubscriber();
QString module_name() const;
QString type() const;
QString temp_trend() const;
QString pressure_trend() const;
double CO2() const;
double noise() const;
double humidity() const;
double temperature() const;
double pressure() const;
unsigned int signal_strength() const;
unsigned int battery() const;
bool reachable() const;
QDateTime sampleTime() const;
QDateTime timestamp() const;
Q_INVOKABLE void init(
QtToDds* dds,
const QString& topic,
const QString& id,
bool with_listener=true);
signals:
void module_nameChanged(QString module_name);
void typeChanged(QString type);
void temp_trendChanged(QString temp_trend);
void pressure_trendChanged(QString pressure_trend);
void reachableChanged(bool reachable);
void CO2Changed(double CO2);
void noiseChanged(double noise);
void humidityChanged(double humidity);
void temperatureChanged(double temperature);
void pressureChanged(double pressure);
void signal_strengthChanged(unsigned int signal_strength);
void batteryChanged(unsigned int battery);
void sampleTimeChanged(QDateTime sampleTime);
void timestampChanged(QDateTime timestamp);
void eventHeard();
public slots:
void updateValues();
private:
std::unique_ptr<sinspekto::Reader<weather::ModuleData>> m_reader;
QString m_id;
};