GlobalConfig.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef GLOBALCONFIG_H
  2. #define GLOBALCONFIG_H
  3. #include <QString>
  4. #include "GlobalVariable.h"
  5. /* ====================================================================================
  6. * ***************************** GlobalConfig ***********************************
  7. * ====================================================================================*/
  8. #define GConfig GlobalConfig::getInstance()
  9. /**
  10. * @brief 配置文件信息
  11. *
  12. */
  13. class GlobalConfig
  14. {
  15. GlobalConfig();
  16. ~GlobalConfig() = default;
  17. GlobalConfig(const GlobalConfig& other) = delete;
  18. GlobalConfig& operator=(const GlobalConfig& other) = delete;
  19. public:
  20. static GlobalConfig& getInstance()
  21. {
  22. static GlobalConfig gc;
  23. return gc;
  24. }
  25. /* 读取配置文件 */
  26. bool readConfig(const QString& strConfigFile);
  27. /* 打印读取到的值 */
  28. void printValue();
  29. int AppUpdateOnWorkTimeInterval_Time; /* 更新在岗信息的时间间隔 */
  30. int AppPeopleOnWork_Time; /* 离岗时间 */
  31. int AppContraband_Time; /* 违禁物品出现的时间 */
  32. int AppBadMan_Time; /* 非法入侵超时时间 */
  33. int AppTired_Time; /* 疲劳检测时间 */
  34. int AppPeopleCont; /* 区域人员统计 */
  35. int AppPlayPhone; /* 玩手机识别 */
  36. int AppMouse; /* 老鼠识别 */
  37. int AppMask; /* 戴口罩识别 */
  38. int CheckSet; /* 服务端多久检测一次配置 */
  39. int EventTimeValid; /* 事件时间有效期 */
  40. int ThreadSleepMS; /* 任务线程休眠时间,单位是ms */
  41. std::string Key; /* Key */
  42. std::string Secret; /* Secret */
  43. public:
  44. /* 添加通道信息 */
  45. void setChannelInfo(std::map<int, std::string> mapChannelName);
  46. /* 清空通道信息 */
  47. void clearChannelInfo();
  48. /* 获取通道名称 */
  49. std::string getChannelName(int ChannelID);
  50. /* 获取通道信息 */
  51. std::map<int, std::string> getChannelInfoMap();
  52. /* 添加摄像机信息 */
  53. void setCameraInfo(std::map<int, std::string> mapCameraName);
  54. /* 获取摄像机名称 */
  55. std::string getCameraName(int CameraID);
  56. /* 获取摄像机信息列表 */
  57. std::map<int, std::string> getCameraInfoMap() { return m_mapCameraName; }
  58. private:
  59. QReadWriteLock m_rwLockChnInfo; /* 读写锁 */
  60. std::map<int, std::string> m_mapChannelName; /* 通道名称 */
  61. /* 摄像机名称 */
  62. QReadWriteLock m_rwLockCamInfo; /* 读写锁 */
  63. std::map<int, std::string> m_mapCameraName; /* 摄像机名称 */
  64. };
  65. #endif /* GLOBALCONFIG_H */