29 lines
1 KiB
C
29 lines
1 KiB
C
#ifndef ENSAHT_MQTT_H
|
|
#define ENSAHT_MQTT_H
|
|
|
|
#include "lwip/apps/mqtt.h"
|
|
|
|
typedef struct {
|
|
mqtt_client_t *client;
|
|
ip_addr_t server_addr;
|
|
const char *hostname;
|
|
u16_t port;
|
|
struct mqtt_connect_client_info_t client_info;
|
|
mqtt_connection_cb_t connect_cb;
|
|
void *connect_arg;
|
|
} ensaht_mqtt_t;
|
|
|
|
void ensaht_mqtt_init(ensaht_mqtt_t *mqtt);
|
|
err_t ensaht_mqtt_connect(ensaht_mqtt_t *mqtt, const char *hostname, u16_t port,
|
|
const struct mqtt_connect_client_info_t *client_info,
|
|
mqtt_connection_cb_t cb, void *arg);
|
|
void ensaht_mqtt_disconnect(ensaht_mqtt_t *mqtt);
|
|
|
|
err_t ensaht_mqtt_publish(mqtt_client_t *client, const char *topic,
|
|
const void *payload, u16_t payload_length,
|
|
mqtt_request_cb_t cb, void *arg);
|
|
err_t ensaht_mqtt_publish_client(ensaht_mqtt_t *mqtt, const char *topic,
|
|
const void *payload, u16_t payload_length,
|
|
mqtt_request_cb_t cb, void *arg);
|
|
|
|
#endif
|