Class RatatoskDoubleValPublisher

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class RatatoskDoubleValPublisher : public QObject

Publisher for DDS type Double as a QML element.

This class is a QML element and enables QML applications to publish a DDS signal type from a writable QML property.

Public Functions

explicit RatatoskDoubleValPublisher(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~RatatoskDoubleValPublisher()

Destructor.

double val() const

Property accessor for double value as QML property.

Returns

Double value.

void init(QtToDds *dds, const QString &topic, double start_value, bool send_first)

Initializes DDS writer and sets initial value.

Parameters
  • dds[in] Pointer to QtToDds instance.

  • topic[in] Name of DDS topic to publish.

  • start_value[in] Initial value of the signal.

  • send_first[in] Whether to forcefully send the initial value.

Public Slots

void setVal(double val)

Write function for the QML property, publishes value on DDS.

This slot publishes the double value onto the DDS topic. It also emits a valChanged().

Note

It only publishes or emits a signal if the QML property value has changed!

Parameters

val[in] New double value.

void publish()

Publish on DDS the value already set.

Signals

void valChanged(double value)

DDS value has has changed.

This signal is connected to the QML RatatoskDoubleValPublisher::val property.

Parameters

value[out] New Double value.

Properties

double val

DDS DoubleVal as double QML property.

Private Members

std::unique_ptr<sinspekto::Writer<ratatosk::types::DoubleVal>> m_writer

The DDS writer wrapper class.