Program Listing for File DdsIdVec1d.hpp¶
↰ Return to documentation for file (sinspekto/DdsIdVec1d.hpp
)
#pragma once
#include "sinspekto/QtToDds.hpp"
#include "QDateTime"
class DdsIdVec1dSubscriber : public QObject
{
Q_OBJECT
Q_PROPERTY(double value READ value NOTIFY valueChanged)
Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)
public:
explicit DdsIdVec1dSubscriber(QObject *parent = nullptr);
virtual ~DdsIdVec1dSubscriber();
double value() const;
QDateTime timestamp() const;
Q_INVOKABLE void init(
QtToDds* dds,
const QString& topic,
const QString& id,
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::IdVec1d>> m_reader;
QString m_id;
};
class DdsIdVec1dPublisher : public QObject
{
Q_OBJECT
Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged)
public:
explicit DdsIdVec1dPublisher(QObject *parent = nullptr);
virtual ~DdsIdVec1dPublisher();
double value() const;
Q_INVOKABLE void init(
QtToDds* dds,
const QString& topic,
const QString& id,
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::IdVec1d>> m_writer;
};