Program Listing for File RatatoskCurrentAtDepth.hpp

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

#pragma once

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

class RatatoskCurrentAtDepthSubscriber : public QObject
{
  Q_OBJECT
  Q_PROPERTY(double depth READ depth NOTIFY depthChanged)
  Q_PROPERTY(double direction READ direction NOTIFY directionChanged)
  Q_PROPERTY(double speed READ speed NOTIFY speedChanged)
  Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)

public:
  explicit RatatoskCurrentAtDepthSubscriber(QObject *parent = nullptr);
  virtual ~RatatoskCurrentAtDepthSubscriber();
  double depth() const;
  double direction() const;
  double speed() const;
  QDateTime timestamp() const;
  Q_INVOKABLE void init(
      QtToDds* dds,
      const QString& topic,
      bool with_listener=true);

signals:
  void depthChanged(double depth);
  void directionChanged(double direction);
  void speedChanged(double speed);
  void timestampChanged(QDateTime timestamp);
  void eventHeard();

public slots:
  void updateValue();

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

};