添加农业环境模块,集成 MQTT 客户端功能,支持配置参数和数据发布
This commit is contained in:
25
components/agri_env/include/agri_env.h
Normal file
25
components/agri_env/include/agri_env.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user