7#define MQTT_MSG_RELEASE 0
8#define MQTT_MSG_TCP_TX_DONE 1
9#define MQTT_MSG_TIMER_PING 2
10#define MQTT_MSG_RECONNECT 3
11#define MQTT_MSG_CLOSE 4
13#define MQTT_ERROR_STATE_SOCKET -1
14#define MQTT_ERROR_STATE_DISCONNECT -2
16#ifndef MQTT_RECV_BUF_LEN_MAX
17#if defined(CHIP_EC618) || defined(CHIP_EC718)|| defined(CHIP_EC716)
18#define MQTT_RECV_BUF_LEN_MAX (80*1024)
20#define MQTT_RECV_BUF_LEN_MAX 4096
int luat_mqtt_init(luat_mqtt_ctrl_t *mqtt_ctrl, int adapter_index)
初始化luatos_mqtt(初始化MQTT)
LUAT_MQTT_STATE_E luat_mqtt_state_get(luat_mqtt_ctrl_t *mqtt_ctrl)
获取MQTT连接状态
struct luat_mqtt_connopts luat_mqtt_connopts_t
设置MQTT服务端服务器信息、加密信息
int luat_mqtt_set_connopts(luat_mqtt_ctrl_t *mqtt_ctrl, luat_mqtt_connopts_t *opts)
设置MQTT服务器信息、加密信息函数
int luat_mqtt_set_rxbuff_size(luat_mqtt_ctrl_t *mqtt_ctrl, uint32_t rxbuff_size)
设置MQTT服务器接收buff大小
int luat_mqtt_set_cb(luat_mqtt_ctrl_t *mqtt_ctrl, luat_mqtt_cb_t mqtt_cb)
设置MQTT事件回调函数
int luat_mqtt_reconnect(luat_mqtt_ctrl_t *mqtt_ctrl)
设置MQTT服务器信息、加密信息函数
int luat_mqtt_ping(luat_mqtt_ctrl_t *mqtt_ctrl)
发送ping包
LUAT_RT_RET_TYPE luat_mqtt_timer_callback(LUAT_RT_CB_PARAM)
MQTT定时器内部回调(用户无需关心)
int32_t luat_mqtt_callback(void *data, void *param)
MQTT报文解析内部回调(用户无需关心)
int l_luat_mqtt_msg_cb(luat_mqtt_ctrl_t *ctrl, int arg1, int arg2)
MQTT内部回调(用户无需关心)
void(* luat_mqtt_cb_t)(luat_mqtt_ctrl_t *luat_mqtt_ctrl, uint16_t event)
int luat_mqtt_connect(luat_mqtt_ctrl_t *mqtt_ctrl)
发起MQTT连接
int luat_mqtt_set_will(luat_mqtt_ctrl_t *mqtt_ctrl, const char *topic, const char *payload, size_t payload_len, uint8_t qos, size_t retain)
设置遗嘱消息
int luat_mqtt_send_packet(void *socket_info, const void *buf, unsigned int count)
MQTT报文发送(用户无需关心)
void luat_mqtt_close_socket(luat_mqtt_ctrl_t *mqtt_ctrl)
关闭MQTT连接,如果设置了自动重连,回重新自动连接
void luat_mqtt_release_socket(luat_mqtt_ctrl_t *mqtt_ctrl)
释放MQTT资源,释放后luatos_mqtt对象不可用
size_t client_password_len
const char * client_password
LUAT_MQTT_STATE_E mqtt_state
mqtt_broker_handle_t broker
uint8_t * mqtt_packet_buffer