10 #ifndef _AIOT_AT_API_H_ 11 #define _AIOT_AT_API_H_ 13 #if defined(__cplusplus) 18 #include "core_list.h" 22 #define MODULE_NAME_AT "AT" 27 #define STATE_AT_BASE (-0x1000) 28 #define STATE_AT_ALREADY_INITED (-0x1003) 29 #define STATE_AT_NOT_INITED (-0x1004) 30 #define STATE_AT_UART_TX_FUNC_MISSING (-0x1005) 31 #define STATE_AT_GET_RSP_FAILED (-0x1006) 32 #define STATE_AT_RINGBUF_OVERFLOW (-0x1007) 33 #define STATE_AT_RX_TIMEOUT (-0x1008) 34 #define STATE_AT_NO_AVAILABLE_LINK (-0x1009) 35 #define STATE_AT_TX_TIMEOUT (-0x100A) 36 #define STATE_AT_TX_ERROR (-0x100B) 37 #define STATE_AT_RINGBUF_NO_DATA (-0x100C) 38 #define STATE_AT_UART_TX_FUNC_NULL (-0x100D) 39 #define STATE_AT_NO_DATA_SLOT (-0x100F) 40 #define STATE_AT_LINK_IS_DISCONN (-0x1010) 41 #define STATE_AT_UART_TX_FAILED (-0x1011) 46 #define AIOT_AT_CMD_LEN_MAXIMUM (128) 47 #define AIOT_AT_RSP_LEN_MAXIMUM (64) 48 #define AIOT_AT_TX_TIMEOUT_DEFAULT (5000) 49 #define AIOT_AT_RX_TIMEOUT_DEFAULT (5000) 50 #define AIOT_AT_DATA_RB_SIZE_DEFAULT (1200) 51 #define AIOT_AT_RSP_RB_SIZE_DEFAULT (50) 52 #define AIOT_AT_CMD_RETRY_TIME (3) 53 #define AIOT_AT_RINGBUF_RETRY_INTERVAL (100) 54 #define AIOT_AT_SOCKET_NUM (5) 57 #define AIOT_UART_DISABLE_RX_IT() do {;} while(0) 58 #define AIOT_UART_ENABLE_RX_IT() do {;} while(0) 168 uint32_t rsp_buf_offset;
229 int32_t
aiot_at_nwk_connect(uint8_t socket_id,
const char *host, uint16_t port, uint32_t timeout);
243 int32_t
aiot_at_nwk_send(uint8_t socket_id,
const uint8_t *buffer, uint32_t len, uint32_t timeout);
257 int32_t
aiot_at_nwk_recv(uint8_t socket_id, uint8_t *buffer, uint32_t len, uint32_t timeout_ms);
288 #if defined(__cplusplus) int32_t aiot_at_bootstrap(void)
模组启动, 内部发送模组相关的AT命令已启动模组, 启动完成后, 模组将获取到IP地址
Definition: aiot_at_api.c:408
ringbuf结构体定义
Definition: aiot_at_api.h:189
int32_t aiot_at_nwk_recv(uint8_t socket_id, uint8_t *buffer, uint32_t len, uint32_t timeout_ms)
内部会从对应的数据ringbu中读取网络数据, 可对接到core_sysdep_network_recv网络接口
Definition: aiot_at_api.c:580
Definition: aiot_at_api.h:63
Definition: aiot_at_api.h:65
int32_t aiot_at_init(void)
初始化AT组件
Definition: aiot_at_api.c:308
core_at_parse_sm_t sm
Definition: aiot_at_api.h:165
aiot_at_option_t
AT组件配置选项
Definition: aiot_at_api.h:61
Definition: aiot_at_api.h:62
SDK Core系统依赖头文件, 所有Core中的系统依赖均在此文件中列出
uint32_t data_len
Definition: aiot_at_api.h:152
Definition: aiot_at_api.h:133
char * delay_rsp
Definition: aiot_at_api.h:109
int32_t aiot_at_deinit(void)
反初始化AT组件
Definition: aiot_at_api.c:792
AT命令请求响应结构体定义
Definition: aiot_at_api.h:110
int32_t aiot_at_setopt(aiot_at_option_t opt, void *data)
配置AT组件, 主要为配置串口发送回调函数
Definition: aiot_at_api.c:376
Definition: aiot_at_api.h:202
AT组件上下文数据结构体
Definition: aiot_at_api.h:235
Definition: aiot_at_api.h:147
core_at_parser_state_t state
Definition: aiot_at_api.h:153
void * tx_mutex
Definition: aiot_at_api.h:171
Definition: aiot_at_api.h:145
uint32_t rsp_timeout
Definition: aiot_at_api.h:163
Definition: aiot_at_api.h:146
Definition: aiot_at_api.h:204
int32_t aiot_at_nwk_close(uint8_t socket_id)
内部会调用模组相关的AT命令, 关闭连接链路。可对接到core_sysdep_network_deinit网络接口 ...
Definition: aiot_at_api.c:619
数据链路上下文结构体
Definition: aiot_at_api.h:210
Definition: aiot_at_api.h:150
int32_t aiot_at_nwk_open(uint8_t *socket_id)
为对应的链路ID创建ringbuf资源
Definition: aiot_at_api.c:428
int32_t aiot_at_nwk_send(uint8_t socket_id, const uint8_t *buffer, uint32_t len, uint32_t timeout)
内部会调用模组相关的AT命令, 通过串口发送TCP数据。可对接到core_sysdep_network_send网络接口 ...
Definition: aiot_at_api.c:554
int32_t aiot_at_uart_reception(uint8_t data)
为AT组件提供串口数据
Definition: aiot_at_api.c:605
#define AIOT_AT_RSP_LEN_MAXIMUM
Definition: aiot_at_api.h:47
#define AIOT_AT_SOCKET_NUM
Definition: aiot_at_api.h:54
uint32_t curr_link_id
Definition: aiot_at_api.h:151
core_at_link_status_t
模组数据链路状态
Definition: aiot_at_api.h:201
int32_t aiot_at_nwk_connect(uint8_t socket_id, const char *host, uint16_t port, uint32_t timeout)
内部会调用模组相关的AT命令, 通过串口发送TCP建连命令。可对接到core_sysdep_network_establish网络接口 ...
Definition: aiot_at_api.c:484
int32_t(* aiot_at_uart_tx_func_t)(const uint8_t *p_data, uint16_t len, uint32_t timeout)
串口发送回调函数定义
Definition: aiot_at_api.h:80
uint8_t link_status
Definition: aiot_at_api.h:140
Definition: aiot_at_api.h:203
core_at_parser_state_t
Definition: aiot_at_api.h:144
uint32_t expected_len
Definition: aiot_at_api.h:111
at_rsp_result_t(* at_rsp_handler_t)(char *rsp)
接受到应答数据后的用户处理回调函数原型定义
Definition: aiot_at_api.h:96