Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
48d2f886
提交
48d2f886
authored
10月 09, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upload video files
上级
d7ccb6c0
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
38 行增加
和
30 行删除
+38
-30
settings.json
.vscode/settings.json
+4
-1
config.json
opencv-motion-detect/deployment/config.json
+1
-1
evcloudsvc-cloud-api.md
opencv-motion-detect/evcloudsvc-cloud-api.md
+2
-1
test_regex.cpp
opencv-motion-detect/test_regex.cpp
+31
-27
没有找到文件。
.vscode/settings.json
浏览文件 @
48d2f886
...
@@ -93,7 +93,9 @@
...
@@ -93,7 +93,9 @@
"*.tcc"
:
"cpp"
,
"*.tcc"
:
"cpp"
,
"memory_resource"
:
"cpp"
,
"memory_resource"
:
"cpp"
,
"csignal"
:
"cpp"
,
"csignal"
:
"cpp"
,
"__functional_03"
:
"cpp"
"__functional_03"
:
"cpp"
,
"variant"
:
"cpp"
,
"format"
:
"cpp"
},
},
"C_Cpp.errorSquiggles"
:
"Disabled"
"C_Cpp.errorSquiggles"
:
"Disabled"
}
}
\ No newline at end of file
opencv-motion-detect/deployment/config.json
浏览文件 @
48d2f886
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
],
],
"evpusher"
:[
"evpusher"
:[
{
{
"enabled"
:
0
,
"enabled"
:
1
,
"iid"
:
1
,
"iid"
:
1
,
"password"
:
""
,
"password"
:
""
,
"sn"
:
"PSBV7GKN"
,
"sn"
:
"PSBV7GKN"
,
...
...
opencv-motion-detect/evcloudsvc-cloud-api.md
浏览文件 @
48d2f886
...
@@ -162,8 +162,9 @@ set or change configuration for edge device
...
@@ -162,8 +162,9 @@ set or change configuration for edge device
}
}
```
```
2.
patch configure (POST /config?patch=true&sn=NMXH73Y2)
2.
patch configure (POST /config?patch=true&sn=NMXH73Y2)
-
SN in path may not be same with sn in param. since a module on this device may connects cluster mgr on other deivce.
```
```
[{"op":"add","path":"/ipcs/0/modules/evpuller/0/enabled","value":1}]
[{"op":"add","path":"/
RBKJ62Z1/
ipcs/0/modules/evpuller/0/enabled","value":1}]
```
```
##### return
##### return
-
type: json
-
type: json
...
...
opencv-motion-detect/test_regex.cpp
浏览文件 @
48d2f886
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <iterator>
#include <iterator>
#include <vector>
#include <vector>
#include <string>
#include <string>
#include <fstream>
#include <set>
#include <set>
#include "json.hpp"
#include "json.hpp"
#include <spdlog/spdlog.h>
#include <spdlog/spdlog.h>
...
@@ -18,8 +19,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -18,8 +19,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
ret
[
"msg"
]
=
"ok"
;
ret
[
"msg"
]
=
"ok"
;
ret
[
"data"
]
=
json
();
ret
[
"data"
]
=
json
();
bool
hasError
=
false
;
bool
hasError
=
false
;
spdlog
::
info
(
"matching {}"
,
diff
.
dump
());
try
{
try
{
for
(
auto
&
d
:
diff
)
{
for
(
auto
&
d
:
diff
.
array
())
{
spdlog
::
info
(
"d :{}, {}"
,
d
.
dump
(),
d
.
size
());
if
(
d
.
count
(
"path"
)
!=
0
)
{
if
(
d
.
count
(
"path"
)
!=
0
)
{
string
path_
=
d
[
"path"
];
string
path_
=
d
[
"path"
];
bool
matched
=
false
;
bool
matched
=
false
;
...
@@ -32,8 +35,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -32,8 +35,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
string
ipcRegStr
=
string
(
"/"
)
+
sn
+
"/ipcs/(
\\
d+)/(
\\
w+)"
;
string
ipcRegStr
=
string
(
"/"
)
+
sn
+
"/ipcs/(
\\
d+)/(
\\
w+)"
;
std
::
smatch
results
;
std
::
smatch
results
;
std
::
regex
ipcRegex
(
ipcRegStr
);
std
::
regex
ipcRegex
(
ipcRegStr
);
spdlog
::
info
(
"x diff: {}"
,
diff
.
dump
());
if
(
std
::
regex_match
(
path_
,
results
,
ipcRegex
))
{
if
(
std
::
regex_match
(
path_
,
results
,
ipcRegex
))
{
if
(
results
.
size
()
==
3
)
{
if
(
results
.
size
()
==
3
)
{
spdlog
::
info
(
"matched ipc: {}"
,
path_
);
matched
=
true
;
matched
=
true
;
int
ipcIdx
=
stoi
(
results
[
1
].
str
());
int
ipcIdx
=
stoi
(
results
[
1
].
str
());
string
tag
=
results
[
2
].
str
();
string
tag
=
results
[
2
].
str
();
...
@@ -71,7 +76,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -71,7 +76,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
}
}
}
}
}
}
}
else
{
for
(
auto
&
i
:
results
)
{
spdlog
::
info
(
"
\t
{}"
,
i
.
str
());
}
}
}
}
else
{
spdlog
::
info
(
"no match for ipc"
,
path_
);
}
}
// match module config
// match module config
...
@@ -82,6 +93,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -82,6 +93,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
std
::
smatch
results2
;
std
::
smatch
results2
;
if
(
std
::
regex_match
(
path_
,
results2
,
moduleRegex
))
{
if
(
std
::
regex_match
(
path_
,
results2
,
moduleRegex
))
{
if
(
results2
.
size
()
==
5
)
{
if
(
results2
.
size
()
==
5
)
{
spdlog
::
info
(
"matched module: {}"
,
path_
);
int
ipcIdx
=
stoi
(
results2
[
1
].
str
());
int
ipcIdx
=
stoi
(
results2
[
1
].
str
());
int
modIdx
=
stoi
(
results
[
3
].
str
());
int
modIdx
=
stoi
(
results
[
3
].
str
());
string
modName
=
results
[
2
].
str
();
string
modName
=
results
[
2
].
str
();
...
@@ -131,7 +143,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -131,7 +143,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
}
}
}
}
}
}
}
else
{
for
(
auto
&
i
:
results
)
{
spdlog
::
info
(
"
\t
{}"
,
i
.
str
());
}
}
}
}
else
{
spdlog
::
info
(
"no match for module {}"
,
path_
);
}
}
}
}
...
@@ -151,30 +169,15 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
...
@@ -151,30 +169,15 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
int
main
(){
int
main
(){
// (?:addr|password|port|user)
std
::
ifstream
iff
(
"deployment/config.json"
);
string
ipcPath
=
"/NMXH73Y2/ipcs/0/addr"
;
std
::
ifstream
iff2
(
"deployment/config_copy.json"
);
string
ipcRegStr
=
string
(
"/NMXH73Y2"
)
+
"/ipcs/(
\\
d+)/(
\\
w+)"
;
json
config
,
config2
;
std
::
smatch
results
;
iff
>>
config
;
std
::
regex
ipcRegex
(
ipcRegStr
);
config
=
config
[
"data"
];
if
(
std
::
regex_match
(
ipcPath
,
results
,
ipcRegex
))
{
iff2
>>
config2
;
if
(
results
.
size
()
==
3
)
{
config2
=
config2
[
"data"
];
for
(
auto
&
v
:
results
)
{
json
dif
=
json
::
diff
(
config2
,
config
).
dump
();
cout
<<
v
.
str
()
<<
endl
;
spdlog
::
info
(
"diff: {}"
,
dif
.
dump
());
}
auto
ret
=
getModulesOperFromConfDiff
(
config2
,
config
,
dif
,
"PSBV7GKN"
);
}
spdlog
::
info
(
"parse: {}"
,
ret
.
dump
());
}
cout
<<
"match2:"
<<
endl
;
string
modulePath
=
"/NMXH73Y2/ipcs/0/modules/evpusher/0/urlDest"
;
string
moduleRegStr
=
"/NMXH73Y2/ipcs/(
\\
d+)/modules/(
\\
w+)/(
\\
d+)/(
\\
w+)"
;
std
::
regex
moduleRegex
(
moduleRegStr
);
std
::
smatch
results2
;
if
(
std
::
regex_match
(
modulePath
,
results2
,
moduleRegex
))
{
if
(
results2
.
size
()
==
5
)
{
for
(
auto
&
v
:
results2
)
{
cout
<<
v
.
str
()
<<
endl
;
}
}
}
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论