config.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-03-07 11:52:08
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-09-29 15:47:50
  8. */
  9. #ifndef __CONFIG_H_
  10. #define __CONFIG_H_
  11. #include <iostream>
  12. #include <memory>
  13. #include <mutex> // mutex
  14. #include <vector>
  15. #include <unistd.h>
  16. #include "Util/logger.h"
  17. #include "requests.hpp"
  18. #include "inifile.h"
  19. using namespace std;
  20. using namespace toolkit;
  21. using namespace inifile;
  22. #define GSD_MAJOR_VERSION 2
  23. #define GSD_MINOR_VERSION 0
  24. #define GSD_PATCH_VERSION 0
  25. class config
  26. {
  27. public:
  28. using Ptr = std::shared_ptr<config>;
  29. std::string Spug_IP;
  30. int Spug_Port;
  31. std::string NettyIP;
  32. int NettyPort;
  33. std::string cameraIp;
  34. std::string usr;
  35. std::string pwd;
  36. std::string comPort;
  37. std::string SimCode;
  38. std::string vpnIP;
  39. // 过滤器设置
  40. int sensitivity = 0;
  41. int interval = 2000;
  42. int TimeOut = 0;
  43. // Debug配置
  44. int debug = 0;
  45. double DiskUsageThreshold = 0.80;
  46. int HardDiskCleanupTime = 3;
  47. int InferDataRetentionTime = 3;
  48. std::string mysql_IP = "192.168.31.174";
  49. int mysql_port = 13306;
  50. std::string app;
  51. // 临时版本
  52. vector<int> DeviceIds;
  53. int deviceType = 0;
  54. vector<std::string> HostIPs;
  55. std::string localIP = "";
  56. int getHistoryVideoFlag = 0;
  57. int ClearPastRecords = 0;
  58. double bboxSize = 0.0;
  59. int ExpelInterval = 10000;
  60. int LowVersion = 1;
  61. int ExpelPort = 19002;
  62. int InferInterval = 2000;
  63. std::string payServerIP = "10.81.160.141";
  64. int filterLevel = 2;
  65. int vpn = 0;
  66. std::string payServerIP_tcp = "192.168.1.102";
  67. int payServerPort_tcp = 12500;
  68. int InferChecker = 0;
  69. std::string InferCheckerIP = "192.168.31.219";
  70. int InferCheckerPort = 8860;
  71. int Hepu = 0;
  72. std::string HepuIP = "192.168.0.36";
  73. int HepuPort = 80;
  74. std::string HepuURL = "/cgi-bin/proc.cgi";
  75. std::string HepuUsr = "sunwin";
  76. std::string HepuPwd = "123456";
  77. protected:
  78. #ifdef RELEASE
  79. std::string configFile = "/etc/gsd/config.ini";
  80. #else
  81. std::string configFile = "../config/config.ini";
  82. #endif
  83. std::string apiKey = "sunwin202110291532";
  84. IniFile m_ini;
  85. private:
  86. config(){}
  87. config(config&) = delete;
  88. config& operator=(const config&) = delete;
  89. public:
  90. ~config(){}
  91. /**
  92. * @description: 获取智能指针
  93. * @param {*}
  94. * @return {*}
  95. */
  96. static Ptr getPtr();
  97. /**
  98. * @description: 更新数据
  99. * @param {*}
  100. * @return {*}
  101. */
  102. bool Update();
  103. /**
  104. * @description: 获取Simcode
  105. * @param {*}
  106. * @return {*}
  107. */
  108. std::string getSimCode();
  109. /**
  110. * @description: getApp
  111. * @param {*}
  112. * @return {*}
  113. */
  114. std::string getApp();
  115. /**
  116. * @description: 获取基础配置
  117. * @param {*}
  118. * @return {*}
  119. */
  120. bool getBasicConfig();
  121. /**
  122. * @description: 获取版本
  123. * @return {*}
  124. */
  125. std::string getVersion();
  126. /**
  127. * @description: 获取IP列表
  128. * @return {*}
  129. */
  130. vector<string> getHostIP();
  131. /**
  132. * @description: 获取历史视频
  133. * @return {*}
  134. */
  135. void getHistoryVideo(vector<std::string>& result);
  136. };
  137. #endif