本文整理汇总了C++中CECClientPtr::Alert方法的典型用法代码示例。如果您正苦于以下问题:C++ CECClientPtr::Alert方法的具体用法?C++ CECClientPtr::Alert怎么用?C++ CECClientPtr::Alert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CECClientPtr
的用法示例。
在下文中一共展示了CECClientPtr::Alert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activeSourceCheck
void *CCECProcessor::Process(void)
{
uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME;
m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started");
if (!m_connCheck)
m_connCheck = new CCECStandbyProtection(this);
m_connCheck->CreateThread();
cec_command command; command.Clear();
CTimeout activeSourceCheck(ACTIVE_SOURCE_CHECK_INTERVAL);
CTimeout tvPresentCheck(TV_PRESENT_CHECK_INTERVAL);
// as long as we're not being stopped and the connection is open
while (!IsStopped() && m_communication->IsOpen())
{
// wait for a new incoming command, and process it
if (m_inBuffer.Pop(command, timeout))
ProcessCommand(command);
if (CECInitialised() && !IsStopped())
{
// check clients for keypress timeouts
timeout = m_libcec->CheckKeypressTimeout();
// check if we need to replace handlers
ReplaceHandlers();
// check whether we need to activate a source, if it failed before
if (activeSourceCheck.TimeLeft() == 0)
{
if (CECInitialised())
TransmitPendingActiveSourceCommands();
activeSourceCheck.Init(ACTIVE_SOURCE_CHECK_INTERVAL);
}
// check whether the TV is present and responding
if (tvPresentCheck.TimeLeft() == 0)
{
CECClientPtr primary = GetPrimaryClient();
// only check whether the tv responds to polls when a client is connected and not in monitoring mode
if (primary && primary->GetConfiguration()->bMonitorOnly != 1)
{
if (!m_busDevices->At(CECDEVICE_TV)->IsPresent())
{
libcec_parameter param;
param.paramType = CEC_PARAMETER_TYPE_STRING;
param.paramData = (void*)"TV does not respond to CEC polls";
primary->Alert(CEC_ALERT_TV_POLL_FAILED, param);
}
}
tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL);
}
}
else
timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME;
}
return NULL;
}
示例2: RegisterClient
//.........这里部分代码省略.........
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", CCECTypeUtils::VersionToString(configuration.clientVersion).c_str());
// 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();
// log the new registration
std::string strLog;
strLog = StringUtils::Format("%s: %s", bReturn ? "CEC client registered" : "failed to register the CEC client", client->GetConnectionInfo().c_str());
m_libcec->AddLog(bReturn ? CEC_LOG_NOTICE : CEC_LOG_ERROR, strLog.c_str());
// display a warning if the firmware can be upgraded
if (bReturn && !IsRunningLatestFirmware())
{
const char *strUpgradeMessage = "The firmware of this adapter can be upgraded. Please visit http://blog.pulse-eight.com/ for more information.";
m_libcec->AddLog(CEC_LOG_WARNING, strUpgradeMessage);
libcec_parameter param;
param.paramData = (void*)strUpgradeMessage; param.paramType = CEC_PARAMETER_TYPE_STRING;
client->Alert(CEC_ALERT_SERVICE_DEVICE, param);
}
// ensure that the command handler for the TV is initialised
if (bReturn)
{
CCECCommandHandler *handler = GetTV()->GetHandler();
if (handler)
handler->InitHandler();
GetTV()->MarkHandlerReady();
}
// report our OSD name to the TV, since some TVs don't request it
client->GetPrimaryDevice()->TransmitOSDName(CECDEVICE_TV, false);
// request the power status of the TV
tv->RequestPowerStatus(sourceAddress, true, true);
return bReturn;
}