Program Listing for File DdsDouble.hpp¶
↰ Return to documentation for file (sinspekto/DdsDouble.hpp
)
#pragma once
#include "sinspekto/QtToDds.hpp"
#include "QDateTime"
class DdsDoubleSubscriber : public QObject
{
Q_OBJECT
Q_PROPERTY(double value READ value NOTIFY valueChanged)
Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)
public:
explicit DdsDoubleSubscriber(QObject *parent = nullptr);
virtual ~DdsDoubleSubscriber();
double value() const;
QDateTime timestamp() const;
Q_INVOKABLE void init(QtToDds* dds, const QString& topic, bool with_listener=true);
signals:
void valueChanged(double value);
void timestampChanged(QDateTime timestamp);
void eventHeard();
public slots:
void updateValue();
private:
std::unique_ptr<sinspekto::Reader<fkin::Real>> m_reader;
};
class DdsDoublePublisher : public QObject
{
Q_OBJECT
Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged)
public:
explicit DdsDoublePublisher(QObject *parent = nullptr);
virtual ~DdsDoublePublisher();
double value() const;
Q_INVOKABLE void init(QtToDds* dds, const QString& topic, double start_value, bool send_first);
signals:
void valueChanged(double value);
public slots:
void setValue(double value);
void publish();
private:
std::unique_ptr<sinspekto::Writer<fkin::Real>> m_writer;
};