123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- //
- // Created by zx on 23-3-14.
- //
- #ifndef NAVIGATION_MPC_MONITOR_MONITOR_EMQX_H_
- #define NAVIGATION_MPC_MONITOR_MONITOR_EMQX_H_
- #include <mutex>
- #include "emqx/paho_client.h"
- typedef void (*StatuCallback)(double x,double y,double theta,double v,double vth,void* context);
- class Monitor_emqx
- {
- public:
- enum SpeedType{
- eStop=0,
- eRotate=1,
- eHorizontal=2,
- eMPC=3,
- };
- public:
- Monitor_emqx(std::string nodeId,std::string pubTopic,std::string subTopic);
- ~Monitor_emqx();
- bool Connect(std::string ip,int port);
- void set_statu_arrived_callback(StatuCallback callback,void* context);
- void set_speed(SpeedType type,double v,double a);
- void stop();
- protected:
- StatuCallback StatuArrivedCallback_;
- static void StatuArrivedCallback(std::string topic,int QOS,MqttMsg& msg,void* context);
- std::mutex mtx_;
- Paho_client* client_;
- void* context_;
- std::string nodeId_;
- std::string pubTopic_;
- std::string subTopic_;
- public:
- int heat_=0;
- MqttMsg msg_;
- };
- #endif //NAVIGATION_MPC_MONITOR_MONITOR_EMQX_H_
|