Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
PVR::CPVRClients Class Reference

#include <PVRClients.h>

Inheritance diagram for PVR::CPVRClients:
ADDON::IAddonMgrCallback

Public Member Functions

 CPVRClients ()
 
 ~CPVRClients () override
 
void Start ()
 Start all clients.
 
void Stop ()
 Stop all clients.
 
void Continue ()
 Continue all clients.
 
void UpdateClients (const std::string &changedAddonId="", ADDON::AddonInstanceId changedInstanceId=ADDON::ADDON_SINGLETON_INSTANCE_ID)
 Update all clients, sync with Addon Manager state (start, restart, shutdown clients).
 
bool RequestRestart (const std::string &addonId, ADDON::AddonInstanceId instanceId, bool bDataChanged) override
 Restart a single client add-on.
 
bool StopClient (int clientId, bool restart)
 Stop a client.
 
void OnAddonEvent (const ADDON::AddonEvent &event)
 Handle addon events (enable, disable, ...).
 
int CreatedClientAmount () const
 Get the number of created clients.
 
bool HasCreatedClients () const
 Check whether there are any created clients.
 
bool IsCreatedClient (int iClientId) const
 Check whether a given client ID points to a created client.
 
std::shared_ptr< CPVRClientGetCreatedClient (int clientId) const
 Get the the client for the given client id, if it is created.
 
CPVRClientMap GetCreatedClients () const
 Get all created clients.
 
int GetFirstCreatedClientID () const
 Get the ID of the first created client.
 
bool HasIgnoredClients () const
 Check whether there are any created, but not (yet) connected clients.
 
int EnabledClientAmount () const
 Get the number of enabled clients.
 
bool IsEnabledClient (int clientId) const
 Check whether a given client ID points to an enabled client.
 
std::vector< CVariantGetEnabledClientInfos () const
 Get a list of the enabled client infos.
 
std::vector< CVariantGetClientProviderInfos () const
 Get info required for providers. Include both enabled and disabled PVR add-ons.
 
general methods
std::vector< SBackendGetBackendProperties () const
 Returns properties about all created clients.
 
Timer methods
bool GetTimers (const std::vector< std::shared_ptr< CPVRClient > > &clients, CPVRTimersContainer *timers, std::vector< int > &failedClients) const
 Get all timers from the given clients.
 
PVR_ERROR UpdateTimerTypes (const std::vector< std::shared_ptr< CPVRClient > > &clients, std::vector< int > &failedClients)
 Update all timer types from the given clients.
 
const std::vector< std::shared_ptr< CPVRTimerType > > GetTimerTypes () const
 Get all timer types supported by the backends, without updating them from the backends.
 
Recording methods
PVR_ERROR GetRecordings (const std::vector< std::shared_ptr< CPVRClient > > &clients, CPVRRecordings *recordings, bool deleted, std::vector< int > &failedClients) const
 Get all recordings from the given clients.
 
PVR_ERROR DeleteAllRecordingsFromTrash ()
 Delete all "soft" deleted recordings permanently on the backend.
 
EPG methods
PVR_ERROR SetEPGMaxPastDays (int iPastDays)
 Tell all clients the past time frame to use when notifying epg events back to Kodi.
 
PVR_ERROR SetEPGMaxFutureDays (int iFutureDays)
 Tell all clients the future time frame to use when notifying epg events back to Kodi.
 
Channel methods
PVR_ERROR GetChannels (const std::vector< std::shared_ptr< CPVRClient > > &clients, bool bRadio, std::vector< std::shared_ptr< CPVRChannel > > &channels, std::vector< int > &failedClients) const
 Get all channels from the given clients.
 
PVR_ERROR GetProviders (const std::vector< std::shared_ptr< CPVRClient > > &clients, CPVRProvidersContainer *providers, std::vector< int > &failedClients) const
 Get all providers from backends.
 
PVR_ERROR GetChannelGroups (const std::vector< std::shared_ptr< CPVRClient > > &clients, CPVRChannelGroups *groups, std::vector< int > &failedClients) const
 Get all channel groups from the given clients.
 
PVR_ERROR GetChannelGroupMembers (const std::vector< std::shared_ptr< CPVRClient > > &clients, CPVRChannelGroup *group, std::vector< std::shared_ptr< CPVRChannelGroupMember > > &groupMembers, std::vector< int > &failedClients) const
 Get all group members of a channel group from the given clients.
 
