mqttmsg.h 1.1 KB

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 "message.pb.h"
  7. #include <mutex>
  8. class MqttMsg
  9. {
  10. public:
  11. public:
  12. MqttMsg();
  13. MqttMsg(char* data,const int length);
  14. MqttMsg(const MqttMsg& msg);
  15. MqttMsg& operator=(const MqttMsg& msg);
  16. ~MqttMsg();
  17. char* data()const;
  18. int length()const;
  19. void fromProtoMessage(const google::protobuf::Message& messge);
  20. bool toProtoMessage(google::protobuf::Message& message)const;
  21. /*void fromStatu(double x,double y,double theta,double v,double vth);
  22. void fromNavSpeed(const NavMessage::Speed& speed);
  23. void fromNavCmd(const NavMessage::NavCmd& cmd);
  24. void fromNavStatu(const NavMessage::NavStatu& statu);
  25. bool toStatu(double& x,double& y,double& theta,double& v,double& vth);
  26. bool toNavSpeed(NavMessage::Speed& speed);
  27. bool toNavCmd(NavMessage::NavCmd& cmd);
  28. bool toNavStatu(NavMessage::NavStatu& statu);*/
  29. protected:
  30. char* data_=nullptr;
  31. int length_=0;
  32. std::mutex mutex_;
  33. };
  34. #endif //PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_