Class DdsIdVec2dSubscriber

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsIdVec2dSubscriber : public QObject

Subscriber for DDS type IdVec2d as a QML element.

This class is a QML element and enables QML applications to gain access to a DDS signal type as a read-only QML property.

Public Functions

explicit DdsIdVec2dSubscriber(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsIdVec2dSubscriber()

Destructor.

QVector2D value() const

Property accessor for vector in QML.

Returns

Value as QML compatible vector.

QDateTime timestamp() const

Property accessor for timestamp in QML.

Returns

Timestamp as QML compatible type.

void init(QtToDds *dds, const QString &topic, const QString &id, bool with_listener = true)

Initializes DDS reader and connects Qt signals and slots.

Parameters
  • dds[in] Pointer to QtToDds instance.

  • topic[in] Name of DDS topic for which to subscribe.

  • id[in] Key identifier for the topic instance.

  • with_listener[in] Use DdsReaderListener callback to trigger eventHeard() signal.

Public Slots

void updateValue()

Takes all new samples from the subscribed topic and uses the last sample.

This slot calls take() from the DDS reader and stores the last new sample as the current value. If there were a new sample it emits valueChanged().

Signals

void valueChanged(QVector2D value)

DDS value has changed.

This signal is connected to the QML DdsIdVec2dSubscriber::value property.

Parameters

value[out] New vector value.

void timestampChanged(QDateTime timestamp)

Timestamp of DDS value has changed.

This signal is connected to the QML DdsIdVec2dSubscriber::timestamp property.

Parameters

timestamp[out] New timestamp value.

void eventHeard()

DdsReaderListener calls this signal when there is data available on the subscribed topic.

If DdsIdVec2dSubscriber is initialized with_listener=true, eventHeard() will be connected to the slot updateValue().

Properties

QVector2D value

DDS 2d-vector as QVector2D QML property.

QDateTime timestamp

Timestamp of sample.

Private Members

std::unique_ptr<sinspekto::Reader<fkin::IdVec2d>> m_reader

The DDS reader wrapper class.

QString m_id

Key identifier for topic instance.