提交 95bef127 authored 作者: blu's avatar blu

init

上级 f5e395eb
...@@ -68,7 +68,7 @@ class EvMLMotion: public TinyThread { ...@@ -68,7 +68,7 @@ class EvMLMotion: public TinyThread {
private: private:
void *pSubCtx = NULL, *pDealerCtx = NULL; // for packets relay void *pSubCtx = NULL, *pDealerCtx = NULL; // for packets relay
void *pSub = NULL, *pDealer = NULL; void *pSub = NULL, *pDealer = NULL;
string urlOut, urlPub, urlRouter, devSn, mgrSn, selfId, pullerGid; string urlOut, urlPub, urlRouter, devSn, mgrSn, selfId, pullerGid, slicerGid;
int iid; int iid;
AVFormatContext *pAVFormatInput = NULL; AVFormatContext *pAVFormatInput = NULL;
AVCodecContext *pCodecCtx = NULL; AVCodecContext *pCodecCtx = NULL;
...@@ -138,6 +138,8 @@ private: ...@@ -138,6 +138,8 @@ private:
if(ipc.size()!=0 && evmlmotion.size()!=0) { if(ipc.size()!=0 && evmlmotion.size()!=0) {
found = true; found = true;
// get evslicer id
break; break;
} }
} }
...@@ -155,6 +157,9 @@ private: ...@@ -155,6 +157,9 @@ private:
pullerGid = evpuller["sn"].get<string>() + ":evpuller:" + to_string(evpuller["iid"]); pullerGid = evpuller["sn"].get<string>() + ":evpuller:" + to_string(evpuller["iid"]);
mgrSn = evmgr["sn"]; mgrSn = evmgr["sn"];
json evslicer = ipc["modules"]["evslicer"][0];
slicerGid = evslicer["sn"].get<string>()+":evslicer:" + to_string(evslicer["iid"]);
urlPub = string("tcp://") + evpuller["addr"].get<string>() + ":" + to_string(evpuller["port-pub"]); urlPub = string("tcp://") + evpuller["addr"].get<string>() + ":" + to_string(evpuller["port-pub"]);
urlRouter = string("tcp://") + evmgr["addr"].get<string>() + ":" + to_string(evmgr["port-router"]); urlRouter = string("tcp://") + evmgr["addr"].get<string>() + ":" + to_string(evmgr["port-router"]);
spdlog::info("evmlmotion {} will connect to {} for sub, {} for router", selfId, urlPub, urlRouter); spdlog::info("evmlmotion {} will connect to {} for sub, {} for router", selfId, urlPub, urlRouter);
...@@ -545,16 +550,18 @@ protected: ...@@ -545,16 +550,18 @@ protected:
meta["type"] = EV_MSG_META_EVENT; meta["type"] = EV_MSG_META_EVENT;
string metaType = meta.dump(); string metaType = meta.dump();
int ret = 0; int ret = 0;
vector<vector<uint8_t> > v = {str2body(this->pullerGid), str2body(metaType), str2body("")}; vector<vector<uint8_t> > v = {str2body(this->slicerGid), str2body(metaType), str2body("")};
while(true) { while(true) {
if(!this->evtQueue->empty()) { if(!this->evtQueue->empty()) {
string evt = this->evtQueue->front(); string evt = this->evtQueue->front();
v[2] = str2body(evt); v[2] = str2body(evt);
this->evtQueue->pop(); this->evtQueue->pop();
ret = z_send_multiple(this->pDealer, v); ret = z_send_multiple(this->pDealer, v);
spdlog::info("evmlmotion {} send event: {}", this->devSn, this->iid, evt);
if(ret < 0) { if(ret < 0) {
spdlog::error("evmlmotion {} failed to send event: {}, {}", this->devSn, this->iid, evt, zmq_strerror(zmq_errno())); spdlog::error("evmlmotion {} failed to send event {} to {}: {}", this->selfId, evt, this->slicerGid, zmq_strerror(zmq_errno()));
}else{
spdlog::info("evmlmotion {} send event: {}", this->selfId, evt);
} }
} }
else { else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论