Kodi Development 19.0
for Binary and Script based Add-Ons
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:
44 PVRChannel() { memset(m_cStructure, 0, sizeof(PVR_CHANNEL)); }
45 PVRChannel(const PVRChannel& channel) : CStructHdl(channel) {}
66
69
72 void SetUniqueId(unsigned int uniqueId) { m_cStructure->iUniqueId = uniqueId; }
73
75 unsigned int GetUniqueId() const { return m_cStructure->iUniqueId; }
76
79 void SetIsRadio(bool isRadio) { m_cStructure->bIsRadio = isRadio; }
80
82 bool GetIsRadio() const { return m_cStructure->bIsRadio; }
83
86 void SetChannelNumber(unsigned int channelNumber)
87 {
88 m_cStructure->iChannelNumber = channelNumber;
89 }
90
92 unsigned int GetChannelNumber() const { return m_cStructure->iChannelNumber; }
93
96 void SetSubChannelNumber(unsigned int subChannelNumber)
97 {
98 m_cStructure->iSubChannelNumber = subChannelNumber;
99 }
100
102 unsigned int GetSubChannelNumber() const { return m_cStructure->iSubChannelNumber; }
103
106 void SetChannelName(const std::string& channelName)
107 {
108 strncpy(m_cStructure->strChannelName, channelName.c_str(),
109 sizeof(m_cStructure->strChannelName) - 1);
110 }
111
113 std::string GetChannelName() const { return m_cStructure->strChannelName; }
114
121 void SetMimeType(const std::string& inputFormat)
122 {
123 strncpy(m_cStructure->strMimeType, inputFormat.c_str(), sizeof(m_cStructure->strMimeType) - 1);
124 }
125
127 std::string GetMimeType() const { return m_cStructure->strMimeType; }
128
136 void SetEncryptionSystem(unsigned int encryptionSystem)
137 {
138 m_cStructure->iEncryptionSystem = encryptionSystem;
139 }
140
142 unsigned int GetEncryptionSystem() const { return m_cStructure->iEncryptionSystem; }
143
146 void SetIconPath(const std::string& iconPath)
147 {
148 strncpy(m_cStructure->strIconPath, iconPath.c_str(), sizeof(m_cStructure->strIconPath) - 1);
149 }
150
152 std::string GetIconPath() const { return m_cStructure->strIconPath; }
153
156 void SetIsHidden(bool isHidden) { m_cStructure->bIsHidden = isHidden; }
157
159 bool GetIsHidden() const { return m_cStructure->bIsHidden; }
160
163 void SetHasArchive(bool hasArchive) { m_cStructure->bHasArchive = hasArchive; }
164
166 bool GetHasArchive() const { return m_cStructure->bHasArchive; }
167
170 void SetOrder(bool order) { m_cStructure->iOrder = order; }
171
173 bool GetOrder() const { return m_cStructure->iOrder; }
175
176private:
177 PVRChannel(const PVR_CHANNEL* channel) : CStructHdl(channel) {}
178 PVRChannel(PVR_CHANNEL* channel) : CStructHdl(channel) {}
179};
181//------------------------------------------------------------------------------
182
183//==============================================================================
191{
192public:
194 PVRChannelsResultSet() = delete;
195 PVRChannelsResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle)
196 : m_instance(instance), m_handle(handle)
197 {
198 }
203
208 {
209 m_instance->toKodi->TransferChannelEntry(m_instance->toKodi->kodiInstance, m_handle, tag);
210 }
211
213
214private:
215 const AddonInstance_PVR* m_instance = nullptr;
216 const ADDON_HANDLE m_handle;
217};
219//------------------------------------------------------------------------------
220
221//==============================================================================
235class PVRSignalStatus : public CStructHdl<PVRSignalStatus, PVR_SIGNAL_STATUS>
236{
237 friend class CInstancePVRClient;
238
239public:
241 PVRSignalStatus() = default;
242 PVRSignalStatus(const PVRSignalStatus& type) : CStructHdl(type) {}
262
265
268 void SetAdapterName(const std::string& adapterName)
269 {
270 strncpy(m_cStructure->strAdapterName, adapterName.c_str(),
271 sizeof(m_cStructure->strAdapterName) - 1);
272 }
273
275 std::string GetAdapterName() const { return m_cStructure->strAdapterName; }
276
279 void SetAdapterStatus(const std::string& adapterStatus)
280 {
281 strncpy(m_cStructure->strAdapterStatus, adapterStatus.c_str(),
282 sizeof(m_cStructure->strAdapterStatus) - 1);
283 }
284
286 std::string GetAdapterStatus() const { return m_cStructure->strAdapterStatus; }
287
290 void SetServiceName(const std::string& serviceName)
291 {
292 strncpy(m_cStructure->strServiceName, serviceName.c_str(),
293 sizeof(m_cStructure->strServiceName) - 1);
294 }
295
297 std::string GetServiceName() const { return m_cStructure->strServiceName; }
298
301 void SetProviderName(const std::string& providerName)
302 {
303 strncpy(m_cStructure->strProviderName, providerName.c_str(),
304 sizeof(m_cStructure->strProviderName) - 1);
305 }
306
308 std::string GetProviderName() const { return m_cStructure->strProviderName; }
309
312 void SetMuxName(const std::string& muxName)
313 {
314 strncpy(m_cStructure->strMuxName, muxName.c_str(), sizeof(m_cStructure->strMuxName) - 1);
315 }
316
318 std::string GetMuxName() const { return m_cStructure->strMuxName; }
319
324 void SetSNR(int snr) { m_cStructure->iSNR = snr; }
325
327 int GetSNR() const { return m_cStructure->iSNR; }
328
333 void SetSignal(int signal) { m_cStructure->iSignal = signal; }
334
336 int GetSignal() const { return m_cStructure->iSignal; }
337
340 void SetBER(long ber) { m_cStructure->iBER = ber; }
341
343 long GetBER() const { return m_cStructure->iBER; }
344
347 void SetUNC(long unc) { m_cStructure->iUNC = unc; }
348
350 long GetUNC() const { return m_cStructure->iUNC; }
352
353private:
354 PVRSignalStatus(const PVR_SIGNAL_STATUS* type) : CStructHdl(type) {}
355 PVRSignalStatus(PVR_SIGNAL_STATUS* type) : CStructHdl(type) {}
356};
358//------------------------------------------------------------------------------
359
360//==============================================================================
375class PVRDescrambleInfo : public CStructHdl<PVRDescrambleInfo, PVR_DESCRAMBLE_INFO>
376{
377 friend class CInstancePVRClient;
378
379public:
382 {
383 m_cStructure->iPid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
384 m_cStructure->iCaid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
385 m_cStructure->iProvid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
386 m_cStructure->iEcmTime = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
387 m_cStructure->iHops = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
388 }
389 PVRDescrambleInfo(const PVRDescrambleInfo& type) : CStructHdl(type) {}
408
411
419 void SetPID(int pid) { m_cStructure->iPid = pid; }
420
422 int GetPID() const { return m_cStructure->iPid; }
423
434 void SetCAID(int iCaid) { m_cStructure->iCaid = iCaid; }
435
437 int GetCAID() const { return m_cStructure->iCaid; }
438
443 void SetProviderID(int provid) { m_cStructure->iProvid = provid; }
444
446 int GetProviderID() const { return m_cStructure->iProvid; }
447
452 void SetECMTime(int ecmTime) { m_cStructure->iEcmTime = ecmTime; }
453
455 int GetECMTime() const { return m_cStructure->iEcmTime; }
456
461 void SetHops(int hops) { m_cStructure->iHops = hops; }
462
464 int GetHops() const { return m_cStructure->iHops; }
465
468 void SetCardSystem(const std::string& cardSystem)
469 {
470 strncpy(m_cStructure->strCardSystem, cardSystem.c_str(),
471 sizeof(m_cStructure->strCardSystem) - 1);
472 }
473
475 std::string GetCardSystem() const { return m_cStructure->strCardSystem; }
476
479 void SetReader(const std::string& reader)
480 {
481 strncpy(m_cStructure->strReader, reader.c_str(), sizeof(m_cStructure->strReader) - 1);
482 }
483
485 std::string GetReader() const { return m_cStructure->strReader; }
486
489 void SetFrom(const std::string& from)
490 {
491 strncpy(m_cStructure->strFrom, from.c_str(), sizeof(m_cStructure->strFrom) - 1);
492 }
493
495 std::string GetFrom() const { return m_cStructure->strFrom; }
496
499 void SetProtocol(const std::string& protocol)
500 {
501 strncpy(m_cStructure->strProtocol, protocol.c_str(), sizeof(m_cStructure->strProtocol) - 1);
502 }
503
505 std::string GetProtocol() const { return m_cStructure->strProtocol; }
507
508private:
509 PVRDescrambleInfo(const PVR_DESCRAMBLE_INFO* type) : CStructHdl(type) {}
510 PVRDescrambleInfo(PVR_DESCRAMBLE_INFO* type) : CStructHdl(type) {}
511};
513//------------------------------------------------------------------------------
514
515} /* namespace addon */
516} /* namespace kodi */
517
518#endif /* __cplusplus */
Definition: PVR.h:385
Definition: AddonBase.h:250
Definition: Channels.h:39
Definition: Channels.h:191
Definition: Channels.h:376
Definition: Channels.h:236
unsigned int GetEncryptionSystem() const
To get with SetEncryptionSystem changed values.
Definition: Channels.h:142
void SetChannelName(const std::string &channelName)
optional Channel name given to this channel.
Definition: Channels.h:106
std::string GetMimeType() const
To get with SetMimeType changed values.
Definition: Channels.h:127
void SetOrder(bool order)
optional The value denoting the order of this channel in the 'All channels' group.
Definition: Channels.h:170
bool GetHasArchive() const
To get with GetIsRadio changed values.
Definition: Channels.h:166
std::string GetChannelName() const
To get with SetChannelName changed values.
Definition: Channels.h:113
unsigned int GetSubChannelNumber() const
To get with SetSubChannelNumber changed values.
Definition: Channels.h:102
void SetChannelNumber(unsigned int channelNumber)
optional Channel number of this channel on the backend.
Definition: Channels.h:86
void SetIconPath(const std::string &iconPath)
optional Path to the channel icon (if present).
Definition: Channels.h:146
void SetSubChannelNumber(unsigned int subChannelNumber)
optional Sub channel number of this channel on the backend (ATSC).
Definition: Channels.h:96
void SetIsRadio(bool isRadio)
required true if this is a radio channel, false if it's a TV channel.
Definition: Channels.h:79
void SetMimeType(const std::string &inputFormat)
optional Input format mime type.
Definition: Channels.h:121
bool GetIsHidden() const
To get with GetIsRadio changed values.
Definition: Channels.h:159
void SetEncryptionSystem(unsigned int encryptionSystem)
optional The encryption ID or CaID of this channel (Conditional access systems).
Definition: Channels.h:136
bool GetIsRadio() const
To get with SetIsRadio changed values.
Definition: Channels.h:82
std::string GetIconPath() const
To get with SetIconPath changed values.
Definition: Channels.h:152
void SetIsHidden(bool isHidden)
optional true if this channel is marked as hidden.
Definition: Channels.h:156
unsigned int GetChannelNumber() const
To get with SetChannelNumber changed values.
Definition: Channels.h:92
void SetHasArchive(bool hasArchive)
optional true if this channel has a server-side back buffer.
Definition: Channels.h:163
void SetUniqueId(unsigned int uniqueId)
required Unique identifier for this channel.
Definition: Channels.h:72
bool GetOrder() const
To get with SetOrder changed values.
Definition: Channels.h:173
unsigned int GetUniqueId() const
To get with SetUniqueId changed values.
Definition: Channels.h:75
void Add(const kodi::addon::PVRChannel &tag)
To add and give content from addon to Kodi on related call.
Definition: Channels.h:207
void SetCAID(int iCaid)
optional Conditional access identifier.
Definition: Channels.h:434
std::string GetFrom() const
To get with SetFrom changed values.
Definition: Channels.h:495
void SetCardSystem(const std::string &cardSystem)
optional Empty string if not available.
Definition: Channels.h:468
int GetECMTime() const
To get with SetECMTime changed values.
Definition: Channels.h:455
int GetHops() const
To get with SetHops changed values.
Definition: Channels.h:464
int GetProviderID() const
To get with SetProviderID changed values.
Definition: Channels.h:446
std::string GetReader() const
To get with SetReader changed values.
Definition: Channels.h:485
std::string GetProtocol() const
To get with SetProtocol changed values.
Definition: Channels.h:505
void SetReader(const std::string &reader)
optional Empty string if not available.
Definition: Channels.h:479
std::string GetCardSystem() const
To get with SetCardSystem changed values.
Definition: Channels.h:475
void SetPID(int pid)
optional Packet identifier.
Definition: Channels.h:419
#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:80
void SetHops(int hops)
optional Hops.
Definition: Channels.h:461
int GetPID() const
To get with SetPID changed values.
Definition: Channels.h:422
void SetECMTime(int ecmTime)
optional ECM time.
Definition: Channels.h:452
void SetFrom(const std::string &from)
optional Empty string if not available.
Definition: Channels.h:489
int GetCAID() const
To get with SetCAID changed values.
Definition: Channels.h:437
void SetProtocol(const std::string &protocol)
optional Empty string if not available.
Definition: Channels.h:499
void SetProviderID(int provid)
optional Provider-ID.
Definition: Channels.h:443
std::string GetProviderName() const
To get with SetProviderName changed values.
Definition: Channels.h:308
std::string GetAdapterName() const
To get with SetAdapterName changed values.
Definition: Channels.h:275
void SetSNR(int snr)
optional Signal/noise ratio.
Definition: Channels.h:324
int GetSNR() const
To get with SetSNR changed values.
Definition: Channels.h:327
void SetMuxName(const std::string &muxName)
optional Name of the current mux.
Definition: Channels.h:312
long GetBER() const
To get with SetBER changed values.
Definition: Channels.h:343
int GetSignal() const
To get with SetSignal changed values.
Definition: Channels.h:336
std::string GetServiceName() const
To get with SetServiceName changed values.
Definition: Channels.h:297
void SetProviderName(const std::string &providerName)
optional Name of the current service's provider.
Definition: Channels.h:301
long GetUNC() const
To get with SetBER changed values.
Definition: Channels.h:350
void SetUNC(long unc)
optional Uncorrected blocks:
Definition: Channels.h:347
void SetBER(long ber)
optional Bit error rate.
Definition: Channels.h:340
std::string GetMuxName() const
To get with SetMuxName changed values.
Definition: Channels.h:318
void SetServiceName(const std::string &serviceName)
optional Name of the current service.
Definition: Channels.h:290
void SetSignal(int signal)
optional Signal strength.
Definition: Channels.h:333
std::string GetAdapterStatus() const
To get with SetAdapterStatus changed values.
Definition: Channels.h:286
void SetAdapterStatus(const std::string &adapterStatus)
optional Status of the adapter that's being used.
Definition: Channels.h:279
void SetAdapterName(const std::string &adapterName)
optional Name of the adapter that's being used.
Definition: Channels.h:268
Definition: pvr.h:322
"C" PVR add-on channel.
Definition: pvr_channels.h:41
"C" PVR add-on descramble information.
Definition: pvr_channels.h:91
"C" PVR add-on signal status information.
Definition: pvr_channels.h:63