本文整理汇总了C++中CCECBusDevice::ReplaceHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ CCECBusDevice::ReplaceHandler方法的具体用法?C++ CCECBusDevice::ReplaceHandler怎么用?C++ CCECBusDevice::ReplaceHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCECBusDevice
的用法示例。
在下文中一共展示了CCECBusDevice::ReplaceHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitHandler
bool CSLCommandHandler::InitHandler(void)
{
if (m_bHandlerInited)
return true;
m_bHandlerInited = true;
if (m_busDevice->GetLogicalAddress() != CECDEVICE_TV)
return true;
CCECBusDevice *primary = m_processor->GetPrimaryDevice();
if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
{
/* imitate LG devices */
if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
{
primary->SetVendorId(CEC_VENDOR_LG);
primary->ReplaceHandler(false);
}
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
{
/* start as 'in transition standby->on' */
primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
primary->TransmitPowerState(CECDEVICE_TV, false);
/* send the vendor id */
primary->TransmitVendorID(CECDEVICE_BROADCAST, false, false);
}
}
return true;
}
示例2: InitHandler
bool CRLCommandHandler::InitHandler(void)
{
if (m_bHandlerInited)
return true;
m_bHandlerInited = true;
if (m_busDevice->GetLogicalAddress() != CECDEVICE_TV)
return true;
CCECBusDevice *primary = m_processor->GetPrimaryDevice();
if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
{
/* imitate Toshiba devices */
if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
{
primary->SetVendorId(CEC_VENDOR_TOSHIBA);
primary->ReplaceHandler(false);
}
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
{
/* send the vendor id */
primary->TransmitVendorID(CECDEVICE_BROADCAST, false, false);
}
}
return true;
}
示例3: InitHandler
bool CVLCommandHandler::InitHandler(void)
{
CCECBusDevice *primary = m_processor->GetPrimaryDevice();
if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
{
/* use the VL commandhandler for the primary device that is handled by libCEC */
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
{
if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
{
libcec_configuration config;
m_processor->GetPrimaryClient()->GetCurrentConfiguration(config);
if (config.iDoubleTapTimeoutMs == 0)
{
config.iDoubleTapTimeoutMs = CEC_DOUBLE_TAP_TIMEOUT_MS;
m_processor->GetPrimaryClient()->SetConfiguration(config);
}
primary->SetVendorId(CEC_VENDOR_PANASONIC);
primary->ReplaceHandler(false);
}
if (primary->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)
return m_processor->GetPrimaryClient()->ChangeDeviceType(CEC_DEVICE_TYPE_RECORDING_DEVICE, CEC_DEVICE_TYPE_PLAYBACK_DEVICE);
}
}
return CCECCommandHandler::InitHandler();
}
示例4: InitHandler
bool CPHCommandHandler::InitHandler(void)
{
CCECBusDevice *primary = m_processor->GetPrimaryDevice();
if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
{
//XXX hack to use this handler for the primary device
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV &&
primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
{
primary->SetVendorId(CEC_VENDOR_PHILIPS);
primary->ReplaceHandler(false);
}
}
return CCECCommandHandler::InitHandler();
}
示例5: RegisterClient
bool CCECProcessor::RegisterClient(CCECClient *client)
{
if (!client)
return false;
libcec_configuration &configuration = *client->GetConfiguration();
if (configuration.clientVersion < CEC_CLIENT_VERSION_2_0_0)
{
m_libcec->AddLog(CEC_LOG_ERROR, "failed to register a new CEC client: client version %s is no longer supported", ToString((cec_client_version)configuration.clientVersion));
return false;
}
if (configuration.bMonitorOnly == 1)
return true;
if (!CECInitialised())
{
m_libcec->AddLog(CEC_LOG_ERROR, "failed to register a new CEC client: CEC processor is not initialised");
return false;
}
// unregister the client first if it's already been marked as registered
if (client->IsRegistered())
UnregisterClient(client);
// ensure that controlled mode is enabled
m_communication->SetControlledMode(true);
m_bMonitor = false;
// source logical address for requests
cec_logical_address sourceAddress(CECDEVICE_UNREGISTERED);
if (!m_communication->SupportsSourceLogicalAddress(CECDEVICE_UNREGISTERED))
{
if (m_communication->SupportsSourceLogicalAddress(CECDEVICE_FREEUSE))
sourceAddress = CECDEVICE_FREEUSE;
else
{
m_libcec->AddLog(CEC_LOG_ERROR, "failed to register a new CEC client: both unregistered and free use are not supported by the device");
return false;
}
}
// ensure that we know the vendor id of the TV
CCECBusDevice *tv = GetTV();
cec_vendor_id tvVendor(tv->GetVendorId(sourceAddress));
// wait until the handler is replaced, to avoid double registrations
if (tvVendor != CEC_VENDOR_UNKNOWN &&
CCECCommandHandler::HasSpecificHandler(tvVendor))
{
while (!tv->ReplaceHandler(false))
CEvent::Sleep(5);
}
// get the configuration from the client
m_libcec->AddLog(CEC_LOG_NOTICE, "registering new CEC client - v%s", ToString((cec_client_version)configuration.clientVersion));
// get the current ackmask, so we can restore it if polling fails
cec_logical_addresses previousMask = GetLogicalAddresses();
// mark as uninitialised
client->SetInitialised(false);
// find logical addresses for this client
if (!AllocateLogicalAddresses(client))
{
m_libcec->AddLog(CEC_LOG_ERROR, "failed to register the new CEC client - cannot allocate the requested device types");
SetLogicalAddresses(previousMask);
return false;
}
// get the settings from the rom
if (configuration.bGetSettingsFromROM == 1)
{
libcec_configuration config; config.Clear();
m_communication->GetConfiguration(config);
CLockObject lock(m_mutex);
if (!config.deviceTypes.IsEmpty())
configuration.deviceTypes = config.deviceTypes;
if (CLibCEC::IsValidPhysicalAddress(config.iPhysicalAddress))
configuration.iPhysicalAddress = config.iPhysicalAddress;
snprintf(configuration.strDeviceName, 13, "%s", config.strDeviceName);
}
// set the firmware version and build date
configuration.serverVersion = LIBCEC_VERSION_CURRENT;
configuration.iFirmwareVersion = m_communication->GetFirmwareVersion();
configuration.iFirmwareBuildDate = m_communication->GetFirmwareBuildDate();
configuration.adapterType = m_communication->GetAdapterType();
// mark the client as registered
client->SetRegistered(true);
sourceAddress = client->GetPrimaryLogicalAdddress();
// initialise the client
bool bReturn = client->OnRegister();
//.........这里部分代码省略.........