本文整理汇总了C++中PVR_CLIENT::CanAutoconfigure方法的典型用法代码示例。如果您正苦于以下问题:C++ PVR_CLIENT::CanAutoconfigure方法的具体用法?C++ PVR_CLIENT::CanAutoconfigure怎么用?C++ PVR_CLIENT::CanAutoconfigure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PVR_CLIENT
的用法示例。
在下文中一共展示了PVR_CLIENT::CanAutoconfigure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoconfigureClients
bool CPVRClients::AutoconfigureClients(void)
{
bool bReturn(false);
std::vector<PVR_CLIENT> autoConfigAddons;
PVR_CLIENT addon;
VECADDONS map;
CAddonMgr::GetInstance().GetInstalledAddons(map, ADDON_PVRDLL);
/** get the auto-configurable add-ons */
for (VECADDONS::iterator it = map.begin(); it != map.end(); ++it)
{
if (CAddonMgr::GetInstance().IsAddonDisabled((*it)->ID()))
{
addon = std::dynamic_pointer_cast<CPVRClient>(*it);
if (addon->CanAutoconfigure())
autoConfigAddons.push_back(addon);
}
}
/** no configurable add-ons found */
if (autoConfigAddons.empty())
return bReturn;
/** display a progress bar while trying to auto-configure add-ons */
CGUIDialogExtendedProgressBar *loadingProgressDialog = (CGUIDialogExtendedProgressBar *)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
CGUIDialogProgressBarHandle* progressHandle = loadingProgressDialog->GetHandle(g_localizeStrings.Get(19688)); // Scanning for PVR services
progressHandle->SetPercentage(0);
progressHandle->SetText(g_localizeStrings.Get(19688)); //Scanning for PVR services
/** start zeroconf and wait a second to get some responses */
CZeroconfBrowser::GetInstance()->Start();
for (std::vector<PVR_CLIENT>::iterator it = autoConfigAddons.begin(); !bReturn && it != autoConfigAddons.end(); ++it)
(*it)->AutoconfigureRegisterType();
unsigned iIterations(0);
float percentage(0.0f);
float percentageStep(100.0f / PVR_CLIENT_AVAHI_SCAN_ITERATIONS);
progressHandle->SetPercentage(percentage);
/** while no add-ons were configured within 20 iterations */
while (!bReturn && iIterations++ < PVR_CLIENT_AVAHI_SCAN_ITERATIONS)
{
/** check each disabled add-on */
for (std::vector<PVR_CLIENT>::iterator it = autoConfigAddons.begin(); !bReturn && it != autoConfigAddons.end(); ++it)
{
if (addon->Autoconfigure())
{
progressHandle->SetPercentage(100.0f);
progressHandle->MarkFinished();
/** enable the add-on */
CAddonMgr::GetInstance().EnableAddon((*it)->ID());
CSingleLock lock(m_critSection);
m_addons.push_back(*it);
bReturn = true;
}
}
/** wait a while and try again */
if (!bReturn)
{
percentage += percentageStep;
progressHandle->SetPercentage(percentage);
Sleep(PVR_CLIENT_AVAHI_SLEEP_TIME_MS);
}
}
progressHandle->SetPercentage(100.0f);
progressHandle->MarkFinished();
return bReturn;
}