Explorar el Código

V0.1.4
1、添加了环形队列
2、跑通了超脑基础平台

Apple hace 7 meses
padre
commit
2fd2bb28eb

+ 3 - 1
SecurePlayAuxServer/CMakeLists.txt

@@ -6,11 +6,11 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/LHLog/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/communication/*.cpp
-    
 
     ${CMAKE_SOURCE_DIR}/External/common/CurlFtp/*.cpp
     ${CMAKE_SOURCE_DIR}/External/common/Thread/*.cpp
     ${CMAKE_SOURCE_DIR}/External/common/CurlHttp/*.cpp
+    ${CMAKE_SOURCE_DIR}/External/common/threadPool/*.cpp
     
     ${LHQLog_SOURCE_DIRS}/*.cpp
     ${LHHTTPAPI_SOURCE_DIRS}/*.cpp
@@ -31,6 +31,8 @@ target_include_directories(${execName1} PRIVATE
     ${CMAKE_SOURCE_DIR}/External/common/CurlFtp
     ${CMAKE_SOURCE_DIR}/External/common/Thread
     ${CMAKE_SOURCE_DIR}/External/common/CurlHttp
+    ${CMAKE_SOURCE_DIR}/External/common/threadPool
+    ${CMAKE_SOURCE_DIR}/External/common/RingQueue
 
     ${LHQLog_INCLUDE_DIRS}
     ${LHHTTPAPI_SOURCE_DIRS}

+ 12 - 10
SecurePlayAuxServer/SPAServer.cpp

@@ -17,8 +17,10 @@ SPAServer::SPAServer()
         return;
     }
 
-    // m_fromSuperBrain.getToken();
-    // // m_fromSuperBrain.getTaskTypeList();
+    m_fromSuperBrain.getToken();
+    // m_fromSuperBrain.getTaskTypeList();
+
+
     // m_fromRedis.setRedisIPAndPort("172.16.36.80", 32222);
     // m_fromRedis.setRedisPassword("Ff1z@TOFr^iwd%Ra");
     // m_fromRedis.connectRedis();
@@ -29,15 +31,15 @@ SPAServer::SPAServer()
 
     //|FTP|192.1.2.178:32021|lh|DWw7V9u0|
 
-    m_toEQMDataBase.initWebApi("http://192.1.3.133:31000/v6/", "", "4c2f9fc91c22dd98331e47af2e2964f4");
+    // m_toEQMDataBase.initWebApi("http://192.1.3.133:31000/v6/", "", "4c2f9fc91c22dd98331e47af2e2964f4");
 
-    AlgorithmInfo info;
-    info.ActionID = "123";
-    info.ActionName = "test";
-    info.ActionTaskID = 456;
-    QVector<AlgorithmInfo> vecInfo;
-    vecInfo.push_back(info);
-    m_toEQMDataBase.writeAlgorithmInfo(vecInfo);
+    // AlgorithmInfo info;
+    // info.ActionID = "123";
+    // info.ActionName = "test";
+    // info.ActionTaskID = 456;
+    // QVector<AlgorithmInfo> vecInfo;
+    // vecInfo.push_back(info);
+    // m_toEQMDataBase.writeAlgorithmInfo(vecInfo);
     
 }
 

+ 6 - 2
SecurePlayAuxServer/communication/FromSuperBrain.cpp

@@ -14,7 +14,9 @@ FromSuperBrain::FromSuperBrain()
         return;
     }
 
-    m_url = "http://172.16.36.80:30000/vos";
+    m_url = "http://192.1.2.64:30000/vos";
+    m_appKey = "x1pcq13r";
+    m_appSecret = "Setyir9yxvSiFGB/wsv4YHWiNmrgeaZhzJKi7c7Gmk04Z5Kd/hCifL+0WnfCRDJF";
 }
 
 FromSuperBrain::~FromSuperBrain()
@@ -26,10 +28,12 @@ FromSuperBrain::~FromSuperBrain()
 bool FromSuperBrain::getToken()
 {
     std::string response;
-    std::string httpBody = R"({"appSecret":"8zR9ug4WbKCtEgaQ08myRm5HqKIMwP83Ra24t921tO/mU0cTIFdm/t0C9Jxrd53x","appKey":"rili4l26"})";
+    std::string httpBody = R"({"appSecret":"Setyir9yxvSiFGB/wsv4YHWiNmrgeaZhzJKi7c7Gmk04Z5Kd/hCifL+0WnfCRDJF","appKey":"x1pcq13r"})";
     std::vector<std::string> vecHeader;
     vecHeader.push_back("Content-Type: application/json");
     std::string url = m_url + m_tokenPath;
+    SPDLOG_LOGGER_DEBUG(m_logger, "url:{}", url);
+    SPDLOG_LOGGER_DEBUG(m_logger, "httpBody:{}", httpBody);
     if(!CurlHttp::Post(url, vecHeader, httpBody, response))
     {
         SPDLOG_LOGGER_ERROR(m_logger, "Get Token failed");

+ 2 - 0
SecurePlayAuxServer/communication/FromSuperBrain.h

@@ -23,6 +23,8 @@ private:
     std::string m_url;
     std::string m_username;
     std::string m_password;
+    std::string m_appKey;       /* 授权码 */
+    std::string m_appSecret;    /* 授权码 */
 
     std::string m_token;                            /* token */
     std::string m_taskTypeList;                     /* 任务类型列表 */

