Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
rt-thread
提交
d203e382
R
rt-thread
项目概览
dgr6878
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d203e382
编写于
8月 31, 2018
作者:
B
Bernard Xiong
提交者:
GitHub
8月 31, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1753 from Lawlieta/chenyong
[net][at] Modify 'AT+CLOSE' processing method
上级
07ec7e68
02c1f0c6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
11 deletion
+48
-11
components/net/at/at_socket/at_socket.c
components/net/at/at_socket/at_socket.c
+11
-2
components/net/at/include/at.h
components/net/at/include/at.h
+2
-1
components/net/at/src/at_client.c
components/net/at/src/at_client.c
+35
-8
未找到文件。
components/net/at/at_socket/at_socket.c
浏览文件 @
d203e382
...
...
@@ -385,6 +385,9 @@ int at_closesocket(int socket)
return
-
1
;
}
/* deal with TCP server actively disconnect */
rt_thread_delay
(
rt_tick_from_millisecond
(
100
));
sock
=
at_get_socket
(
socket
);
if
(
sock
==
RT_NULL
)
{
...
...
@@ -401,10 +404,13 @@ int at_closesocket(int socket)
if
(
at_dev_ops
->
at_closesocket
(
socket
)
!=
0
)
{
LOG_E
(
"AT socket (%d) closesocket failed!"
,
socket
);
free_socket
(
sock
);
return
-
1
;
}
}
return
free_socket
(
sock
);
free_socket
(
sock
);
return
0
;
}
int
at_shutdown
(
int
socket
,
int
how
)
...
...
@@ -427,10 +433,13 @@ int at_shutdown(int socket, int how)
if
(
at_dev_ops
->
at_closesocket
(
socket
)
!=
0
)
{
LOG_E
(
"AT socket (%d) shutdown failed!"
,
socket
);
free_socket
(
sock
);
return
-
1
;
}
}
return
free_socket
(
sock
);
free_socket
(
sock
);
return
0
;
}
int
at_bind
(
int
socket
,
const
struct
sockaddr
*
name
,
socklen_t
namelen
)
...
...
components/net/at/include/at.h
浏览文件 @
d203e382
...
...
@@ -31,7 +31,8 @@
#ifdef __cplusplus
extern
"C"
{
#endif
#define AT_SW_VERSION "1.0.0"
#define AT_SW_VERSION "1.0.1"
#define AT_SW_VERSION_NUM 0x10000
#define DBG_ENABLE
...
...
components/net/at/src/at_client.c
浏览文件 @
d203e382
...
...
@@ -290,9 +290,14 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
rt_err_t
result
=
RT_EOK
;
const
char
*
cmd
=
RT_NULL
;
RT_ASSERT
(
client
);
RT_ASSERT
(
cmd_expr
);
if
(
client
==
RT_NULL
)
{
LOG_E
(
"input AT Client object is NULL, please create or get AT Client object!"
);
return
-
RT_ERROR
;
}
rt_mutex_take
(
client
->
lock
,
RT_WAITING_FOREVER
);
client
->
resp_status
=
AT_RESP_OK
;
...
...
@@ -348,8 +353,8 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
if
(
client
==
RT_NULL
)
{
LOG_E
(
"
Input AT Client is NULL, please create or get AT Clien
t!"
);
return
RT_NULL
;
LOG_E
(
"
input AT Client object is NULL, please create or get AT Client objec
t!"
);
return
-
RT_ERROR
;
}
resp
=
at_create_resp
(
16
,
0
,
rt_tick_from_millisecond
(
500
));
...
...
@@ -400,13 +405,19 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
* @param buf send data buffer
* @param size send fixed data size
*
* @return send data size
* @return >0: send data size
* =0: send failed
*/
rt_size_t
at_client_obj_send
(
at_client_t
client
,
const
char
*
buf
,
rt_size_t
size
)
{
RT_ASSERT
(
client
);
RT_ASSERT
(
buf
);
if
(
client
==
RT_NULL
)
{
LOG_E
(
"input AT Client object is NULL, please create or get AT Client object!"
);
return
0
;
}
#ifdef AT_PRINT_RAW_CMD
at_print_raw_cmd
(
"send"
,
buf
,
size
);
#endif
...
...
@@ -436,16 +447,22 @@ static char at_client_getchar(at_client_t client)
*
* @note this function can only be used in execution function of URC data
*
* @return success receive data size
* @return >0: receive data size
* =0: receive failed
*/
rt_size_t
at_client_obj_recv
(
at_client_t
client
,
char
*
buf
,
rt_size_t
size
)
{
rt_size_t
read_idx
=
0
;
char
ch
;
RT_ASSERT
(
client
);
RT_ASSERT
(
buf
);
if
(
client
==
RT_NULL
)
{
LOG_E
(
"input AT Client object is NULL, please create or get AT Client object!"
);
return
0
;
}
while
(
1
)
{
if
(
read_idx
<
size
)
...
...
@@ -475,7 +492,11 @@ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size)
*/
void
at_obj_set_end_sign
(
at_client_t
client
,
char
ch
)
{
RT_ASSERT
(
client
);
if
(
client
==
RT_NULL
)
{
LOG_E
(
"input AT Client object is NULL, please create or get AT Client object!"
);
return
;
}
client
->
end_sign
=
ch
;
}
...
...
@@ -491,6 +512,12 @@ void at_obj_set_urc_table(at_client_t client, const struct at_urc *urc_table, rt
{
rt_size_t
idx
;
if
(
client
==
RT_NULL
)
{
LOG_E
(
"input AT Client object is NULL, please create or get AT Client object!"
);
return
;
}
for
(
idx
=
0
;
idx
<
table_sz
;
idx
++
)
{
RT_ASSERT
(
urc_table
[
idx
].
cmd_prefix
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录