interface_mqtt.h 1.0 KB

123456789101112131415161718192021222324252627282930
  1. #ifdef ENABLE_MQTT
  2. #pragma once
  3. #ifndef INTERFACE_MQTT_H
  4. #define INTERFACE_MQTT_H
  5. #include <string>
  6. #include <map>
  7. #include <functional>
  8. bool MQTT_Configure(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password,
  9. std::string _maintopic, std::string _lwt, std::string _lwt_connected, std::string _lwt_disconnected,
  10. int _keepalive, int SetRetainFlag, void *callbackOnConnected);
  11. int MQTT_Init();
  12. void MQTTdestroy_client(bool _disable);
  13. bool MQTTPublish(std::string _key, std::string _content, int retained_flag = 1); // retained Flag as Standart
  14. bool getMQTTisEnabled();
  15. bool getMQTTisConnected();
  16. void MQTTregisterConnectFunction(std::string name, std::function<void()> func);
  17. void MQTTunregisterConnectFunction(std::string name);
  18. void MQTTregisterSubscribeFunction(std::string topic, std::function<bool(std::string, char*, int)> func);
  19. void MQTTdestroySubscribeFunction();
  20. void MQTTconnected();
  21. #endif //INTERFACE_MQTT_H
  22. #endif //#ENABLE_MQTT