+ 1 - 1
SecurePlayAuxServer/communication/ToEQMDataBase.cpp

@@ -49,7 +49,7 @@ bool ToEQMDataBase::initWebApi(const QString& url, const QString& serverIP, cons
     }
     SPDLOG_LOGGER_TRACE(m_logger,"Server list:{}",serverList.toStdString());
     SPDLOG_LOGGER_DEBUG(m_logger,"WebAPI Sucess!");
-    /* 登录 */
+    /* 登录,第二个参数是限制的服务 */
     ret = m_httpApi->DBQLogin(serverIP, serID, "SPSS", m_userToken);
     if(ret < 0)
     {

+ 12 - 0
SecurePlayAuxServer/main.cpp

@@ -5,9 +5,17 @@
 #include "SPAServer.h"
 #include "LHLogInit.h"
 #include "LHQLogAPI.h"
+#include "ThreadPool.h"
 
 #include <QCoreApplication>
 
+#include <QString>
+#include "RingQueue.hpp"
+
+RingQueue<QString> g_queue(10);
+
+
+
 int main(int argc, char* argv[])
 {
     QCoreApplication app(argc, argv);
@@ -20,9 +28,13 @@ int main(int argc, char* argv[])
         return -1;
     }
     SPDLOG_LOGGER_INFO(logger, "★  ★  ★  ★  ★  ☆  SecurePlayAuxServer  ☆  ★  ★  ★  ★  ★");
+    /* 设置线程池最大线程个数 */
+    CPPTP.setThreadMaxNum(256);
 
     SPAServer server;
 
     return app.exec();
 }
 
+
+

+ 8 - 1
json.json

@@ -110,4 +110,11 @@
             "dbType": "Dm"
         }
     ]
-}
+}
+
+curl --location --request POST 'http://192.1.2.64:30000/vos/external/broadcastToken' \
+--header 'Content-Type: application/json' \
+--data-raw '{
+    "appSecret": "x1pcq13r/Setyir9yxvSiFGB/wsv4YHWiNmrgeaZhzJKi7c7Gmk04Z5Kd/hCifL",
+    "appKey": "0WnfCRDJF"
+}'

+ 14 - 5
安播辅助服务程序说明.md

@@ -12,7 +12,7 @@
 5. 将处理过的信息写入到数据库中
 
 ## 使用到的地址
-1. 超脑基础信息地址 [apifox](https://apifox.com/apidoc/shared-1f40509b-3aca-4c2c-9d8e-381b986b085a/api-183796683)
+1. 超脑基础信息API地址 [apifox](https://apifox.com/apidoc/shared-1f40509b-3aca-4c2c-9d8e-381b986b085a/api-183796683)
 2. Redis地址
     - IP:http://172.16.36.80:30000/vos/
     - 端口:32222
@@ -29,8 +29,8 @@
         - 密码:QWERT12345
         - 数据库:EQM_BJ
     - WebApi
-        - 地址:http://192.1.3.133:31000/LocalSetup
-        - 密码:HZlh
+        - 地址:http://192.1.3.133:31000/v6/
+        - SQL_SERVER EQM_BJ SerID:4c2f9fc91c22dd98331e47af2e2964f4
 
 ## 从行业超脑获取基础信息
 1. 使用http从行业超脑获取到`算法列表`和`设备列表`
@@ -38,9 +38,18 @@
 
 ## 从Redis获取数据
 1. `Key`的组成:`%d : %s`, `DeviceID`, `算子编号`
-2. `算子编号`通过获取摄像头算法列表获取到这个设备的算法编号,从EQM数据库的tCamerinfo表格中获取到
+2. `算子编号`通过获取摄像头算法列表获取到这个设备的算法编号,关键字是`ability`,存放在EQM数据库的tAction表格的ActionID,既算法ID
 
 ## EQM数据库表格说明
 1. `tAction`是算法信息表,从超脑获取到的算法信息写入这个表格
-2. 
+2. `tWorkOnInfo`是人员在岗信息表,也包含人脸信息库
+3. `tActionCamer`摄像机ID,和算法ID关联
+4. `tFaceUser`用户信息表
+
+## 启动程序,可能需要从EQM获取的数据
+1. `tCamerinfo`获取摄像机信息
+2. `tAction`获取算法信息
+3. `tPeriod`获取时段详细信息,这里是补充获取摄像机信息
+4. `tRoomCamer`获取房间信息,这里是补充获取摄像机信息
+5. `tRoomCamer`获取通道信息,这里是补充获取摄像机信息