26 lines
968 B
C
26 lines
968 B
C
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef void (*mqtt_transport_connected_fn_t)(void *ctx);
|
|
typedef void (*mqtt_transport_message_fn_t)(const char *topic, size_t topic_len,
|
|
const char *data, size_t data_len, void *ctx);
|
|
typedef void (*mqtt_transport_heartbeat_fn_t)(void *ctx);
|
|
typedef struct {
|
|
const char *broker_uri;
|
|
const char *client_id;
|
|
const char *last_will_topic;
|
|
const char *last_will_payload;
|
|
uint32_t heartbeat_interval_seconds;
|
|
mqtt_transport_connected_fn_t on_connected;
|
|
mqtt_transport_message_fn_t on_message;
|
|
mqtt_transport_heartbeat_fn_t on_heartbeat;
|
|
void *ctx;
|
|
} mqtt_transport_config_t;
|
|
esp_err_t mqtt_transport_start(const mqtt_transport_config_t *config);
|
|
int mqtt_transport_publish(const char *topic, const char *payload, int qos, bool retain);
|
|
int mqtt_transport_subscribe(const char *topic, int qos);
|