| 1 |
/* |
| 2 |
* Copyright (C) 2009-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "DPMSSupport.h" |
| 10 |
|
| 11 |
#include "ServiceBroker.h" |
| 12 |
#include "settings/Settings.h" |
| 13 |
#include "settings/SettingsComponent.h" |
| 14 |
#include "settings/lib/Setting.h" |
| 15 |
#include "utils/log.h" |
| 16 |
|
| 17 |
#include <array> |
| 18 |
#include <string> |
| 19 |
|
| 20 |
CDPMSSupport::CDPMSSupport() |
| 21 |
{ |
| 22 |
auto settingsComponent = CServiceBroker::GetSettingsComponent(); |
| 23 |
if (settingsComponent) |
| 24 |
{ |
| 25 |
auto settings = settingsComponent->GetSettings(); |
| 26 |
if (settings) |
| 27 |
{ |
| 28 |
auto setting = settings->GetSetting(CSettings::SETTING_POWERMANAGEMENT_DISPLAYSOFF); |
| 29 |
if (setting) |
| 30 |
setting->SetRequirementsMet(true); |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
bool CDPMSSupport::IsModeSupported(PowerSavingMode mode) const |
| 36 |
{ |
| 37 |
for (const auto& supportedModes : m_supportedModes) |
| 38 |
{ |
| 39 |
if (supportedModes == mode) |
| 40 |
return true; |
| 41 |
} |
| 42 |
|
| 43 |
return false; |
| 44 |
} |