26 lines
677 B
C
26 lines
677 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include "esp_err.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* 启动 MQTT 客户端连接。 */
|
|
esp_err_t agri_env_mqtt_start(void);
|
|
/* 停止 MQTT 客户端连接并释放资源。 */
|
|
esp_err_t agri_env_mqtt_stop(void);
|
|
/* 查询 MQTT 当前是否已连接。 */
|
|
bool agri_env_mqtt_is_connected(void);
|
|
/* 发布指定的 JSON 载荷到指定主题。 */
|
|
esp_err_t agri_env_mqtt_publish(const char *topic, const char *payload, int qos, int retain);
|
|
/* 发布固定 MQTT-only 心跳载荷到指定主题。 */
|
|
esp_err_t agri_env_mqtt_publish_latest(const char *topic, int qos, int retain);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|