GlobalInfo.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. #ifndef GLOBALINFO_H
  2. #define GLOBALINFO_H
  3. #include <QString>
  4. #include <vector>
  5. #include <list>
  6. #include <map>
  7. #include <mutex>
  8. #include <QDateTime>
  9. #include <QReadWriteLock>
  10. #include "nlohmann/json.hpp"
  11. /* ====================================================================================
  12. * ******************************* 全局变量定义 **********************************
  13. * ====================================================================================*/
  14. /**
  15. * @brief 全局信息
  16. *
  17. */
  18. using nJson = nlohmann::json;
  19. /* Rides数据时间有效性 */
  20. extern int g_eventTimeVaild;
  21. /* 线程运行时的状态 */
  22. enum class RunTimeState
  23. {
  24. RUN_STATE_INIT = 0, /* 初始化 */
  25. RUN_STATE_RUN, /* 运行 */
  26. RUN_STATE_STOP, /* 停止 */
  27. RUN_STATE_ERROR, /* 错误 */
  28. RUN_STATE_NONE /* 无状态 */
  29. };
  30. /* 应用功能 */
  31. enum class AppFunction
  32. {
  33. APP_NONE = 0, /* 无功能 */
  34. APP_ONWORK = 1, /* 人员在岗识别(需要多个摄像机配合) */
  35. APP_CONTRABAND, /* 违禁品识别 */
  36. APP_ILLEGAL, /* 非法入侵检测 */
  37. APP_FATIGUE, /* 疲劳检测 */
  38. APP_REGIONAL, /* 区域人员检测(需要多个摄像机配合) */
  39. APP_MOUSE, /* 老鼠识别 */
  40. APP_PLAYPHONE, /* 玩手机识别 */
  41. APP_NOMASK, /* 未戴口罩识别 */
  42. APP_ALLDOWN, /* 摔倒识别 */
  43. };
  44. /* 全局算法列表 */
  45. class ActionList
  46. {
  47. public:
  48. /* 全局算法ID */
  49. // std::mutex mutexActionID; /* 算法ID的互斥锁 */
  50. QReadWriteLock mutexRW; /* 读写锁 */
  51. std::string ActFace; /* 人脸识别 */
  52. std::string ActPersonNumber; /* 人员计数 */
  53. std::string ActPlayPhone; /* 玩手机 */
  54. std::string ActContraband; /* 违禁品物品 */
  55. std::string ActSleep; /* 睡岗识别 */
  56. std::string ActFatigueDetection; /* 疲劳检测 */
  57. std::string ActAnimalDetect; /* 动物识别 */
  58. std::string ActMouseDetect; /* 老鼠识别 */
  59. std::string ActMask; /* 口罩识别 */
  60. };
  61. extern ActionList g_actionList;
  62. /* 算法相关信息 */
  63. struct AlgorithmInfo
  64. {
  65. int PKID; /* 主键ID */
  66. int ActionTaskID; /* 算法任务ID */
  67. std::string ActionID; /* 算法ID */
  68. std::string ActionName; /* 算法名称 */
  69. AlgorithmInfo() = default;
  70. AlgorithmInfo(const AlgorithmInfo& other)
  71. : PKID(other.PKID), ActionID(other.ActionID), ActionName(other.ActionName), ActionTaskID(other.ActionTaskID) {}
  72. AlgorithmInfo& operator=(const AlgorithmInfo& other) {
  73. if (this != &other) {
  74. ActionID = other.ActionID;
  75. ActionName = other.ActionName;
  76. ActionTaskID = other.ActionTaskID;
  77. PKID = other.PKID;
  78. }
  79. return *this;
  80. }
  81. /* 对比是否相等 */
  82. bool operator==(const AlgorithmInfo& other) const {
  83. if(ActionID != other.ActionID) {
  84. return false;
  85. }
  86. if(ActionName != other.ActionName || ActionTaskID != other.ActionTaskID) {
  87. return false;
  88. }
  89. return true;
  90. }
  91. };
  92. /* 设备列表 */
  93. struct DeviceInfo
  94. {
  95. int PKID; /* 主键ID */
  96. int DeviceID; /* 设备ID */
  97. int DevicePort; /* 设备端口 */
  98. std::string DeviceName; /* 设备名称 */
  99. std::string DeviceIP; /* 设备IP */
  100. std::string DeviceSerial; /* 设备序列号 */
  101. std::string DeviceType; /* 设备类型 */
  102. std::string UserAccount; /* 用户账号 */
  103. std::string UserPassword; /* 用户密码 */
  104. std::vector<AlgorithmInfo> vecAlgorithmInfo; /* 算法信息 */
  105. DeviceInfo() = default;
  106. DeviceInfo(const DeviceInfo& other)
  107. : PKID(other.PKID),
  108. DeviceID(other.DeviceID),
  109. DevicePort(other.DevicePort),
  110. DeviceName(other.DeviceName),
  111. DeviceSerial(other.DeviceSerial),
  112. DeviceType(other.DeviceType),
  113. DeviceIP(other.DeviceIP),
  114. UserAccount(other.UserAccount),
  115. UserPassword(other.UserPassword),
  116. vecAlgorithmInfo(other.vecAlgorithmInfo) {}
  117. DeviceInfo& operator=(const DeviceInfo& other) {
  118. if (this != &other) {
  119. DeviceID = other.DeviceID;
  120. DevicePort = other.DevicePort;
  121. DeviceName = other.DeviceName;
  122. DeviceSerial = other.DeviceSerial;
  123. DeviceType = other.DeviceType;
  124. DeviceIP = other.DeviceIP;
  125. UserAccount = other.UserAccount;
  126. UserPassword = other.UserPassword;
  127. vecAlgorithmInfo = other.vecAlgorithmInfo;
  128. }
  129. return *this;
  130. }
  131. /* 对比是否相等 */
  132. bool operator==(const DeviceInfo& other);
  133. /* 对比设备关联的算法信息是否相等 */
  134. bool isEqualAlgorithmInfo(const std::vector<AlgorithmInfo>& other);
  135. };
  136. /* 算法和设备关联的相关信息 */
  137. struct DeviceAlgorithmInfo
  138. {
  139. int DeviceID; /* 设备ID */
  140. int ActionTaskID; /* 算法任务ID */
  141. std::string ActionID; /* 算法ID */
  142. std::string ActionName; /* 算法名称 */
  143. };
  144. /**
  145. * @brief 摄像机线程需要的信息
  146. *
  147. */
  148. struct CameraThreadInfo
  149. {
  150. std::string RedisIP; /* Redis IP */
  151. int RedisPort; /* Redis Port */
  152. std::string RedisPWD; /* Redis Password */
  153. int DeviceID; /* 设备ID */
  154. std::vector<std::string> vecAction; /* Redis Key,一个设备可能会有多个算法ID */
  155. CameraThreadInfo() = default;
  156. CameraThreadInfo& operator=(const CameraThreadInfo& other) {
  157. if (this != &other) {
  158. RedisIP = other.RedisIP;
  159. RedisPort = other.RedisPort;
  160. RedisPWD = other.RedisPWD;
  161. DeviceID = other.DeviceID;
  162. vecAction = other.vecAction;
  163. }
  164. return *this;
  165. }
  166. };
  167. /* ====================================================================================
  168. * ******************************* 各种报警信息 **********************************
  169. * ====================================================================================*/
  170. /**
  171. * @brief 人员信息
  172. *
  173. */
  174. struct PersonInfo
  175. {
  176. std::string PersonID; /* 人员ID,等于-1就是无法识别出身份的人员 */
  177. std::string PersonName; /* 人员名称 */
  178. QDateTime lastOnWork; /* 最后在岗时间 */
  179. };
  180. /**
  181. * @brief 报警信息
  182. *
  183. */
  184. struct AlarmInfo
  185. {
  186. bool Is_Alarm; /* 是否报警 */
  187. int AlarmID; /* 报警ID */
  188. int DeviceID; /* 设备ID,数据库表格中对应的是CamerID */
  189. int RoomID; /* 房间ID */
  190. int ChannelID; /* 通道ID */
  191. int State; /* 状态 */
  192. int OnWork; /* 是否在工作 */
  193. std::string ActionID; /* 算法ID */
  194. std::string StartTime; /* 报警开始时间 */
  195. std::string EndTime; /* 报警结束时间 */
  196. std::string EventTime; /* 事件时间(报警发生时间,在数据库里对应的是CreateTime) */
  197. std::string PicUrl; /* 报警图片URL */
  198. std::string ImageInfo; /* 图片信息 */
  199. std::string AppID; /* 客户端应用ID */
  200. std::string ActionDes; /* 算法描述信息 */
  201. std::string FaceIDList; /* 人脸ID列表 */
  202. std::string FaceNameList; /* 人脸名称列表 */
  203. std::string BboxList; /* Bbox列表,应该是图片中的报警位置 */
  204. std::vector<PersonInfo> vecPersonInfo; /* 人员信息 */
  205. AlarmInfo();
  206. AlarmInfo(const AlarmInfo& other);
  207. AlarmInfo& operator=(AlarmInfo& other);
  208. void reInit();
  209. };
  210. /**
  211. * @brief 报警信息容器,并提供一些函数
  212. *
  213. */
  214. struct ListAlarmInfo
  215. {
  216. std::list<AlarmInfo> listAlarmInfo; /* 报警信息列表 */
  217. /* 添加报警信息 */
  218. bool addAlarmInfo(AlarmInfo& info);
  219. AlarmInfo* findAlarmInfo(AlarmInfo& info);
  220. };
  221. /**
  222. * @brief 房间内的人脸信息
  223. *
  224. */
  225. struct RoomFaceInfo
  226. {
  227. int ChannelID = 0;
  228. int RoomID = 0;
  229. int CameraID = 0;
  230. int MaxNum = 0;
  231. int MinNum = 0;
  232. QDateTime StartTime;
  233. QDateTime EndTime;
  234. std::list<PersonInfo> listPersonInfo;
  235. RoomFaceInfo() = default;
  236. RoomFaceInfo& operator=(const RoomFaceInfo& other) {
  237. if (this != &other) {
  238. ChannelID = other.ChannelID;
  239. RoomID = other.RoomID;
  240. CameraID = other.CameraID;
  241. MaxNum = other.MaxNum;
  242. MinNum = other.MinNum;
  243. StartTime = other.StartTime;
  244. EndTime = other.EndTime;
  245. listPersonInfo = other.listPersonInfo;
  246. }
  247. return *this;
  248. }
  249. /* 查找是否有相同的人脸信息 */
  250. bool findPersonInfo(const PersonInfo& info);
  251. };
  252. /**
  253. * @brief 房间内的人脸信息
  254. *
  255. */
  256. struct ListRoomFaceInfo
  257. {
  258. std::list<RoomFaceInfo> listRoomFaceInfo;
  259. void addRoomFaceInfo(RoomFaceInfo& info);
  260. void addRoomFaceInfo(AlarmInfo& info);
  261. RoomFaceInfo* findRoomFaceInfo(RoomFaceInfo& info);
  262. RoomFaceInfo* findRoomFaceInfo(int ChannelID, int RoomID, int CameraID);
  263. };
  264. /**
  265. * @brief 非法入侵检测信息结构体,作为缓存存储正在报警的信息
  266. *
  267. */
  268. struct IllegalInvasionInfo
  269. {
  270. bool isInsertEQM = false; /* 是否已经插入到EQM数据库的报警信息中 */
  271. int PKID = 0;
  272. int CameraID = 0;
  273. int RoomID = 0;
  274. int ChannelID = 0;
  275. int RoomType = 0; /* 房间类型 */
  276. QDateTime FirstTime; /* 最开始的报警时间 */
  277. std::string strActionDec; /* 算法描述 */
  278. std::string strImageInfo; /* 图片信息 */
  279. IllegalInvasionInfo() = default;
  280. IllegalInvasionInfo(IllegalInvasionInfo& other);
  281. IllegalInvasionInfo& operator=(IllegalInvasionInfo& other);
  282. };
  283. /**
  284. * @brief 非法入侵报警列表
  285. *
  286. */
  287. struct ListIllegalInvasionInfo
  288. {
  289. std::list<IllegalInvasionInfo> listIll;
  290. std::list<IllegalInvasionInfo>& getData() { return listIll; }
  291. /* 添加信息 */
  292. void addIllInfo(IllegalInvasionInfo& info);
  293. /* 查找相同的信息 */
  294. IllegalInvasionInfo* findIllInfo(IllegalInvasionInfo& info);
  295. IllegalInvasionInfo* findIllInfo(int roomID, int roomType);
  296. };
  297. /**
  298. * @brief 房间为单位的非法入侵信息
  299. *
  300. */
  301. struct RoomIllegalInvasionInfo
  302. {
  303. bool isAlarm = false; /* 是否在报警 */
  304. int RoomID = 0; /* 房间ID */
  305. int RoomType = 0; /* 房间类型 */
  306. int numMaxFace = 0; /* 最大人脸数 */
  307. int numMaxPerson = 0; /* 最大人员数 */
  308. int CameraID = 0; /* 摄像机ID,这个存储的是使用的哪个报警信息的ID */
  309. std::string strBoxList; /* box */
  310. std::string strMessage; /* 报警信息字符串 */
  311. std::string strImage; /* 报警图片 */
  312. std::vector<PersonInfo> vecPersonInfo; /* 人员信息 */
  313. RoomIllegalInvasionInfo() = default;
  314. RoomIllegalInvasionInfo(RoomIllegalInvasionInfo& o);
  315. RoomIllegalInvasionInfo& operator=(RoomIllegalInvasionInfo& o);
  316. };
  317. /**
  318. * @brief 房间报警数据,以房间为单位
  319. *
  320. */
  321. struct ListRoomIll
  322. {
  323. std::list<RoomIllegalInvasionInfo> listRoomIll;
  324. std::list<RoomIllegalInvasionInfo>& getData() { return listRoomIll; }
  325. /* 添加房间 */
  326. void addRoom(int RoomID, int RoomType);
  327. /* 查找是否有相同的房间 */
  328. RoomIllegalInvasionInfo* findRoom(int RoomID, int RoomType);
  329. };
  330. /**
  331. * @brief 报警规则
  332. *
  333. */
  334. struct AlarmRuleInfo
  335. {
  336. bool LiveMinEnable; /* 启用直播间最小人数 */
  337. bool LiveMaxEnable; /* 启用直播间最大人数 */
  338. bool DicMinEnable; /* 启用导播间最小人数 */
  339. bool DicMaxEnable; /* 启用导播间最大人数 */
  340. bool LiveDicMinEnable; /* 启用直播间和导播间最小人数 */
  341. bool LiveDicMaxEnable; /* 启用直播间和导播间最大人数 */
  342. int LiveMin; /* 直播间最小人数 */
  343. int LiveMax; /* 直播间最大人数 */
  344. int DicMin; /* 导播间最小人数 */
  345. int DicMax; /* 导播间最大人数 */
  346. int LiveDicMin; /* 直播间和导播间最小人数 */
  347. int LiveDicMax; /* 直播间和导播间最大人数 */
  348. std::string RuleName; /* 规则名称 */
  349. AlarmRuleInfo();
  350. AlarmRuleInfo& operator=(AlarmRuleInfo& other);
  351. };
  352. /**
  353. * @brief 房间和摄像机关联信息,这个是从客户端配置的
  354. * 一个房间对应多个摄像机
  355. *
  356. */
  357. struct RoomCameraInfo
  358. {
  359. int RoomID; /* 房间ID */
  360. std::list<int> listCameraID; /* 摄像机列表 */
  361. RoomCameraInfo() = default;
  362. RoomCameraInfo& operator=(const RoomCameraInfo& other) {
  363. if (this != &other) {
  364. RoomID = other.RoomID;
  365. listCameraID = other.listCameraID;
  366. }
  367. return *this;
  368. }
  369. /* 这里只对比RoomID */
  370. bool operator==(const RoomCameraInfo& other) const {
  371. if(RoomID != other.RoomID) {
  372. return false;
  373. }
  374. return true;
  375. }
  376. };
  377. /* ====================================================================================
  378. * **************************** 线程功能需要的结构体 *****************************
  379. * ====================================================================================*/
  380. /**
  381. * @brief 单个算法信息,包括包含的摄像机,房间、频率信息
  382. *
  383. */
  384. struct ActionInfo
  385. {
  386. RunTimeState RunState; /* 线程运行状态 */
  387. int ChannelID; /* 通道ID */
  388. int RoomID; /* 房间ID */
  389. int CameraID; /* 摄像机ID */
  390. int RoomType; /* 房间类型 */
  391. std::string ActionID; /* 算法ID */
  392. std::string strRoomName; /* 房间名称 */
  393. std::string strActionName; /* 算法名称,这个是自定义的,不需要对比 */
  394. ActionInfo();
  395. ActionInfo& operator=(const ActionInfo& other);
  396. /* 对比是否相等,这个需要完全相等,包括算法信息和摄像机信息 */
  397. bool operator==(const ActionInfo& other);
  398. /* 对比除摄像机外的基础信息是否相等 */
  399. bool isEqualBaseInfo(const ActionInfo& other);
  400. };
  401. /**
  402. * @brief 算法信息列表,这个列表既可以存储房间和算法ID的关联信息,也可以用来存储运行线程的信息
  403. *
  404. */
  405. class ListActionInfo
  406. {
  407. public:
  408. ListActionInfo() = default;
  409. /* 添加关联信息,会自动进行重复判断,如果已有相同的信息,则跳过 */
  410. bool insertActionInfo(ActionInfo* info);
  411. /* 删除信息 */
  412. bool deleteActionInfo(ActionInfo* info);
  413. /* 给算法添加摄像机,原有的会被替换掉 */
  414. bool addActionCamera(ActionInfo* pInfo);
  415. /* 清空算法中的摄像机信息 */
  416. void clearCameraList();
  417. /* 清空设置成STOP或ERROR的Action */
  418. void clearStopAction();
  419. /* 查找算法ID是否已在列表中 */
  420. ActionInfo* findActionInList(ActionInfo* pInfo);
  421. /* 查找算法ID是否在列表中,这里查找不会对比摄像机ID */
  422. ActionInfo* findActionIDInListNoCamera(ActionInfo* pInfo);
  423. /* 获取容器 */
  424. std::list<ActionInfo*>& getData() {
  425. return listActionInfo;
  426. }
  427. /* 清空容器 */
  428. void clear();
  429. std::list<ActionInfo*> listActionInfo; /* 房间和算法ID关联列表 */
  430. };
  431. /**
  432. * @brief 算法信息,以房间分类,算法包含在这干房间内所需要的摄像机ID
  433. *
  434. */
  435. struct RoomActionInfo
  436. {
  437. int ChannelID; /* 通道ID */
  438. int RoomID; /* 房间ID */
  439. int RoomType; /* 房间类型 */
  440. std::string ActionID; /* 算法ID */
  441. std::string strRoomName; /* 房间名称 */
  442. std::list<int> listCameraID; /* 摄像机ID */
  443. RoomActionInfo() {
  444. ChannelID = -1;
  445. RoomID = -1;
  446. RoomType = -1;
  447. ActionID = "";
  448. strRoomName = "";
  449. listCameraID.clear();
  450. }
  451. RoomActionInfo(const RoomActionInfo& other)
  452. : ChannelID(other.ChannelID), RoomID(other.RoomID),
  453. RoomType(other.RoomType), ActionID(other.ActionID),
  454. strRoomName(other.strRoomName), listCameraID(other.listCameraID) {}
  455. RoomActionInfo& operator=(const RoomActionInfo& other) {
  456. if (this != &other) {
  457. ChannelID = other.ChannelID;
  458. RoomID = other.RoomID;
  459. RoomType = other.RoomType;
  460. ActionID = other.ActionID;
  461. strRoomName = other.strRoomName;
  462. listCameraID = other.listCameraID;
  463. }
  464. return *this;
  465. }
  466. /* 对比频道信息、房间信息、算法ID是否相等 */
  467. bool isEqualBaseInfo(const RoomActionInfo& other);
  468. };
  469. /* 房间和算法ID关联列表 */
  470. class ListRoomActionInfo
  471. {
  472. public:
  473. ListRoomActionInfo() = default;
  474. /* 添加关联信息,会自动进行重复判断,如果已有相同的room和action关联信息,则跳过 */
  475. bool insertRoomActionInfo(const RoomActionInfo& info);
  476. /* 添加关联信息,会自动进行重复判断,如果已有相同的room和action关联信息,则跳过 */
  477. bool insertRoomActionInfo(const int ChannelID, const int RoomID, const std::string& strActionID);
  478. /* 删除一个容器,注意,这个不能在别的for循环中删除,只能单独删除 */
  479. bool deleteRoomActionInfo(RoomActionInfo* pInfo);
  480. /* 清空容器 */
  481. void clear();
  482. /* 添加算法信息,根据传入的算法信息,自动将其加入到对应的容器中 */
  483. void addActionInfo(const ActionInfo& info);
  484. /* 清空算法对应的摄像机列表 */
  485. void clearCameraList();
  486. /* 清理设置为STOP或者ERROR的RoomAction */
  487. // void clearStopRoomAction();
  488. /* 查找算法ID是否已在列表中 */
  489. RoomActionInfo* findActionIDInList(const int chnID, const int RoomID, const std::string& strActionID);
  490. /* 获取容器 */
  491. std::list<RoomActionInfo*>& getData() {
  492. return listRoomActionInfo;
  493. }
  494. std::list<RoomActionInfo*> listRoomActionInfo; /* 房间和算法ID关联列表 */
  495. };
  496. /**
  497. * @brief 房间内的摄像机和算法关联信息
  498. *
  499. */
  500. struct RoomCamActInfo
  501. {
  502. int RoomID; /* 房间ID */
  503. int RoomType; /* 房间类型 */
  504. std::multimap<int, std::string> mapCameraAction; /* 摄像机ID和算法ID关联信息 */
  505. };
  506. /**
  507. * @brief 读取到的应用信息和启用时段
  508. *
  509. */
  510. struct AppAndTimeInfo
  511. {
  512. uint8_t AppType; /* 应用信息,按位计算 */
  513. int ChannelID; /* 通道ID */
  514. QDateTime StartTime; /* 开始时间 */
  515. QDateTime EndTime; /* 结束时间 */
  516. AppAndTimeInfo() = default;
  517. AppAndTimeInfo& operator=(AppAndTimeInfo& other) {
  518. if (this != &other) {
  519. AppType = other.AppType;
  520. ChannelID = other.ChannelID;
  521. StartTime = other.StartTime;
  522. EndTime = other.EndTime;
  523. }
  524. return *this;
  525. }
  526. };
  527. /**
  528. * @brief 按照功能分类的线程信息,一个实例就是一个功能,
  529. 比如区域入侵检测,需要多个算法多个摄像机共同配合
  530. *
  531. */
  532. struct FuncActionInfo
  533. {
  534. int ChannelID; /* 通道ID */
  535. AppFunction appFunction; /* 任务功能 */
  536. RunTimeState RunState; /* 线程运行状态 */
  537. std::string strFunctionName; /* 功能名称 */
  538. QDateTime StartTime; /* 开始时间 */
  539. QDateTime EndTime; /* 结束时间 */
  540. std::list<RoomCamActInfo> listRoomCamActInfo; /* 房间内的摄像机和算法关联信息 */
  541. FuncActionInfo();
  542. FuncActionInfo& operator=(FuncActionInfo& other);
  543. /* 添加算法信息 */
  544. bool addActionInfo(const ActionInfo& info);
  545. /* 清空算法信息 */
  546. void clearActionList();
  547. };
  548. /**
  549. * @brief
  550. *
  551. */
  552. struct ListFuncActInfo
  553. {
  554. ListFuncActInfo() = default;
  555. /* 添加功能信息 */
  556. bool addFuncActionInfo(const AppAndTimeInfo& func);
  557. /* 添加算法信息 */
  558. bool addActionInfo(const ActionInfo& info);
  559. /* 清空无用的功能信息 */
  560. void clearNoneFuncActionInfo();
  561. /* 清空房间和算法列表 */
  562. void clearActionList();
  563. /* 获取容器 */
  564. std::list<FuncActionInfo*>& getData() {
  565. return listFuncActionInfo;
  566. }
  567. /* 查找应用信息 */
  568. bool findAppFunction(const AppFunction func);
  569. FuncActionInfo* findAppFunction(const int ChannelID, const AppFunction func);
  570. FuncActionInfo* findAppFunction(const FuncActionInfo& func);
  571. std::list<FuncActionInfo*> listFuncActionInfo; /* 功能信息列表 */
  572. };
  573. /**
  574. * @brief 读取配置文件
  575. *
  576. */
  577. class GlobalConfig
  578. {
  579. public:
  580. GlobalConfig();
  581. ~GlobalConfig() = default;
  582. /* 读取配置文件 */
  583. bool readConfig(const QString& strConfigFile);
  584. /* 打印读取到的值 */
  585. void printValue();
  586. int AppUpdateOnWorkTimeInterval;/* 更新在岗信息的时间间隔 */
  587. int AppPeopleOnWork; /* 离岗时间 */
  588. int Contraband; /* 违禁物品出现的时间 */
  589. int AppBadMan; /* 非法入侵 */
  590. int AppTired; /* 疲劳检测时间 */
  591. int AppPeopleCont; /* 区域人员统计 */
  592. int AppPlayPhone; /* 玩手机识别 */
  593. int AppMouse; /* 老鼠识别 */
  594. int AppMask; /* 戴口罩识别 */
  595. int CheckSet; /* 服务端多久检测一次配置 */
  596. int EventTimeValid; /* 事件时间有效期 */
  597. int ThreadSleepMS; /* 任务线程休眠时间,单位是ms */
  598. std::string Key; /* Key */
  599. std::string Secret; /* Secret */
  600. };
  601. extern GlobalConfig g_config;
  602. #endif /* GLOBALINFO_H */