Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
a442a339
提交
a442a339
authored
11月 26, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
new feature: evwifi
上级
123eabbf
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
3 行增加
和
10 行删除
+3
-10
evwifi.cpp
opencv-motion-detect/evwifi.cpp
+3
-10
没有找到文件。
opencv-motion-detect/evwifi.cpp
浏览文件 @
a442a339
...
@@ -62,10 +62,6 @@ class WifiMgr {
...
@@ -62,10 +62,6 @@ class WifiMgr {
// ap
// ap
// stop all
// stop all
spdlog
::
info
(
"prepare to enter AP mode"
);
spdlog
::
info
(
"prepare to enter AP mode"
);
exec
(
"systemctl stop wpa_supplicant@wlan1"
);
exec
(
"ifconfig wlan1 down"
);
exec
(
"ifconfig wlan1 up"
);
exec
(
"ifconfig wlan1 192.168.0.1"
);
// exec("systemctl dsiable wpa_supplicant@wlan1 ")
// exec("systemctl dsiable wpa_supplicant@wlan1 ")
string
apdContent
=
fmt
::
format
(
"interface=wlan1
\n
driver=nl80211
\n
ssid=EVB-{}
\n
hw_mode=g
\n
"
string
apdContent
=
fmt
::
format
(
"interface=wlan1
\n
driver=nl80211
\n
ssid=EVB-{}
\n
hw_mode=g
\n
"
"channel=6
\n
macaddr_acl=0
\n
ignore_broadcast_ssid=0
\n
wpa=0
\n
"
,
this
->
info
[
"sn"
].
get
<
string
>
());
"channel=6
\n
macaddr_acl=0
\n
ignore_broadcast_ssid=0
\n
wpa=0
\n
"
,
this
->
info
[
"sn"
].
get
<
string
>
());
...
@@ -74,7 +70,8 @@ class WifiMgr {
...
@@ -74,7 +70,8 @@ class WifiMgr {
fileApd
<<
apdContent
;
fileApd
<<
apdContent
;
fileApd
.
close
();
fileApd
.
close
();
// start hostapd
// start hostapd
exec
(
"hostapd /etc/apd.conf -B"
);
system
(
"systemctl stop wpa_supplicant@wlan1;ifconfig wlan1 down;"
"ifconfig wlan1 up;ifconfig wlan1 192.168.0.1;hostapd /etc/apd.conf -B"
);
// TODO: check result
// TODO: check result
//scan
//scan
...
@@ -97,9 +94,6 @@ class WifiMgr {
...
@@ -97,9 +94,6 @@ class WifiMgr {
ret
[
"code"
]
=
3
;
ret
[
"code"
]
=
3
;
}
}
else
{
else
{
// stop hostapd
exec
(
"pkill hostapd"
);
exec
(
"pkill dhclient"
);
string
wpaContent
=
fmt
::
format
(
"ctrl_interface=/run/wpa_supplicant
\n
update_config=1
\n
ap_scan=1
\n
"
string
wpaContent
=
fmt
::
format
(
"ctrl_interface=/run/wpa_supplicant
\n
update_config=1
\n
ap_scan=1
\n
"
"network={{
\n
ssid=
\"
{}
\"\n
psk=
\"
{}
\"\n
}}
\n
"
,
this
->
wifiData
[
"wifi"
][
"ssid"
].
get
<
string
>
(),
this
->
wifiData
[
"wifi"
][
"password"
].
get
<
string
>
());
"network={{
\n
ssid=
\"
{}
\"\n
psk=
\"
{}
\"\n
}}
\n
"
,
this
->
wifiData
[
"wifi"
][
"ssid"
].
get
<
string
>
(),
this
->
wifiData
[
"wifi"
][
"password"
].
get
<
string
>
());
ofstream
wpaFile
(
wpaCfgPath
,
ios
::
out
|
ios
::
trunc
);
ofstream
wpaFile
(
wpaCfgPath
,
ios
::
out
|
ios
::
trunc
);
...
@@ -107,11 +101,10 @@ class WifiMgr {
...
@@ -107,11 +101,10 @@ class WifiMgr {
wpaFile
<<
wpaContent
;
wpaFile
<<
wpaContent
;
wpaFile
.
close
();
wpaFile
.
close
();
// TODO: verify
// TODO: verify
exec
(
"systemctl enable wpa_supplicant@wlan1"
);
auto
t
=
thread
([](){
auto
t
=
thread
([](){
// delay for rest return (ifdown caused no networking available)
// delay for rest return (ifdown caused no networking available)
this_thread
::
sleep_for
(
chrono
::
seconds
(
1
));
this_thread
::
sleep_for
(
chrono
::
seconds
(
1
));
exec
(
"
systemctl enable wpa_supplicant@wlan1;systemctl restart wpa_supplicant@wlan1;"
system
(
"pkill hostapd; pkill dhclient;
systemctl enable wpa_supplicant@wlan1;systemctl restart wpa_supplicant@wlan1;"
"/sbin/ifdown -a --read-environment;/sbin/ifup -a --read-environment"
);
"/sbin/ifdown -a --read-environment;/sbin/ifup -a --read-environment"
);
});
});
t
.
detach
();
t
.
detach
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论