[components][at] 优化AT组件,并解决内存泄露

1.优化at server endmark判断,支持自动识别'\r''\n'"\r\n"。
2.优化at_recvfrom,修复大数据量时sem多次释放造成的接收错误。
3.修复at组件中可能存在的内存泄露。
4.优化部分代码逻辑,减少冗余代码。
This commit is contained in:
yangpengya
2024-02-18 11:07:05 -05:00
committed by GitHub
parent 02eaf76d7b
commit a8d5a645f2
7 changed files with 172 additions and 338 deletions
-15
View File
@@ -22,20 +22,6 @@ extern "C" {
#define AT_SW_VERSION "1.3.1"
#define AT_CMD_NAME_LEN 16
#define AT_END_MARK_LEN 4
#ifndef AT_CMD_MAX_LEN
#define AT_CMD_MAX_LEN 128
#endif
/* the server AT commands new line sign */
#if defined(AT_CMD_END_MARK_CRLF)
#define AT_CMD_END_MARK "\r\n"
#elif defined(AT_CMD_END_MARK_CR)
#define AT_CMD_END_MARK "\r"
#elif defined(AT_CMD_END_MARK_LF)
#define AT_CMD_END_MARK "\n"
#endif
#ifndef AT_SERVER_RECV_BUFF_LEN
#define AT_SERVER_RECV_BUFF_LEN 256
@@ -104,7 +90,6 @@ struct at_server
char recv_buffer[AT_SERVER_RECV_BUFF_LEN];
rt_size_t cur_recv_len;
rt_sem_t rx_notice;
char end_mark[AT_END_MARK_LEN];
rt_thread_t parser;
void (*parser_entry)(struct at_server *server);