Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
c229d8b2
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c229d8b2
编写于
9月 01, 2021
作者:
Comeon_fly
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix at_client.c
上级
5fb6cb8b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
18 deletion
+19
-18
components/net/at/src/at_client.c
components/net/at/src/at_client.c
+19
-18
未找到文件。
components/net/at/src/at_client.c
浏览文件 @
c229d8b2
...
@@ -310,7 +310,6 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
...
@@ -310,7 +310,6 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
rt_mutex_take
(
client
->
lock
,
RT_WAITING_FOREVER
);
rt_mutex_take
(
client
->
lock
,
RT_WAITING_FOREVER
);
client
->
resp_status
=
AT_RESP_OK
;
client
->
resp_status
=
AT_RESP_OK
;
client
->
resp
=
resp
;
if
(
resp
!=
RT_NULL
)
if
(
resp
!=
RT_NULL
)
{
{
...
@@ -318,6 +317,9 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
...
@@ -318,6 +317,9 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
resp
->
line_counts
=
0
;
resp
->
line_counts
=
0
;
}
}
client
->
resp
=
resp
;
rt_sem_control
(
client
->
resp_notice
,
RT_IPC_CMD_RESET
,
RT_NULL
);
va_start
(
args
,
cmd_expr
);
va_start
(
args
,
cmd_expr
);
at_vprintfln
(
client
->
device
,
cmd_expr
,
args
);
at_vprintfln
(
client
->
device
,
cmd_expr
,
args
);
va_end
(
args
);
va_end
(
args
);
...
@@ -327,7 +329,7 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
...
@@ -327,7 +329,7 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
if
(
rt_sem_take
(
client
->
resp_notice
,
resp
->
timeout
)
!=
RT_EOK
)
if
(
rt_sem_take
(
client
->
resp_notice
,
resp
->
timeout
)
!=
RT_EOK
)
{
{
cmd
=
at_get_last_cmd
(
&
cmd_size
);
cmd
=
at_get_last_cmd
(
&
cmd_size
);
LOG_
D
(
"execute command (%.*s) timeout (%d ticks)!"
,
cmd_size
,
cmd
,
resp
->
timeout
);
LOG_
W
(
"execute command (%.*s) timeout (%d ticks)!"
,
cmd_size
,
cmd
,
resp
->
timeout
);
client
->
resp_status
=
AT_RESP_TIMEOUT
;
client
->
resp_status
=
AT_RESP_TIMEOUT
;
result
=
-
RT_ETIMEOUT
;
result
=
-
RT_ETIMEOUT
;
goto
__exit
;
goto
__exit
;
...
@@ -381,6 +383,7 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
...
@@ -381,6 +383,7 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
rt_mutex_take
(
client
->
lock
,
RT_WAITING_FOREVER
);
rt_mutex_take
(
client
->
lock
,
RT_WAITING_FOREVER
);
client
->
resp
=
resp
;
client
->
resp
=
resp
;
rt_sem_control
(
client
->
resp_notice
,
RT_IPC_CMD_RESET
,
RT_NULL
);
start_time
=
rt_tick_get
();
start_time
=
rt_tick_get
();
...
@@ -480,9 +483,7 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo
...
@@ -480,9 +483,7 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo
*/
*/
rt_size_t
at_client_obj_recv
(
at_client_t
client
,
char
*
buf
,
rt_size_t
size
,
rt_int32_t
timeout
)
rt_size_t
at_client_obj_recv
(
at_client_t
client
,
char
*
buf
,
rt_size_t
size
,
rt_int32_t
timeout
)
{
{
rt_size_t
read_idx
=
0
;
rt_size_t
len
=
0
;
rt_err_t
result
=
RT_EOK
;
char
ch
;
RT_ASSERT
(
buf
);
RT_ASSERT
(
buf
);
...
@@ -494,28 +495,28 @@ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size, rt_i
...
@@ -494,28 +495,28 @@ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size, rt_i
while
(
1
)
while
(
1
)
{
{
if
(
read_idx
<
size
)
rt_sem_control
(
client
->
rx_notice
,
RT_IPC_CMD_RESET
,
RT_NULL
);
rt_size_t
read_len
=
rt_device_read
(
client
->
device
,
0
,
buf
+
len
,
size
);
if
(
read_len
>
0
)
{
{
result
=
at_client_getchar
(
client
,
&
ch
,
timeout
);
len
+=
read_len
;
if
(
result
!=
RT_EOK
)
size
-=
read_len
;
{
if
(
size
==
0
)
LOG_E
(
"AT Client receive failed, uart device get data error(%d)"
,
result
);
break
;
return
0
;
}
buf
[
read_idx
++
]
=
ch
;
continue
;
}
}
else
{
if
(
rt_sem_take
(
client
->
rx_notice
,
rt_tick_from_millisecond
(
timeout
))
!=
RT_EOK
)
break
;
break
;
}
}
}
#ifdef AT_PRINT_RAW_CMD
#ifdef AT_PRINT_RAW_CMD
at_print_raw_cmd
(
"urc_recv"
,
buf
,
size
);
at_print_raw_cmd
(
"urc_recv"
,
buf
,
len
);
#endif
#endif
return
read_idx
;
return
len
;
}
}
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录