123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #ifndef GLOBALCONFIG_H
- #define GLOBALCONFIG_H
- #include <QString>
- #include "GlobalVariable.h"
- /* ====================================================================================
- * ***************************** GlobalConfig ***********************************
- * ====================================================================================*/
- #define GConfig GlobalConfig::getInstance()
- /**
- * @brief 配置文件信息
- *
- */
- class GlobalConfig
- {
- GlobalConfig();
- ~GlobalConfig() = default;
- GlobalConfig(const GlobalConfig& other) = delete;
- GlobalConfig& operator=(const GlobalConfig& other) = delete;
- public:
- static GlobalConfig& getInstance()
- {
- static GlobalConfig gc;
- return gc;
- }
- /* 读取配置文件 */
- bool readConfig(const QString& strConfigFile);
- /* 打印读取到的值 */
- void printValue();
-
- int AppUpdateOnWorkTimeInterval;/* 更新在岗信息的时间间隔 */
- int AppPeopleOnWork; /* 离岗时间 */
- int Contraband; /* 违禁物品出现的时间 */
- int AppBadMan; /* 非法入侵 */
- int AppTired; /* 疲劳检测时间 */
- int AppPeopleCont; /* 区域人员统计 */
- int AppPlayPhone; /* 玩手机识别 */
- int AppMouse; /* 老鼠识别 */
- int AppMask; /* 戴口罩识别 */
- int CheckSet; /* 服务端多久检测一次配置 */
- int EventTimeValid; /* 事件时间有效期 */
- int ThreadSleepMS; /* 任务线程休眠时间,单位是ms */
- std::string Key; /* Key */
- std::string Secret; /* Secret */
- };
- /* ====================================================================================
- * ************************ GlobalThreadInfo成员函数 ****************************
- * ====================================================================================*/
- #define GThreadInfo GlobalThreadInfo::getInstance()
- /**
- * @brief 线程信息,也是应用功能块列表,每个频率下的每个功能就是一个线程
- *
- */
- class GlobalThreadInfo
- {
- GlobalThreadInfo() {}
- ~GlobalThreadInfo() {}
- GlobalThreadInfo(const GlobalThreadInfo& other) = delete;
- GlobalThreadInfo& operator=(const GlobalThreadInfo& other) = delete;
- public:
- static GlobalThreadInfo& getInstance()
- {
- static GlobalThreadInfo instance;
- return instance;
- }
- /* 获取线程运行标志位 */
- bool getRunning() const;
- /* 设置线程运行标志位 */
- void setRunning(bool bRunning);
-
- /* 手动给功能块列表加锁 */
- void lockRunFAI();
- /* 手动解锁 */
- void unlockRunFAI();
- /* 添加功能信息 */
- bool addFuncActionInfo(const AppAndTimeInfo& func);
- /* 添加算法信息 */
- bool addActionInfo(const ActionInfo& info);
- /* 清空无用的功能信息 */
- void clearNoneFuncActionInfo();
- /* 清空房间和算法列表 */
- void clearActionList();
- /* 设置没有配置摄像机的功能退出 */
- void setNoneCameraFuncStop();
- /* 获取容器 */
- std::list<FuncActionInfo*>& getList() {
- return m_listFuncActionInfo;
- }
- /* 查找应用信息 */
- bool findAppFunction(const AppFunction func);
- FuncActionInfo* findAppFunction(const int ChannelID, const AppFunction func);
- FuncActionInfo* findAppFunction(const FuncActionInfo& func);
- /* 设置线程状态 */
- void setThreadState(FuncActionInfo* pInfo, RunTimeState state);
- /* 更新算法的摄像机ID */
- bool updateFuncInfo(FuncActionInfo* pInfo);
- private:
- std::atomic_bool m_bRunning; /* 线程运行状态 */
- /* 运行时应用线程功能相关信息 */
- std::mutex m_mutexRunFAI;
- std::list<FuncActionInfo*> m_listFuncActionInfo; /* 功能信息列表 */
- };
- #endif /* GLOBALCONFIG_H */
|