Program Listing for File DdsKinematics2DBuffer.hpp

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

#pragma once

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

class DdsKinematics2DBuffer : public DdsBuffer
{
  Q_OBJECT
  Q_PROPERTY(QPointF rangePosX READ rangePosX NOTIFY rangeChanged)
  Q_PROPERTY(QPointF rangePosY READ rangePosY NOTIFY rangeChanged)
  Q_PROPERTY(QPointF rangeCourse READ rangeCourse NOTIFY rangeChanged)
  Q_PROPERTY(QPointF rangeSpeed READ rangeSpeed NOTIFY rangeChanged)


public:
  explicit DdsKinematics2DBuffer(QObject *parent = nullptr);
  virtual ~DdsKinematics2DBuffer();
  QPointF rangePosX() const;
  QPointF rangePosY() const;
  QPointF rangeCourse() const;
  QPointF rangeSpeed() const;
  Q_INVOKABLE void init(
      QtToDds* dds,
      const QString& topic,
      const QString& id,
      int buffer_size,
      bool use_batch,
      bool with_listener=true);

signals:
  void rangeChanged(QPointF range, qml_enums::DimId dim);
  void eventHeard();
  void newData();

public slots:
  virtual void updateBuffers();

private:
  std::unique_ptr<sinspekto::Reader<fkin::Kinematics2D>> m_reader;
  std::unique_ptr<sinspekto::Reader<fkin::BatchKinematics2D>> m_batchReader;
  QString m_id;

};