From fa6cd4892d2841f7237a125f4c2ae96f9f49f520 Mon Sep 17 00:00:00 2001 From: miyanhui <dennismi1024@gmail.com> Date: 星期五, 15 二月 2019 15:49:20 +0800 Subject: [PATCH] 解决新的方式程序崩溃的问题 --- QiaoJiaSystem/StructureApp/FaceExtractElement.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 43 insertions(+), 11 deletions(-) diff --git a/QiaoJiaSystem/StructureApp/FaceExtractElement.cpp b/QiaoJiaSystem/StructureApp/FaceExtractElement.cpp index c1519f2..c3f170a 100644 --- a/QiaoJiaSystem/StructureApp/FaceExtractElement.cpp +++ b/QiaoJiaSystem/StructureApp/FaceExtractElement.cpp @@ -4,6 +4,7 @@ #include <QtCore/QString> #include <basic/util/app/AppUtil.h> #include <basic/util/opencv/CvUtil.h> +#include <basic/util/app/AppPreference.hpp> //diao鐢ㄥ搴攅s鏁版嵁灏佽鐨勭被 //#include <basic/db/ES/es/ManagerEsDB.h> #include <basic/db/Elasticsearch/EsDBTool.h> @@ -11,6 +12,7 @@ #include <QtCore/QJsonObject> #include <uuid/uuid.h> #include <jsoncpp/json/json.h> +#include <basic/util/app/AppConfig.h> #define state "state" @@ -35,7 +37,9 @@ faceSearchRpcClient(appPref.getStringData("faceSear.proxy"), appPref.getStringData("faceSear.ip"), appPref.getIntData("faceSear.port"), "tcp"), // faceSearchRpcClient("faceCmServer", "", 10004, "tcp") - m_sdkRule(rule) { + m_sdkRule(rule), + m_rpcClient("RtspAnalysServer", "127.0.0.1",10009,"tcp") +{ sharedMemory = new QSharedMemory(QString(shareMemoryName.c_str())); if (!sharedMemory->create(4608 * 2592 * 4)) { sharedMemory->attach(); @@ -110,7 +114,8 @@ CvUtil::cvMat2Buffer(faceExtractQueueTmp[i].faceImages[j], buffer); std::string strImgUrlTmp = ""; fdfsClient->fastFds->uploadFile(buffer, strImgUrlTmp, "jpg"); - strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); + // strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); + DBG("strImgUrlTmp="<<strImgUrlTmp); strImgUrl.clear(); strImgUrl = strImgUrlTmp; // strImgUrl.append("/").append(strImgUrlTmp); @@ -130,30 +135,35 @@ //#鍦ㄥ姣斾腑娣诲姞鐗瑰緛鍊� t_json["FaceFeature"] = "base64"; - t_json["personId"] = "wait todo";//鍏宠仈搴曞簱浜哄憳id,浜鸿劯id - t_json["BaseName"] = "wait todo";//鍏宠仈搴曞簱琛ㄥ悕 + t_json["personId"] = "";//鍏宠仈搴曞簱浜哄憳id,浜鸿劯id + t_json["BaseName"] = "";//鍏宠仈搴曞簱琛ㄥ悕 //#end // t_json["likePer"] = faceExtractQueueTmp[i].scoredRects[j].score;//浜哄憳鐩镐技搴� Score t_json["likeDate"] = AppUtil::getTimeSecString();//"2018-01-01 01:01:01";//姣旇緝鏃堕棿 - t_json["picName"] = "wait todo"; + t_json["picName"] = ""; - t_json["personPicUrl"] = "wait todo";//浜哄憳鍥剧墖 store + t_json["personPicUrl"] = "";//浜哄憳鍥剧墖 store t_json["picAddress"] = getProperty("str_addr");//鎶撴媿鍦板潃 - t_json["picMaxUrl"] = "wait todo";//澶у浘璺緞 - t_json["picLocalUrl"] = "wait todo";//鏈湴璺緞 + DBG("picAddress="<< t_json["picAddress"] ); + t_json["picMaxUrl"] = "";//澶у浘璺緞 + t_json["picLocalUrl"] = "";//鏈湴璺緞 t_json["picSmUrl"] = strImgUrl;//浜哄憳鎶撳皬鍥� //#todo t_json["picDate"] = faceExtractQueueTmp[i].scoredRects[j].properties["time"]; DBG("picDate=" << t_json["picDate"].asString()); -// DBG("timeC ::::B" << t_json["picDate"].asString()); +// DBG("timeC ::::B" << t_json["picDate"m_bIsMask].asString()); // t_json["picDate"] = AppUtil::getTimeSecString(); - t_json["content"] = "wait todo"; - t_json["viType"] = "1";//鍙湁4绉嶇被鍨� 1:personface 2:personbody 3:car 4:bicycle 5:none 鏈煡绫诲瀷 + t_json["content"] = ""; + //t_json["viType"] = "2";//鍙湁4绉嶇被鍨� 1:personface 2:personbody 3:car 4:bicycle 5:none 鏈煡绫诲瀷 + t_json["sdkType"] = std::to_string(m_sdkRule.nSdkType);//鍙湁4绉嶇被鍨� 1:personface 2:personbody 3:car 4:bicycle 5:none 鏈煡绫诲瀷 t_json["personIsHub"] = "4";//1: 鎶ヨ 2: 鍙枒 3: 瀹夊叏 4: 鏈煡 + + t_json["cluster_id"] = appPref.getStringData("clusterID"); + t_json["ack_alarm"] = "0"; //faceExtractElement.setProperty("dev_id", str_device_id); //faceExtractElement.setProperty("cg_id", str_ch_id); @@ -182,6 +192,9 @@ t_json["Race"] = "";//妫�娴嬬殑绉嶆棌 搴旇涓虹┖ 鏃犳娴嬬粨鏋� t_json["videoIp"] = getProperty("local_ip");//褰撳墠鏈嶅姟鍣↖P鍦板潃 + t_json["cluster_id"] = appConfig.getStringProperty("clusterID");//闆嗙兢id + t_json["ack_alarm"] = "0";//ack_alarm鏄惁鎶ヨ + //#todo 浼樺寲 get vector<string> from json switch (atoi(faceExtractQueueTmp[i].scoredRects[j].properties["race"].c_str())) { case 1: @@ -200,6 +213,25 @@ t_json["indeviceid"] = appPref.getStringData("fxDevID"); t_json["indevicename"] = appPref.getStringData("fxDevNAME"); + std::string strImageKey = faceExtractQueueTmp[i].scoredRects[j].properties["imgKey"]; + INFO("SaveImageKey To ES: "<<strImageKey); + t_json["imgKey"] = strImageKey; + + try { + auto server = m_rpcClient.getServer(); + if (!server) + { + ERR("server is null"); + return; + } + INFO("Record Video "<<strImageKey); + server->recordVideo(strImageKey); + } + catch (std::exception &e) + { + ERR("Record Video Err: "<<strImageKey <<" Message: "<<e.what()); + return; + } auto faceSearchServer = faceSearchRpcClient.getServer(); if (!faceSearchServer) { ERR("faceSearchServer is null"); -- Gitblit v1.8.0