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 "core_log.h"
#include "os_net_interface.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
函数 | |
static at_rsp_result_t | at_csq_handler (char *rsp) |
int32_t | core_ringbuf_init (core_ringbuf_t *rbuf, uint32_t size) |
void | core_ringbuf_reset (core_ringbuf_t *rbuf) |
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) |
static int32_t | core_at_uart_tx (const uint8_t *p_data, uint16_t len, uint32_t timeout) |
static at_rsp_result_t | core_at_rsp_process_default (const core_at_cmd_item_t *cmd, char *rsp) |
static int32_t | core_at_wait_resp (const core_at_cmd_item_t *cmd) |
static int32_t | core_at_commands_send_sync (const core_at_cmd_item_t *cmd_list, uint16_t cmd_num) |
int32_t | aiot_at_init (void) |
初始化AT组件 更多... | |
static int32_t | core_at_set_device (at_device_t *device) |
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_set_ssl (uint8_t socket_id, const char *ca_cert) |
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网络接口 更多... | |
static int32_t | core_at_send_package (uint8_t socket_id, const uint8_t *buffer, uint32_t len, uint32_t timeout) |
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网络接口 更多... | |
static int32_t | core_at_recv_prefix_match (const char *data, uint32_t size) |
static int32_t | core_at_process_line (char *line, uint32_t len) |
static int32_t | core_at_hal_process (uint8_t *data, uint32_t size) |
int32_t | aiot_at_hal_recv_handle (uint8_t *data, uint32_t size) |
为AT组件提供串口数据 更多... | |
int32_t | aiot_at_deinit (void) |
反初始化AT组件 更多... | |
int32_t | core_at_notify_ip_status (core_ip_status_t status) |
int32_t | core_at_socket_status (uint32_t id, core_at_link_status_t status) |
变量 | |
aiot_os_al_t * | os_api |
const char * | ali_ca_cert |
static core_at_handle_t | at_handle |
core_at_cmd_item_t | at_module_init_cmd_table [] |
|
static |
int32_t core_ringbuf_init | ( | core_ringbuf_t * | rbuf, |
uint32_t | size | ||
) |
void core_ringbuf_reset | ( | core_ringbuf_t * | rbuf | ) |
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 | ) |
|
static |
|
static |
|
static |
|
static |
int32_t aiot_at_init | ( | void | ) |
初始化AT组件
AT moduel API start
|
static |
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_set_ssl | ( | uint8_t | socket_id, |
const char * | ca_cert | ||
) |
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 | 建连失败 |
|
static |
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 | 操作失败 |
|
static |
|
static |
|
static |
int32_t aiot_at_hal_recv_handle | ( | uint8_t * | data, |
uint32_t | size | ||
) |
为AT组件提供串口数据
data | 字节数据 |
>=0 | 操作成功,返回已经消费掉的数据 |
<0 | 操作失败 |
int32_t aiot_at_deinit | ( | void | ) |
反初始化AT组件
int32_t core_at_notify_ip_status | ( | core_ip_status_t | status | ) |
int32_t core_at_socket_status | ( | uint32_t | id, |
core_at_link_status_t | status | ||
) |
aiot_os_al_t* os_api |
const char* ali_ca_cert |
|
static |
core_at_cmd_item_t at_module_init_cmd_table[] |