Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
44c36e1d
提交
44c36e1d
authored
9月 09, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
big refacting of communitation architect
上级
b0eaf7ab
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
40 行增加
和
64 行删除
+40
-64
database.cpp
opencv-motion-detect/database.cpp
+30
-47
evdaemon.cpp
opencv-motion-detect/evdaemon.cpp
+0
-2
evmgr.cpp
opencv-motion-detect/evmgr.cpp
+0
-2
evmlmotion.cpp
opencv-motion-detect/evmlmotion.cpp
+7
-7
evpusher.cpp
opencv-motion-detect/evpusher.cpp
+0
-3
evslicer.cpp
opencv-motion-detect/evslicer.cpp
+3
-3
没有找到文件。
opencv-motion-detect/database.cpp
浏览文件 @
44c36e1d
...
...
@@ -51,48 +51,46 @@ namespace LVDB {
json
*
findConfigModule
(
json
&
config
,
string
sn
,
string
moduleName
,
int
iid
)
{
json
*
ret
=
NULL
;
json
&
data
=
config
[
"data"
];
for
(
auto
&
[
k
,
v
]
:
data
.
items
()){
json
&
mgr
=
data
[
k
];
if
(
mgr
.
count
(
"ipcs"
)
==
0
)
{
break
;
}
else
{
json
&
ipcs
=
mgr
[
"ipcs"
];
for
(
auto
&
ipc
:
ipcs
)
{
if
(
ipc
.
count
(
"modules"
)
==
0
)
{
break
;
json
&
mgr
=
config
;
if
(
mgr
.
count
(
"ipcs"
)
==
0
)
{
return
ret
;
}
else
{
json
&
ipcs
=
mgr
[
"ipcs"
];
for
(
auto
&
ipc
:
ipcs
)
{
if
(
ipc
.
count
(
"modules"
)
==
0
)
{
break
;
}
else
{
json
&
modules
=
ipc
[
"modules"
];
string
modname
=
moduleName
.
substr
(
0
,
4
);
string
sub
;
if
(
modname
==
"evml"
)
{
sub
=
moduleName
.
substr
(
4
,
moduleName
.
size
());
}
else
{
json
&
modules
=
ipc
[
"modules"
];
string
modname
=
moduleName
.
substr
(
0
,
4
);
string
sub
;
if
(
modname
==
"evml"
)
{
sub
=
moduleName
.
substr
(
4
,
moduleName
.
size
());
}
else
{
modname
=
moduleName
;
}
modname
=
moduleName
;
}
if
(
modules
.
count
(
modname
)
==
0
){
break
;
}
else
{
json
&
module
=
modules
[
modname
];
for
(
auto
&
inst
:
module
)
{
if
(
inst
.
count
(
"sn"
)
!=
0
&&
inst
[
"sn"
]
==
sn
&&
inst
.
count
(
"iid"
)
!=
0
&&
inst
[
"iid"
]
==
iid
)
{
if
(
!
sub
.
empty
())
{
if
(
inst
.
count
(
"type"
)
!=
0
&&
inst
[
"type"
]
==
sub
)
{
return
&
inst
;
}
// continue
}
else
{
if
(
modules
.
count
(
modname
)
==
0
){
break
;
}
else
{
json
&
module
=
modules
[
modname
];
for
(
auto
&
inst
:
module
)
{
if
(
inst
.
count
(
"sn"
)
!=
0
&&
inst
[
"sn"
]
==
sn
&&
inst
.
count
(
"iid"
)
!=
0
&&
inst
[
"iid"
]
==
iid
)
{
if
(
!
sub
.
empty
())
{
if
(
inst
.
count
(
"type"
)
!=
0
&&
inst
[
"type"
]
==
sub
)
{
return
&
inst
;
}
// continue
}
else
{
return
&
inst
;
}
}
}
}
}
}
}
return
ret
;
}
...
...
@@ -391,22 +389,7 @@ togo_end:
spdlog
::
error
(
"failed to save new generated sn"
);
exit
(
1
);
}
else
{
// // replace sn
// size_t idx = 0;
// for(auto &j:_sn_tmpl) {
// idx = 0;
// while(true) {
// idx = _config_default_tmpl.find(j, idx);
// if(idx == string::npos) break;
// _config_default_tmpl.replace(idx, j.size(), sn);
// idx+=sn.size();
// }
// }
// // replace camera addr, user, password, cloud-addr
// spdlog::debug("new config: {}", _config_default_tmpl);
// json j = json::parse(_config_default_tmpl);
// return setLocalConfig(j);
//
}
}
...
...
opencv-motion-detect/evdaemon.cpp
浏览文件 @
44c36e1d
...
...
@@ -220,8 +220,6 @@ class EvDaemon{
spdlog
::
warn
(
"evdaemon {} peer disconnected: {}"
,
devSn
,
selfId
);
}
//update config
ret
=
LVDB
::
setLocalConfig
(
config
);
if
(
ret
<
0
)
{
spdlog
::
error
(
"evdaemon {} failed to update localconfig"
,
devSn
);
}
...
...
opencv-motion-detect/evmgr.cpp
浏览文件 @
44c36e1d
...
...
@@ -145,8 +145,6 @@ private:
spdlog
::
warn
(
"evmgr {} peer disconnected: {}"
,
devSn
,
selfId
);
}
//update config
ret
=
LVDB
::
setLocalConfig
(
config
);
if
(
ret
<
0
)
{
spdlog
::
error
(
"evmgr {} failed to update localconfig"
,
devSn
);
}
...
...
opencv-motion-detect/evmlmotion.cpp
浏览文件 @
44c36e1d
...
...
@@ -100,7 +100,7 @@ private:
spdlog
::
error
(
"failed to get local configuration"
);
exit
(
1
);
}
spdlog
::
info
(
"evmlmotion {} config: {}"
,
devSn
,
config
.
dump
(
4
));
json
evmlmotion
;
json
&
evmgr
=
this
->
config
;
...
...
@@ -146,7 +146,7 @@ private:
// TODO: multiple protocols support
if
(
evmlmotion
.
count
(
"path"
)
==
0
)
{
spdlog
::
warn
(
"evmlmotion {} no params for path, using default: {}"
,
selfId
,
URLOUT_DEFAULT
);
spdlog
::
info
(
"evmlmotion {} no params for path, using default: {}"
,
selfId
,
URLOUT_DEFAULT
);
urlOut
=
URLOUT_DEFAULT
;
}
else
{
...
...
@@ -161,35 +161,35 @@ private:
// detection params
if
(
evmlmotion
.
count
(
"thresh"
)
==
0
||
evmlmotion
[
"thresh"
]
<
10
||
evmlmotion
[
"thresh"
]
>=
255
)
{
spdlog
::
warn
(
"evmlmotion {} invalid thresh value. should be in (10,255), default to 80"
,
selfId
);
spdlog
::
info
(
"evmlmotion {} invalid thresh value. should be in (10,255), default to 80"
,
selfId
);
detPara
.
thre
=
80
;
}
else
{
detPara
.
thre
=
evmlmotion
[
"thresh"
];
}
if
(
evmlmotion
.
count
(
"area"
)
==
0
||
evmlmotion
[
"area"
]
<
10
||
evmlmotion
[
"area"
]
>=
int
(
FRAME_SIZE
*
FRAME_SIZE
)
*
9
/
10
)
{
spdlog
::
warn
(
"evmlmotion {} invalid area value. should be in (10, 500*500*/10), default to 500"
,
selfId
);
spdlog
::
info
(
"evmlmotion {} invalid area value. should be in (10, 500*500*/10), default to 500"
,
selfId
);
detPara
.
area
=
FRAME_SIZE
;
}
else
{
detPara
.
area
=
evmlmotion
[
"area"
];
}
if
(
evmlmotion
.
count
(
"pre"
)
==
0
||
evmlmotion
[
"pre"
]
<
1
||
evmlmotion
[
"pre"
]
>=
120
)
{
spdlog
::
warn
(
"evmlmotion {} invalid pre value. should be in (1, 120), default to 3"
,
selfId
);
spdlog
::
info
(
"evmlmotion {} invalid pre value. should be in (1, 120), default to 3"
,
selfId
);
detPara
.
pre
=
3
;
}
else
{
detPara
.
pre
=
evmlmotion
[
"pre"
];
}
if
(
evmlmotion
.
count
(
"post"
)
==
0
||
evmlmotion
[
"post"
]
<
6
||
evmlmotion
[
"post"
]
>=
120
)
{
spdlog
::
warn
(
"evmlmotion {} invalid post value. should be in (6, 120), default to 30"
,
selfId
);
spdlog
::
info
(
"evmlmotion {} invalid post value. should be in (6, 120), default to 30"
,
selfId
);
detPara
.
post
=
30
;
}
else
{
detPara
.
post
=
evmlmotion
[
"post"
];
}
if
(
evmlmotion
.
count
(
"entropy"
)
==
0
||
evmlmotion
[
"entropy"
]
<
0
||
evmlmotion
[
"entropy"
]
>=
10
)
{
spdlog
::
warn
(
"evmlmotion {} invalid entropy value. should be in (0, 10), default to 0.3"
,
selfId
);
spdlog
::
info
(
"evmlmotion {} invalid entropy value. should be in (0, 10), default to 0.3"
,
selfId
);
detPara
.
entropy
=
0.3
;
}
else
{
detPara
.
entropy
=
evmlmotion
[
"entropy"
];
...
...
opencv-motion-detect/evpusher.cpp
浏览文件 @
44c36e1d
...
...
@@ -126,9 +126,6 @@ private:
exit
(
1
);
}
//update status and ping
evpusher
[
"status"
]
=
1
;
ret
=
LVDB
::
setLocalConfig
(
config
);
if
(
ret
<
0
)
{
spdlog
::
error
(
"evpusher {} failed to set config: {}"
,
selfId
,
config
.
dump
());
}
...
...
opencv-motion-detect/evslicer.cpp
浏览文件 @
44c36e1d
...
...
@@ -101,14 +101,14 @@ private:
pullerGid
=
evpuller
[
"sn"
].
get
<
string
>
()
+
":evpuller:"
+
to_string
(
evpuller
[
"iid"
]);
mgrSn
=
evmgr
[
"sn"
];
if
(
evslicer
.
count
(
"path"
)
==
0
)
{
spdlog
::
warn
(
"evslicer {} no params for path, using default: {}"
,
selfId
,
URLOUT_DEFAULT
);
spdlog
::
info
(
"evslicer {} no params for path, using default: {}"
,
selfId
,
URLOUT_DEFAULT
);
urlOut
=
URLOUT_DEFAULT
;
}
else
{
urlOut
=
evslicer
[
"path"
];
}
if
(
evslicer
.
count
(
"days"
)
==
0
)
{
spdlog
::
warn
(
"evslicer {} no params for days, using default: {}"
,
selfId
,
NUM_DAYS_DEFAULT
);
spdlog
::
info
(
"evslicer {} no params for days, using default: {}"
,
selfId
,
NUM_DAYS_DEFAULT
);
days
=
NUM_DAYS_DEFAULT
;
}
else
{
...
...
@@ -116,7 +116,7 @@ private:
}
if
(
evslicer
.
count
(
"minutes"
)
==
0
)
{
spdlog
::
warn
(
"evslicer {} no params for minutes, using default: {}"
,
selfId
,
MINUTES_PER_SLICE_DEFAULT
);
spdlog
::
info
(
"evslicer {} no params for minutes, using default: {}"
,
selfId
,
MINUTES_PER_SLICE_DEFAULT
);
minutes
=
MINUTES_PER_SLICE_DEFAULT
;
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论