瀏覽代碼

V0.1.13
1、添加了部分内容

Apple 7 月之前
父節點
當前提交
d1cdf56f79

+ 2 - 0
SecurePlayAuxServer/CMakeLists.txt

@@ -6,6 +6,7 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/LHLog/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/communication/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/GlobalInfo/*.cpp
 
     ${CMAKE_SOURCE_DIR}/External/common/CurlFtp/*.cpp
     ${CMAKE_SOURCE_DIR}/External/common/Thread/*.cpp
@@ -26,6 +27,7 @@ target_include_directories(${execName1} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}/common/LHLog
     ${CMAKE_CURRENT_SOURCE_DIR}/communication
+    ${CMAKE_CURRENT_SOURCE_DIR}/GlobalInfo
 
     ${CMAKE_SOURCE_DIR}/External/common
     ${CMAKE_SOURCE_DIR}/External/common/FmtLog

+ 12 - 0
SecurePlayAuxServer/GlobalInfo/GlobalInfo.cpp

@@ -0,0 +1,12 @@
+#include "GlobalInfo.h"
+
+
+/* ====================================================================================
+ * *******************************    全局变量定义    **********************************
+ * ====================================================================================*/
+
+int g_eventTimeVaild = 600;         /* 事件时间有效性,单位秒,超过这个时间就认为是无效数据 */
+
+
+
+

+ 17 - 0
SecurePlayAuxServer/GlobalInfo.h → SecurePlayAuxServer/GlobalInfo/GlobalInfo.h

@@ -5,6 +5,23 @@
 #include <vector>
 #include "nlohmann/json.hpp"
 
+
+
+/* ====================================================================================
+ * *******************************    全局变量定义    **********************************
+ * ====================================================================================*/
+
+
+
+extern int g_eventTimeVaild;
+
+
+
+
+
+
+
+
 /**
  * @brief 全局信息
  * 

+ 25 - 4
SecurePlayAuxServer/SPAServer.cpp

@@ -1,9 +1,9 @@
 #include "SPAServer.h"
 
 #include "spdlog/spdlog.h"
-#include "CurlHttp.h"
+// #include "CurlHttp.h"
 #include <filesystem>
-#include "CurlFtp.h"
+// #include "CurlFtp.h"
 #include "ThreadPool/ThreadPool.h"
 
 #include <QVector>
@@ -396,9 +396,13 @@ void SPAServer::threadFromRedis(const CameraThreadInfo& info)
             alarmInfo.ActionID = it.substr(it.find(":") + 1);
             /* 解析数据 */
             parseRedisData(strRetValue, alarmInfo);
-            /* 时间有效性判断 */
+            /* 信息时间有的效性判断,主要是记录Redis数据的有效性,是否长时间没有变化,排查错误时用的
+             * 如果数据长时间数据不变,那么超脑那里就挂了,写入日志 */
+            isEventTimeVaild(alarmInfo.EventTime);
+            
+            /* 是否需要写入EQM数据库判断
+             * 人员计数和区域人员检测需要多次判断,其他的直接写入即可 */
             
-            /* 是否需要写入EQM数据库判断 */
         }
 
 
@@ -535,3 +539,20 @@ void SPAServer::parseRedisData(const std::string& strData, AlarmInfo& alarmInfo)
 
 }
 
+
+/* 判断时间是否长时间没有更新 */
+bool SPAServer::isEventTimeVaild(const std::string& strTime)
+{
+    /* 获取当前时间 */
+    time_t now = time(0);
+    /* 字符串转成时间 */
+    tm tmTime;
+    strptime(strTime.c_str(), "%Y-%m-%d %H:%M:%S", &tmTime);
+    time_t eventTime = mktime(&tmTime);
+    /* 时间差 */
+    double diff = difftime(now, eventTime);
+    SPDLOG_LOGGER_DEBUG(m_logger, "now:{} eventTime: {} 时间差:{}秒",now, eventTime, diff);
+
+    return true;
+}
+

+ 2 - 0
SecurePlayAuxServer/SPAServer.h

@@ -34,6 +34,8 @@ private:
     void threadFromRedis(const CameraThreadInfo& info);
     /* 解析Redis基础数据 */
     void parseRedisData(const std::string& strData, AlarmInfo& alarmInfo);
+    /* 判断时间是否长时间没有更新 */
+    bool isEventTimeVaild(const std::string& strTime);
 
 private:
     std::shared_ptr<spdlog::logger> m_logger = nullptr;

+ 4 - 0
安播辅助服务程序说明.md

@@ -116,3 +116,7 @@
 4. `tRoomCamer`获取房间信息,这里是补充获取摄像机信息
 5. `tRoomCamer`获取通道信息,这里是补充获取摄像机信息
 
+
+## 应用各算法的检测逻辑
+1. 逻辑详情见[安播辅助提示系统需求文档](https://alidocs.dingtalk.com/i/nodes/20eMKjyp81pbx3nQUAEOAlnGJxAZB1Gv?utm_scene=person_space)
+