本文整理汇总了C++中CECClientPtr::AutodetectPhysicalAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ CECClientPtr::AutodetectPhysicalAddress方法的具体用法?C++ CECClientPtr::AutodetectPhysicalAddress怎么用?C++ CECClientPtr::AutodetectPhysicalAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CECClientPtr
的用法示例。
在下文中一共展示了CECClientPtr::AutodetectPhysicalAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AllocateLogicalAddresses
bool CCECProcessor::AllocateLogicalAddresses(CECClientPtr client)
{
libcec_configuration &configuration = *client->GetConfiguration();
// mark as unregistered
client->SetRegistered(false);
// unregister this client from the old addresses
CECDEVICEVEC devices;
m_busDevices->GetByLogicalAddresses(devices, configuration.logicalAddresses);
for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
{
// remove client entry
CLockObject lock(m_mutex);
m_clients.erase((*it)->GetLogicalAddress());
}
// find logical addresses for this client
if (!client->AllocateLogicalAddresses())
{
m_libcec->AddLog(CEC_LOG_ERROR, "failed to find a free logical address for the client");
return false;
}
// refresh the address
if (configuration.bAutodetectAddress)
client->AutodetectPhysicalAddress();
// register this client on the new addresses
devices.clear();
m_busDevices->GetByLogicalAddresses(devices, configuration.logicalAddresses);
for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
{
// set the physical address of the device at this LA
if (CLibCEC::IsValidPhysicalAddress(configuration.iPhysicalAddress))
(*it)->SetPhysicalAddress(configuration.iPhysicalAddress);
// replace a previous client
CLockObject lock(m_mutex);
m_clients.erase((*it)->GetLogicalAddress());
m_clients.insert(make_pair((*it)->GetLogicalAddress(), client));
}
// set the new ackmask
SetLogicalAddresses(GetLogicalAddresses());
// resume outgoing communication
m_bStallCommunication = false;
return true;
}