Manager.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-01-11 11:47:37
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-01-12 10:39:05
  8. */
  9. #pragma once
  10. #include <iostream>
  11. #include <iostream>
  12. #include <map>
  13. #include <time.h>
  14. #include <dirent.h>
  15. #include <time.h>
  16. #include <cstdlib>
  17. #include <dirent.h>
  18. #include <sys/types.h>
  19. #include <sys/stat.h>
  20. #include <unistd.h>
  21. #include "Util/logger.h"
  22. #include "Util/NoticeCenter.h"
  23. #include "Poller/EventPoller.h"
  24. #include "Player/PlayerProxy.h"
  25. #include "Rtmp/RtmpPusher.h"
  26. #include "Common/config.h"
  27. #include "Pusher/MediaPusher.h"
  28. #include "Extension/Frame.h"
  29. #include "Util/SqlPool.h"
  30. #include "Network/TcpClient.h"
  31. #include "Poller/Timer.h"
  32. #include "monitor.h"
  33. #include "Notices.h"
  34. #include "inference.h"
  35. #include "deviceState.h"
  36. using namespace toolkit;
  37. using namespace std;
  38. namespace MIVA{
  39. class Manager
  40. {
  41. private:
  42. int MemoryThreshold;
  43. int TempThreshold;
  44. int FdThreshold;
  45. private:
  46. /**
  47. * @description: 获取fd的判定结果
  48. * @param {*}
  49. * @return {*}
  50. */
  51. bool decideFdResult();
  52. /**
  53. * @description: 获取内存的判定结果
  54. * @param {*}
  55. * @return {*}
  56. */
  57. bool decideMemoryResult();
  58. /**
  59. * @description: 获取温度判定结果
  60. * @param {*}
  61. * @return {*}
  62. */
  63. bool decideTempResult();
  64. /**
  65. * @description: 判定播放的结果
  66. * @param {*}
  67. * @return {*}
  68. */
  69. bool decidePlayResult();
  70. public:
  71. Manager();
  72. ~Manager();
  73. /**
  74. * @description: 创建实例
  75. * @param {*}
  76. * @return {*}
  77. */
  78. static std::shared_ptr<Manager> CreateNew();
  79. /**
  80. * @description: 设置MemoryThreshold
  81. * @param {int} MemoryThreshold
  82. * @return {*}
  83. */
  84. void setMemoryThreshold(int memoryThreshold);
  85. /**
  86. * @description: 设置温度阈值
  87. * @param {int} TempThreshold
  88. * @return {*}
  89. */
  90. void setTempThreshold(int tempThreshold);
  91. /**
  92. * @description: 设置fd阈值
  93. * @param {int} fdThreshold
  94. * @return {*}
  95. */
  96. void setFdThreshold(int fdThreshold);
  97. /**
  98. * @description: 获取启动资格
  99. * @param {*}
  100. * @return {*}
  101. */
  102. int32_t getStartPower();
  103. /**
  104. * @description: 获取停止的资格
  105. * @param {*}
  106. * @return {*}
  107. */
  108. int32_t getStopPower();
  109. /**
  110. * @description: 获取清理的资格
  111. * @param {*}
  112. * @return {*}
  113. */
  114. int32_t getClearPower();
  115. /**
  116. * @description: 获取同步数据的资格
  117. * @param {*}
  118. * @return {*}
  119. */
  120. int32_t getSyncDataPower();
  121. /**
  122. * @description: 获取上层数据的资格
  123. * @param {*}
  124. * @return {*}
  125. */
  126. int32_t getHostDataPower();
  127. /**
  128. * @description: 获取同步FdThreshold的资格
  129. * @param {*}
  130. * @return {*}
  131. */
  132. int32_t getSyncFdThresholdPower();
  133. public:
  134. using Ptr = std::shared_ptr<Manager>;
  135. };
  136. }