ESP32-PaxCounter/include/mqttclient.h

26 lines
732 B
C
Raw Normal View History

2020-05-16 23:49:34 +02:00
#ifndef _MQTTCLIENT_H
#define _MQTTCLIENT_H
#include "globals.h"
#include "rcommand.h"
#include <ETH.h>
#include <PubSubClient.h>
2020-05-21 19:42:42 +02:00
#define MQTT_INTOPIC "paxcounter_in/"
#define MQTT_OUTTOPIC "paxcounter_out/"
2020-05-16 23:49:34 +02:00
#define MQTT_PORT 1883
2020-05-17 23:07:38 +02:00
#define MQTT_SERVER "broker.hivemq.com"
2020-05-22 00:07:49 +02:00
#define MQTT_RETRYSEC 10 // retry reconnect every 10 seconds
2020-05-16 23:49:34 +02:00
extern TaskHandle_t mqttTask;
2020-05-21 19:42:42 +02:00
extern PubSubClient mqttClient;
2020-05-16 23:49:34 +02:00
void mqtt_enqueuedata(MessageBuffer_t *message);
void mqtt_queuereset(void);
void mqtt_client_task(void *param);
2020-05-20 18:29:07 +02:00
int mqtt_connect(const char *my_host, const uint16_t my_port);
2020-05-16 23:49:34 +02:00
void mqtt_callback(char *topic, byte *payload, unsigned int length);
2020-05-20 12:40:37 +02:00
void NetworkEvent(WiFiEvent_t event);
2020-05-16 23:49:34 +02:00
esp_err_t mqtt_init(void);
#endif // _MQTTCLIENT_H