Program Listing for File RatatoskDepthInfo.hpp

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

#pragma once

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

class RatatoskDepthInfoSubscriber : public QObject
{
  Q_OBJECT
  Q_PROPERTY(double depth READ depth NOTIFY depthChanged)
  Q_PROPERTY(double depthBelowTransducer READ depthBelowTransducer NOTIFY depthBelowTransducerChanged)
  Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)

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

signals:
  void depthChanged(double depth);
  void depthBelowTransducerChanged(double depthBelowTransducer);
  void timestampChanged(QDateTime timestamp);
  void eventHeard();

public slots:
  void updateValue();

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

};