SystemConfigStruct.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef __SYSTEMCONFIGSTRUCT_H__
  2. #define __SYSTEMCONFIGSTRUCT_H__
  3. #include <QString>
  4. #include <QMap>
  5. #include <cerrno>
  6. #include "GlobalVariable.h"
  7. /* =============================================================================
  8. * 基础配置结构体
  9. * ============================================================================= */
  10. /* 不一致判断选项 */
  11. const QMap<int, QString> g_mapNotConsistency =
  12. {
  13. {1, "在其他报警时,不一致不报警且后台不进行不一致对比"},
  14. {2, "如果主通道、其他通道,二者一个噪音,一个非噪音,直接判定为不一致"},
  15. {3, "不一致对比不进行静音、反相等处理"}
  16. };
  17. /* 录音模式 */
  18. const QMap<int, QString> g_mapRecordModes =
  19. {
  20. {1, "ASIO"}
  21. };
  22. const float fespipe = 1e-6f; /* 单精度浮点数比较时的误差 */
  23. const double despipe = 1e-10; /* 双精度浮点数比较时的误差 */
  24. /**
  25. * @brief 基础配置结构体
  26. *
  27. */
  28. struct BaseConfig_t
  29. {
  30. QString strServerIP; /* 服务器IP地址 */
  31. int nRecordMode; /* 录音模式, ASIO等 */
  32. QString strDriverName; /* 驱动名称 */
  33. int nNotConsistency = 1; /* 不一致判断选项,默认是1 */
  34. bool isEnableMultiCore = false; /* 是否启用多核处理 */
  35. bool isEnableDebugLog = false; /* 是否启用调试日志 */
  36. bool isClearDirSystemOn = false; /* 启动服务时是否清空历史文件夹 */
  37. bool isUsingSoundCardName = false; /* 是否使用声卡名称,确定频道配置的各个通道 */
  38. bool operator==(const BaseConfig_t &other) const;
  39. };
  40. /* =============================================================================
  41. * AI对比
  42. * ============================================================================= */
  43. struct AICompareConfig_t
  44. {
  45. int nAiComputeDuration = 0; /* AI计算所需文件的时长,单位为秒 */
  46. int nAiCompareCount = 0; /* AI对比持续次数 */
  47. float fNotSimilarThrehold = 0.0; /* 不相似度阈值 */
  48. float fSimilarThrehold = 0.0; /* 相似度阈值 */
  49. bool bNoConsistencyAlarmOtherAlarm = false; /* 在其他报警时,不一致不报警且后台不进行不一致对比 */
  50. bool operator==(const AICompareConfig_t &other) const;
  51. };
  52. /* =============================================================================
  53. * 噪音检测
  54. * ============================================================================= */
  55. struct NoiseDetectBaseConfig_t
  56. {
  57. QString strNoiseServerAddr; /* 噪音检测服务器地址 */
  58. QString strNoiseDetectDir; /* 噪音检测文件夹 */
  59. QString strServerPath; /* 噪音检测服务器路径 */
  60. int nNoiseDetectInterval = 0; /* 噪音检测间隔,单位为秒 */
  61. bool isEnableNoiseDetect = false; /* 是否启用噪音检测 */
  62. bool isEnableMainRoadDetect = false;/* 是否启用主通道噪音检测 */
  63. bool operator==(const NoiseDetectBaseConfig_t &other) const;
  64. };
  65. /**
  66. * @brief 噪音检测参数
  67. *
  68. */
  69. struct NoiseDetectParam_t
  70. {
  71. int nNoiseOneDetectDuration = 0; /* 单次噪音检测时长,单位为秒 */
  72. int nNoiseDetectContinueCount = 0; /* 噪音检测持续次数 */
  73. int nNoiseContinueCountIsWarn = 0; /* 噪音持续几次为报警 */
  74. int nNoiseContinueCountPercent = 0; /* 检测持续次数中,噪音次数占的百分比 */
  75. double dThresholdSlient = 0; /* 静音阈值 */
  76. double dThresholdDB = 0; /* 分贝阈值 */
  77. double dThresholdCV = 0; /* 变异系数阈值 */
  78. int nPerseg = 0; /* 每段样本数 */
  79. int nOverlap = 0; /* 重叠样本数 */
  80. int nFFT= 0; /* FFT点数 */
  81. bool operator==(const NoiseDetectParam_t &other) const;
  82. };
  83. /* =============================================================================
  84. * 数据库配置
  85. * ============================================================================= */
  86. struct DatabaseConfig_t
  87. {
  88. int nRecordLogRetain = 0; /* 录音日志保留天数 */
  89. int nOperatorLogRetain = 0; /* 操作日志保留天数 */
  90. int nRecordFileRetain = 0; /* 录音文件保留小时数 */
  91. int nClientPort = 0; /* 客户端端口 */
  92. int nListenPort = 0; /* 监听端口 */
  93. QString strRecordFilePath; /* 录音文件路径 */
  94. QString strFtpPath; /* FTP报警文件路径 */
  95. bool operator==(const DatabaseConfig_t &other) const;
  96. };
  97. /* =============================================================================
  98. * 声卡信息结构体
  99. * ============================================================================= */
  100. #endif // __SYSTEMCONFIGSTRUCT_H__