Program Listing for File RatatoskWindInfo.hpp

Return to documentation for file (sinspekto/ratatosk/RatatoskWindInfo.hpp)

#pragma once

#include "sinspekto/QtToDds.hpp"
#include "QDateTime"

class RatatoskWindInfoSubscriber : public QObject
{
  Q_OBJECT
  Q_PROPERTY(double trueSpeed READ trueSpeed NOTIFY trueSpeedChanged)
  Q_PROPERTY(double trueDir READ trueDir NOTIFY trueDirChanged)
  Q_PROPERTY(double relSpeed READ relSpeed NOTIFY relSpeedChanged)
  Q_PROPERTY(double relDir READ relDir NOTIFY relDirChanged)
  Q_PROPERTY(double trueWindRelDir READ trueWindRelDir NOTIFY trueWindRelDirChanged)
  Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)

public:
  explicit RatatoskWindInfoSubscriber(QObject *parent = nullptr);
  virtual ~RatatoskWindInfoSubscriber();
  double trueSpeed() const;
  double trueDir() const;
  double relSpeed() const;
  double relDir() const;
  double trueWindRelDir() const;
  QDateTime timestamp() const;
  Q_INVOKABLE void init(
      QtToDds* dds,
      const QString& topic,
      bool with_listener=true);

signals:
  void trueSpeedChanged(double trueSpeed);
  void trueDirChanged(double trueDir);
  void relSpeedChanged(double relSpeed);
  void relDirChanged(double relDir);
  void trueWindRelDirChanged(double trueWindRelDir);
  void timestampChanged(QDateTime timestamp);
  void eventHeard();

public slots:
  void updateValue();

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

};