mqtt_communication.h 870 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include "vzense/device_tof3d.h"
  7. #include "net_message_trans.h"
  8. #include "detect/data_buf_lable.hpp"
  9. class Tof3DMqttAsyncClient : public MqttAsyncClient {
  10. friend class MqttAsyncClient;
  11. public:
  12. static Tof3DMqttAsyncClient *iter() {
  13. static Tof3DMqttAsyncClient *instance = nullptr;
  14. if (instance == nullptr) {
  15. instance = new Tof3DMqttAsyncClient();
  16. }
  17. return instance;
  18. }
  19. void init(const std::string &file);
  20. protected:
  21. private:
  22. Tof3DMqttAsyncClient() = default;
  23. void run();
  24. static int CloudDataArrived(void *client, char *topicName, int topicLen, MQTTAsync_message *message);
  25. public:
  26. private:
  27. std::thread *t = nullptr;
  28. Thread_condition *condit = nullptr;
  29. };