std::vector< std::shared_ptr< CPVRClient > > GetClientsSupportingChannelScan () const
 Get a list of clients providing a channel scan dialog.
 
std::vector< std::shared_ptr< CPVRClient > > GetClientsSupportingChannelSettings (bool bRadio) const
 Get a list of clients providing a channel settings dialog.
 
bool AnyClientSupportingRecordingsSize () const
 Get whether or not any client supports recording size.
 
bool AnyClientSupportingEPG () const
 Get whether or not any client supports EPG.
 
bool AnyClientSupportingRecordings () const
 Get whether or not any client supports recordings.
 
bool AnyClientSupportingRecordingsDelete () const
 Get whether or not any client supports recordings delete.
 
- Public Member Functions inherited from ADDON::IAddonMgrCallback
virtual ~IAddonMgrCallback ()=default
 

Power management methods

void OnSystemSleep ()
 Propagate "system sleep" event to clients.
 
void OnSystemWake ()
 Propagate "system wakeup" event to clients.
 
void OnPowerSavingActivated ()
 Propagate "power saving activated" event to clients.
 
void OnPowerSavingDeactivated ()
 Propagate "power saving deactivated" event to clients.
 
void ConnectionStateChange (CPVRClient *client, const std::string &strConnectionString, PVR_CONNECTION_STATE newState, const std::string &strMessage)
 Notify a change of an addon connection state.
 

Constructor & Destructor Documentation

◆ CPVRClients()

CPVRClients::CPVRClients ( )

◆ ~CPVRClients()

CPVRClients::~CPVRClients ( )
override

Member Function Documentation

◆ AnyClientSupportingEPG()

bool CPVRClients::AnyClientSupportingEPG ( ) const

Get whether or not any client supports EPG.

Returns
True if any client supports EPG.

◆ AnyClientSupportingRecordings()

bool CPVRClients::AnyClientSupportingRecordings ( ) const

Get whether or not any client supports recordings.

Returns
True if any client supports recordings.

◆ AnyClientSupportingRecordingsDelete()

bool CPVRClients::AnyClientSupportingRecordingsDelete ( ) const

Get whether or not any client supports recordings delete.

Returns
True if any client supports recordings delete.

◆ AnyClientSupportingRecordingsSize()

bool CPVRClients::AnyClientSupportingRecordingsSize ( ) const

Get whether or not any client supports recording size.

Returns
True if any client supports recording size.

◆ ConnectionStateChange()

void CPVRClients::ConnectionStateChange ( CPVRClient * client,
const std::string & strConnectionString,
PVR_CONNECTION_STATE newState,
const std::string & strMessage )

Notify a change of an addon connection state.

Parameters
clientThe changed client.
strConnectionStringA human-readable string providing additional information.
newStateThe new connection state.
strMessageA human readable string replacing default state message.

◆ Continue()

void CPVRClients::Continue ( )

Continue all clients.

◆ CreatedClientAmount()

int CPVRClients::CreatedClientAmount ( ) const

Get the number of created clients.

Returns
The amount of created clients.

◆ DeleteAllRecordingsFromTrash()

PVR_ERROR CPVRClients::DeleteAllRecordingsFromTrash ( )

Delete all "soft" deleted recordings permanently on the backend.

Returns
PVR_ERROR_NO_ERROR if the operation succeeded, the respective PVR_ERROR value otherwise.

◆ EnabledClientAmount()

int CPVRClients::EnabledClientAmount ( ) const

Get the number of enabled clients.

Returns
The amount of enabled clients.

◆ GetBackendProperties()

std::vector< SBackend > CPVRClients::GetBackendProperties ( ) const

Returns properties about all created clients.

Returns
the properties

◆ GetChannelGroupMembers()

PVR_ERROR CPVRClients::GetChannelGroupMembers ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
CPVRChannelGroup * group,
std::vector< std::shared_ptr< CPVRChannelGroupMember > > & groupMembers,
std::vector< int > & failedClients ) const

Get all group members of a channel group from the given clients.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
groupThe group to get the member for.
groupMembersThe container for the group members.
failedClientsin case of errors will contain the ids of the clients for which the channel group members could not be obtained.
Returns
PVR_ERROR_NO_ERROR if the channel group members were fetched successfully, last error otherwise.

◆ GetChannelGroups()

