Link Kit C-SDK
4.0.0
|
#include "core_stdinc.h"
#include "core_string.h"
#include "aiot_state_api.h"
#include "aiot_sysdep_api.h"
#include "aiot_at_api.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
宏定义 | |
#define | AT_RSP_LEN_MINIMUM (3) |
#define | AT_RSP_TCP_RECV_HEAD "TCPRECV" |
#define | AT_CMD_TCP_SETUP_FMT "AT+TCPSETUP=%d,%s,%d\r\n" |
#define | AT_CMD_TCP_SEND_FMT "AT+TCPSEND=%d,%d\r\n" |
函数 | |
static int32_t | core_at_uart_tx (const uint8_t *p_data, uint16_t len, uint32_t timeout) |
int32_t | core_ringbuf_init (core_ringbuf_t *rbuf, uint32_t size) |
int32_t | core_ringbuf_get_occupy (core_ringbuf_t *rbuf) |
int32_t | core_ringbuf_write (core_ringbuf_t *rbuf, const uint8_t *data, uint32_t len) |
int32_t | core_ringbuf_read (core_ringbuf_t *rbuf, uint8_t *data, uint32_t len) |
void | core_ringbuf_deinit (core_ringbuf_t *rbuf) |
int32_t | core_ringbuf_read_sync_rsp (uint8_t *rsp, uint32_t len, uint32_t timeout) |
int32_t | core_at_commands_send_sync (core_at_handle_t *handle, const core_at_cmd_item_t *cmd_list, uint16_t cmd_num) |
int32_t | aiot_at_init (void) |
初始化AT组件 更多... | |
int32_t | aiot_at_setopt (aiot_at_option_t opt, void *data) |
配置AT组件, 主要为配置串口发送回调函数 更多... | |
int32_t | aiot_at_bootstrap (void) |
模组启动, 内部发送模组相关的AT命令已启动模组, 启动完成后, 模组将获取到IP地址 更多... | |
int32_t | aiot_at_nwk_open (uint8_t *socket_id) |
为对应的链路ID创建ringbuf资源 更多... | |
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网络接口 更多... | |
int32_t | _at_rsp_delay_handler (char *rsp, void *user_data) |
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网络接口 更多... | |
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网络接口 更多... | |
int32_t | aiot_at_nwk_close (uint8_t socket_id) |
内部会调用模组相关的AT命令, 关闭连接链路。可对接到core_sysdep_network_deinit网络接口 更多... | |
int32_t | aiot_at_uart_reception (uint8_t data) |
为AT组件提供串口数据 更多... | |
int32_t | aiot_at_deinit (void) |
反初始化AT组件 更多... | |
变量 | |
static const core_at_cmd_item_t | at_bootstrap_cmd_list [] |
static core_at_cmd_item_t | at_connect_cmd_list [] |
static const core_at_cmd_item_t | at_disconn_cmd_list [] |
aiot_sysdep_portfile_t | g_aiot_sysdep_portfile |
static aiot_sysdep_portfile_t * | at_sysdep = &g_aiot_sysdep_portfile |
static core_at_handle_t | at_handle |
#define AT_RSP_LEN_MINIMUM (3) |
#define AT_RSP_TCP_RECV_HEAD "TCPRECV" |
#define AT_CMD_TCP_SETUP_FMT "AT+TCPSETUP=%d,%s,%d\r\n" |
#define AT_CMD_TCP_SEND_FMT "AT+TCPSEND=%d,%d\r\n" |
|
static |
int32_t core_ringbuf_init | ( | core_ringbuf_t * | rbuf, |
uint32_t | size | ||
) |
int32_t core_ringbuf_get_occupy | ( | core_ringbuf_t * | rbuf | ) |
int32_t core_ringbuf_write | ( | core_ringbuf_t * | rbuf, |
const uint8_t * | data, | ||
uint32_t | len | ||
) |
int32_t core_ringbuf_read | ( | core_ringbuf_t * | rbuf, |
uint8_t * | data, | ||
uint32_t | len | ||
) |
void core_ringbuf_deinit | ( | core_ringbuf_t * | rbuf | ) |
int32_t core_ringbuf_read_sync_rsp | ( | uint8_t * | rsp, |
uint32_t | len, | ||
uint32_t | timeout | ||
) |
int32_t core_at_commands_send_sync | ( | core_at_handle_t * | handle, |
const core_at_cmd_item_t * | cmd_list, | ||
uint16_t | cmd_num | ||
) |
int32_t aiot_at_init | ( | void | ) |
初始化AT组件
AT moduel API start
int32_t aiot_at_setopt | ( | aiot_at_option_t | opt, |
void * | data | ||
) |
配置AT组件, 主要为配置串口发送回调函数
opt | 配置项 |
data | 配置数据 |
=0 | 配置成功 |
<0 | 配置失败 |
int32_t aiot_at_bootstrap | ( | void | ) |
模组启动, 内部发送模组相关的AT命令已启动模组, 启动完成后, 模组将获取到IP地址
=0 | 启动成功 |
<0 | 启动失败 |
int32_t aiot_at_nwk_open | ( | uint8_t * | socket_id | ) |
为对应的链路ID创建ringbuf资源
socket_id | 链路ID |
=0 | 操作成功 |
<0 | 操作失败 |
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网络接口
socket_id | 链路ID |
host | 主机名 |
port | 端口号 |
timeout | 建连超时时间 |
>=0 | 建连成功 |
<0 | 建连失败 |
int32_t _at_rsp_delay_handler | ( | char * | rsp, |
void * | user_data | ||
) |
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网络接口
socket_id | 链路ID |
buffer | 指向外部数据缓冲区的指针 |
len | 数据长度 |
timeout | 发送超时时间 |
>=0 | 已发送的数据长度 |
<0 | 发送失败 |
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网络接口
socket_id | 链路ID |
buffer | 指向外部数据缓冲区的指针 |
len | 外部数据缓冲区大小 |
timeout_ms | 接收超时时间 |
>=0 | 读取到的数据长度 |
<0 | 读取失败 |
int32_t aiot_at_nwk_close | ( | uint8_t | socket_id | ) |
内部会调用模组相关的AT命令, 关闭连接链路。可对接到core_sysdep_network_deinit网络接口
socket_id | 链路ID |
=0 | 操作成功 |
<0 | 操作失败 |
int32_t aiot_at_uart_reception | ( | uint8_t | data | ) |
为AT组件提供串口数据
data | 单个字节数据 |
=0 | 操作成功 |
<0 | 操作失败 |
int32_t aiot_at_deinit | ( | void | ) |
反初始化AT组件
|
static |
|
static |
|
static |
aiot_sysdep_portfile_t g_aiot_sysdep_portfile |
|
static |
|
static |