config.hpp 2.9 KB

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