mqtt_communication.h 704 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <pcl/point_types.h>
  3. #include <pcl/point_cloud.h>
  4. #include "pahoc/mqtt_async.h"
  5. #include "tool/log.hpp"
  6. class Tof3DMqttAsyncClient : public MqttAsyncClient {
  7. public:
  8. static Tof3DMqttAsyncClient *iter() {
  9. static Tof3DMqttAsyncClient *instance = nullptr;
  10. if (instance == nullptr) {
  11. instance = new Tof3DMqttAsyncClient();
  12. }
  13. return instance;
  14. }
  15. void init(const std::string &file);
  16. protected:
  17. Tof3DMqttAsyncClient() = default;
  18. private:
  19. void run();
  20. static int CloudDataArrived(MqttAsyncClient *client, char *topicName, int topicLen, MQTTAsync_message *message);
  21. public:
  22. private:
  23. std::mutex m_cloud_mutex;
  24. };