Program Listing for File RatatoskCurrentProfile.hpp

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

#pragma once

#include "sinspekto/QtToDds.hpp"
#include "QDateTime"
#include <vector>

class RatatoskCurrentProfileSubscriber : public QObject
{
  Q_OBJECT
  Q_PROPERTY(std::vector<double> depths READ depths NOTIFY depthsChanged)
  Q_PROPERTY(std::vector<double> directions READ directions NOTIFY directionsChanged)
  Q_PROPERTY(std::vector<double> speeds READ speeds NOTIFY speedsChanged)
  Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)

public:
  explicit RatatoskCurrentProfileSubscriber(QObject *parent = nullptr);
  virtual ~RatatoskCurrentProfileSubscriber();
  std::vector<double> depths() const;
  std::vector<double> directions() const;
  std::vector<double> speeds() const;
  QDateTime timestamp() const;
  Q_INVOKABLE void init(
      QtToDds* dds,
      const QString& topic,
      bool with_listener=true);

signals:
  void depthsChanged(std::vector<double> depths);
  void directionsChanged(std::vector<double> directions);
  void speedsChanged(std::vector<double> speeds);
  void timestampChanged(QDateTime timestamp);
  void eventHeard();

public slots:
  void updateValue();

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

};