From 44cd306a95d4cd281d72aefacac28906ac6059a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=94=E7=BD=97=E6=8A=80=E6=9C=AF?= Date: Thu, 4 Mar 2021 20:21:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3URC=E8=A1=A8=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E7=AC=AC=E4=B8=80=E9=A1=B9=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Demo/AT-Command/at_chat.c | 9 +++++---- at_chat.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Demo/AT-Command/at_chat.c b/Demo/AT-Command/at_chat.c index f499904..52983d4 100644 --- a/Demo/AT-Command/at_chat.c +++ b/Demo/AT-Command/at_chat.c @@ -327,10 +327,10 @@ static void urc_handler_entry(at_obj_t *at, char *urc, unsigned int size) { int i, n; utc_item_t *tbl = at->adap.utc_tbl; - for (i = 0; i < at->adap.urc_tbl_count; i++) { + for (i = 0; i < at->adap.urc_tbl_count; i++, tbl++) { n = strlen(tbl->prefix); - if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */ - tbl[i].handler(urc, size); /* 回调处理*/ + if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */ + tbl->handler(urc, size); /* 回调处理*/ break; } } @@ -354,8 +354,9 @@ static void urc_recv_process(at_obj_t *at, char *buf, unsigned int size) if (size == 0 && at->urc_cnt > 0) { if (AT_IS_TIMEOUT(at->urc_timer, 2000)) { /* 接收超时*/ urc_handler_entry(at, urc_buf, at->urc_cnt); + if (at->urc_cnt > 1) + AT_DEBUG("Urc recv timeout.\r\n"); at->urc_cnt = 0; - AT_DEBUG("Urc recv timeout.\r\n"); } } else if (urc_buf != NULL){ at->urc_timer = AT_GET_TICK(); diff --git a/at_chat.c b/at_chat.c index f499904..52983d4 100644 --- a/at_chat.c +++ b/at_chat.c @@ -327,10 +327,10 @@ static void urc_handler_entry(at_obj_t *at, char *urc, unsigned int size) { int i, n; utc_item_t *tbl = at->adap.utc_tbl; - for (i = 0; i < at->adap.urc_tbl_count; i++) { + for (i = 0; i < at->adap.urc_tbl_count; i++, tbl++) { n = strlen(tbl->prefix); - if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */ - tbl[i].handler(urc, size); /* 回调处理*/ + if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */ + tbl->handler(urc, size); /* 回调处理*/ break; } } @@ -354,8 +354,9 @@ static void urc_recv_process(at_obj_t *at, char *buf, unsigned int size) if (size == 0 && at->urc_cnt > 0) { if (AT_IS_TIMEOUT(at->urc_timer, 2000)) { /* 接收超时*/ urc_handler_entry(at, urc_buf, at->urc_cnt); + if (at->urc_cnt > 1) + AT_DEBUG("Urc recv timeout.\r\n"); at->urc_cnt = 0; - AT_DEBUG("Urc recv timeout.\r\n"); } } else if (urc_buf != NULL){ at->urc_timer = AT_GET_TICK();