Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
5cc5ea4f
提交
5cc5ea4f
authored
9月 09, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
big refacting of communitation architect
上级
6ee36698
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
52 行增加
和
30 行删除
+52
-30
settings.json
.vscode/settings.json
+3
-1
config.json
opencv-motion-detect/config.json
+6
-7
database-sqlite.cpp
opencv-motion-detect/database-sqlite.cpp
+4
-4
database.cpp
opencv-motion-detect/database.cpp
+4
-4
evdaemon.cpp
opencv-motion-detect/evdaemon.cpp
+27
-6
evmlmotion.cpp
opencv-motion-detect/evmlmotion.cpp
+4
-4
evslicer.cpp
opencv-motion-detect/evslicer.cpp
+4
-4
没有找到文件。
.vscode/settings.json
浏览文件 @
5cc5ea4f
...
...
@@ -5,7 +5,8 @@
"chrono"
:
"cpp"
,
"optional"
:
"cpp"
,
"string"
:
"cpp"
,
"set"
:
"cpp"
"set"
:
"cpp"
,
"thread"
:
"cpp"
},
"C_Cpp.errorSquiggles"
:
"Disabled"
}
\ No newline at end of file
opencv-motion-detect/config.json
浏览文件 @
5cc5ea4f
{
"data"
:{
"
W5TA2ZE6
"
:{
"
5A5S3CTJ
"
:{
"addr"
:
"127.0.0.1"
,
"api-cloud"
:
"http://127.0.0.1:8089"
,
"ipcs"
:[
...
...
@@ -14,7 +14,7 @@
"iid"
:
1
,
"post"
:
30
,
"pre"
:
3
,
"sn"
:
"
W5TA2ZE6
"
,
"sn"
:
"
5A5S3CTJ
"
,
"status"
:
0
,
"thresh"
:
80
,
"type"
:
"motion"
...
...
@@ -24,9 +24,8 @@
{
"addr"
:
"127.0.0.1"
,
"iid"
:
1
,
"enabled"
:
1
,
"port-pub"
:
5556
,
"sn"
:
"
W5TA2ZE6
"
,
"sn"
:
"
5A5S3CTJ
"
,
"status"
:
0
}
],
...
...
@@ -35,7 +34,7 @@
"enabled"
:
1
,
"iid"
:
1
,
"password"
:
""
,
"sn"
:
"
W5TA2ZE6
"
,
"sn"
:
"
5A5S3CTJ
"
,
"status"
:
0
,
"token"
:
""
,
"urlDest"
:
"rtsp://40.73.41.176:554/test1"
,
...
...
@@ -47,7 +46,7 @@
"enabled"
:
1
,
"iid"
:
1
,
"path"
:
"slices"
,
"sn"
:
"
W5TA2ZE6
"
,
"sn"
:
"
5A5S3CTJ
"
,
"status"
:
0
}
]
...
...
@@ -63,7 +62,7 @@
"port-cloud"
:
5556
,
"port-router"
:
5550
,
"proto"
:
"zmq"
,
"sn"
:
"
W5TA2ZE6
"
,
"sn"
:
"
5A5S3CTJ
"
,
"status"
:
1
}
},
...
...
opencv-motion-detect/database-sqlite.cpp
浏览文件 @
5cc5ea4f
...
...
@@ -203,10 +203,10 @@ int saveLocalConfigration(json &config, string fileName)
int
ret
=
0
;
string
mv
=
string
(
"mv -f "
)
+
fileName
+
" "
+
fileName
+
".bak"
;
system
(
mv
.
c_str
());
if
(
ret
==
-
1
)
{
spdlog
::
error
(
"saveLocalConfigration failed to mv file: {}"
,
mv
);
return
-
1
;
}
//
if(ret == -1) {
//
spdlog::error("saveLocalConfigration failed to mv file: {}", mv);
//
return -1;
//
}
// write prettified JSON file
try
{
...
...
opencv-motion-detect/database.cpp
浏览文件 @
5cc5ea4f
...
...
@@ -175,10 +175,10 @@ namespace LVDB {
string
mkdir_
=
"mkdir -p "
+
fileName
;
//spdlog::info("creating directory: {}", mkdir_);
ret
=
system
(
mkdir_
.
c_str
());
if
(
-
1
==
ret
)
{
spdlog
::
error
(
"failed to create directory for {}"
,
fileName
);
exit
(
1
);
}
//
if(-1 == ret) {
//
spdlog::error("failed to create directory for {}", fileName);
//
exit(1);
//
}
bmk
=
true
;
}
...
...
opencv-motion-detect/evdaemon.cpp
浏览文件 @
5cc5ea4f
...
...
@@ -36,6 +36,7 @@ class EvDaemon{
thread
::
id
thIdMain
;
thread
thRouter
;
json
peerData
;
bool
bReload
=
true
;
// peerData["status"];
// peerData["pids"];
// peerData["config"];
...
...
@@ -88,7 +89,7 @@ class EvDaemon{
if
(
ret
!=
0
)
{
spdlog
::
error
(
"evdaemon {} failed to fork subsystem: {}"
,
devSn
,
peerId
);
// TODO: clean up and reload config
exit
(
1
)
;
return
-
3
;
}
this
->
peerData
[
"pids"
][
peerId
]
=
pid
;
spdlog
::
info
(
"evdaemon {} created subsystem {}"
,
devSn
,
peerId
);
...
...
@@ -122,7 +123,7 @@ class EvDaemon{
if
(
ret
!=
0
)
{
spdlog
::
error
(
"evdaemon {} failed to fork subsystem: {}"
,
devSn
,
peerId
);
// TODO: cleanup and reload
exit
(
1
)
;
return
-
2
;
}
this
->
peerData
[
"pids"
][
peerId
]
=
pid
;
spdlog
::
info
(
"evdaemon {} created subsystem {}"
,
devSn
,
peerId
);
...
...
@@ -143,18 +144,37 @@ class EvDaemon{
}
void
setupSubSystems
()
{
thMon
=
thread
([
this
](){
thMon
=
thread
([
&
,
this
](){
while
(
true
)
{
if
(
bReload
)
{
int
ret
=
reloadCfg
();
if
(
ret
!=
0
)
{
spdlog
::
error
(
"evdaemon {} failed to setup subsystems, please check log for more info"
,
this
->
devSn
);
this_thread
::
sleep_for
(
chrono
::
seconds
(
5
));
// cleanup
spdlog
::
info
(
"evdaemon {} peerData {}"
,
this
->
devSn
,
this
->
peerData
.
dump
());
json
&
pd
=
this
->
peerData
;
for
(
auto
&
[
k
,
v
]
:
pd
[
"pids"
].
items
()){
//kill(v, SIGTERM);
if
(
this
->
peerData
[
"status"
].
count
(
k
)
!=
0
){
this
->
peerData
[
"status"
].
erase
(
k
);
}
if
(
this
->
peerData
[
"config"
].
count
(
k
)
!=
0
){
this
->
peerData
[
"config"
].
erase
(
k
);
}
this
->
peerData
[
"pids"
].
erase
(
k
);
}
}
else
{
bReload
=
false
;
}
}
break
;
this_thread
::
sleep_for
(
chrono
::
seconds
(
30
))
;
}
});
thMon
.
detach
();
}
...
...
@@ -419,6 +439,7 @@ void cleanup(int signal) {
int
main
(){
signal
(
SIGCHLD
,
cleanup
);
//sigignore(SIGCHLD);
json
info
;
LVDB
::
getSn
(
info
);
spdlog
::
info
(
"evdaemon:
\n
{}"
,
info
.
dump
(
4
));
...
...
opencv-motion-detect/evmlmotion.cpp
浏览文件 @
5cc5ea4f
...
...
@@ -177,10 +177,10 @@ private:
}
ret
=
system
((
"mkdir -p "
+
urlOut
).
c_str
());
if
(
ret
==
-
1
)
{
spdlog
::
error
(
"failed mkdir {}"
,
urlOut
);
return
-
1
;
}
//
if(ret == -1) {
//
spdlog::error("failed mkdir {}", urlOut);
//
return -1;
//
}
// detection params
if
(
evmlmotion
.
count
(
"thresh"
)
==
0
||
evmlmotion
[
"thresh"
]
<
10
||
evmlmotion
[
"thresh"
]
>=
255
)
{
...
...
opencv-motion-detect/evslicer.cpp
浏览文件 @
5cc5ea4f
...
...
@@ -156,10 +156,10 @@ private:
// DB::exec(NULL, "select id, ts, last from slices;", DB::get_slices, sliceIdxToName);
spdlog
::
info
(
"mkdir -p {}"
,
urlOut
);
ret
=
system
((
string
(
"mkdir -p "
)
+
urlOut
).
c_str
());
if
(
ret
==
-
1
)
{
spdlog
::
error
(
"failed to create {} dir"
,
urlOut
);
exit
(
1
);
}
//
if(ret == -1) {
//
spdlog::error("failed to create {} dir", urlOut);
//
exit(1);
//
}
urlPub
=
string
(
"tcp://"
)
+
evpuller
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evpuller
[
"port-pub"
]);
urlRouter
=
string
(
"tcp://"
)
+
evmgr
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evmgr
[
"port-router"
]);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论