mirror of
https://gitee.com/moluo-tech/AT-Command
synced 2025-06-18 00:17:53 +00:00
解决URC表匹配第一项的问题。
This commit is contained in:
parent
93c7ab71ff
commit
44cd306a95
@ -327,10 +327,10 @@ static void urc_handler_entry(at_obj_t *at, char *urc, unsigned int size)
|
|||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
utc_item_t *tbl = at->adap.utc_tbl;
|
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);
|
n = strlen(tbl->prefix);
|
||||||
if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */
|
if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */
|
||||||
tbl[i].handler(urc, size); /* 回调处理*/
|
tbl->handler(urc, size); /* 回调处理*/
|
||||||
break;
|
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 (size == 0 && at->urc_cnt > 0) {
|
||||||
if (AT_IS_TIMEOUT(at->urc_timer, 2000)) { /* ½ÓÊÕ³¬Ê±*/
|
if (AT_IS_TIMEOUT(at->urc_timer, 2000)) { /* ½ÓÊÕ³¬Ê±*/
|
||||||
urc_handler_entry(at, urc_buf, at->urc_cnt);
|
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->urc_cnt = 0;
|
||||||
AT_DEBUG("Urc recv timeout.\r\n");
|
|
||||||
}
|
}
|
||||||
} else if (urc_buf != NULL){
|
} else if (urc_buf != NULL){
|
||||||
at->urc_timer = AT_GET_TICK();
|
at->urc_timer = AT_GET_TICK();
|
||||||
|
@ -327,10 +327,10 @@ static void urc_handler_entry(at_obj_t *at, char *urc, unsigned int size)
|
|||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
utc_item_t *tbl = at->adap.utc_tbl;
|
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);
|
n = strlen(tbl->prefix);
|
||||||
if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */
|
if (strncmp(urc, tbl->prefix, n) == 0) { /* 匹配前缀 */
|
||||||
tbl[i].handler(urc, size); /* 回调处理*/
|
tbl->handler(urc, size); /* 回调处理*/
|
||||||
break;
|
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 (size == 0 && at->urc_cnt > 0) {
|
||||||
if (AT_IS_TIMEOUT(at->urc_timer, 2000)) { /* ½ÓÊÕ³¬Ê±*/
|
if (AT_IS_TIMEOUT(at->urc_timer, 2000)) { /* ½ÓÊÕ³¬Ê±*/
|
||||||
urc_handler_entry(at, urc_buf, at->urc_cnt);
|
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->urc_cnt = 0;
|
||||||
AT_DEBUG("Urc recv timeout.\r\n");
|
|
||||||
}
|
}
|
||||||
} else if (urc_buf != NULL){
|
} else if (urc_buf != NULL){
|
||||||
at->urc_timer = AT_GET_TICK();
|
at->urc_timer = AT_GET_TICK();
|
||||||
|
Loading…
Reference in New Issue
Block a user