本文整理汇总了C++中PVR_CLIENTMAP类的典型用法代码示例。如果您正苦于以下问题:C++ PVR_CLIENTMAP类的具体用法?C++ PVR_CLIENTMAP怎么用?C++ PVR_CLIENTMAP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PVR_CLIENTMAP类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: error
PVR_ERROR CPVRClients::GetChannels(CPVRChannelGroupInternal *group)
{
PVR_ERROR error(PVR_ERROR_NO_ERROR);
PVR_CLIENTMAP clients;
GetConnectedClients(clients);
/* get the channel list from each client */
for (PVR_CLIENTMAP_ITR itrClients = clients.begin(); itrClients != clients.end(); itrClients++)
{
PVR_ERROR currentError = (*itrClients).second->GetChannels(*group, group->IsRadio());
if (currentError != PVR_ERROR_NOT_IMPLEMENTED &&
currentError != PVR_ERROR_NO_ERROR)
{
error = currentError;
CLog::Log(LOGERROR, "PVR - %s - cannot get channels from client '%d': %s",__FUNCTION__, (*itrClients).first, CPVRClient::ToString(error));
}
}
return error;
}
示例2: error
PVR_ERROR CPVRClients::GetChannelGroupMembers(CPVRChannelGroup *group)
{
PVR_ERROR error(PVR_ERROR_NO_ERROR);
PVR_CLIENTMAP clients;
GetCreatedClients(clients);
/* get the member list from each client */
for (PVR_CLIENTMAP_CITR itrClients = clients.begin(); itrClients != clients.end(); itrClients++)
{
PVR_ERROR currentError = (*itrClients).second->GetChannelGroupMembers(group);
if (currentError != PVR_ERROR_NOT_IMPLEMENTED &&
currentError != PVR_ERROR_NO_ERROR)
{
error = currentError;
CLog::Log(LOGERROR, "PVR - %s - cannot get group members from client '%d': %s",__FUNCTION__, (*itrClients).first, CPVRClient::ToString(error));
}
}
return error;
}
示例3: iReturn
int CPVRClients::GetConnectedClients(PVR_CLIENTMAP &clients) const
{
int iReturn(0);
CSingleLock lock(m_critSection);
for (PVR_CLIENTMAP_CITR itr = m_clientMap.begin(); itr != m_clientMap.end(); itr++)
{
if (itr->second->ReadyToUse())
{
clients.insert(std::make_pair(itr->second->GetID(), itr->second));
++iReturn;
}
}
return iReturn;
}
示例4: GetCreatedClients
int CPVRClients::GetCreatedClients(PVR_CLIENTMAP &clients) const
{
int iReturn(0);
CSingleLock lock(m_critSection);
for (const auto &client : m_clientMap)
{
if (client.second->ReadyToUse())
{
if (client.second->IgnoreClient())
continue;
clients.insert(std::make_pair(client.second->GetID(), client.second));
++iReturn;
}
}
return iReturn;
}
示例5: iActiveClients
void CPVRGUIInfo::UpdateBackendCache(void)
{
CStdString strBackendName;
CStdString strBackendVersion;
CStdString strBackendHost;
CStdString strBackendDiskspace;
CStdString strBackendTimers;
CStdString strBackendRecordings;
CStdString strBackendChannels;
int iActiveClients(0);
if (!AddonInfoToggle())
return;
CPVRClients *clients = g_PVRClients;
PVR_CLIENTMAP activeClients;
iActiveClients = clients->GetConnectedClients(activeClients);
if (iActiveClients > 0)
{
PVR_CLIENTMAP_CITR activeClient = activeClients.begin();
/* safe to read unlocked */
for (unsigned int i = 0; i < m_iAddonInfoToggleCurrent; i++)
activeClient++;
long long kBTotal = 0;
long long kBUsed = 0;
if (activeClient->second->GetDriveSpace(&kBTotal, &kBUsed) == PVR_ERROR_NO_ERROR)
{
kBTotal /= 1024; // Convert to MBytes
kBUsed /= 1024; // Convert to MBytes
strBackendDiskspace.Format("%s %.1f GByte - %s: %.1f GByte",
g_localizeStrings.Get(20161), (float) kBTotal / 1024, g_localizeStrings.Get(20162), (float) kBUsed / 1024);
}
else
{
strBackendDiskspace = g_localizeStrings.Get(19055);
}
int NumChannels = activeClient->second->GetChannelsAmount();
if (NumChannels >= 0)
strBackendChannels.Format("%i", NumChannels);
else
strBackendChannels = g_localizeStrings.Get(161);
int NumTimers = activeClient->second->GetTimersAmount();
if (NumTimers >= 0)
strBackendTimers.Format("%i", NumTimers);
else
strBackendTimers = g_localizeStrings.Get(161);
int NumRecordings = activeClient->second->GetRecordingsAmount();
if (NumRecordings >= 0)
strBackendRecordings.Format("%i", NumRecordings);
else
strBackendRecordings = g_localizeStrings.Get(161);
strBackendName = activeClient->second->GetBackendName();
strBackendVersion = activeClient->second->GetBackendVersion();
strBackendHost = activeClient->second->GetConnectionString();
}
CSingleLock lock(m_critSection);
m_strBackendName = strBackendName;
m_strBackendVersion = strBackendVersion;
m_strBackendHost = strBackendHost;
m_strBackendDiskspace = strBackendDiskspace;
m_strBackendTimers = strBackendTimers;
m_strBackendRecordings = strBackendRecordings;
m_strBackendChannels = strBackendChannels;
m_iActiveClients = iActiveClients;
}
示例6: OnClickButtonNewChannel
bool CGUIDialogPVRChannelManager::OnClickButtonNewChannel(CGUIMessage &message)
{
std::vector<long> clients;
CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!pDlgSelect)
return false;
pDlgSelect->SetHeading(19213); // Select Client
pDlgSelect->Add(g_localizeStrings.Get(19209));
clients.push_back(PVR_VIRTUAL_CLIENT_ID);
PVR_CLIENTMAP clientMap;
if (g_PVRClients->GetConnectedClients(clientMap) > 0)
{
PVR_CLIENTMAP_ITR itr;
for (itr = clientMap.begin() ; itr != clientMap.end(); itr++)
{
clients.push_back((*itr).first);
pDlgSelect->Add((*itr).second->Name());
}
}
pDlgSelect->DoModal();
int selection = pDlgSelect->GetSelectedLabel();
if (selection >= 0 && selection <= (int) clients.size())
{
int clientID = clients[selection];
if (clientID == PVR_VIRTUAL_CLIENT_ID)
{
CStdString strURL = "";
if (CGUIKeyboardFactory::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false))
{
if (!strURL.empty())
{
CPVRChannel *newchannel = new CPVRChannel(m_bIsRadio);
newchannel->SetChannelName(g_localizeStrings.Get(19204));
newchannel->SetEPGEnabled(false);
newchannel->SetVirtual(true);
newchannel->SetStreamURL(strURL);
newchannel->SetClientID(PVR_VIRTUAL_CLIENT_ID);
if (g_PVRChannelGroups->CreateChannel(*newchannel))
g_PVRChannelGroups->GetGroupAll(m_bIsRadio)->Persist();
CFileItemPtr channel(new CFileItem(*newchannel));
if (channel)
{
channel->SetProperty("ActiveChannel", true);
channel->SetProperty("Name", g_localizeStrings.Get(19204));
channel->SetProperty("UseEPG", false);
channel->SetProperty("Icon", newchannel->IconPath());
channel->SetProperty("EPGSource", (int)0);
channel->SetProperty("ClientName", g_localizeStrings.Get(19209));
channel->SetProperty("ParentalLocked", false);
m_channelItems->AddFront(channel, m_iSelected);
m_viewControl.SetItems(*m_channelItems);
Renumber();
}
}
}
}
else
{
CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
}
}
return true;
}
示例7: GetConnectedClients
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat, const CFileItem *item)
{
PVR_MENUHOOKS *hooks = NULL;
// get client id
if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING)
{
PVR_CLIENTMAP clients;
GetConnectedClients(clients);
if (clients.size() == 1)
{
iClientID = clients.begin()->first;
}
else if (clients.size() > 1)
{
// have user select client
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(19196);
PVR_CLIENTMAP_ITR itrClients;
for (itrClients = clients.begin(); itrClients != clients.end(); itrClients++)
{
pDialog->Add(itrClients->second->GetBackendName());
}
pDialog->DoModal();
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
{
itrClients = clients.begin();
for (int i = 0; i < selection; i++)
itrClients++;
iClientID = itrClients->first;
}
}
}
if (iClientID < 0)
iClientID = GetPlayingClientID();
PVR_CLIENT client;
if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat))
{
hooks = client->GetMenuHooks();
std::vector<int> hookIDs;
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(19196);
for (unsigned int i = 0; i < hooks->size(); i++)
if (hooks->at(i).category == cat || hooks->at(i).category == PVR_MENUHOOK_ALL)
{
pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId));
hookIDs.push_back(i);
}
pDialog->DoModal();
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
client->CallMenuHook(hooks->at(hookIDs.at(selection)), item);
}
}
示例8: ProcessMenuHooks
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat, const CFileItem *item)
{
// get client id
if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING)
{
PVR_CLIENTMAP clients;
GetCreatedClients(clients);
if (clients.size() == 1)
{
iClientID = clients.begin()->first;
}
else if (clients.size() > 1)
{
// have user select client
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(CVariant{19196});
for (const auto client : clients)
{
pDialog->Add(client.second->GetBackendName());
}
pDialog->Open();
int selection = pDialog->GetSelectedItem();
if (selection >= 0)
{
auto client = clients.begin();
std::advance(client, selection);
iClientID = client->first;
}
}
}
if (iClientID < 0)
iClientID = GetPlayingClientID();
PVR_CLIENT client;
if (GetCreatedClient(iClientID, client) && client->HaveMenuHooks(cat))
{
PVR_MENUHOOKS *hooks = client->GetMenuHooks();
std::vector<int> hookIDs;
int selection = 0;
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(CVariant{19196});
for (unsigned int i = 0; i < hooks->size(); ++i)
{
if (hooks->at(i).category == cat || hooks->at(i).category == PVR_MENUHOOK_ALL)
{
pDialog->Add(g_localizeStrings.GetAddonString(client->ID(), hooks->at(i).iLocalizedStringId));
hookIDs.push_back(i);
}
}
if (hookIDs.size() > 1)
{
pDialog->Open();
selection = pDialog->GetSelectedItem();
}
if (selection >= 0)
client->CallMenuHook(hooks->at(hookIDs.at(selection)), item);
}
}
示例9: iBackendkBUsed
void CPVRGUIInfo::UpdateBackendCache(void)
{
std::string strBackendName;
std::string strBackendVersion;
std::string strBackendHost;
std::string strBackendDiskspace;
std::string strBackendTimers;
std::string strBackendRecordings;
std::string strBackendChannels;
long long iBackendkBUsed(0);
long long iBackendkBTotal(0);
int iActiveClients(0);
CPVRClients *clients = g_PVRClients;
PVR_CLIENTMAP activeClients;
iActiveClients = clients->GetConnectedClients(activeClients);
if (iActiveClients > 1 && !AddonInfoToggle())
return;
if (iActiveClients > 0)
{
PVR_CLIENTMAP_CITR activeClient = activeClients.begin();
/* safe to read unlocked */
for (unsigned int i = 0; i < m_iAddonInfoToggleCurrent; i++)
activeClient++;
if (activeClient->second->GetDriveSpace(&iBackendkBTotal, &iBackendkBUsed) == PVR_ERROR_NO_ERROR)
{
iBackendkBUsed *= 1024; // Convert to Bytes
iBackendkBTotal *= 1024; // Convert to Bytes
}
else
{
iBackendkBUsed = 0;
iBackendkBTotal = 0;
}
int NumChannels = activeClient->second->GetChannelsAmount();
if (NumChannels >= 0)
strBackendChannels = StringUtils::Format("%i", NumChannels);
else
strBackendChannels = g_localizeStrings.Get(161);
int NumTimers = activeClient->second->GetTimersAmount();
if (NumTimers >= 0)
strBackendTimers = StringUtils::Format("%i", NumTimers);
else
strBackendTimers = g_localizeStrings.Get(161);
int NumRecordings = activeClient->second->GetRecordingsAmount();
if (NumRecordings >= 0)
strBackendRecordings = StringUtils::Format("%i", NumRecordings);
else
strBackendRecordings = g_localizeStrings.Get(161);
strBackendName = activeClient->second->GetBackendName();
strBackendVersion = activeClient->second->GetBackendVersion();
strBackendHost = activeClient->second->GetConnectionString();
}
CSingleLock lock(m_critSection);
m_strBackendName = strBackendName;
m_strBackendVersion = strBackendVersion;
m_strBackendHost = strBackendHost;
m_strBackendTimers = strBackendTimers;
m_strBackendRecordings = strBackendRecordings;
m_strBackendChannels = strBackendChannels;
m_iActiveClients = iActiveClients;
m_iBackendUsedDiskspace = iBackendkBUsed;
m_iBackendTotalDiskspace = iBackendkBTotal;
}