Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Channels.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/addon-instance/pvr.h"
13
14//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
15// "C++" Definitions group 2 - PVR channel
16#ifdef __cplusplus
17
18namespace kodi
19{
20namespace addon
21{
22
23//==============================================================================
38class PVRChannel : public CStructHdl<PVRChannel, PVR_CHANNEL>
39{
40 friend class CInstancePVRClient;
41
42public:
45 {
46 memset(m_cStructure, 0, sizeof(PVR_CHANNEL));
47 m_cStructure->iClientProviderUid = PVR_PROVIDER_INVALID_UID;
48 }
71
74
77 void SetUniqueId(unsigned int uniqueId) { m_cStructure->iUniqueId = uniqueId; }
78
80 unsigned int GetUniqueId() const { return m_cStructure->iUniqueId; }
81
84 void SetIsRadio(bool isRadio) { m_cStructure->bIsRadio = isRadio; }
85
87 bool GetIsRadio() const { return m_cStructure->bIsRadio; }
88
92 {
93 m_cStructure->iChannelNumber = channelNumber;
94 }
95
97 unsigned int GetChannelNumber() const { return m_cStructure->iChannelNumber; }
98
102 {
103 m_cStructure->iSubChannelNumber = subChannelNumber;
104 }
105
107 unsigned int GetSubChannelNumber() const { return m_cStructure->iSubChannelNumber; }
108
111 void SetChannelName(const std::string& channelName)
112 {
113 strncpy(m_cStructure->strChannelName, channelName.c_str(),
114 sizeof(m_cStructure->strChannelName) - 1);
115 }
116
118 std::string GetChannelName() const { return m_cStructure->strChannelName; }
119
126 void SetMimeType(const std::string& inputFormat)
127 {
128 strncpy(m_cStructure->strMimeType, inputFormat.c_str(), sizeof(m_cStructure->strMimeType) - 1);
129 }
130
132 std::string GetMimeType() const { return m_cStructure->strMimeType; }
133
142 {
143 m_cStructure->iEncryptionSystem = encryptionSystem;
144 }
145
147 unsigned int GetEncryptionSystem() const { return m_cStructure->iEncryptionSystem; }
148
151 void SetIconPath(const std::string& iconPath)
152 {
153 strncpy(m_cStructure->strIconPath, iconPath.c_str(), sizeof(m_cStructure->strIconPath) - 1);
154 }
155
157 std::string GetIconPath() const { return m_cStructure->strIconPath; }
158
161 void SetIsHidden(bool isHidden) { m_cStructure->bIsHidden = isHidden; }
162
164 bool GetIsHidden() const { return m_cStructure->bIsHidden; }
165
168 void SetHasArchive(bool hasArchive) { m_cStructure->bHasArchive = hasArchive; }
169
171 bool GetHasArchive() const { return m_cStructure->bHasArchive; }
172
175 void SetOrder(bool order) { m_cStructure->iOrder = order; }
176
178 bool GetOrder() const { return m_cStructure->iOrder; }
180
185 void SetClientProviderUid(int iClientProviderUid)
186 {
187 m_cStructure->iClientProviderUid = iClientProviderUid;
188 }
189
191 int GetClientProviderUid() const { return m_cStructure->iClientProviderUid; }
192
193private:
195 PVRChannel(PVR_CHANNEL* channel) : CStructHdl(channel) {}
196};
198//------------------------------------------------------------------------------
199
200//==============================================================================
208{
209public:
211 PVRChannelsResultSet() = delete;
212 PVRChannelsResultSet(const AddonInstance_PVR* instance, PVR_HANDLE handle)
213 : m_instance(instance), m_handle(handle)
214 {
215 }
220
225 {
226 m_instance->toKodi->TransferChannelEntry(m_instance->toKodi->kodiInstance, m_handle, tag);
227 }
228
230
231private:
232 const AddonInstance_PVR* m_instance = nullptr;
233 const PVR_HANDLE m_handle;
234};
236//------------------------------------------------------------------------------
237
238//==============================================================================
252class PVRSignalStatus : public CStructHdl<PVRSignalStatus, PVR_SIGNAL_STATUS>
253{
254 friend class CInstancePVRClient;
255
256public:
258 PVRSignalStatus() = default;
259 PVRSignalStatus(const PVRSignalStatus& type) : CStructHdl(type) {}
278
281
284 void SetAdapterName(const std::string& adapterName)
285 {
286 strncpy(m_cStructure->strAdapterName, adapterName.c_str(),
287 sizeof(m_cStructure->strAdapterName) - 1);
288 }
289
291 std::string GetAdapterName() const { return m_cStructure->strAdapterName; }
292
295 void SetAdapterStatus(const std::string& adapterStatus)
296 {
297 strncpy(m_cStructure->strAdapterStatus, adapterStatus.c_str(),
298 sizeof(m_cStructure->strAdapterStatus) - 1);
299 }
300
302 std::string GetAdapterStatus() const { return m_cStructure->strAdapterStatus; }
303
306 void SetServiceName(const std::string& serviceName)
307 {
308 strncpy(m_cStructure->strServiceName, serviceName.c_str(),
309 sizeof(m_cStructure->strServiceName) - 1);
310 }
311
313 std::string GetServiceName() const { return m_cStructure->strServiceName; }
314
317 void SetProviderName(const std::string& providerName)
318 {
319 strncpy(m_cStructure->strProviderName, providerName.c_str(),
320 sizeof(m_cStructure->strProviderName) - 1);
321 }
322
324 std::string GetProviderName() const { return m_cStructure->strProviderName; }
325
328 void SetMuxName(const std::string& muxName)
329 {
330 strncpy(m_cStructure->strMuxName, muxName.c_str(), sizeof(m_cStructure->strMuxName) - 1);
331 }
332
334 std::string GetMuxName() const { return m_cStructure->strMuxName; }
335
340 void SetSNR(int snr) { m_cStructure->iSNR = snr; }
341
343 int GetSNR() const { return m_cStructure->iSNR; }
344
349 void SetSignal(int signal) { m_cStructure->iSignal = signal; }
350
352 int GetSignal() const { return m_cStructure->iSignal; }
353
356 void SetBER(long ber) { m_cStructure->iBER = ber; }
357
359 long GetBER() const { return m_cStructure->iBER; }
360
363 void SetUNC(long unc) { m_cStructure->iUNC = unc; }
364
366 long GetUNC() const { return m_cStructure->iUNC; }
368
369private:
370 PVRSignalStatus(const PVR_SIGNAL_STATUS* type) : CStructHdl(type) {}
371 PVRSignalStatus(PVR_SIGNAL_STATUS* type) : CStructHdl(type) {}
372};
374//------------------------------------------------------------------------------
375
376//==============================================================================
391class PVRDescrambleInfo : public CStructHdl<PVRDescrambleInfo, PVR_DESCRAMBLE_INFO>
392{
393 friend class CInstancePVRClient;
394
395public:
398 {
399 m_cStructure->iPid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
400 m_cStructure->iCaid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
401 m_cStructure->iProvid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
402 m_cStructure->iEcmTime = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
403 m_cStructure->iHops = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
404 }
405 PVRDescrambleInfo(const PVRDescrambleInfo& type) : CStructHdl(type) {}
424
427
435 void SetPID(int pid) { m_cStructure->iPid = pid; }
436
438 int GetPID() const { return m_cStructure->iPid; }
439
450 void SetCAID(int iCaid) { m_cStructure->iCaid = iCaid; }
451
453 int GetCAID() const { return m_cStructure->iCaid; }
454
459 void SetProviderID(int provid) { m_cStructure->iProvid = provid; }
460
462 int GetProviderID() const { return m_cStructure->iProvid; }
463
468 void SetECMTime(int ecmTime) { m_cStructure->iEcmTime = ecmTime; }
469
471 int GetECMTime() const { return m_cStructure->iEcmTime; }
472
477 void SetHops(int hops) { m_cStructure->iHops = hops; }
478
480 int GetHops() const { return m_cStructure->iHops; }
481
484 void SetCardSystem(const std::string& cardSystem)
485 {
486 strncpy(m_cStructure->strCardSystem, cardSystem.c_str(),
487 sizeof(m_cStructure->strCardSystem) - 1);
488 }
489
491 std::string GetCardSystem() const { return m_cStructure->strCardSystem; }
492
495 void SetReader(const std::string& reader)
496 {
497 strncpy(m_cStructure->strReader, reader.c_str(), sizeof(m_cStructure->strReader) - 1);
498 }
499
501 std::string GetReader() const { return m_cStructure->strReader; }
502
505 void SetFrom(const std::string& from)
506 {
507 strncpy(m_cStructure->strFrom, from.c_str(), sizeof(m_cStructure->strFrom) - 1);
508 }
509
511 std::string GetFrom() const { return m_cStructure->strFrom; }
512
515 void SetProtocol(const std::string& protocol)
516 {
517 strncpy(m_cStructure->strProtocol, protocol.c_str(), sizeof(m_cStructure->strProtocol) - 1);
518 }
519
521 std::string GetProtocol() const { return m_cStructure->strProtocol; }
523
524private:
525 PVRDescrambleInfo(const PVR_DESCRAMBLE_INFO* type) : CStructHdl(type) {}
526 PVRDescrambleInfo(PVR_DESCRAMBLE_INFO* type) : CStructHdl(type) {}
527};
529//------------------------------------------------------------------------------
530
531} /* namespace addon */
532} /* namespace kodi */
533
534#endif /* __cplusplus */
Definition AddonBase.h:120
Definition Channels.h:39
void SetClientProviderUid(int iClientProviderUid)
optional Unique identifier of the provider this channel belongs to.
Definition Channels.h:185
int GetClientProviderUid() const
To get with SetClientProviderUid changed values.
Definition Channels.h:191
Definition Channels.h:208
Definition Channels.h:392
Definition Channels.h:253
Definition PeripheralUtils.h:48
unsigned int GetEncryptionSystem() const
To get with SetEncryptionSystem changed values.
Definition Channels.h:147
void SetChannelName(const std::string &channelName)
optional Channel name given to this channel.
Definition Channels.h:111
std::string GetMimeType() const
To get with SetMimeType changed values.
Definition Channels.h:132
void SetOrder(bool order)
optional The value denoting the order of this channel in the 'All channels' group.
Definition Channels.h:175
bool GetHasArchive() const
To get with GetIsRadio changed values.
Definition Channels.h:171
std::string GetChannelName() const
To get with SetChannelName changed values.
Definition Channels.h:118
unsigned int GetSubChannelNumber() const
To get with SetSubChannelNumber changed values.
Definition Channels.h:107
void SetChannelNumber(unsigned int channelNumber)
optional Channel number of this channel on the backend.
Definition Channels.h:91
void SetIconPath(const std::string &iconPath)
optional Path to the channel icon (if present).
Definition Channels.h:151
void SetSubChannelNumber(unsigned int subChannelNumber)
optional Sub channel number of this channel on the backend (ATSC).
Definition Channels.h:101
void SetIsRadio(bool isRadio)
required true if this is a radio channel, false if it's a TV channel.
Definition Channels.h:84
void SetMimeType(const std::string &inputFormat)
optional Input format mime type.
Definition Channels.h:126
bool GetIsHidden() const
To get with GetIsRadio changed values.
Definition Channels.h:164
void SetEncryptionSystem(unsigned int encryptionSystem)
optional The encryption ID or CaID of this channel (Conditional access systems).
Definition Channels.h:141
bool GetIsRadio() const
To get with SetIsRadio changed values.
Definition Channels.h:87
std::string GetIconPath() const
To get with SetIconPath changed values.
Definition Channels.h:157
void SetIsHidden(bool isHidden)
optional true if this channel is marked as hidden.
Definition Channels.h:161
unsigned int GetChannelNumber() const
To get with SetChannelNumber changed values.
Definition Channels.h:97
void SetHasArchive(bool hasArchive)
optional true if this channel has a server-side back buffer.
Definition Channels.h:168
void SetUniqueId(unsigned int uniqueId)
required Unique identifier for this channel.
Definition Channels.h:77
bool GetOrder() const
To get with SetOrder changed values.
Definition Channels.h:178
unsigned int GetUniqueId() const
To get with SetUniqueId changed values.
Definition Channels.h:80
void Add(const kodi::addon::PVRChannel &tag)
To add and give content from addon to Kodi on related call.
Definition Channels.h:224
void SetCAID(int iCaid)
optional Conditional access identifier.
Definition Channels.h:450
std::string GetFrom() const
To get with SetFrom changed values.
Definition Channels.h:511
void SetCardSystem(const std::string &cardSystem)
optional Empty string if not available.
Definition Channels.h:484
int GetECMTime() const
To get with SetECMTime changed values.
Definition Channels.h:471
int GetHops() const
To get with SetHops changed values.
Definition Channels.h:480
int GetProviderID() const
To get with SetProviderID changed values.
Definition Channels.h:462
std::string GetReader() const
To get with SetReader changed values.
Definition Channels.h:501
std::string GetProtocol() const
To get with SetProtocol changed values.
Definition Channels.h:521
void SetReader(const std::string &reader)
optional Empty string if not available.
Definition Channels.h:495
std::string GetCardSystem() const
To get with SetCardSystem changed values.
Definition Channels.h:491
void SetPID(int pid)
optional Packet identifier.
Definition Channels.h:435
#define PVR_DESCRAMBLE_INFO_NOT_AVAILABLE
Special class PVRDescrambleInfo value to indicate that a struct member's value is not available.
Definition pvr_channels.h:81
void SetHops(int hops)
optional Hops.
Definition Channels.h:477
int GetPID() const
To get with SetPID changed values.
Definition Channels.h:438
void SetECMTime(int ecmTime)
optional ECM time.
Definition Channels.h:468
void SetFrom(const std::string &from)
optional Empty string if not available.
Definition Channels.h:505
int GetCAID() const
To get with SetCAID changed values.
Definition Channels.h:453
void SetProtocol(const std::string &protocol)
optional Empty string if not available.
Definition Channels.h:515
void SetProviderID(int provid)
optional Provider-ID.
Definition Channels.h:459
std::string GetProviderName() const
To get with SetProviderName changed values.
Definition Channels.h:324
std::string GetAdapterName() const
To get with SetAdapterName changed values.
Definition Channels.h:291
void SetSNR(int snr)
optional Signal/noise ratio.
Definition Channels.h:340
int GetSNR() const
To get with SetSNR changed values.
Definition Channels.h:343
void SetMuxName(const std::string &muxName)
optional Name of the current mux.
Definition Channels.h:328
long GetBER() const
To get with SetBER changed values.
Definition Channels.h:359
int GetSignal() const
To get with SetSignal changed values.
Definition Channels.h:352
std::string GetServiceName() const
To get with SetServiceName changed values.
Definition Channels.h:313
void SetProviderName(const std::string &providerName)
optional Name of the current service's provider.
Definition Channels.h:317
long GetUNC() const
To get with SetBER changed values.
Definition Channels.h:366
void SetUNC(long unc)
optional Uncorrected blocks:
Definition Channels.h:363
void SetBER(long ber)
optional Bit error rate.
Definition Channels.h:356
std::string GetMuxName() const
To get with SetMuxName changed values.
Definition Channels.h:334
void SetServiceName(const std::string &serviceName)
optional Name of the current service.
Definition Channels.h:306
void SetSignal(int signal)
optional Signal strength.
Definition Channels.h:349
std::string GetAdapterStatus() const
To get with SetAdapterStatus changed values.
Definition Channels.h:302
void SetAdapterStatus(const std::string &adapterStatus)
optional Status of the adapter that's being used.
Definition Channels.h:295
void SetAdapterName(const std::string &adapterName)
optional Name of the adapter that's being used.
Definition Channels.h:284
#define PVR_PROVIDER_INVALID_UID
Denotes that no provider uid is available.
Definition pvr_providers.h:28
Definition pvr.h:333
"C" PVR add-on channel.
Definition pvr_channels.h:41
"C" PVR add-on descramble information.
Definition pvr_channels.h:92
"C" PVR add-on signal status information.
Definition pvr_channels.h:64