#ifndef _CHANNEL_PARAM_H_ #define _CHANNEL_PARAM_H_ /* ========================================================================================= * 宏定义 * =========================================================================================*/ // 1秒钟30个音量值,相位值同样是30个 #define VOLUME_INFO_NUM 30 // 音量有效范围 #define VOLUME_MAX_BD 0 #define VOLUME_MIN_BD -90 // 反相值范围 #define REVERSED_MAX_VALUE 100 #define REVERSED_MIN_VALUE -100 // 数据库字符串长度 #define DB_VARCHAR_LEN 32 // 一次比较最多可得到多少个值(相似度) #define RESULT_NUM_OF_ONETIME_COMPARE 1 /************************** 缩放比较相关宏 **************************/ // 静音默认值 #define SILENCE_DEF_VALUE true // 最大缓存180秒,3分钟 #define CACHE_DATA_SECOND_MAX 180 /** * @brief 音量设置参数 * */ struct StVolumeParam { StVolumeParam(); StVolumeParam(const StVolumeParam& obj); StVolumeParam& operator=(const StVolumeParam& obj); void Init(); /* -------------------- 静音 -------------------- */ void SetSilentSwitch(bool b) { m_bSilentSwitch = b; } // 静音持续时间为0不进行静音判定 bool GetSilentSwitch() const { return m_bSilentSwitch && m_iSilentDuration > 0; } int GetSilentThreshold() const { return m_iSilentThreshold; } void SetSilentThreshold(int ival) { m_iSilentThreshold = ival; } int GetSilentDuration() const { return m_iSilentDuration; } void SetSilentDuration(int ival) { m_iSilentDuration = ival; } int GetSilentNum() const; int GetSilentSensitivity() const { return m_nSilentSensitivity; } void SetSilentSensitivity(int ival) { m_nSilentSensitivity = ival; } /* -------------------- 过载 -------------------- */ void SetOverloadSwitch(bool b) { m_bOverloadSwitch = b; } bool GetOverloadSwitch() const { return m_bOverloadSwitch && m_iOverloadDuration > 0; } int GetOverloadThreshold() const { return m_iOverloadThreshold; } void SetOverloadThreshold(int ival) { m_iOverloadThreshold = ival; } int GetOverloadDuration() const { return m_iOverloadDuration; } void SetOverloadDuration(int ival) { m_iOverloadDuration = ival; } int GetOverloadSensitivity() const { return m_nOverloadSensitivity; } void SetOverloadSensitivity(int ival) { m_nOverloadSensitivity = ival; } int GetOverloadNum() const; /* -------------------- 反相 -------------------- */ void SetPhaseSwitch(bool b) { m_bPhaseSwitch = b; } bool GetPhaseSwitch() const { return m_bPhaseSwitch && m_iPhaseSensitivity > 0; } float GetPhaseThreshold() const { return m_iPhaseThreshold; } void SetPhaseThreshold(float ival) { m_iPhaseThreshold = ival; } int GetPhaseDuration() const { return m_iPhaseDuration; } void SetPhaseDuration(int ival) { m_iPhaseDuration = ival; } int GetPhaseSensitivity() const { return m_iPhaseSensitivity; } void SetPhaseSensitivity(int ival) { m_iPhaseSensitivity = ival; } int GetPhaseNum() const; int GetNoiseDuration() const { return 3; } private: /* -------------------- 静音 -------------------- */ // 静音监测开关 bool m_bSilentSwitch; int m_iSilentThreshold; // 持续时间(秒) int m_iSilentDuration; // 过载灵敏度(百分比) int m_nSilentSensitivity; /* -------------------- 过载 -------------------- */ // 过载监测开关 bool m_bOverloadSwitch; int m_iOverloadThreshold; // 持续时间(秒) int m_iOverloadDuration; // 过载灵敏度(百分比) int m_nOverloadSensitivity; /* -------------------- 反相 -------------------- */ // 反相监测开关 bool m_bPhaseSwitch; // 反相阀值(-1.0 – 1.0) float m_iPhaseThreshold; // 持续时间(秒) int m_iPhaseDuration; // 反相灵敏度(0 - 100%) int m_iPhaseSensitivity; }; /** * @brief 一致性检测参数 * */ struct StConsistencyParam { StConsistencyParam(); StConsistencyParam(const StConsistencyParam& obj); StConsistencyParam& operator=(const StConsistencyParam& obj); void Init(); // ********* 一致性 ********* [[ void SetConsistencySwitch(bool b) { m_bConsistencySwitch = b; } bool GetConsistencySwitch() { return m_bConsistencySwitch; } int GetConsistencyThreshold() const { return m_iConsistencyThreshold; } void SetConsistencyThreshold(int ival) { m_iConsistencyThreshold = ival; } int GetConsistencyThresholdNum() const { return m_iConsistencyThresholdNum; } void SetConsistencyThresholdNum(int ival) { m_iConsistencyThresholdNum = ival; } int GetConsistencyThresholdNot() const { return m_iConsistencyThresholdNot; } void SetConsistencyThresholdNot(int ival) { m_iConsistencyThresholdNot = ival; } int GetConsistencyThresholdNotNum() const { return m_iConsistencyThresholdNotNum; } // 不一致的判定更严谨,全部为不一致时,才判定为不一致 int GetConsistencyThresholdNotNumEx() const { return m_iConsistencyThresholdNotNum * 2; } void SetConsistencyThresholdNotNum(int ival) { m_iConsistencyThresholdNotNum = ival; } int GetConsistencyThresholdWarningNum() const { return m_nConsistencyThresholdWarningNum; } void SetConsistencyThresholdWarningNum(int ival) { m_nConsistencyThresholdWarningNum = ival; } private: // 一致性监测开关 bool m_bConsistencySwitch; // 一致性阀值 // 持续时间内,如果有m_iConsistencyThresholdNum相似度个比阀值大,就表示一致性 int m_iConsistencyThreshold; int m_iConsistencyThresholdNum; // 一致性阀值预警次数: 多少个不一致时,开启不一致预警 int m_nConsistencyThresholdWarningNum; // 不一致性阀值 // 持续时间内,如果有m_iConsistencyThresholdNotNum相似度个比阀值小,就表示不一致性 int m_iConsistencyThresholdNot; int m_iConsistencyThresholdNotNum; }; #endif /* _CHANNEL_PARAM_H_ */