Class RatatoskWindInfoSubscriber

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class RatatoskWindInfoSubscriber : public QObject

Subscriber for DDS type ratatosk::types::WindInfo 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 RatatoskWindInfoSubscriber(QObject *parent = nullptr)


The initialization is deferred to an init() function.


parent[in] QObject pointer.

virtual ~RatatoskWindInfoSubscriber()


double trueSpeed() const

Property accessor for trueSpeed in QML.


True speed [m/s]

double trueDir() const

Property accessor for trueDir in QML.


True direction [rad]

double relSpeed() const

Property accessor for relSpeed in QML.


Relative speed [m/s]

double relDir() const

Property accessor for relDir in QML.


Relative direction [rad]

double trueWindRelDir() const

Property accessor for trueWindRelDir in QML.


True wind relative direction [m/s]

QDateTime timestamp() const

Property accessor for timestamp in QML.


Timestamp as QML compatible type.

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

Initializes DDS reader and connects Qt signals and slots.

  • dds[in] Pointer to QtToDds instance.

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

  • 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 <…>Changed().


void trueSpeedChanged(double trueSpeed)

DDS value has changed.

This signal is connected to the QML RatatoskWindInfoSubscriber::trueSpeed property.


trueSpeed[out] New value.

void trueDirChanged(double trueDir)

DDS value has changed.

This signal is connected to the QML RatatoskWindInfoSubscriber::trueDir property.


trueDir[out] New value.

void relSpeedChanged(double relSpeed)

DDS value has changed.

This signal is connected to the QML RatatoskWindInfoSubscriber::relSpeed property.


relSpeed[out] New value.

void relDirChanged(double relDir)

DDS value has changed.

This signal is connected to the QML RatatoskWindInfoSubscriber::relDir property.


relDir[out] New value.

void trueWindRelDirChanged(double trueWindRelDir)

DDS value has changed.

This signal is connected to the QML RatatoskWindInfoSubscriber::trueWindRelDir property.


trueWindRelDir[out] New value.

void timestampChanged(QDateTime timestamp)

Timestamp of DDS value has changed.

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


timestamp[out] New timestamp value.

void eventHeard()

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

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


double trueSpeed

True speed [m/s].

double trueDir

True direction [rad].

double relSpeed

Relative speed [m/s].

double relDir

Relative direction [rad].

double trueWindRelDir

True wind relative direction [m/s].

QDateTime timestamp

Timestamp of sample.

Private Members

std::unique_ptr<sinspekto::Reader<ratatosk::types::WindInfo>> m_reader

The DDS reader wrapper class.