X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=8f02ac7e28bf9ad725cf5179a4ef43ec447e271e;hb=55c75e6e4bd3d1c44907b59768b891227bd8ab5a;hp=757204cb3ed31ed3b3fb4aae727e2c8c295ac68c;hpb=bb033e13e66263b9fa45e779e9a6435a85134e0e;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 757204c..8f02ac7 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -47,7 +47,7 @@ using namespace PLATFORM; CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) : m_type (CEC_DEVICE_TYPE_RESERVED), m_iPhysicalAddress (iPhysicalAddress), - m_iStreamPath (0xFFFF), + m_iStreamPath (CEC_INVALID_PHYSICAL_ADDRESS), m_iLogicalAddress (iLogicalAddress), m_powerStatus (CEC_POWER_STATUS_UNKNOWN), m_processor (processor), @@ -170,6 +170,21 @@ cec_version CCECBusDevice::GetCecVersion(bool bUpdate /* = false */) return m_cecVersion; } +bool CCECBusDevice::RequestActiveSource(bool bWaitForResponse /* = true */) +{ + bool bReturn(false); + + if (MyLogicalAddressContains(m_iLogicalAddress)) + { + MarkBusy(); + CLibCEC::AddLog(CEC_LOG_NOTICE, "<< requesting active source"); + + bReturn = m_handler->TransmitRequestActiveSource(GetMyLogicalAddress(), bWaitForResponse); + MarkReady(); + } + return bReturn; +} + bool CCECBusDevice::RequestCecVersion(bool bWaitForResponse /* = true */) { bool bReturn(false); @@ -286,7 +301,7 @@ uint16_t CCECBusDevice::GetPhysicalAddress(bool bSuppressUpdate /* = true */) bool bRequestUpdate(false); { CLockObject lock(m_mutex); - bRequestUpdate = bIsPresent && m_iPhysicalAddress == 0xFFFF; + bRequestUpdate = bIsPresent && m_iPhysicalAddress == CEC_INVALID_PHYSICAL_ADDRESS; } if (bRequestUpdate) @@ -576,7 +591,7 @@ void CCECBusDevice::ResetDeviceStatus(void) SetVendorId (CEC_VENDOR_UNKNOWN); SetMenuState (CEC_MENU_STATE_ACTIVATED); SetCecVersion (CEC_VERSION_UNKNOWN); - SetStreamPath (0xFFFF); + SetStreamPath (CEC_INVALID_PHYSICAL_ADDRESS); SetOSDName (ToString(m_iLogicalAddress)); SetInactiveSource(); m_iLastActive = 0; @@ -602,7 +617,7 @@ void CCECBusDevice::SetDeviceStatus(const cec_bus_device_status newStatus) SetVendorId (CEC_VENDOR_UNKNOWN); SetMenuState (CEC_MENU_STATE_ACTIVATED); SetCecVersion (CEC_VERSION_1_3A); - SetStreamPath (0xFFFF); + SetStreamPath (CEC_INVALID_PHYSICAL_ADDRESS); SetInactiveSource(); m_iLastActive = 0; m_deviceStatus = newStatus; @@ -637,7 +652,7 @@ void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress) } } -void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0xFFFF */) +void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) { CLockObject lock(m_mutex); if (iNewAddress != m_iStreamPath) @@ -884,7 +899,7 @@ bool CCECBusDevice::TransmitPhysicalAddress(void) cec_device_type type; { CLockObject lock(m_mutex); - if (m_iPhysicalAddress == 0xffff) + if (m_iPhysicalAddress == CEC_INVALID_PHYSICAL_ADDRESS) return false; CLibCEC::AddLog(CEC_LOG_NOTICE, "<< %s (%X) -> broadcast (F): physical adddress %4x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress);