mqttmsg.h 868 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // Created by zx on 23-2-22.
  3. //
  4. #ifndef PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
  5. #define PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
  6. #include <mutex>
  7. class MqttMsg
  8. {
  9. public:
  10. enum Dtype
  11. {
  12. ePointCloudXYZ,
  13. ePointCloudXYZI,
  14. eString,
  15. eImage,
  16. eAGVStatu,
  17. eAGVSpeed
  18. };
  19. public:
  20. MqttMsg();
  21. MqttMsg(char* data,const int length);
  22. MqttMsg(const MqttMsg& msg);
  23. MqttMsg& operator=(const MqttMsg& msg);
  24. ~MqttMsg();
  25. char* data()const;
  26. int length()const;
  27. void fromStatu(double x,double y,double theta,double v,double vth);
  28. void fromSpeed(double v,double vth);
  29. bool toStatu(double& x,double& y,double& theta,double& v,double& vth);
  30. bool toSpeed(double& v,double& vth);
  31. protected:
  32. char* data_=nullptr;
  33. int length_=0;
  34. std::mutex mutex_;
  35. };
  36. #endif //PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_