config.hpp 3.1 KB

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