Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
e4928744
提交
e4928744
authored
9月 04, 2019
作者:
bruce.lu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init
上级
6c00a563
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
4 行删除
+18
-4
evcloudsvc.cpp
opencv-motion-detect/evcloudsvc.cpp
+10
-4
utils.hpp
opencv-motion-detect/inc/utils.hpp
+8
-0
没有找到文件。
opencv-motion-detect/evcloudsvc.cpp
浏览文件 @
e4928744
...
@@ -31,6 +31,11 @@ class HttpSrv{
...
@@ -31,6 +31,11 @@ class HttpSrv{
ret
[
"code"
]
=
0
;
ret
[
"code"
]
=
0
;
ret
[
"msg"
]
=
"ok"
;
ret
[
"msg"
]
=
"ok"
;
ret
[
"time"
]
=
chrono
::
duration_cast
<
chrono
::
seconds
>
(
chrono
::
system_clock
::
now
().
time_since_epoch
()).
count
();
ret
[
"time"
]
=
chrono
::
duration_cast
<
chrono
::
seconds
>
(
chrono
::
system_clock
::
now
().
time_since_epoch
()).
count
();
spdlog
::
info
(
body
);
if
(
body
.
empty
()){
ret
[
"code"
]
=
1
;
ret
[
"msg"
]
=
"no body payload"
;
}
else
{
try
{
try
{
json
newConfig
=
json
::
parse
(
body
);
json
newConfig
=
json
::
parse
(
body
);
if
(
newConfig
.
count
(
"data"
)
==
0
||
newConfig
[
"data"
].
size
()
==
0
)
{
if
(
newConfig
.
count
(
"data"
)
==
0
||
newConfig
[
"data"
].
size
()
==
0
)
{
...
@@ -86,13 +91,15 @@ class HttpSrv{
...
@@ -86,13 +91,15 @@ class HttpSrv{
// save configmap
// save configmap
LVDB
::
setValue
(
this
->
configMap
,
"configmap"
);
LVDB
::
setValue
(
this
->
configMap
,
"configmap"
);
ret
[
"data"
]
=
newConfig
[
"data"
];
}
}
}
catch
(
exception
&
e
)
{
}
catch
(
exception
&
e
)
{
ret
.
clear
();
ret
.
clear
();
ret
[
"code"
]
=
-
1
;
ret
[
"code"
]
=
-
1
;
ret
[
"msg"
]
=
e
.
what
();
ret
[
"msg"
]
=
e
.
what
();
}
}
}
return
ret
;
return
ret
;
}
}
...
@@ -110,11 +117,10 @@ class HttpSrv{
...
@@ -110,11 +117,10 @@ class HttpSrv{
svr
.
Post
(
"/register"
,
[
this
](
const
Request
&
req
,
Response
&
res
){
svr
.
Post
(
"/register"
,
[
this
](
const
Request
&
req
,
Response
&
res
){
json
ret
;
json
ret
;
try
{
try
{
json
config
=
json
::
parse
(
req
.
body
);
string
sn
=
req
.
get_param_value
(
"sn"
);
string
sn
=
req
.
get_param_value
(
"sn"
);
string
module
=
req
.
get_param_value
(
"module"
);
string
module
=
req
.
get_param_value
(
"module"
);
if
(
sn
.
empty
()
||
module
.
empty
()){
if
(
sn
.
empty
()
||
module
.
empty
()){
throw
"no para sn/module"
;
throw
StrException
(
"no para sn/module"
)
;
}
}
string
modname
=
module
.
substr
(
0
,
4
);
string
modname
=
module
.
substr
(
0
,
4
);
if
(
modname
==
"evml"
)
{
if
(
modname
==
"evml"
)
{
...
@@ -130,7 +136,7 @@ class HttpSrv{
...
@@ -130,7 +136,7 @@ class HttpSrv{
spdlog
::
info
(
"evcloudsvc no such edge module registred: {}, create new entry"
,
key
);
spdlog
::
info
(
"evcloudsvc no such edge module registred: {}, create new entry"
,
key
);
ret
=
this
->
config
(
req
.
body
);
ret
=
this
->
config
(
req
.
body
);
if
(
ret
[
"code"
]
==
0
)
{
if
(
ret
[
"code"
]
==
0
)
{
ret
[
"data"
]
=
config
[
"data"
];
//ret["data"] =ret
["data"];
}
}
}
else
{
}
else
{
// TODO: calc md5
// TODO: calc md5
...
...
opencv-motion-detect/inc/utils.hpp
浏览文件 @
e4928744
...
@@ -108,4 +108,12 @@ vector<string> split(const std::string& s, char delimiter)
...
@@ -108,4 +108,12 @@ vector<string> split(const std::string& s, char delimiter)
}
// namespace cloudutils
}
// namespace cloudutils
struct
StrException
:
public
std
::
exception
{
std
::
string
s
;
StrException
(
std
::
string
ss
)
:
s
(
ss
)
{}
~
StrException
()
throw
()
{}
// Updated
const
char
*
what
()
const
throw
()
{
return
s
.
c_str
();
}
};
#endif
#endif
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论