#include "displayeffectmanager.h"
#include "schedpolicy.h"
#include "loghelper.h"
DisplayEffectManager* DisplayEffectManager::instance = new DisplayEffectManager();
DisplayEffectManager* DisplayEffectManager::getInstance()
{
    // TODO: 在此处插入 return 语句
    return instance;
}

DisplayEffectManager::DisplayEffectManager() : m_effectDbusInterface(std::unique_ptr<EffectDbusInterface>(new EffectDbusInterface()))
{
    m_EffectsStatus = true;
}

DisplayEffectManager::~DisplayEffectManager()
{
}

void DisplayEffectManager::changeEffectStatus(bool status)
{

    PRINT_DBG("DisplayEffectManager::changeEffectStatus status: %s, m_EffectsStatus: %s\n",status ? "TRUE" : "FALSE", m_EffectsStatus ? "TRUE" : "FALSE");
    std::lock_guard<std::mutex> lock(m_EffectsMutex);
    //m_effectDbusInterface.initActiveEffects();
    if(status == false) {
        if(m_EffectsStatus == false) return;
        m_effectDbusInterface->changeEffectEffects(status);
        m_EffectsStatus = false;
        PRINT_DBG("DisplayEffectManager::changeEffectStatus: close");
    } else {
        if(m_EffectsStatus == true) return;
        m_effectDbusInterface->changeEffectEffects(status);
        m_EffectsStatus = true;
        PRINT_DBG("DisplayEffectManager::changeEffectStatus: true");
    }
}

void DisplayEffectManager::printEffectStatus()
{
    PRINT_DBG("DisplayEffectManager::printEffectStatus()");
    m_effectDbusInterface->printEffectStatus();
}
