Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
94ecc77e
提交
94ecc77e
authored
10月 12, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cloud cmd api for platform client
上级
18570676
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
61 行增加
和
41 行删除
+61
-41
database.cpp
opencv-motion-detect/database.cpp
+2
-2
config.json
opencv-motion-detect/deployment/config.json
+13
-13
evmgr.cpp
opencv-motion-detect/evmgr.cpp
+1
-1
evmlmotion.cpp
opencv-motion-detect/evmlmotion.cpp
+2
-2
evpuller.cpp
opencv-motion-detect/evpuller.cpp
+2
-2
evpusher.cpp
opencv-motion-detect/evpusher.cpp
+2
-2
evslicer.cpp
opencv-motion-detect/evslicer.cpp
+32
-12
utils.cpp
opencv-motion-detect/inc/utils.cpp
+7
-7
没有找到文件。
opencv-motion-detect/database.cpp
浏览文件 @
94ecc77e
...
@@ -21,7 +21,7 @@ update: 2019/09/10
...
@@ -21,7 +21,7 @@ update: 2019/09/10
using
namespace
leveldb
;
using
namespace
leveldb
;
using
namespace
httplib
;
using
namespace
httplib
;
string
_config_default_tmpl
=
"{
\"
time
\"
:0,
\"
code
\"
:0,
\"
data
\"
:{
\"
<SN_MGR>
\"
:{
\"
sn
\"
:
\"
<SN_MGR>
\"
,
\"
addr
\"
:
\"
127.0.0.1
\"
,
\"
mqtt
-cloud
\"
:
\"
<cloud_addr>
\"
,
\"
api-cloud
\"
:
\"
http://127.0.0.1:8089
\"
,
\"
proto
\"
:
\"
zmq
\"
,
\"
port-cloud
\"
:5556,
\"
port-router
\"
:5550,
\"
status
\"
:1,
\"
ipcs
\"
:[{
\"
addr
\"
:
\"
172.31.0.51
\"
,
\"
proto
\"
:
\"
rtsp
\"
,
\"
user
\"
:
\"
admin
\"
,
\"
password
\"
:
\"
FWBWTU
\"
,
\"
status
\"
:0,
\"
port
\"
:554,
\"
modules
\"
:{
\"
evpuller
\"
:[{
\"
sn
\"
:
\"
<SN_PULLER>
\"
,
\"
addr
\"
:
\"
127.0.0.1
\"
,
\"
iid
\"
:1,
\"
port-p
ub
\"
:5556,
\"
status
\"
:0}],
\"
evpusher
\"
:[{
\"
sn
\"
:
\"
<SN_PUSHER>
\"
,
\"
iid
\"
:1,
\"
urlDest
\"
:
\"
rtsp://40.73.41.176:554/test1
\"
,
\"
user
\"
:
\"\"
,
\"
password
\"
:
\"\"
,
\"
token
\"
:
\"\"
,
\"
enabled
\"
:1,
\"
status
\"
:0}],
\"
evslicer
\"
:[{
\"
sn
\"
:
\"
<SN_SLICER>
\"
,
\"
iid
\"
:1,
\"
path
\"
:
\"
slices
\"
,
\"
enabled
\"
:1,
\"
status
\"
:0}],
\"
evml
\"
:[{
\"
type
\"
:
\"
motion
\"
,
\"
sn
\"
:
\"
<SN_ML>
\"
,
\"
iid
\"
:1,
\"
pre
\"
:3,
\"
area
\"
:300,
\"
post
\"
:30,
\"
thresh
\"
:80,
\"
enabled
\"
:1,
\"
status
\"
:0}]}}]}}}"
;
string
_config_default_tmpl
=
"{
\"
time
\"
:0,
\"
code
\"
:0,
\"
data
\"
:{
\"
<SN_MGR>
\"
:{
\"
sn
\"
:
\"
<SN_MGR>
\"
,
\"
addr
\"
:
\"
127.0.0.1
\"
,
\"
mqtt
Cloud
\"
:
\"
<cloud_addr>
\"
,
\"
apiCloud
\"
:
\"
http://127.0.0.1:8089
\"
,
\"
proto
\"
:
\"
zmq
\"
,
\"
portCloud
\"
:5556,
\"
portRouter
\"
:5550,
\"
status
\"
:1,
\"
ipcs
\"
:[{
\"
addr
\"
:
\"
172.31.0.51
\"
,
\"
proto
\"
:
\"
rtsp
\"
,
\"
user
\"
:
\"
admin
\"
,
\"
password
\"
:
\"
FWBWTU
\"
,
\"
status
\"
:0,
\"
port
\"
:554,
\"
modules
\"
:{
\"
evpuller
\"
:[{
\"
sn
\"
:
\"
<SN_PULLER>
\"
,
\"
addr
\"
:
\"
127.0.0.1
\"
,
\"
iid
\"
:1,
\"
portP
ub
\"
:5556,
\"
status
\"
:0}],
\"
evpusher
\"
:[{
\"
sn
\"
:
\"
<SN_PUSHER>
\"
,
\"
iid
\"
:1,
\"
urlDest
\"
:
\"
rtsp://40.73.41.176:554/test1
\"
,
\"
user
\"
:
\"\"
,
\"
password
\"
:
\"\"
,
\"
token
\"
:
\"\"
,
\"
enabled
\"
:1,
\"
status
\"
:0}],
\"
evslicer
\"
:[{
\"
sn
\"
:
\"
<SN_SLICER>
\"
,
\"
iid
\"
:1,
\"
path
\"
:
\"
slices
\"
,
\"
enabled
\"
:1,
\"
status
\"
:0}],
\"
evml
\"
:[{
\"
type
\"
:
\"
motion
\"
,
\"
sn
\"
:
\"
<SN_ML>
\"
,
\"
iid
\"
:1,
\"
pre
\"
:3,
\"
area
\"
:300,
\"
post
\"
:30,
\"
thresh
\"
:80,
\"
enabled
\"
:1,
\"
status
\"
:0}]}}]}}}"
;
const
string
_sn_tmpl
[]
=
{
"<SN_MGR>"
,
"<SN_PULLER>"
,
"<SN_PUSHER>"
,
"<SN_SLICER>"
,
"<SN_ML>"
};
const
string
_sn_tmpl
[]
=
{
"<SN_MGR>"
,
"<SN_PULLER>"
,
"<SN_PUSHER>"
,
"<SN_SLICER>"
,
"<SN_ML>"
};
const
string
_addr_tmpl
[]
=
{
"<ADDR_CAMERA>"
};
const
string
_addr_tmpl
[]
=
{
"<ADDR_CAMERA>"
};
...
@@ -381,7 +381,7 @@ togo_end:
...
@@ -381,7 +381,7 @@ togo_end:
// create default sn.
// create default sn.
string
sn
=
getStrRand
(
8
);
string
sn
=
getStrRand
(
8
);
info
[
"sn"
]
=
sn
;
info
[
"sn"
]
=
sn
;
info
[
"api
-c
loud"
]
=
"http://127.0.0.1:8089"
;
info
[
"api
C
loud"
]
=
"http://127.0.0.1:8089"
;
spdlog
::
warn
(
"no local sn set. create a new one: {}"
,
sn
);
spdlog
::
warn
(
"no local sn set. create a new one: {}"
,
sn
);
auto
tsNow
=
chrono
::
duration_cast
<
chrono
::
seconds
>
(
chrono
::
system_clock
::
now
().
time_since_epoch
()).
count
();
auto
tsNow
=
chrono
::
duration_cast
<
chrono
::
seconds
>
(
chrono
::
system_clock
::
now
().
time_since_epoch
()).
count
();
info
[
"lastboot"
]
=
tsNow
;
info
[
"lastboot"
]
=
tsNow
;
...
...
opencv-motion-detect/deployment/config.json
浏览文件 @
94ecc77e
{
{
"data"
:{
"data"
:{
"
W2E0VFN1
"
:{
"
V2I0C7KC
"
:{
"addr"
:
"127.0.0.1"
,
"addr"
:
"127.0.0.1"
,
"api
-c
loud"
:
"http://127.0.0.1:8089"
,
"api
C
loud"
:
"http://127.0.0.1:8089"
,
"ipcs"
:[
"ipcs"
:[
{
{
"addr"
:
"172.31.0.129"
,
"addr"
:
"172.31.0.129"
,
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
"iid"
:
1
,
"iid"
:
1
,
"post"
:
30
,
"post"
:
30
,
"pre"
:
3
,
"pre"
:
3
,
"sn"
:
"
W2E0VFN1
"
,
"sn"
:
"
V2I0C7KC
"
,
"thresh"
:
30
,
"thresh"
:
30
,
"entropy"
:
0.3
,
"entropy"
:
0.3
,
"type"
:
"motion"
"type"
:
"motion"
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
"addr"
:
"127.0.0.1"
,
"addr"
:
"127.0.0.1"
,
"iid"
:
1
,
"iid"
:
1
,
"enabled"
:
1
,
"enabled"
:
1
,
"port
-p
ub"
:
5556
,
"port
P
ub"
:
5556
,
"sn"
:
"
W2E0VFN1
"
"sn"
:
"
V2I0C7KC
"
}
}
],
],
"evpusher"
:[
"evpusher"
:[
...
@@ -34,9 +34,9 @@
...
@@ -34,9 +34,9 @@
"enabled"
:
0
,
"enabled"
:
0
,
"iid"
:
1
,
"iid"
:
1
,
"password"
:
""
,
"password"
:
""
,
"sn"
:
"
W2E0VFN1
"
,
"sn"
:
"
V2I0C7KC
"
,
"token"
:
""
,
"token"
:
""
,
"urlDest"
:
"rtsp://40.73.41.176/
W2E0VFN1
"
,
"urlDest"
:
"rtsp://40.73.41.176/
V2I0C7KC
"
,
"user"
:
""
"user"
:
""
}
}
],
],
...
@@ -45,8 +45,8 @@
...
@@ -45,8 +45,8 @@
"enabled"
:
1
,
"enabled"
:
1
,
"iid"
:
1
,
"iid"
:
1
,
"path"
:
"slices"
,
"path"
:
"slices"
,
"sn"
:
"
W2E0VFN1
"
,
"sn"
:
"
V2I0C7KC
"
,
"video
-server-a
ddr"
:
"http://40.73.41.176:10009/upload/evtvideos/"
"video
ServerA
ddr"
:
"http://40.73.41.176:10009/upload/evtvideos/"
}
}
]
]
},
},
...
@@ -57,11 +57,11 @@
...
@@ -57,11 +57,11 @@
"sn"
:
"iLabService"
"sn"
:
"iLabService"
}
}
],
],
"mqtt
-c
loud"
:
"<cloud_addr>"
,
"mqtt
C
loud"
:
"<cloud_addr>"
,
"port
-c
loud"
:
5556
,
"port
C
loud"
:
5556
,
"port
-r
outer"
:
5550
,
"port
R
outer"
:
5550
,
"proto"
:
"zmq"
,
"proto"
:
"zmq"
,
"sn"
:
"
W2E0VFN1
"
"sn"
:
"
V2I0C7KC
"
}
}
},
},
"lastupdated"
:
1567669674
"lastupdated"
:
1567669674
...
...
opencv-motion-detect/evmgr.cpp
浏览文件 @
94ecc77e
...
@@ -68,7 +68,7 @@ private:
...
@@ -68,7 +68,7 @@ private:
goto
error_exit
;
goto
error_exit
;
}
}
addr
=
"tcp://*:"
+
to_string
(
config
[
"port
-r
outer"
]);
addr
=
"tcp://*:"
+
to_string
(
config
[
"port
R
outer"
]);
// setup zmq
// setup zmq
// TODO: connect to cloud
// TODO: connect to cloud
...
...
opencv-motion-detect/evmlmotion.cpp
浏览文件 @
94ecc77e
...
@@ -217,8 +217,8 @@ private:
...
@@ -217,8 +217,8 @@ private:
json
evslicer
=
ipc
[
"modules"
][
"evslicer"
][
0
];
json
evslicer
=
ipc
[
"modules"
][
"evslicer"
][
0
];
slicerGid
=
evslicer
[
"sn"
].
get
<
string
>
()
+
":evslicer:"
+
to_string
(
evslicer
[
"iid"
]);
slicerGid
=
evslicer
[
"sn"
].
get
<
string
>
()
+
":evslicer:"
+
to_string
(
evslicer
[
"iid"
]);
urlPub
=
string
(
"tcp://"
)
+
evpuller
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evpuller
[
"port
-p
ub"
]);
urlPub
=
string
(
"tcp://"
)
+
evpuller
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evpuller
[
"port
P
ub"
]);
urlRouter
=
string
(
"tcp://"
)
+
evmgr
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evmgr
[
"port
-r
outer"
]);
urlRouter
=
string
(
"tcp://"
)
+
evmgr
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evmgr
[
"port
R
outer"
]);
spdlog
::
info
(
"evmlmotion {} will connect to {} for sub, {} for router"
,
selfId
,
urlPub
,
urlRouter
);
spdlog
::
info
(
"evmlmotion {} will connect to {} for sub, {} for router"
,
selfId
,
urlPub
,
urlRouter
);
// TODO: multiple protocols support
// TODO: multiple protocols support
...
...
opencv-motion-detect/evpuller.cpp
浏览文件 @
94ecc77e
...
@@ -220,8 +220,8 @@ private:
...
@@ -220,8 +220,8 @@ private:
exit
(
1
);
exit
(
1
);
}
}
urlPub
=
string
(
"tcp://*:"
)
+
to_string
(
evpuller
[
"port
-p
ub"
]);
urlPub
=
string
(
"tcp://*:"
)
+
to_string
(
evpuller
[
"port
P
ub"
]);
urlDealer
=
"tcp://"
+
evmgr
[
"addr"
].
get
<
string
>
()
+
string
(
":"
)
+
to_string
(
evmgr
[
"port
-r
outer"
]);
urlDealer
=
"tcp://"
+
evmgr
[
"addr"
].
get
<
string
>
()
+
string
(
":"
)
+
to_string
(
evmgr
[
"port
R
outer"
]);
spdlog
::
info
(
"evpuller {} bind on {} for pub, connect to {} for dealer"
,
selfId
,
urlPub
,
urlDealer
);
spdlog
::
info
(
"evpuller {} bind on {} for pub, connect to {} for dealer"
,
selfId
,
urlPub
,
urlDealer
);
pPubCtx
=
zmq_ctx_new
();
pPubCtx
=
zmq_ctx_new
();
...
...
opencv-motion-detect/evpusher.cpp
浏览文件 @
94ecc77e
...
@@ -91,8 +91,8 @@ private:
...
@@ -91,8 +91,8 @@ private:
pullerGid
=
evpuller
[
"sn"
].
get
<
string
>
()
+
":evpuller:"
+
to_string
(
evpuller
[
"iid"
]);
pullerGid
=
evpuller
[
"sn"
].
get
<
string
>
()
+
":evpuller:"
+
to_string
(
evpuller
[
"iid"
]);
mgrSn
=
evmgr
[
"sn"
];
mgrSn
=
evmgr
[
"sn"
];
urlPub
=
string
(
"tcp://"
)
+
evpuller
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evpuller
[
"port
-p
ub"
]);
urlPub
=
string
(
"tcp://"
)
+
evpuller
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evpuller
[
"port
P
ub"
]);
urlDealer
=
string
(
"tcp://"
)
+
evmgr
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evmgr
[
"port
-r
outer"
]);
urlDealer
=
string
(
"tcp://"
)
+
evmgr
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evmgr
[
"port
R
outer"
]);
spdlog
::
info
(
"evpusher {} connect to {} for sub, {} for router"
,
selfId
,
urlPub
,
urlDealer
);
spdlog
::
info
(
"evpusher {} connect to {} for sub, {} for router"
,
selfId
,
urlPub
,
urlDealer
);
// TODO: multiple protocols support
// TODO: multiple protocols support
urlOut
=
evpusher
[
"urlDest"
].
get
<
string
>
();
urlOut
=
evpusher
[
"urlDest"
].
get
<
string
>
();
...
...
opencv-motion-detect/evslicer.cpp
浏览文件 @
94ecc77e
...
@@ -259,8 +259,8 @@ private:
...
@@ -259,8 +259,8 @@ private:
ipcSn
=
ipc
[
"sn"
];
ipcSn
=
ipc
[
"sn"
];
}
}
if
(
evslicer
.
count
(
"video
-server-addr"
)
!=
0
&&
!
evslicer
[
"video-server-a
ddr"
].
get
<
string
>
().
empty
())
{
if
(
evslicer
.
count
(
"video
ServerAddr"
)
!=
0
&&
!
evslicer
[
"videoServerA
ddr"
].
get
<
string
>
().
empty
())
{
videoFileServerApi
=
evslicer
[
"video
-server-a
ddr"
].
get
<
string
>
();
videoFileServerApi
=
evslicer
[
"video
ServerA
ddr"
].
get
<
string
>
();
if
(
videoFileServerApi
.
at
(
videoFileServerApi
.
size
()
-
1
)
!=
'/'
)
{
if
(
videoFileServerApi
.
at
(
videoFileServerApi
.
size
()
-
1
)
!=
'/'
)
{
videoFileServerApi
+=
string
(
"/"
);
videoFileServerApi
+=
string
(
"/"
);
}
}
...
@@ -301,8 +301,8 @@ private:
...
@@ -301,8 +301,8 @@ private:
spdlog
::
info
(
"evslicer mkdir -p {}"
,
selfId
,
urlOut
);
spdlog
::
info
(
"evslicer mkdir -p {}"
,
selfId
,
urlOut
);
ret
=
system
((
string
(
"mkdir -p "
)
+
urlOut
).
c_str
());
ret
=
system
((
string
(
"mkdir -p "
)
+
urlOut
).
c_str
());
urlPub
=
string
(
"tcp://"
)
+
evpuller
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evpuller
[
"port
-p
ub"
]);
urlPub
=
string
(
"tcp://"
)
+
evpuller
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evpuller
[
"port
P
ub"
]);
urlRouter
=
string
(
"tcp://"
)
+
evmgr
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evmgr
[
"port
-r
outer"
]);
urlRouter
=
string
(
"tcp://"
)
+
evmgr
[
"addr"
].
get
<
string
>
()
+
":"
+
to_string
(
evmgr
[
"port
R
outer"
]);
spdlog
::
info
(
"evslicer {} will connect to {} for sub, {} for router"
,
selfId
,
urlPub
,
urlRouter
);
spdlog
::
info
(
"evslicer {} will connect to {} for sub, {} for router"
,
selfId
,
urlPub
,
urlRouter
);
// setup sub
// setup sub
...
@@ -613,11 +613,12 @@ protected:
...
@@ -613,11 +613,12 @@ protected:
string
videoFileTs2Name
(
long
ts
,
bool
bLog
=
false
)
string
videoFileTs2Name
(
long
ts
,
bool
bLog
=
false
)
{
{
std
::
time_t
now
=
ts
;
std
::
tm
t
;
std
::
tm
*
ptm
=
std
::
localtime
(
&
now
);
memcpy
(
&
t
,
localtime
(
&
ts
),
sizeof
(
t
));
char
buffer
[
20
];
char
buffer
[
20
];
// Format: Mo, 15.06.2009 20:20:00
// Format: Mo, 15.06.2009 20:20:00
std
::
strftime
(
buffer
,
20
,
"%Y%m%d_%H%M%S"
,
ptm
);
std
::
strftime
(
buffer
,
20
,
"%Y%m%d_%H%M%S"
,
&
t
);
if
(
bLog
)
if
(
bLog
)
spdlog
::
info
(
"ts: {}, fname: {}/{}.mp4"
,
ts
,
this
->
urlOut
,
buffer
);
spdlog
::
info
(
"ts: {}, fname: {}/{}.mp4"
,
ts
,
this
->
urlOut
,
buffer
);
return
string
(
buffer
);
return
string
(
buffer
);
...
@@ -822,8 +823,6 @@ protected:
...
@@ -822,8 +823,6 @@ protected:
// find video files
// find video files
vector
<
string
>
findSlicesByRange
(
long
tss
,
long
tse
,
int
offsetS
,
int
offsetE
)
vector
<
string
>
findSlicesByRange
(
long
tss
,
long
tse
,
int
offsetS
,
int
offsetE
)
{
{
debugFilesRing
(
this
->
vTsActive
);
vector
<
string
>
ret
;
vector
<
string
>
ret
;
int
found
=
0
;
int
found
=
0
;
int
_itss
=
0
;
int
_itss
=
0
;
...
@@ -997,9 +996,30 @@ public:
...
@@ -997,9 +996,30 @@ public:
}
}
// TODO: scheduled task
// TODO: scheduled task
spdlog
::
info
(
"evslicer {} wait for {}s to matching event videos"
,
this
->
selfId
,
this
->
seconds
+
5
);
// check tss, tse
int
sIdx
=
0
,
eIdx
=
0
;
this_thread
::
sleep_for
(
chrono
::
seconds
(
this
->
seconds
+
5
));
if
(
this
->
bSegFull
)
{
sIdx
=
this
->
incSegHead
(
this
->
segHead
);
eIdx
=
this
->
decSegHead
(
this
->
segHead
);
}
else
{
sIdx
=
1
;
eIdx
=
this
->
decSegHead
(
this
->
segHead
);
}
if
(
sIdx
>
eIdx
||
tss
>
this
->
vTsActive
[
eIdx
]
||
tse
<
this
->
vTsActive
[
sIdx
])
{
spdlog
::
error
(
"event range ({}, {}) not in local range ({}, {})."
,
tss
,
tse
,
this
->
vTsActive
[
sIdx
],
this
->
vTsActive
[
eIdx
]);
this
->
debugFilesRing
(
this
->
vTsActive
);
continue
;
}
if
(
sIdx
==
eIdx
)
{
spdlog
::
info
(
"evslicer {} wait for {}s to matching event videos"
,
this
->
selfId
,
this
->
seconds
+
5
);
this_thread
::
sleep_for
(
chrono
::
seconds
(
this
->
seconds
+
5
));
}
else
{
spdlog
::
info
(
"event range ({}, {}) is in local range ({}, {})."
,
tss
,
tse
,
this
->
vTsActive
[
sIdx
],
this
->
vTsActive
[
eIdx
]);
}
auto
v
=
findSlicesByRange
(
tss
,
tse
,
offsetS
,
offsetE
);
auto
v
=
findSlicesByRange
(
tss
,
tse
,
offsetS
,
offsetE
);
if
(
v
.
size
()
==
0
)
{
if
(
v
.
size
()
==
0
)
{
spdlog
::
error
(
"evslicer {} ignore upload videos in range ({}, {})"
,
this
->
selfId
,
this
->
videoFileTs2Name
(
tss
),
this
->
videoFileTs2Name
(
tse
));
spdlog
::
error
(
"evslicer {} ignore upload videos in range ({}, {})"
,
this
->
selfId
,
this
->
videoFileTs2Name
(
tss
),
this
->
videoFileTs2Name
(
tse
));
...
...
opencv-motion-detect/inc/utils.cpp
浏览文件 @
94ecc77e
...
@@ -9,10 +9,10 @@ json registry(json &conf, string sn, string module)
...
@@ -9,10 +9,10 @@ json registry(json &conf, string sn, string module)
json
ret
;
json
ret
;
string
api
;
string
api
;
try
{
try
{
api
=
conf
.
at
(
"data"
).
at
(
sn
).
at
(
"api
-c
loud"
).
get
<
string
>
()
+
"/register"
;
api
=
conf
.
at
(
"data"
).
at
(
sn
).
at
(
"api
C
loud"
).
get
<
string
>
()
+
"/register"
;
Uri
uri
=
Uri
::
Parse
(
api
);
Uri
uri
=
Uri
::
Parse
(
api
);
if
(
uri
.
Host
.
empty
()
||
uri
.
Port
.
empty
()
||
uri
.
Protocol
.
find
(
"http"
)
==
string
::
npos
||
uri
.
Path
.
empty
())
{
if
(
uri
.
Host
.
empty
()
||
uri
.
Port
.
empty
()
||
uri
.
Protocol
.
find
(
"http"
)
==
string
::
npos
||
uri
.
Path
.
empty
())
{
string
msg
=
"registry error. invalid api
-c
loud in config: "
+
api
;
string
msg
=
"registry error. invalid api
C
loud in config: "
+
api
;
ret
[
"code"
]
=
1
;
ret
[
"code"
]
=
1
;
ret
[
"msg"
]
=
msg
;
ret
[
"msg"
]
=
msg
;
spdlog
::
error
(
msg
);
spdlog
::
error
(
msg
);
...
@@ -45,11 +45,11 @@ json reqConfig(json &info)
...
@@ -45,11 +45,11 @@ json reqConfig(json &info)
json
ret
;
json
ret
;
string
api
;
string
api
;
try
{
try
{
api
=
info
.
at
(
"api
-c
loud"
).
get
<
string
>
();
api
=
info
.
at
(
"api
C
loud"
).
get
<
string
>
();
Uri
uri
=
Uri
::
Parse
(
api
);
Uri
uri
=
Uri
::
Parse
(
api
);
string
sn
=
info
.
at
(
"sn"
).
get
<
string
>
();
string
sn
=
info
.
at
(
"sn"
).
get
<
string
>
();
if
(
uri
.
Host
.
empty
()
||
uri
.
Port
.
empty
()
||
uri
.
Protocol
.
find
(
"http"
)
==
string
::
npos
)
{
if
(
uri
.
Host
.
empty
()
||
uri
.
Port
.
empty
()
||
uri
.
Protocol
.
find
(
"http"
)
==
string
::
npos
)
{
string
msg
=
string
(
__FILE__
)
+
":"
+
to_string
(
__LINE__
)
+
": request cloud configuration error. invalid api
-c
loud in info: "
+
api
;
string
msg
=
string
(
__FILE__
)
+
":"
+
to_string
(
__LINE__
)
+
": request cloud configuration error. invalid api
C
loud in info: "
+
api
;
ret
[
"code"
]
=
EVCLOUD_REQ_E_PARAM
;
ret
[
"code"
]
=
EVCLOUD_REQ_E_PARAM
;
ret
[
"msg"
]
=
msg
;
ret
[
"msg"
]
=
msg
;
spdlog
::
error
(
msg
);
spdlog
::
error
(
msg
);
...
@@ -334,7 +334,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -334,7 +334,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
// one ipc
// one ipc
if
(
!
matched
&&
!
hasError
)
{
if
(
!
matched
&&
!
hasError
)
{
// /PSBV7GKN/ipcs/0"
// /PSBV7GKN/ipcs/0"
// {"addr":"172.31.0.129","modules":{"evml":[{"area":200,"enabled":1,"entropy":0.3,"iid":1,"post":30,"pre":3,"sn":"PSBV7GKN","thresh":30,"type":"motion"}],"evpuller":[{"addr":"127.0.0.1","enabled":1,"iid":1,"port
-pub":5556,"sn":"PSBV7GKN"}],"evpusher":[{"enabled":0,"iid":1,"password":"","sn":"PSBV7GKN","token":"","urlDest":"rtsp://40.73.41.176/PSBV7GKN","user":""}],"evslicer":[{"enabled":1,"iid":1,"path":"slices","sn":"PSBV7GKN","video-server-a
ddr":"http://40.73.41.176:10009/upload/evtvideos/"}]},"password":"iLabService","port":554,"proto":"rtsp","sn":"iLabService","user":"admin"}
// {"addr":"172.31.0.129","modules":{"evml":[{"area":200,"enabled":1,"entropy":0.3,"iid":1,"post":30,"pre":3,"sn":"PSBV7GKN","thresh":30,"type":"motion"}],"evpuller":[{"addr":"127.0.0.1","enabled":1,"iid":1,"port
Pub":5556,"sn":"PSBV7GKN"}],"evpusher":[{"enabled":0,"iid":1,"password":"","sn":"PSBV7GKN","token":"","urlDest":"rtsp://40.73.41.176/PSBV7GKN","user":""}],"evslicer":[{"enabled":1,"iid":1,"path":"slices","sn":"PSBV7GKN","videoServerA
ddr":"http://40.73.41.176:10009/upload/evtvideos/"}]},"password":"iLabService","port":554,"proto":"rtsp","sn":"iLabService","user":"admin"}
string
clusterRegStr
=
"/(
\\
w+)/ipcs/(
\\
d+)(?:/[^/]+)?"
;
string
clusterRegStr
=
"/(
\\
w+)/ipcs/(
\\
d+)(?:/[^/]+)?"
;
std
::
regex
clusterRegex
(
clusterRegStr
);
std
::
regex
clusterRegex
(
clusterRegStr
);
std
::
smatch
results
;
std
::
smatch
results
;
...
@@ -375,7 +375,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -375,7 +375,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
// match module config
// match module config
if
(
!
matched
&&
!
hasError
)
{
if
(
!
matched
&&
!
hasError
)
{
// /PSBV7GKN/ipcs/0/modules/evslicer/0/video
-server-a
ddr
// /PSBV7GKN/ipcs/0/modules/evslicer/0/video
ServerA
ddr
// /NMXH73Y2/ipcs/0/modules/evpusher/0/urlDest
// /NMXH73Y2/ipcs/0/modules/evpusher/0/urlDest
string
moduleRegStr
=
"/(
\\
w+)/ipcs/(
\\
d+)/modules/(
\\
w+)/(
\\
d+)/([^/]+)"
;
string
moduleRegStr
=
"/(
\\
w+)/ipcs/(
\\
d+)/modules/(
\\
w+)/(
\\
d+)/([^/]+)"
;
std
::
regex
moduleRegex
(
moduleRegStr
);
std
::
regex
moduleRegex
(
moduleRegStr
);
...
@@ -518,7 +518,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -518,7 +518,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
// whole cluster
// whole cluster
if
(
!
matched
&&
!
hasError
)
{
if
(
!
matched
&&
!
hasError
)
{
// /PSBV7GKN
// /PSBV7GKN
// "value":{"addr":"127.0.0.1","api
-cloud":"http://127.0.0.1:8089","ipcs":[{"addr":"172.31.0.129","modules":{"evml":[{"area":200,"enabled":1,"entropy":0.3,"iid":1,"post":30,"pre":3,"sn":"PSBV7GKN","thresh":30,"type":"motion"}],"evpuller":[{"addr":"127.0.0.1","enabled":1,"iid":1,"port-pub":5556,"sn":"PSBV7GKN"}],"evpusher":[{"enabled":0,"iid":1,"password":"","sn":"PSBV7GKN","token":"","urlDest":"rtsp://40.73.41.176/PSBV7GKN","user":""}],"evslicer":[{"enabled":1,"iid":1,"path":"slices","sn":"PSBV7GKN","video-server-addr":"http://40.73.41.176:10009/upload/evtvideos/"}]},"password":"iLabService","port":554,"proto":"rtsp","sn":"iLabService","user":"admin"}],"mqtt-cloud":"<cloud_addr>","port-cloud":5556,"port-r
outer":5550,"proto":"zmq","sn":"PSBV7GKN"}
// "value":{"addr":"127.0.0.1","api
Cloud":"http://127.0.0.1:8089","ipcs":[{"addr":"172.31.0.129","modules":{"evml":[{"area":200,"enabled":1,"entropy":0.3,"iid":1,"post":30,"pre":3,"sn":"PSBV7GKN","thresh":30,"type":"motion"}],"evpuller":[{"addr":"127.0.0.1","enabled":1,"iid":1,"portPub":5556,"sn":"PSBV7GKN"}],"evpusher":[{"enabled":0,"iid":1,"password":"","sn":"PSBV7GKN","token":"","urlDest":"rtsp://40.73.41.176/PSBV7GKN","user":""}],"evslicer":[{"enabled":1,"iid":1,"path":"slices","sn":"PSBV7GKN","videoServerAddr":"http://40.73.41.176:10009/upload/evtvideos/"}]},"password":"iLabService","port":554,"proto":"rtsp","sn":"iLabService","user":"admin"}],"mqttCloud":"<cloud_addr>","portCloud":5556,"portR
outer":5550,"proto":"zmq","sn":"PSBV7GKN"}
string
clusterRegStr
=
"/(
\\
w+)"
;
string
clusterRegStr
=
"/(
\\
w+)"
;
std
::
regex
clusterRegex
(
clusterRegStr
);
std
::
regex
clusterRegex
(
clusterRegStr
);
std
::
smatch
results
;
std
::
smatch
results
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论