本文整理汇总了C++中CCECBusDevice::GetPhysicalAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ CCECBusDevice::GetPhysicalAddress方法的具体用法?C++ CCECBusDevice::GetPhysicalAddress怎么用?C++ CCECBusDevice::GetPhysicalAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCECBusDevice
的用法示例。
在下文中一共展示了CCECBusDevice::GetPhysicalAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDevicePhysicalAddress
uint16_t CCECClient::GetDevicePhysicalAddress(const cec_logical_address iAddress)
{
CCECBusDevice *device = m_processor->GetDevice(iAddress);
if (device)
return device->GetPhysicalAddress(GetPrimaryLogicalAdddress());
return CEC_INVALID_PHYSICAL_ADDRESS;
}
示例2: SetHDMIPort
bool CCECClient::SetHDMIPort(const cec_logical_address iBaseDevice, const uint8_t iPort, bool bForce /* = false */)
{
bool bReturn(false);
// limit the HDMI port range to 1-15
if (iPort < CEC_MIN_HDMI_PORTNUMBER ||
iPort > CEC_MAX_HDMI_PORTNUMBER)
return bReturn;
LIB_CEC->AddLog(CEC_LOG_NOTICE, "setting HDMI port to %d on device %s (%d)", iPort, ToString(iBaseDevice), (int)iBaseDevice);
// update the configuration
{
CLockObject lock(m_mutex);
m_configuration.baseDevice = iBaseDevice;
m_configuration.iHDMIPort = iPort;
}
// don't continue if the connection isn't opened
if (!m_processor->CECInitialised() && !bForce)
return true;
// get the PA of the base device
uint16_t iPhysicalAddress(CEC_INVALID_PHYSICAL_ADDRESS);
CCECBusDevice *baseDevice = m_processor->GetDevice(iBaseDevice);
if (baseDevice)
iPhysicalAddress = baseDevice->GetPhysicalAddress(GetPrimaryLogicalAdddress());
// add our port number
if (iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS)
{
if (iPhysicalAddress == 0)
iPhysicalAddress += 0x1000 * iPort;
else if (iPhysicalAddress % 0x1000 == 0)
iPhysicalAddress += 0x100 * iPort;
else if (iPhysicalAddress % 0x100 == 0)
iPhysicalAddress += 0x10 * iPort;
else if (iPhysicalAddress % 0x10 == 0)
iPhysicalAddress += iPort;
bReturn = true;
}
// set the default address when something went wrong
if (!bReturn)
{
LIB_CEC->AddLog(CEC_LOG_WARNING, "failed to set the physical address to %04X, setting it to the default value %04X", iPhysicalAddress, CEC_DEFAULT_PHYSICAL_ADDRESS);
iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS;
}
// and set the address
SetDevicePhysicalAddress(iPhysicalAddress);
CallbackConfigurationChanged(m_configuration);
return bReturn;
}