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" 26 #define STATE_AT_BASE (-0x1000) 27 #define STATE_AT_ALREADY_INITED (-0x1003) 28 #define STATE_AT_NOT_INITED (-0x1004) 29 #define STATE_AT_UART_TX_FUNC_MISSING (-0x1005) 30 #define STATE_AT_GET_RSP_FAILED (-0x1006) 31 #define STATE_AT_RINGBUF_OVERFLOW (-0x1007) 32 #define STATE_AT_RX_TIMEOUT (-0x1008) 33 #define STATE_AT_NO_AVAILABLE_LINK (-0x1009) 34 #define STATE_AT_TX_TIMEOUT (-0x100A) 35 #define STATE_AT_TX_ERROR (-0x100B) 36 #define STATE_AT_RINGBUF_NO_DATA (-0x100C) 37 #define STATE_AT_UART_TX_FUNC_NULL (-0x100D) 38 #define STATE_AT_NO_DATA_SLOT (-0x100F) 39 #define STATE_AT_LINK_IS_DISCONN (-0x1010) 40 #define STATE_AT_UART_TX_FAILED (-0x1011) 45 #define AIOT_AT_CMD_LEN_MAXIMUM (128) 46 #define AIOT_AT_RSP_LEN_MAXIMUM (128) 47 #define AIOT_AT_TX_TIMEOUT_DEFAULT (10000) 48 #define AIOT_AT_RX_TIMEOUT_DEFAULT (10000) 49 #define AIOT_AT_DATA_RB_SIZE_DEFAULT (4096) 50 #define AIOT_AT_RSP_RB_SIZE_DEFAULT (4096) 51 #define AIOT_AT_CMD_RETRY_TIME (3) 52 #define AIOT_AT_RINGBUF_RETRY_INTERVAL (5) 53 #define AIOT_AT_SOCKET_NUM (5) 54 #define AIOT_AT_MAX_PACKAGE_SIZE (1460) 55 #define AT_SOCKET_ID_START (1) 318 int32_t
aiot_at_nwk_connect(uint8_t socket_id,
const char *host, uint16_t port, uint32_t timeout);
332 int32_t
aiot_at_nwk_send(uint8_t socket_id,
const uint8_t *buffer, uint32_t len, uint32_t timeout);
346 int32_t
aiot_at_nwk_recv(uint8_t socket_id, uint8_t *buffer, uint32_t len, uint32_t timeout_ms);
377 #if defined(__cplusplus) core_ip_status_t ip_status
Definition: aiot_at_api.h:239
int32_t aiot_at_bootstrap(void)
模组启动, 内部发送模组相关的AT命令已启动模组, 启动完成后, 模组将获取到IP地址
Definition: aiot_at_api.c:408
ringbuf结构体定义
Definition: aiot_at_api.h:189
int32_t core_at_socket_status(uint32_t id, core_at_link_status_t status)
Definition: aiot_at_api.c:826
const core_at_cmd_item_t * cmd_content
Definition: aiot_at_api.h:247
core_at_urc_item_t * urc_register
Definition: aiot_at_api.h:177
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
char * error_prefix
Definition: aiot_at_api.h:174
char * fmt
Definition: aiot_at_api.h:112
core_at_cmd_item_t * send_cmd
Definition: aiot_at_api.h:163
uint32_t close_cmd_size
Definition: aiot_at_api.h:171
core_at_cmd_item_t * module_init_cmd
Definition: aiot_at_api.h:151
uint8_t * end
Definition: aiot_at_api.h:193
Definition: aiot_at_api.h:63
Definition: aiot_at_api.h:65
void * mutex
Definition: aiot_at_api.h:195
int32_t aiot_at_init(void)
初始化AT组件
Definition: aiot_at_api.c:308
uint8_t * tail
Definition: aiot_at_api.h:192
uint32_t data_len
Definition: aiot_at_api.h:217
aiot_at_option_t
AT组件配置选项
Definition: aiot_at_api.h:61
char * prefix
Definition: aiot_at_api.h:130
Definition: aiot_at_api.h:62
core_at_read_t reader
Definition: aiot_at_api.h:245
SDK Core系统依赖头文件, 所有Core中的系统依赖均在此文件中列出
char * rsp
Definition: aiot_at_api.h:118
char * prefix
Definition: aiot_at_api.h:140
void * send_mutex
Definition: aiot_at_api.h:259
core_at_cmd_item_t * open_cmd
Definition: aiot_at_api.h:159
at_device_t * device
Definition: aiot_at_api.h:262
core_at_cmd_item_t * ip_init_cmd
Definition: aiot_at_api.h:155
aiot_at_uart_tx_func_t uart_tx_func
Definition: aiot_at_api.h:255
uint32_t ip_init_cmd_size
Definition: aiot_at_api.h:156
uint32_t ssl_cmd_size
Definition: aiot_at_api.h:182
int32_t aiot_at_deinit(void)
反初始化AT组件
Definition: aiot_at_api.c:792
AT命令请求响应结构体定义
Definition: aiot_at_api.h:110
#define AIOT_AT_SOCKET_NUM
Definition: aiot_at_api.h:53
uint32_t cmd_len
Definition: aiot_at_api.h:116
Definition: aiot_at_api.h:84
uint8_t * buf
Definition: aiot_at_api.h:190
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
Definition: aiot_at_api.h:225
AT组件上下文数据结构体
Definition: aiot_at_api.h:235
Definition: aiot_at_api.h:228
rsp_result_t
Definition: aiot_at_api.h:83
uint32_t urc_register_size
Definition: aiot_at_api.h:178
Definition: aiot_at_api.h:85
int32_t core_at_ip_status(core_ip_status_t status)
AT主动上报接收的数据,可识别头
Definition: aiot_at_api.h:138
core_ringbuf_t data_rb
Definition: aiot_at_api.h:212
Definition: aiot_at_api.h:204
uint32_t open_cmd_size
Definition: aiot_at_api.h:160
Definition: aiot_at_api.h:226
uint32_t module_init_cmd_size
Definition: aiot_at_api.h:152
at_rsp_handler_t handler
Definition: aiot_at_api.h:122
char * fmt
Definition: aiot_at_api.h:142
int32_t aiot_at_nwk_close(uint8_t socket_id)
内部会调用模组相关的AT命令, 关闭连接链路。可对接到core_sysdep_network_deinit网络接口 ...
Definition: aiot_at_api.c:619
uint8_t is_init
Definition: aiot_at_api.h:237
at_urc_handler_t handle
Definition: aiot_at_api.h:132
数据链路上下文结构体
Definition: aiot_at_api.h:210
void * user_data
Definition: aiot_at_api.h:260
uint32_t rsp_buf_offset
Definition: aiot_at_api.h:253
#define AIOT_AT_RSP_LEN_MAXIMUM
Definition: aiot_at_api.h:46
core_ip_status_t
Definition: aiot_at_api.h:224
uint32_t remain_len
Definition: aiot_at_api.h:218
uint32_t send_cmd_size
Definition: aiot_at_api.h:164
void(* at_urc_handler_t)(char *line)
接受到应答数据后的用户处理回调函数原型定义
Definition: aiot_at_api.h:106
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
core_at_cmd_item_t * ssl_cmd
Definition: aiot_at_api.h:181
enum rsp_result_t at_rsp_result_t
AT设备结构化数据
Definition: aiot_at_api.h:149
core_at_cmd_item_t * close_cmd
Definition: aiot_at_api.h:170
uint32_t size
Definition: aiot_at_api.h:194
uint32_t timeout_ms
Definition: aiot_at_api.h:120
uint32_t tx_timeout
Definition: aiot_at_api.h:243
char * cmd
Definition: aiot_at_api.h:114
core_at_link_status_t
模组数据链路状态
Definition: aiot_at_api.h:201
Definition: aiot_at_api.h:229
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
core_at_link_status_t link_status
Definition: aiot_at_api.h:211
Definition: aiot_at_api.h:203
Definition: aiot_at_api.h:64
void * cmd_mutex
Definition: aiot_at_api.h:257
at_rsp_result_t(* at_rsp_handler_t)(char *rsp)
接受到应答数据后的用户处理回调函数原型定义
Definition: aiot_at_api.h:96
core_ringbuf_t rsp_rb
Definition: aiot_at_api.h:249
core_at_recv_data_prefix * recv
Definition: aiot_at_api.h:167
Definition: aiot_at_api.h:86
Definition: aiot_at_api.h:227
uint8_t * head
Definition: aiot_at_api.h:191
AT主动上报命令
Definition: aiot_at_api.h:128
int32_t aiot_at_hal_recv_handle(uint8_t *data, uint32_t size)
为AT组件提供串口数据
Definition: aiot_at_api.c:776
uint32_t curr_link_id
Definition: aiot_at_api.h:216
Definition: aiot_at_api.h:215