WS_MQTT.h 806 B

123456789101112131415161718192021222324252627
  1. #ifndef _WS_MQTT_H_
  2. #define _WS_MQTT_H_
  3. #include <ArduinoJson.h>
  4. #include <Arduino.h>
  5. #include <PubSubClient.h>
  6. #include <WiFi.h>
  7. #include <WiFiClientSecure.h>
  8. #include "WS_GPIO.h"
  9. #include "WS_Information.h"
  10. #define MSG_BUFFER_SIZE (50)
  11. #define MQTT_Mode 3
  12. extern bool Relay_Flag[6]; // Relay current status flag
  13. extern void Relay_Analysis(uint8_t *buf,uint8_t Mode_Flag);
  14. void callback(char* topic, byte* payload, unsigned int length); // MQTT subscribes to callback functions for processing received messages
  15. void setup_wifi();
  16. void reconnect(); // Reconnect to the MQTT server
  17. void sendJsonData(); // Send data in JSON format to MQTT server
  18. void MQTT_Init();
  19. void MQTT_Loop();
  20. #endif