Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
12b8a0cc
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
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看板
未验证
提交
12b8a0cc
编写于
12月 18, 2018
作者:
B
Bernard Xiong
提交者:
GitHub
12月 18, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2020 from enkiller/dev
[components][drivers][wlan] 更正表意错误的返回值类型
上级
3e7c0440
353792b6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
48 addition
and
24 deletion
+48
-24
components/drivers/wlan/wlan_dev.c
components/drivers/wlan/wlan_dev.c
+38
-17
components/drivers/wlan/wlan_dev.h
components/drivers/wlan/wlan_dev.h
+1
-1
components/drivers/wlan/wlan_mgnt.c
components/drivers/wlan/wlan_mgnt.c
+8
-5
components/drivers/wlan/wlan_mgnt.h
components/drivers/wlan/wlan_mgnt.h
+1
-1
未找到文件。
components/drivers/wlan/wlan_dev.c
浏览文件 @
12b8a0cc
...
...
@@ -145,7 +145,10 @@ rt_err_t rt_wlan_dev_ap_start(struct rt_wlan_device *device, struct rt_wlan_info
rt_memset
(
&
ap_info
,
0
,
sizeof
(
struct
rt_ap_info
));
rt_memcpy
(
&
ap_info
.
ssid
,
&
info
->
ssid
,
sizeof
(
rt_wlan_ssid_t
));
rt_memcpy
(
ap_info
.
key
.
val
,
password
,
password_len
);
if
(
password
!=
RT_NULL
)
{
rt_memcpy
(
ap_info
.
key
.
val
,
password
,
password_len
);
}
ap_info
.
key
.
len
=
password_len
;
ap_info
.
hidden
=
info
->
hidden
;
ap_info
.
channel
=
info
->
channel
;
...
...
@@ -184,13 +187,21 @@ rt_err_t rt_wlan_dev_ap_deauth(struct rt_wlan_device *device, rt_uint8_t mac[6])
int
rt_wlan_dev_get_rssi
(
struct
rt_wlan_device
*
device
)
{
int
rssi
=
0
;
rt_err_t
result
=
RT_EOK
;
if
(
device
==
RT_NULL
)
{
return
-
RT_EIO
;
rt_set_errno
(
-
RT_EIO
);
return
0
;
}
result
=
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_GET_RSSI
,
&
rssi
);
if
(
result
!=
RT_EOK
)
{
rt_set_errno
(
result
);
return
0
;
}
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_GET_RSSI
,
&
rssi
);
return
rssi
;
}
...
...
@@ -235,14 +246,20 @@ rt_err_t rt_wlan_dev_set_powersave(struct rt_wlan_device *device, int level)
int
rt_wlan_dev_get_powersave
(
struct
rt_wlan_device
*
device
)
{
int
level
=
0
;
int
level
=
-
1
;
rt_err_t
result
=
RT_EOK
;
if
(
device
==
RT_NULL
)
{
rt_set_errno
(
-
RT_EIO
);
return
-
1
;
}
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_GET_POWERSAVE
,
&
level
);
result
=
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_GET_POWERSAVE
,
&
level
);
if
(
result
!=
RT_EOK
)
{
rt_set_errno
(
result
);
}
return
level
;
}
...
...
@@ -432,19 +449,21 @@ rt_err_t rt_wlan_dev_set_channel(struct rt_wlan_device *device, int channel)
return
result
;
}
rt_err_
t
rt_wlan_dev_get_channel
(
struct
rt_wlan_device
*
device
)
in
t
rt_wlan_dev_get_channel
(
struct
rt_wlan_device
*
device
)
{
rt_err_t
result
=
RT_EOK
;
int
channel
;
int
channel
=
-
1
;
if
(
device
==
RT_NULL
)
{
return
-
RT_EIO
;
rt_set_errno
(
-
RT_EIO
);
return
-
1
;
}
result
=
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_GET_CHANNEL
,
&
channel
);
if
(
result
!=
RT_EOK
)
{
rt_set_errno
(
result
);
return
-
1
;
}
...
...
@@ -466,17 +485,19 @@ rt_err_t rt_wlan_dev_set_country(struct rt_wlan_device *device, rt_country_code_
rt_country_code_t
rt_wlan_dev_get_country
(
struct
rt_wlan_device
*
device
)
{
int
result
=
0
;
int
result
=
RT_EOK
;
rt_country_code_t
country_code
=
RT_COUNTRY_UNKNOWN
;
if
(
device
==
RT_NULL
)
{
return
country_code
;
rt_set_errno
(
-
RT_EIO
);
return
RT_COUNTRY_UNKNOWN
;
}
result
=
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_GET_COUNTRY
,
&
country_code
);
if
(
result
!=
RT_EOK
)
{
rt_set_errno
(
result
);
return
RT_COUNTRY_UNKNOWN
;
}
...
...
@@ -641,7 +662,7 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_SET_POWERSAVE
,
"RT_WLAN_CMD_SET_POWERSAVE"
);
if
(
wlan
->
ops
->
wlan_set_powersave
)
wlan
->
ops
->
wlan_set_powersave
(
wlan
,
level
);
err
=
wlan
->
ops
->
wlan_set_powersave
(
wlan
,
level
);
break
;
}
case
RT_WLAN_CMD_GET_POWERSAVE
:
...
...
@@ -659,7 +680,7 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_CFG_PROMISC
,
"RT_WLAN_CMD_CFG_PROMISC"
);
if
(
wlan
->
ops
->
wlan_cfg_promisc
)
wlan
->
ops
->
wlan_cfg_promisc
(
wlan
,
start
);
err
=
wlan
->
ops
->
wlan_cfg_promisc
(
wlan
,
start
);
break
;
}
case
RT_WLAN_CMD_CFG_FILTER
:
...
...
@@ -668,7 +689,7 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_CFG_FILTER
,
"RT_WLAN_CMD_CFG_FILTER"
);
if
(
wlan
->
ops
->
wlan_cfg_filter
)
wlan
->
ops
->
wlan_cfg_filter
(
wlan
,
filter
);
err
=
wlan
->
ops
->
wlan_cfg_filter
(
wlan
,
filter
);
break
;
}
case
RT_WLAN_CMD_SET_CHANNEL
:
...
...
@@ -676,7 +697,7 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
int
channel
=
*
(
int
*
)
args
;
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_SET_CHANNEL
,
"RT_WLAN_CMD_SET_CHANNEL"
);
if
(
wlan
->
ops
->
wlan_set_channel
)
wlan
->
ops
->
wlan_set_channel
(
wlan
,
channel
);
err
=
wlan
->
ops
->
wlan_set_channel
(
wlan
,
channel
);
break
;
}
case
RT_WLAN_CMD_GET_CHANNEL
:
...
...
@@ -694,7 +715,7 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_SET_COUNTRY
,
"RT_WLAN_CMD_SET_COUNTRY"
);
if
(
wlan
->
ops
->
wlan_set_country
)
wlan
->
ops
->
wlan_set_country
(
wlan
,
country
);
err
=
wlan
->
ops
->
wlan_set_country
(
wlan
,
country
);
break
;
}
case
RT_WLAN_CMD_GET_COUNTRY
:
...
...
@@ -711,7 +732,7 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_SET_MAC
,
"RT_WLAN_CMD_SET_MAC"
);
if
(
wlan
->
ops
->
wlan_set_mac
)
wlan
->
ops
->
wlan_set_mac
(
wlan
,
mac
);
err
=
wlan
->
ops
->
wlan_set_mac
(
wlan
,
mac
);
break
;
}
case
RT_WLAN_CMD_GET_MAC
:
...
...
@@ -720,7 +741,7 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_GET_MAC
,
"RT_WLAN_CMD_GET_MAC"
);
if
(
wlan
->
ops
->
wlan_get_mac
)
wlan
->
ops
->
wlan_get_mac
(
wlan
,
mac
);
err
=
wlan
->
ops
->
wlan_get_mac
(
wlan
,
mac
);
break
;
}
default:
...
...
components/drivers/wlan/wlan_dev.h
浏览文件 @
12b8a0cc
...
...
@@ -559,7 +559,7 @@ rt_err_t rt_wlan_dev_cfg_filter(struct rt_wlan_device *device, struct rt_wlan_fi
* wlan device channel interface
*/
rt_err_t
rt_wlan_dev_set_channel
(
struct
rt_wlan_device
*
device
,
int
channel
);
rt_err_
t
rt_wlan_dev_get_channel
(
struct
rt_wlan_device
*
device
);
in
t
rt_wlan_dev_get_channel
(
struct
rt_wlan_device
*
device
);
/*
* wlan device country interface
...
...
components/drivers/wlan/wlan_mgnt.c
浏览文件 @
12b8a0cc
...
...
@@ -1320,7 +1320,10 @@ rt_err_t rt_wlan_start_ap_adv(struct rt_wlan_info *info, const char *password)
return
-
RT_EIO
;
}
RT_WLAN_LOG_D
(
"%s is run"
,
__FUNCTION__
);
password_len
=
rt_strlen
(
password
);
if
(
password
!=
RT_NULL
)
{
password_len
=
rt_strlen
(
password
);
}
if
(
password_len
>
RT_WLAN_PASSWORD_MAX_LENGTH
)
{
RT_WLAN_LOG_E
(
"key is to long! len:%d"
,
password_len
);
...
...
@@ -1358,16 +1361,16 @@ rt_err_t rt_wlan_start_ap_adv(struct rt_wlan_info *info, const char *password)
return
err
;
}
in
t
rt_wlan_ap_is_active
(
void
)
rt_bool_
t
rt_wlan_ap_is_active
(
void
)
{
int
_active
=
0
;
rt_bool_t
_active
=
RT_FALSE
;
if
(
_ap_is_null
())
{
return
0
;
return
RT_FALSE
;
}
_active
=
_ap_mgnt
.
state
&
RT_WLAN_STATE_ACTIVE
?
1
:
0
;
_active
=
_ap_mgnt
.
state
&
RT_WLAN_STATE_ACTIVE
?
RT_TRUE
:
RT_FALSE
;
RT_WLAN_LOG_D
(
"%s is run active:%s"
,
__FUNCTION__
,
_active
?
"Active"
:
"Inactive"
);
return
_active
;
}
...
...
components/drivers/wlan/wlan_mgnt.h
浏览文件 @
12b8a0cc
...
...
@@ -97,7 +97,7 @@ int rt_wlan_get_rssi(void);
*/
rt_err_t
rt_wlan_start_ap
(
const
char
*
ssid
,
const
char
*
password
);
rt_err_t
rt_wlan_start_ap_adv
(
struct
rt_wlan_info
*
info
,
const
char
*
password
);
in
t
rt_wlan_ap_is_active
(
void
);
rt_bool_
t
rt_wlan_ap_is_active
(
void
);
rt_err_t
rt_wlan_ap_stop
(
void
);
rt_err_t
rt_wlan_ap_get_info
(
struct
rt_wlan_info
*
info
);
int
rt_wlan_ap_get_sta_num
(
void
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录