//
// Created by zx on 23-2-22.
//

#ifndef PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
#define PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_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);

    bool toStatu(double& x,double& y,double& theta,double& v,double& vth);
    bool toSpeed(double& v,double& vth);

 protected:
    char* data_=nullptr;
    int length_=0;
    std::mutex mutex_;

};


#endif //PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
