Class DdsStateAutomaton

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsStateAutomaton : public QObject

Subscriber for DDS type ProcessStateAutomaton 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 properties.

This element is useful to gain access to the process state of external applications that use this DDS type to report its state in a QML application.

Note

Unlike most other adapters in sinspekto, the DDS QoS of this are implemented with a reader with dds::core::policy::Durability::TransientLocal() and dds::core::policy::Reliability::Reliable();, see DDS QoS for details.

Public Functions

explicit DdsStateAutomaton(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsStateAutomaton()

Destructor.

fkin::ProcessStateKind state() const

Property accessor for process state kind as an enum.

Returns

state as an enum.

QString stateName() const

Property accessor for process state name.

Returns

State as a human readable string.

void init(QtToDds *dds, const QString &topic, const QString &stateIdentifier)

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.

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

Public Slots

void updateState()

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 state. If there were a new sample it emits stateChanged() and stateNameChanged().

Signals

void stateChanged(fkin::ProcessStateKind state)

DDS process state value has changed.

This signal is connected to the QML DdsStateAutomaton::state property.

Parameters

state[out] New state value.

void stateNameChanged(QString stateName)

DDS process state name has changed.

This signal is connected to the QML DdsStateAutomaton::stateName property.

Parameters

stateName[out] New state name.

void eventHeard()

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

signal eventHeard() is connected to the slot updateState().

Properties

fkin::ProcessStateKind state

Subscribed process state kind.

QString stateName

Human readable name of state.

Private Members

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

The DDS reader wrapper class.

QString m_identifier

Key identifier for topic instance.