提交 a47cd2e8 authored 作者: blu's avatar blu

big refacting of communitation architect

上级 b8feb2d5
DEBUG=-g
#DEBUG=-g
CC = gcc
CPP = g++
CPPFLAGS = $(DEBUG) -Wall -std=gnu++1z
......
{
"data":{
"NMXH73Y2":{
"19JG1U6E":{
"addr":"127.0.0.1",
"api-cloud":"http://127.0.0.1:8089",
"ipcs":[
......@@ -14,7 +14,7 @@
"iid":1,
"post":30,
"pre":3,
"sn":"NMXH73Y2",
"sn":"19JG1U6E",
"status":0,
"thresh":80,
"type":"motion"
......@@ -24,8 +24,9 @@
{
"addr":"127.0.0.1",
"iid":1,
"enabled": 1,
"port-pub":5556,
"sn":"NMXH73Y2",
"sn":"19JG1U6E",
"status":0
}
],
......@@ -34,7 +35,7 @@
"enabled":1,
"iid":1,
"password":"",
"sn":"NMXH73Y2",
"sn":"19JG1U6E",
"status":0,
"token":"",
"urlDest":"rtsp://40.73.41.176:554/test1",
......@@ -46,7 +47,7 @@
"enabled":1,
"iid":1,
"path":"slices",
"sn":"NMXH73Y2",
"sn":"19JG1U6E",
"status":0
}
]
......@@ -62,7 +63,7 @@
"port-cloud":5556,
"port-router":5550,
"proto":"zmq",
"sn":"NMXH73Y2",
"sn":"19JG1U6E",
"status":1
}
},
......
......@@ -20,6 +20,7 @@ update: 2019/09/10
#include "inc/json.hpp"
#include "inc/utils.hpp"
#include <unistd.h>
#include <sys/wait.h>
using namespace std;
using namespace httplib;
......@@ -68,6 +69,18 @@ private:
/// tracking sub-systems: evmgr, evpuller, evpusher, evml*, evslicer etc.
json mapSubSystems;
int ping(void *s)
{
int ret = 0;
vector<vector<uint8_t> >body = {str2body("evcloudsvc:0:0"), str2body(EV_MSG_META_PING), str2body(MSG_HELLO)};
ret = z_send_multiple(s, body);
if(ret < 0) {
spdlog::error("evdaemon {} failed to send ping: {}", devSn, zmq_strerror(zmq_errno()));
}
return ret;
}
int reloadCfg(string subModGid = "")
{
// int bootType = 0;
......@@ -81,7 +94,6 @@ private:
// bootType = 3;
// }
int ret = LVDB::getSn(this->info);
if(ret < 0) {
spdlog::error("evdaemon {} failed to get info", this->devSn);
......@@ -599,7 +611,6 @@ public:
spdlog::info("evdaemon {} edge message processor had setup {}", devSn, addr);
// dealer port
strEnv = getenv("CLOUD_ADDR");
if(strEnv != nullptr) {
......@@ -628,6 +639,7 @@ public:
thCloud.detach();
spdlog::info("evdaemon {} cloud message processor had setup {}", devSn, cloudAddr);
ping(pDealer);
this->thIdMain = this_thread::get_id();
......
......@@ -346,12 +346,6 @@ protected:
}
zmq_msg_close(&msg);
// if(pktCnt == 0 && packet.stream_index != 0) {
// pktIgnore++;
// av_packet_unref(&packet);
// continue;
// }
spdlog::debug("packet stream indx: {:d}", packet.stream_index);
// relay
AVStream *in_stream =NULL, *out_stream = nullptr;
......
......@@ -43,7 +43,6 @@ private:
#define NUM_DAYS_DEFAULT 2
#define MINUTES_PER_SLICE_DEFAULT 1
// 2 days, 5 minutes per record
void *pSubCtx = nullptr, *pDealerCtx = nullptr; // for packets relay
void *pSub = nullptr, *pDealer = nullptr, *pDaemonCtx = nullptr, *pDaemon = nullptr;
string urlOut, urlPub, urlRouter, devSn, mgrSn, selfId, pullerGid;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论