X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECDeviceMap.cpp;h=b7f3ab2026b4143b88b1096358b04d513b5caa3c;hb=0c271bd0fc05728d0dd90065a064737a979f50d3;hp=a21b2b43254149cf51408d43c90365a81bbe6a4a;hpb=b0a5e4fc9b66620b00f937f7e9a406bf22aaaf1d;p=deb_libcec.git diff --git a/src/lib/devices/CECDeviceMap.cpp b/src/lib/devices/CECDeviceMap.cpp index a21b2b4..b7f3ab2 100644 --- a/src/lib/devices/CECDeviceMap.cpp +++ b/src/lib/devices/CECDeviceMap.cpp @@ -39,6 +39,7 @@ #include "CECTuner.h" #include "CECTV.h" #include "lib/CECProcessor.h" +#include "lib/CECTypeUtils.h" using namespace std; using namespace CEC; @@ -266,3 +267,25 @@ cec_logical_addresses CCECDeviceMap::ToLogicalAddresses(const CECDEVICEVEC &devi addresses.Set((*it)->GetLogicalAddress()); return addresses; } + +void CCECDeviceMap::GetChildrenOf(CECDEVICEVEC& devices, CCECBusDevice* device) const +{ + devices.clear(); + if (!device) + return; + + uint16_t iPA = device->GetCurrentPhysicalAddress(); + + for (CECDEVICEMAP::const_iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++) + { + uint16_t iCurrentPA = it->second->GetCurrentPhysicalAddress(); + if (CCECTypeUtils::PhysicalAddressIsIncluded(iPA, iCurrentPA)) + devices.push_back(it->second); + } +} + +void CCECDeviceMap::SignalAll(cec_opcode opcode) +{ + for (CECDEVICEMAP::iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++) + it->second->SignalOpcode(opcode); +}