//
// 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 fromProtoMessage(const google::protobuf::Message& messge);
    bool toProtoMessage(google::protobuf::Message& message)const;

    /*void fromStatu(double x,double y,double theta,double v,double vth);
    void fromNavSpeed(const NavMessage::Speed& speed);
    void fromNavCmd(const NavMessage::NavCmd& cmd);
    void fromNavStatu(const NavMessage::NavStatu& statu);

    bool toStatu(double& x,double& y,double& theta,double& v,double& vth);
    bool toNavSpeed(NavMessage::Speed& speed);
    bool toNavCmd(NavMessage::NavCmd& cmd);
    bool toNavStatu(NavMessage::NavStatu& statu);*/


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

};


#endif //PAHOC_SAMPLE_SAMPLES_DEVICE_MSG_H_
