DataMqttClient.h 958 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include "../common/iobuffer.h"
  3. #include "../common/sensor_socket.h"
  4. class CMessageQueue;
  5. class CDataMqttSensor//:public ISensorNotify
  6. {
  7. public:
  8. CDataMqttSensor(CMessageQueue* q);
  9. void SetSensorMQTT(MQTTAsync mqClient,std::string Esn);
  10. void Stop(const char* _Esn);
  11. static MQTTAsync_responseOptions opts;
  12. static MQTTAsync m_mqttClient;
  13. static bool _run;
  14. static char** subTopic;
  15. static std::string _Esn;
  16. static void Disconnect(void* context, char* cause); //���ӶϿ�callback
  17. static int RecevieMessage(void* context, char* pubTopic, int topicLen, MQTTAsync_message* message);
  18. static void onConnectFailure(void* context, MQTTAsync_failureData* response); //����ʧ��callback
  19. static void onConnectCallCBack(void* context, char* cause); //���ӳɹ�callback
  20. static void sendMessage(char* data, int qos, const char* pubTopic);
  21. private:
  22. CMessageQueue* _message;
  23. };