ESP32-PaxCounter/include/mqttclient.h

29 lines
855 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-06-16 20:29:49 +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-06-16 20:29:49 +02:00
//#define MQTT_SERVER "test.mosquitto.org"
#define MQTT_RETRYSEC 20 // retry reconnect every 20 seconds
#define MQTT_KEEPALIVE 10 // seconds to keep alive server connections
2020-05-16 23:49:34 +02:00
extern TaskHandle_t mqttTask;
void mqtt_enqueuedata(MessageBuffer_t *message);
void mqtt_queuereset(void);
2020-06-16 20:29:49 +02:00
void mqtt_irq(void);
void mqtt_loop(void);
2020-05-16 23:49:34 +02:00
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