newDevice->SetOSDName(previousDevice->GetOSDName(false));
previousDevice->SetOSDName(ToString(previousDevice->GetLogicalAddress()));
- newDevice->SetPhysicalAddress(previousDevice->GetPhysicalAddress(false));
+ newDevice->SetPhysicalAddress(previousDevice->GetPhysicalAddress());
previousDevice->SetPhysicalAddress(0xFFFF);
newDevice->SetPowerStatus(previousDevice->GetPowerStatus(false));
}
m_busDevices[addr]->SetActiveSource();
- if (m_busDevices[addr]->GetPhysicalAddress(false) != 0xFFFF)
+ if (m_busDevices[addr]->GetPhysicalAddress() != 0xFFFF)
bReturn = m_busDevices[addr]->ActivateSource();
return bReturn;
bool bReturn(false);
// suppress polls when searching for a device
- CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath, false, true);
+ CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath);
if (device)
{
device->SetActiveSource();
{
for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
{
- if (m_busDevices[iPtr]->GetPhysicalAddress(false) == iPhysicalAddress)
+ if (m_busDevices[iPtr]->GetPhysicalAddress() == iPhysicalAddress)
return true;
}
return false;
return status;
}
-CCECBusDevice *CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bRefresh /* = false */, bool bSuppressPoll /* = false */) const
+CCECBusDevice *CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate /* = true */)
{
- if (m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress(false) == iPhysicalAddress)
+ if (m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress() == iPhysicalAddress)
return m_busDevices[m_configuration.logicalAddresses.primary];
CCECBusDevice *device = NULL;
for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
{
- if (m_busDevices[iPtr]->GetPhysicalAddress(bRefresh, bSuppressPoll) == iPhysicalAddress)
+ if (m_busDevices[iPtr]->GetPhysicalAddress(bSuppressUpdate) == iPhysicalAddress)
{
device = m_busDevices[iPtr];
break;
uint16_t CCECProcessor::GetDevicePhysicalAddress(cec_logical_address iAddress)
{
if (m_busDevices[iAddress])
- return m_busDevices[iAddress]->GetPhysicalAddress(false);
+ return m_busDevices[iAddress]->GetPhysicalAddress();
return false;
}
uint16_t CCECProcessor::GetPhysicalAddress(void) const
{
if (!m_configuration.logicalAddresses.IsEmpty() && m_busDevices[m_configuration.logicalAddresses.primary])
- return m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress(false);
+ return m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress();
return false;
}
bool OnCommandReceived(const cec_command &command);
bool IsMonitoring(void) const { return m_bMonitor; }
- CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bRefresh = false, bool bSuppressPoll = false) const;
+ CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate = true);
CCECBusDevice * GetDeviceByType(cec_device_type type) const;
CCECBusDevice * GetPrimaryDevice(void) const;
cec_version GetDeviceCecVersion(cec_logical_address iAddress);
return bReturn;
}
-uint16_t CCECBusDevice::GetPhysicalAddress(bool bUpdate /* = false */, bool bSuppressPoll /* = false */)
+uint16_t CCECBusDevice::GetPhysicalAddress(bool bSuppressUpdate /* = true */)
{
- bool bIsPresent(GetStatus(false, bSuppressPoll) == CEC_DEVICE_STATUS_PRESENT);
- bool bRequestUpdate(false);
+ if (!bSuppressUpdate)
{
- CLockObject lock(m_mutex);
- bRequestUpdate = bIsPresent &&
- (m_iPhysicalAddress == 0xFFFF || bUpdate);
- }
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(m_mutex);
+ bRequestUpdate = bIsPresent && m_iPhysicalAddress == 0xFFFF;
+ }
- if (bRequestUpdate)
- {
- CheckVendorIdRequested();
- if (!RequestPhysicalAddress())
- CLibCEC::AddLog(CEC_LOG_ERROR, "failed to request the physical address");
+ if (bRequestUpdate)
+ {
+ CheckVendorIdRequested();
+ if (!RequestPhysicalAddress())
+ CLibCEC::AddLog(CEC_LOG_ERROR, "failed to request the physical address");
+ }
}
CLockObject lock(m_mutex);
m_iStreamPath = iNewAddress;
// suppress polls when searching for a device
- CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iNewAddress, false, true);
+ CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iNewAddress);
if (device)
{
// if a device is found with the new physical address, mark it as active, which will automatically mark all other devices as inactive
else
{
// try to find the device with the old address, and mark it as inactive when found
- device = m_processor->GetDeviceByPhysicalAddress(iOldAddress, false, true);
+ device = m_processor->GetDeviceByPhysicalAddress(iOldAddress);
if (device)
device->SetInactiveSource();
}
virtual cec_logical_address GetMyLogicalAddress(void) const;
virtual uint16_t GetMyPhysicalAddress(void) const;
virtual CStdString GetOSDName(bool bUpdate = false);
- virtual uint16_t GetPhysicalAddress(bool bUpdate = false, bool bSuppressPoll = false);
+ virtual uint16_t GetPhysicalAddress(bool bSuppressUpdate = true);
virtual cec_power_status GetPowerStatus(bool bUpdate = false);
virtual CCECProcessor * GetProcessor(void) const { return m_processor; }
virtual cec_device_type GetType(void) const { return m_type; }
{
uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
CCECBusDevice *primary = m_processor->GetPrimaryDevice();
- bool bSendPowerOffState(iAddress != primary->GetPhysicalAddress(false) && primary->IsActiveSource());
+ bool bSendPowerOffState(iAddress != primary->GetPhysicalAddress() && primary->IsActiveSource());
m_processor->SetActiveSource(iAddress);
if (bSendPowerOffState)
if (bTransmitCommand)
{
CLibCEC::AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command");
- return CCECCommandHandler::TransmitActiveSource(m_busDevice->GetLogicalAddress(), m_busDevice->GetPhysicalAddress(false, true));
+ return CCECCommandHandler::TransmitActiveSource(m_busDevice->GetLogicalAddress(), m_busDevice->GetPhysicalAddress());
}
return true;
}