/*
 * @Description: 
 * @Version: 1.0
 * @Autor: lishengyin
 * @Date: 2022-01-11 10:44:52
 * @LastEditors: lishengyin
 * @LastEditTime: 2022-01-12 16:27:43
 */
#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 "Player/PlayerProxy.h"
#include "Rtmp/RtmpPusher.h"
#include "Common/config.h"
#include "Pusher/MediaPusher.h"
#include "Extension/Frame.h"
#include "Util/SqlPool.h"
#include "Network/TcpClient.h"
#include "Poller/Timer.h"
#include "monitor.h"
#include <mutex>

using namespace toolkit;
using namespace std;

namespace MIVA
{
    class deviceState
    {
    public:
        using Ptr = std::shared_ptr<deviceState>;
        int CpuUsage;
        int GpuUsage;
        int MemoryUsage;
        int CpuTemp;
        int GpuTemp = 0;
        int AUXTemp = 0;
        int A0Temp = 0;
        int ThermalTemp = 0;
        int FdUsage;
        
    public:
        deviceState();
        ~deviceState();

        /**
         * @description: 创建实例
         * @param {*}
         * @return {*}
         */  
        static std::shared_ptr<deviceState> CreateNew();

        /**
         * @description: 获取设备数据
         * @param {*}
         * @return {*}
         */        
        int32_t getDeviceState();

        /**
         * @description: 同步设备数据
         * @param {*}
         * @return {*}
         */        
        int32_t SyncDeviceState(std::string& Ctime);

        /**
         * @description:同步fd阈值 
         * @param {*}
         * @return {*}
         */        
        int32_t SyncFdThreshold(int sourceNum, bool outState);
    private:
        mutex m_mutex;
    };
} // namespace MIVA