Program Listing for File DdsStateAutomaton.hpp

Return to documentation for file (sinspekto/DdsStateAutomaton.hpp)

#pragma once

#include "sinspekto/QtToDds.hpp"

class DdsStateAutomaton : public QObject
{
  Q_OBJECT
  Q_PROPERTY(fkin::ProcessStateKind state READ state NOTIFY stateChanged)
  Q_PROPERTY(QString stateName READ stateName NOTIFY stateNameChanged)

public:
  explicit DdsStateAutomaton(QObject *parent = nullptr);
  virtual ~DdsStateAutomaton();
  fkin::ProcessStateKind state() const;
  QString stateName() const;
  Q_INVOKABLE void init(
      QtToDds* dds,
      const QString& topic,
      const QString& stateIdentifier);

signals:
  void stateChanged(fkin::ProcessStateKind state);
  void stateNameChanged(QString stateName);
  void eventHeard();

public slots:
  void updateState();

private:
  std::unique_ptr<sinspekto::Reader<fkin::ProcessStateAutomaton>> m_reader;
  QString m_identifier;
};