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

big refacting of communitation architect

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