PVR_ERROR CPVRClients::GetChannelGroups ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
CPVRChannelGroups * groups,
std::vector< int > & failedClients ) const

Get all channel groups from the given clients.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
groupsStore the channel groups in this container.
failedClientsin case of errors will contain the ids of the clients for which the channel groups could not be obtained.
Returns
PVR_ERROR_NO_ERROR if the channel groups were fetched successfully, last error otherwise.

◆ GetChannels()

PVR_ERROR CPVRClients::GetChannels ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
bool bRadio,
std::vector< std::shared_ptr< CPVRChannel > > & channels,
std::vector< int > & failedClients ) const

Get all channels from the given clients.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
bRadioWhether to fetch radio or TV channels.
channelsThe container to store the channels.
failedClientsin case of errors will contain the ids of the clients for which the channels could not be obtained.
Returns
PVR_ERROR_NO_ERROR if the channels were fetched successfully, last error otherwise.

◆ GetClientProviderInfos()

std::vector< CVariant > CPVRClients::GetClientProviderInfos ( ) const

Get info required for providers. Include both enabled and disabled PVR add-ons.

Returns
A list containing the information required to create client providers.

◆ GetClientsSupportingChannelScan()

std::vector< std::shared_ptr< CPVRClient > > CPVRClients::GetClientsSupportingChannelScan ( ) const

Get a list of clients providing a channel scan dialog.

Returns
All clients supporting channel scan.

◆ GetClientsSupportingChannelSettings()

std::vector< std::shared_ptr< CPVRClient > > CPVRClients::GetClientsSupportingChannelSettings ( bool bRadio) const

Get a list of clients providing a channel settings dialog.

Returns
All clients supporting channel settings.

◆ GetCreatedClient()

std::shared_ptr< CPVRClient > CPVRClients::GetCreatedClient ( int clientId) const

Get the the client for the given client id, if it is created.

Parameters
clientIdThe ID of the client to get.
Returns
The client if found, nullptr otherwise.

◆ GetCreatedClients()

CPVRClientMap CPVRClients::GetCreatedClients ( ) const

Get all created clients.

Returns
All created clients.

◆ GetEnabledClientInfos()

std::vector< CVariant > CPVRClients::GetEnabledClientInfos ( ) const

Get a list of the enabled client infos.

Returns
A list of enabled client infos.

◆ GetFirstCreatedClientID()

int CPVRClients::GetFirstCreatedClientID ( ) const

Get the ID of the first created client.

Returns
the ID or -1 if no clients are created;

◆ GetProviders()

PVR_ERROR CPVRClients::GetProviders ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
CPVRProvidersContainer * providers,
std::vector< int > & failedClients ) const

Get all providers from backends.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
groupThe container to store the providers in.
failedClientsin case of errors will contain the ids of the clients for which the providers could not be obtained.
Returns
PVR_ERROR_NO_ERROR if the providers were fetched successfully, last error otherwise.

◆ GetRecordings()

PVR_ERROR CPVRClients::GetRecordings ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
CPVRRecordings * recordings,
bool deleted,
std::vector< int > & failedClients ) const

Get all recordings from the given clients.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
recordingsStore the recordings in this container.
deletedIf true, return deleted recordings, return not deleted recordings otherwise.
failedClientsin case of errors will contain the ids of the clients for which the recordings could not be obtained.
Returns
PVR_ERROR_NO_ERROR if the operation succeeded, the respective PVR_ERROR value otherwise.

◆ GetTimers()

bool CPVRClients::GetTimers ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
CPVRTimersContainer * timers,
std::vector< int > & failedClients ) const

Get all timers from the given clients.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
timersStore the timers in this container.
failedClientsin case of errors will contain the ids of the clients for which the timers could not be obtained.
Returns
true on success for all clients, false in case of error for at least one client.

◆ GetTimerTypes()

const std::vector< std::shared_ptr< CPVRTimerType > > CPVRClients::GetTimerTypes ( ) const

Get all timer types supported by the backends, without updating them from the backends.

Returns
the types.

◆ HasCreatedClients()

bool CPVRClients::HasCreatedClients ( ) const

Check whether there are any created clients.

Returns
True if at least one client is created.

◆ HasIgnoredClients()

bool CPVRClients::HasIgnoredClients ( ) const

Check whether there are any created, but not (yet) connected clients.

