X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FPulse-Eight%2FUSBCECAdapterCommands.cpp;fp=src%2Flib%2Fadapter%2FUSBCECAdapterCommands.cpp;h=bbd15d4b0b230edf42b76e0042396f35489f6ffe;hb=2b44051cbfa70deafc30d9767323214debbc1a75;hp=6642ac838567a35dd0b0fc86cd0e3aa27028c968;hpb=ebefc26c10d68ba9ced2a30c896dccc81c6c2eeb;p=deb_libcec.git diff --git a/src/lib/adapter/USBCECAdapterCommands.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp similarity index 92% rename from src/lib/adapter/USBCECAdapterCommands.cpp rename to src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp index 6642ac8..bbd15d4 100644 --- a/src/lib/adapter/USBCECAdapterCommands.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp @@ -30,10 +30,15 @@ * http://www.pulse-eight.net/ */ +#include "env.h" #include "USBCECAdapterCommands.h" -#include "../LibCEC.h" -#include "../CECProcessor.h" -#include "../CECTypeUtils.h" + +#include "USBCECAdapterMessage.h" +#include "USBCECAdapterCommunication.h" +#include "lib/LibCEC.h" +#include "lib/CECProcessor.h" +#include "lib/CECTypeUtils.h" +#include using namespace CEC; using namespace PLATFORM; @@ -222,14 +227,11 @@ bool CUSBCECAdapterCommands::RequestSettingPhysicalAddress(void) bool CUSBCECAdapterCommands::SetSettingAutoEnabled(bool enabled) { - bool bReturn(true); + bool bReturn(false); /* check whether this value was changed */ if (m_bSettingAutoEnabled == enabled) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "autonomous mode setting unchanged (%s)", enabled ? "on" : "off"); return bReturn; - } m_bNeedsWrite = true; LIB_CEC->AddLog(CEC_LOG_DEBUG, "turning autonomous mode %s", enabled ? "on" : "off"); @@ -248,14 +250,11 @@ bool CUSBCECAdapterCommands::SetSettingAutoEnabled(bool enabled) bool CUSBCECAdapterCommands::SetSettingDeviceType(cec_device_type type) { - bool bReturn(true); + bool bReturn(false); /* check whether this value was changed */ if (m_persistedConfiguration.deviceTypes.types[0] == type) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "device type setting unchanged (%X)", (uint8_t)type); return bReturn; - } m_bNeedsWrite = true; LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the device type to %X (previous: %X)", (uint8_t)type, (uint8_t)m_persistedConfiguration.deviceTypes.types[0]); @@ -271,14 +270,11 @@ bool CUSBCECAdapterCommands::SetSettingDeviceType(cec_device_type type) bool CUSBCECAdapterCommands::SetSettingDefaultLogicalAddress(cec_logical_address address) { - bool bReturn(true); + bool bReturn(false); /* check whether this value was changed */ if (m_persistedConfiguration.logicalAddresses.primary == address) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "logical address setting unchanged (%X)", (uint8_t)address); return bReturn; - } m_bNeedsWrite = true; LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the default logical address to %X (previous: %X)", (uint8_t)address, (uint8_t)m_persistedConfiguration.logicalAddresses.primary); @@ -297,14 +293,11 @@ bool CUSBCECAdapterCommands::SetSettingDefaultLogicalAddress(cec_logical_address bool CUSBCECAdapterCommands::SetSettingLogicalAddressMask(uint16_t iMask) { - bool bReturn(true); + bool bReturn(false); /* check whether this value was changed */ if (m_iSettingLAMask == iMask) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "logical address mask setting unchanged (%2X)", iMask); return bReturn; - } m_bNeedsWrite = true; LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the logical address mask to %2X (previous: %2X)", iMask, m_iSettingLAMask); @@ -324,14 +317,11 @@ bool CUSBCECAdapterCommands::SetSettingLogicalAddressMask(uint16_t iMask) bool CUSBCECAdapterCommands::SetSettingPhysicalAddress(uint16_t iPhysicalAddress) { - bool bReturn(true); + bool bReturn(false); /* check whether this value was changed */ if (m_persistedConfiguration.iPhysicalAddress == iPhysicalAddress) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "physical address setting unchanged (%04X)", iPhysicalAddress); return bReturn; - } m_bNeedsWrite = true; LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the physical address to %04X (previous: %04X)", iPhysicalAddress, m_persistedConfiguration.iPhysicalAddress); @@ -351,14 +341,11 @@ bool CUSBCECAdapterCommands::SetSettingPhysicalAddress(uint16_t iPhysicalAddress bool CUSBCECAdapterCommands::SetSettingCECVersion(cec_version version) { - bool bReturn(true); + bool bReturn(false); /* check whether this value was changed */ if (m_settingCecVersion == version) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "CEC version setting unchanged (%s)", ToString(version)); return bReturn; - } m_bNeedsWrite = true; LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the CEC version to %s (previous: %s)", ToString(version), ToString(m_settingCecVersion)); @@ -377,14 +364,11 @@ bool CUSBCECAdapterCommands::SetSettingCECVersion(cec_version version) bool CUSBCECAdapterCommands::SetSettingOSDName(const char *strOSDName) { - bool bReturn(true); + bool bReturn(false); /* check whether this value was changed */ if (!strcmp(m_persistedConfiguration.strDeviceName, strOSDName)) - { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "OSD name setting unchanged (%s)", strOSDName); return bReturn; - } LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the OSD name to %s (previous: %s)", strOSDName, m_persistedConfiguration.strDeviceName); @@ -417,21 +401,21 @@ bool CUSBCECAdapterCommands::WriteEEPROM(void) bool CUSBCECAdapterCommands::PersistConfiguration(const libcec_configuration &configuration) { + bool bReturn(false); if (m_persistedConfiguration.iFirmwareVersion < 2) - return false; + return bReturn; if (!RequestSettings()) - return false; + return bReturn; + + bReturn |= SetSettingAutoEnabled(true); + bReturn |= SetSettingDeviceType(CLibCEC::GetType(configuration.logicalAddresses.primary)); + bReturn |= SetSettingDefaultLogicalAddress(configuration.logicalAddresses.primary); + bReturn |= SetSettingLogicalAddressMask(CLibCEC::GetMaskForType(configuration.logicalAddresses.primary)); + bReturn |= SetSettingPhysicalAddress(configuration.iPhysicalAddress); + bReturn |= SetSettingCECVersion(configuration.clientVersion >= CEC_CLIENT_VERSION_1_8_0 ? configuration.cecVersion : CEC_VERSION_1_4); + bReturn |= SetSettingOSDName(configuration.strDeviceName); - bool bReturn(true); - bReturn &= SetSettingAutoEnabled(true); - bReturn &= SetSettingDeviceType(CLibCEC::GetType(configuration.logicalAddresses.primary)); - bReturn &= SetSettingDefaultLogicalAddress(configuration.logicalAddresses.primary); - bReturn &= SetSettingLogicalAddressMask(CLibCEC::GetMaskForType(configuration.logicalAddresses.primary)); - bReturn &= SetSettingPhysicalAddress(configuration.iPhysicalAddress); - bReturn &= SetSettingCECVersion(CEC_VERSION_1_3A); - bReturn &= SetSettingOSDName(configuration.strDeviceName); - bReturn &= WriteEEPROM(); return bReturn; }