From: Lars Op den Kamp Date: Mon, 2 Apr 2012 14:31:30 +0000 (+0200) Subject: cec: added a new setting to control whether to put the TV in standby when the player... X-Git-Tag: upstream/2.2.0~1^2~31^2~22 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b98fc43dcbbf0b4790bb9b038b1e116864edb445;p=deb_libcec.git cec: added a new setting to control whether to put the TV in standby when the player is put in standby. added some missing bits (version numbers, config) to LibCecSharp. bugzid: 558 --- diff --git a/include/cectypes.h b/include/cectypes.h index 451b2ab..3beef1c 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -80,6 +80,7 @@ namespace CEC { #define CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER 1 #define CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY 1 #define CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE 1 +#define CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY 1 #define CEC_DEFAULT_TRANSMIT_RETRY_WAIT 500 #define CEC_DEFAULT_TRANSMIT_TIMEOUT 1000 @@ -1006,7 +1007,8 @@ typedef struct libcec_configuration ICECCallbacks * callbacks; /*!< the callback methods to use. set this to NULL when not using callbacks */ cec_logical_addresses logicalAddresses; /*!< the current logical addresses. read-only. added in 1.5.3 */ - uint16_t iFirmwareVersion; /*!< the firmware version of the adapter. in 1.6.0 */ + uint16_t iFirmwareVersion; /*!< the firmware version of the adapter. added in 1.6.0 */ + uint8_t bPowerOffDevicesOnStandby; /*!< put devices in standby when the PC/player is put in standby. added in 1.6.0 */ #ifdef __cplusplus void Clear(void) @@ -1037,6 +1039,7 @@ typedef struct libcec_configuration bSendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE; logicalAddresses.Clear(); iFirmwareVersion = 0; + bPowerOffDevicesOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY; callbackParam = NULL; callbacks = NULL; diff --git a/src/LibCecSharp/CecSharpTypes.h b/src/LibCecSharp/CecSharpTypes.h index 8cdaa89..d9fcc9d 100644 --- a/src/LibCecSharp/CecSharpTypes.h +++ b/src/LibCecSharp/CecSharpTypes.h @@ -328,7 +328,9 @@ namespace CecSharp VersionPre1_5 = 0, Version1_5_0 = 0x1500, Version1_5_1 = 0x1501, - Version1_5_2 = 0x1502 + Version1_5_2 = 0x1502, + Version1_5_3 = 0x1503, + Version1_6_0 = 0x1600 }; public enum class CecServerVersion @@ -336,7 +338,9 @@ namespace CecSharp VersionPre1_5 = 0, Version1_5_0 = 0x1500, Version1_5_1 = 0x1501, - Version1_5_2 = 0x1502 + Version1_5_2 = 0x1502, + Version1_5_3 = 0x1503, + Version1_6_0 = 0x1600 }; public ref class CecAdapter @@ -552,6 +556,9 @@ namespace CecSharp PowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER == 1; PowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY == 1; SendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE == 1; + LogicalAddresses = gcnew CecLogicalAddresses(); + FirmwareVersion = 1; + PowerOffDevicesOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY == 1; } void SetCallbacks(CecCallbackMethods ^callbacks) @@ -591,7 +598,23 @@ namespace CecSharp PowerOffScreensaver = config.bPowerOffScreensaver == 1; PowerOffOnStandby = config.bPowerOffOnStandby == 1; - SendInactiveSource = config.bSendInactiveSource == 1; + + if (ServerVersion >= CecServerVersion::Version1_5_1) + SendInactiveSource = config.bSendInactiveSource == 1; + + if (ServerVersion >= CecServerVersion::Version1_5_3) + { + LogicalAddresses->Clear(); + for (uint8_t iPtr = 0; iPtr <= 16; iPtr++) + if (config.logicalAddresses[iPtr]) + LogicalAddresses->Set((CecLogicalAddress)iPtr); + } + + if (ServerVersion >= CecServerVersion::Version1_6_0) + { + FirmwareVersion = config.iFirmwareVersion; + PowerOffDevicesOnStandby = config.bPowerOffDevicesOnStandby == 1; + } } property System::String ^ DeviceName; @@ -613,6 +636,9 @@ namespace CecSharp property bool PowerOffScreensaver; property bool PowerOffOnStandby; property bool SendInactiveSource; + property CecLogicalAddresses ^LogicalAddresses; + property uint16_t FirmwareVersion; + property bool PowerOffDevicesOnStandby; property CecCallbackMethods ^ Callbacks; }; diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index 0737dbb..2338671 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -117,7 +117,13 @@ namespace CecSharp } config.bPowerOffScreensaver = netConfig->PowerOffScreensaver ? 1 : 0; config.bPowerOffOnStandby = netConfig->PowerOffOnStandby ? 1 : 0; - config.bSendInactiveSource = netConfig->SendInactiveSource ? 1 : 0; + + if (netConfig->ServerVersion >= CecServerVersion::Version1_5_1) + config.bSendInactiveSource = netConfig->SendInactiveSource ? 1 : 0; + + if (netConfig->ServerVersion >= CecServerVersion::Version1_6_0) + config.bPowerOffDevicesOnStandby = netConfig->PowerOffDevicesOnStandby ? 1 : 0; + config.callbacks = &g_cecCallbacks; } diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 095fb63..20ae10a 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -1623,6 +1623,10 @@ bool CCECProcessor::SetConfiguration(const libcec_configuration *configuration) if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_1) m_configuration.bSendInactiveSource = configuration->bSendInactiveSource; + // client version 1.6.0 + if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_6_0) + m_configuration.bPowerOffDevicesOnStandby = configuration->bPowerOffDevicesOnStandby; + // ensure that there is at least 1 device type set if (m_configuration.deviceTypes.IsEmpty()) m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); @@ -1675,8 +1679,11 @@ bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration) configuration->logicalAddresses = m_configuration.logicalAddresses; // client version 1.6.0 - if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_3) - configuration->logicalAddresses = m_configuration.logicalAddresses; + if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_6_0) + { + configuration->iFirmwareVersion = m_configuration.iFirmwareVersion; + configuration->bPowerOffDevicesOnStandby = m_configuration.bPowerOffDevicesOnStandby; + } return true; } diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index 03962e2..2e149c7 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -60,7 +60,7 @@ CLibCEC::CLibCEC(libcec_configuration *configuration) : m_callbacks(configuration->callbacks), m_cbParam(configuration->callbackParam) { - configuration->serverVersion = CEC_SERVER_VERSION_1_5_3; + configuration->serverVersion = CEC_SERVER_VERSION_1_6_0; m_cec = new CCECProcessor(this, configuration); }