config.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. int HepuProtocol = 31;
  78. protected:
  79. #ifdef RELEASE
  80. std::string configFile = "/etc/gsd/config.ini";
  81. #else
  82. std::string configFile = "../config/config.ini";
  83. #endif
  84. std::string apiKey = "sunwin202110291532";
  85. IniFile m_ini;
  86. private:
  87. config(){}
  88. config(config&) = delete;
  89. config& operator=(const config&) = delete;
  90. public:
  91. ~config(){}
  92. /**
  93. * @description: 获取智能指针
  94. * @param {*}
  95. * @return {*}
  96. */
  97. static Ptr getPtr();
  98. /**
  99. * @description: 更新数据
  100. * @param {*}
  101. * @return {*}
  102. */
  103. bool Update();
  104. /**
  105. * @description: 获取Simcode
  106. * @param {*}
  107. * @return {*}
  108. */
  109. std::string getSimCode();
  110. /**
  111. * @description: getApp
  112. * @param {*}
  113. * @return {*}
  114. */
  115. std::string getApp();
  116. /**
  117. * @description: 获取基础配置
  118. * @param {*}
  119. * @return {*}
  120. */
  121. bool getBasicConfig();
  122. /**
  123. * @description: 获取版本
  124. * @return {*}
  125. */
  126. std::string getVersion();
  127. /**
  128. * @description: 获取IP列表
  129. * @return {*}
  130. */
  131. vector<string> getHostIP();
  132. /**
  133. * @description: 获取历史视频
  134. * @return {*}
  135. */
  136. void getHistoryVideo(vector<std::string>& result);
  137. };
  138. #endif