奥特QT DDS 插件库
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

38 líneas
1.1KB

  1. #pragma once
  2. #include <QObject>
  3. #include "interfaces/plugin_interface.hpp"
  4. #include <fastdds/dds/domain/DomainParticipant.hpp>
  5. #include <fastdds/dds/publisher/Publisher.hpp>
  6. #include <fastdds/dds/publisher/DataWriter.hpp>
  7. #include <fastdds/dds/topic/Topic.hpp>
  8. #include <fastdds/dds/topic/TypeSupport.hpp>
  9. using namespace eprosima::fastdds::dds;
  10. class AQTPackageMachinePlug : public QObject, public AuseftDDSPluginInterface
  11. {
  12. Q_OBJECT
  13. Q_PLUGIN_METADATA(IID AuseftDDSPluginInterface_iid FILE "AQTPackageMachinePlug.json")
  14. Q_INTERFACES(AuseftDDSPluginInterface)
  15. public:
  16. explicit AQTPackageMachinePlug(QObject *parent = nullptr);
  17. ~AQTPackageMachinePlug() override;
  18. Q_INVOKABLE bool init() override;
  19. Q_INVOKABLE void publishOnce() override;
  20. Q_INVOKABLE QString echo(const QString& message) override;
  21. Q_INVOKABLE int calculate(int a, int b) override;
  22. signals:
  23. void messagePublished(const QString& message, int index);
  24. private:
  25. DomainParticipant* participant_;
  26. Publisher* publisher_;
  27. Topic* topic_;
  28. DataWriter* writer_;
  29. TypeSupport type_;
  30. int message_index_;
  31. };