/* * @Description: * @Version: 1.0 * @Autor: lishengyin * @Date: 2022-01-11 11:47:37 * @LastEditors: lishengyin * @LastEditTime: 2022-07-20 09:40:22 */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include "Util/logger.h" #include "Util/NoticeCenter.h" #include "Poller/EventPoller.h" #include "Util/SqlPool.h" #include "Network/TcpClient.h" #include "Poller/Timer.h" #include "monitor.h" #include "Notices.h" #include "inference.h" #include "deviceState.h" using namespace toolkit; using namespace std; namespace gsd_ds{ class Manager { private: int MemoryThreshold; int TempThreshold; int FdThreshold; int ResetThreshold = 100; bool ResetSwitch = false; int TimeoutThreshold = 3; private: /** * @description: 获取fd的判定结果 * @param {*} * @return {*} */ bool decideFdResult(); /** * @description: 获取内存的判定结果 * @param {*} * @return {*} */ bool decideMemoryResult(); /** * @description: 获取温度判定结果 * @param {*} * @return {*} */ bool decideTempResult(); /** * @description: 判定播放的结果 * @param {*} * @return {*} */ bool decidePlayResult(); /** * @description: 获取重置的判定结果 * @param {*} * @return {*} */ bool decideResetResult(); /** * @description: 获取超时的判定结果 * @param {*} * @return {*} */ bool decideTimeoutResult(); public: Manager(); ~Manager(); /** * @description: 创建实例 * @param {*} * @return {*} */ static std::shared_ptr CreateNew(); /** * @description: 设置MemoryThreshold * @param {int} MemoryThreshold * @return {*} */ void setMemoryThreshold(int memoryThreshold); /** * @description: 设置温度阈值 * @param {int} TempThreshold * @return {*} */ void setTempThreshold(int tempThreshold); /** * @description: 设置fd阈值 * @param {int} fdThreshold * @return {*} */ void setFdThreshold(int fdThreshold); /** * @description: 设置重启阈值 * @param {int} resetThreshold * @return {*} */ void setResetThreshold(int resetThreshold); /** * @description: 设置重启开关 * @param {bool} resetSwich * @return {*} */ void setResetSwitch(bool resetSwitch); /** * @description: 设置超时阈值 * @param {int} timeoutThreshold * @return {*} */ void setTimeoutThreshold(int timeoutThreshold); /** * @description: 纪律超时 * @param {*} * @return {*} */ void recordTimeOut(); /** * @description: 清除超时 * @param {*} * @return {*} */ void clearRecordTimeOut(); /** * @description: 获取启动资格 * @param {*} * @return {*} */ int32_t getStartPower(); /** * @description: 获取停止的资格 * @param {*} * @return {*} */ int32_t getStopPower(); /** * @description: 获取清理的资格 * @param {*} * @return {*} */ int32_t getClearPower(); /** * @description: 获取同步数据的资格 * @param {*} * @return {*} */ int32_t getSyncDataPower(); /** * @description: 获取上层数据的资格 * @param {*} * @return {*} */ int32_t getHostDataPower(); /** * @description: 获取同步FdThreshold的资格 * @param {*} * @return {*} */ int32_t getSyncFdThresholdPower(); /** * @description: 获取重启的资格 * @param {*} * @return {*} */ int32_t getResetPower(); /** * @description: 重启 * @param {*} * @return {*} */ void Reset(); public: using Ptr = std::shared_ptr; }; }