From: Javier Marcet Date: Wed, 2 Jan 2013 01:05:36 +0000 (+0100) Subject: Add new method PowerOnScreensaver. closes #114 X-Git-Tag: upstream/2.2.0~1^2~6^2~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d18ea27bd89c0244bef7077df2fbe0a687cf5f5e;p=deb_libcec.git Add new method PowerOnScreensaver. closes #114 --- diff --git a/include/cectypes.h b/include/cectypes.h index 3a004aa..58c7f6c 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -174,6 +174,11 @@ namespace CEC { */ #define CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER 1 +/*! + * default value for settings "wake up when deactivating the screensaver" + */ +#define CEC_DEFAULT_SETTING_POWER_ON_SCREENSAVER 1 + /*! * default value for settings "power off on standby" */ @@ -1452,6 +1457,7 @@ struct libcec_configuration uint8_t bUseTVMenuLanguage; /*!< use the menu language of the TV in the player application */ uint8_t bActivateSource; /*!< make libCEC the active source on the bus when starting the player application */ uint8_t bPowerOffScreensaver; /*!< put devices in standby mode when activating the screensaver */ + uint8_t bPowerOnScreensaver; /*!< wake devices when deactivating the screensaver */ uint8_t bPowerOffOnStandby; /*!< put this PC in standby mode when the TV is switched off. only used when bShutdownOnStandby = 0 */ uint8_t bSendInactiveSource; /*!< send an 'inactive source' message when stopping the player. added in 1.5.1 */ @@ -1504,8 +1510,9 @@ struct libcec_configuration cecVersion == other.cecVersion && adapterType == other.adapterType && iDoubleTapTimeoutMs == other.iDoubleTapTimeoutMs && - (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || comboKey == other.comboKey) && - (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs)); + (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || comboKey == other.comboKey) && + (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && + (other.clientVersion < CEC_CLIENT_VERSION_2_1_0 || bPowerOnScreensaver == other.bPowerOnScreensaver)); } bool operator!=(const libcec_configuration &other) const @@ -1529,6 +1536,7 @@ struct libcec_configuration bUseTVMenuLanguage = CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE; bActivateSource = CEC_DEFAULT_SETTING_ACTIVATE_SOURCE; bPowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER; + bPowerOnScreensaver = CEC_DEFAULT_SETTING_POWER_ON_SCREENSAVER; bPowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY; bShutdownOnStandby = CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY; bSendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE; diff --git a/src/LibCecSharp/CecSharpTypes.h b/src/LibCecSharp/CecSharpTypes.h index 67829da..78c2a8d 100644 --- a/src/LibCecSharp/CecSharpTypes.h +++ b/src/LibCecSharp/CecSharpTypes.h @@ -1794,6 +1794,9 @@ namespace CecSharp if (ServerVersion >= CecServerVersion::Version1_8_2) AdapterType = (CecAdapterType)config.adapterType; + + if (ServerVersion >= CecServerVersion::Version2_1_0) + PowerOnScreensaver = config.bPowerOnScreensaver == 1; } /// diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index ff3c619..562d13a 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -822,6 +822,9 @@ namespace CecSharp if (netConfig->ServerVersion >= CecServerVersion::Version1_8_0) config.cecVersion = (cec_version)netConfig->CECVersion; + if (netConfig->ServerVersion >= CecServerVersion::Version2_1_0) + config.bPowerOnScreensaver = netConfig->PowerOnScreensaver ? 1 : 0; + config.callbacks = &g_cecCallbacks; } diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index d069913..a67b956 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -822,6 +822,7 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) configuration.wakeDevices = m_configuration.wakeDevices; configuration.powerOffDevices = m_configuration.powerOffDevices; configuration.bPowerOffScreensaver = m_configuration.bPowerOffScreensaver; + configuration.bPowerOnScreensaver = m_configuration.bPowerOnScreensaver; configuration.bPowerOffOnStandby = m_configuration.bPowerOffOnStandby; configuration.bSendInactiveSource = m_configuration.bSendInactiveSource; configuration.logicalAddresses = m_configuration.logicalAddresses; @@ -888,6 +889,11 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) m_configuration.comboKey = defaultSettings.comboKey; m_configuration.iComboKeyTimeoutMs = defaultSettings.iComboKeyTimeoutMs; } + + if (m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_1_0) + m_configuration.bPowerOnScreensaver = configuration.bPowerOnScreensaver; + else + m_configuration.bPowerOnScreensaver = defaultSettings.bPowerOnScreensaver; } bool bNeedReinit(false);