Class RatatoskCurrentProfileSubscriber

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class RatatoskCurrentProfileSubscriber : public QObject

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


The initialization is deferred to an init() function.


parent[in] QObject pointer.

virtual ~RatatoskCurrentProfileSubscriber()


std::vector<double> depths() const

Property accessor for current depths in QML.


depths [m]

std::vector<double> directions() const

Property accessor for current directions in QML.


directions [rad]

std::vector<double> speeds() const

Property accessor for current speeds in QML.


speeds [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 depthsChanged(std::vector<double> depths)

DDS value has changed.

This signal is connected to the QML RatatoskCurrentProfileSubscriber::depths property.


depths[out] New values.

void directionsChanged(std::vector<double> directions)

DDS value has changed.

This signal is connected to the QML RatatoskCurrentProfileSubscriber::directions property.


directions[out] New values.

void speedsChanged(std::vector<double> speeds)

DDS value has changed.

This signal is connected to the QML RatatoskCurrentProfileSubscriber::speeds property.


speeds[out] New values.

void timestampChanged(QDateTime timestamp)

Timestamp of DDS value has changed.

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


timestamp[out] New timestamp value.

void eventHeard()

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

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


std::vector<double> depths

Depths [m].

std::vector<double> directions

Directions [rad].

std::vector<double> speeds

Speeds [m/s].

QDateTime timestamp

Timestamp of sample.

Private Members

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

The DDS reader wrapper class.