奥特QT DDS 插件库
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

53 rindas
1.3KB

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