123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- //
- // Created by zx on 23-2-22.
- //
- #ifndef PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
- #define PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
- #include "message.pb.h"
- #include <mutex>
- class MqttMsg
- {
- public:
- enum Dtype
- {
- ePointCloudXYZ,
- ePointCloudXYZI,
- eString,
- eImage,
- eAGVStatu,
- eAGVSpeed
- };
- public:
- MqttMsg();
- MqttMsg(char* data,const int length);
- MqttMsg(const MqttMsg& msg);
- MqttMsg& operator=(const MqttMsg& msg);
- ~MqttMsg();
- char* data()const;
- int length()const;
- void fromStatu(double x,double y,double theta,double v,double vth);
- void fromSpeed(double v,double vth);
- void fromNavCmd(const NavCmd& cmd);
- void fromNavStatu(const NavStatu& statu);
- bool toStatu(double& x,double& y,double& theta,double& v,double& vth);
- bool toSpeed(double& v,double& vth);
- bool toNavCmd(NavCmd& cmd);
- bool toNavStatu(NavStatu& statu);
- protected:
- char* data_=nullptr;
- int length_=0;
- std::mutex mutex_;
- };
- #endif //PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
|