Returns
True if at least one client is ignored.

◆ IsCreatedClient()

bool CPVRClients::IsCreatedClient ( int iClientId) const

Check whether a given client ID points to a created client.

Parameters
iClientIdThe client ID.
Returns
True if the the client ID represents a created client, false otherwise.

◆ IsEnabledClient()

bool CPVRClients::IsEnabledClient ( int clientId) const

Check whether a given client ID points to an enabled client.

Parameters
clientIdThe client ID.
Returns
True if the the client ID represents an enabled client, false otherwise.

◆ OnAddonEvent()

void CPVRClients::OnAddonEvent ( const ADDON::AddonEvent & event)

Handle addon events (enable, disable, ...).

Parameters
eventThe addon event.

◆ OnPowerSavingActivated()

void CPVRClients::OnPowerSavingActivated ( )

Propagate "power saving activated" event to clients.

◆ OnPowerSavingDeactivated()

void CPVRClients::OnPowerSavingDeactivated ( )

Propagate "power saving deactivated" event to clients.

◆ OnSystemSleep()

void CPVRClients::OnSystemSleep ( )

Propagate "system sleep" event to clients.

◆ OnSystemWake()

void CPVRClients::OnSystemWake ( )

Propagate "system wakeup" event to clients.

◆ RequestRestart()

bool CPVRClients::RequestRestart ( const std::string & addonId,
ADDON::AddonInstanceId instanceId,
bool bDataChanged )
overridevirtual

Restart a single client add-on.

Parameters
addonIdThe add-on to restart.
instanceIdInstance identifier to use
bDataChangedTrue if the client's data changed, false otherwise (unused).
Returns
True if the client was found and restarted, false otherwise.

Implements ADDON::IAddonMgrCallback.

◆ SetEPGMaxFutureDays()

PVR_ERROR CPVRClients::SetEPGMaxFutureDays ( int iFutureDays)

Tell all clients the future time frame to use when notifying epg events back to Kodi.

The clients might push epg events asynchronously to Kodi using the callback function EpgEventStateChange. To be able to only push events that are actually of interest for Kodi, clients need to know about the future epg time frame Kodi uses.

Parameters
[in]iFutureDaysnumber of days from "now". EPG_TIMEFRAME_UNLIMITED means that Kodi is interested in all epg events, regardless of event times.
Returns
PVR_ERROR_NO_ERROR if the operation succeeded, the respective PVR_ERROR value otherwise.

◆ SetEPGMaxPastDays()

PVR_ERROR CPVRClients::SetEPGMaxPastDays ( int iPastDays)

Tell all clients the past time frame to use when notifying epg events back to Kodi.

The clients might push epg events asynchronously to Kodi using the callback function EpgEventStateChange. To be able to only push events that are actually of interest for Kodi, clients need to know about the future epg time frame Kodi uses.

Parameters
[in]iPastDaysnumber of days before "now". EPG_TIMEFRAME_UNLIMITED means that Kodi is interested in all epg events, regardless of event times.
Returns
PVR_ERROR_NO_ERROR if the operation succeeded, the respective PVR_ERROR value otherwise.

◆ Start()

void CPVRClients::Start ( )

Start all clients.

◆ Stop()

void CPVRClients::Stop ( )

Stop all clients.

◆ StopClient()

bool CPVRClients::StopClient ( int clientId,
bool restart )

Stop a client.

Parameters
clientIdThe id of the client to stop.
restartIf true, restart the client.
Returns
True if the client was found, false otherwise.

◆ UpdateClients()

void CPVRClients::UpdateClients ( const std::string & changedAddonId = "",
ADDON::AddonInstanceId changedInstanceId = ADDON::ADDON_SINGLETON_INSTANCE_ID )

Update all clients, sync with Addon Manager state (start, restart, shutdown clients).

Parameters
changedAddonIdThe id of the changed addon, empty string denotes 'any addon'.
changedInstanceIdThe Identifier of the changed add-on instance

◆ UpdateTimerTypes()

PVR_ERROR CPVRClients::UpdateTimerTypes ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
std::vector< int > & failedClients )

Update all timer types from the given clients.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
failedClientsin case of errors will contain the ids of the clients for which the timer types could not be obtained.
Returns
PVR_ERROR_NO_ERROR if the operation succeeded, the respective PVR_ERROR value otherwise.

The documentation for this class was generated from the following files: