123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- /*
- * @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 <iostream>
- #include <iostream>
- #include <map>
- #include <time.h>
- #include <dirent.h>
- #include <time.h>
- #include <cstdlib>
- #include <dirent.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #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<Manager> 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<Manager>;
- };
- }
|