Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
b91ccff3
提交
b91ccff3
authored
6月 03, 2020
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
nop
上级
a7d3931a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
1 行删除
+22
-1
evcloudsvc.cpp
opencv-motion-detect/evcloudsvc.cpp
+20
-0
mqtt_helper.hpp
opencv-motion-detect/mqtt_helper.hpp
+2
-1
没有找到文件。
opencv-motion-detect/evcloudsvc.cpp
浏览文件 @
b91ccff3
...
...
@@ -31,6 +31,12 @@ using namespace zmqhelper;
#define KEY_RELEASE_BUNDLE "release_bundle"
#define NUM_MAX_REPORT_HISTORY 5
// + evcloudsvc
const
string
mqtt_topic_response
=
"evsuits/response/"
;
const
string
mqtt_topic_report
=
"evsuits/report/"
;
const
string
mqtt_topic_subscribe
=
"evsuits/request/"
;
const
string
mqtt_topic_lastwill
=
"evsuits/lastwill/"
;
const
char
kcArrMqttUrl
[]
=
"tcp://admin:vJ3zHqWrHbrqxVMT@evcloudsvc.ilabservice.cloud:11883"
;
class
EvCloudSvc
{
private
:
...
...
@@ -54,6 +60,7 @@ private:
recursive_mutex
mutIpcStatus
;
json
allIssues
;
MqttHelper
*
mqClient
=
nullptr
;
json
buildIssuesForIpc
(
string
ipcSn
,
json
&
v
)
{
...
...
@@ -1800,6 +1807,19 @@ public:
this
->
peerData
[
"mgr2ipc"
]
=
json
();
this
->
peerData
[
"modulecls"
]
=
json
();
// setup mqtt
char
*
pEnv
=
getenv
(
"MQTT_URL"
);
if
(
!
pEnv
){
pEnv
=
(
char
*
)
kcArrMqttUrl
;
}
string
mqttUrl
=
string
(
pEnv
);
string
mqId
=
"evcloudsvc"
;
mqClient
=
MqttMgr
::
get_instance
(
mqttUrl
,
mqId
,
mqtt_topic_lastwill
+
mqId
,
mqtt_topic_report
+
mqId
);
if
(
mqClient
==
nullptr
){
spdlog
::
error
(
"failed to connect to mqtt: {}"
,
mqttUrl
);
exit
(
1
);
}
spdlog
::
info
(
"evcloudsvc boot"
);
loadConfigMap
();
char
*
strEnv
=
getenv
(
"HTTP_PORT"
);
...
...
opencv-motion-detect/mqtt_helper.hpp
浏览文件 @
b91ccff3
...
...
@@ -28,6 +28,7 @@ using namespace std;
using
namespace
nlohmann
;
#define EV_MAX_PRINTABLE_SIZE 512
const
string
kIdPrefix
=
"EVB-"
;
extern
void
on_connected
(
void
*
context
,
MQTTAsync_successData
*
response
);
extern
void
on_connlost
(
void
*
context
,
char
*
cause
);
...
...
@@ -148,7 +149,7 @@ public:
spdlog
::
debug
(
"mqtt url: proto: {}, host: {}, port: {}, user: {}, pass: {}"
,
uri
.
Protocol
,
uri
.
Host
,
uri
.
Port
,
uri
.
User
,
uri
.
Password
);
if
(
MQTTASYNC_SUCCESS
!=
MQTTAsync_create
(
&
client
,
addr
.
c_str
(),
(
"EVC"
+
id
).
c_str
(),
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
))
{
if
(
MQTTASYNC_SUCCESS
!=
MQTTAsync_create
(
&
client
,
addr
.
c_str
(),
(
kIdPrefix
+
id
).
c_str
(),
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
))
{
msg
=
"failed to async create mqtt"
;
spdlog
::
error
(
msg
);
throw
StrException
(
msg
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论