Kodi Development 19.0
for Binary and Script based Add-Ons
ChannelGroups.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 3 - PVR channel group
16#ifdef __cplusplus
17
18namespace kodi
19{
20namespace addon
21{
22
23//==============================================================================
37class PVRChannelGroup : public CStructHdl<PVRChannelGroup, PVR_CHANNEL_GROUP>
38{
39 friend class CInstancePVRClient;
40
41public:
43 PVRChannelGroup() { memset(m_cStructure, 0, sizeof(PVR_CHANNEL_GROUP)); }
44 PVRChannelGroup(const PVRChannelGroup& channel) : CStructHdl(channel) {}
57
60
63 void SetGroupName(const std::string& groupName)
64 {
65 strncpy(m_cStructure->strGroupName, groupName.c_str(), sizeof(m_cStructure->strGroupName) - 1);
66 }
67
69 std::string GetGroupName() const { return m_cStructure->strGroupName; }
70
73 void SetIsRadio(bool isRadio) { m_cStructure->bIsRadio = isRadio; }
74
76 bool GetIsRadio() const { return m_cStructure->bIsRadio; }
77
81 void SetPosition(unsigned int position) { m_cStructure->iPosition = position; }
82
84 unsigned int GetPosition() const { return m_cStructure->iPosition; }
85
87
88private:
89 PVRChannelGroup(const PVR_CHANNEL_GROUP* channel) : CStructHdl(channel) {}
90 PVRChannelGroup(PVR_CHANNEL_GROUP* channel) : CStructHdl(channel) {}
91};
93//------------------------------------------------------------------------------
94
95//==============================================================================
103{
104public:
106 PVRChannelGroupsResultSet() = delete;
107 PVRChannelGroupsResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle)
108 : m_instance(instance), m_handle(handle)
109 {
110 }
116
121 {
122 m_instance->toKodi->TransferChannelGroup(m_instance->toKodi->kodiInstance, m_handle, tag);
123 }
124
126
127private:
128 const AddonInstance_PVR* m_instance = nullptr;
129 const ADDON_HANDLE m_handle;
130};
132//------------------------------------------------------------------------------
133
134//==============================================================================
148class PVRChannelGroupMember : public CStructHdl<PVRChannelGroupMember, PVR_CHANNEL_GROUP_MEMBER>
149{
150 friend class CInstancePVRClient;
151
152public:
154 PVRChannelGroupMember() { memset(m_cStructure, 0, sizeof(PVR_CHANNEL_GROUP_MEMBER)); }
155 PVRChannelGroupMember(const PVRChannelGroupMember& channel) : CStructHdl(channel) {}
170
173
176 void SetGroupName(const std::string& groupName)
177 {
178 strncpy(m_cStructure->strGroupName, groupName.c_str(), sizeof(m_cStructure->strGroupName) - 1);
179 }
180
182 std::string GetGroupName() const { return m_cStructure->strGroupName; }
183
186 void SetChannelUniqueId(unsigned int channelUniqueId)
187 {
188 m_cStructure->iChannelUniqueId = channelUniqueId;
189 }
190
192 unsigned int GetChannelUniqueId() const { return m_cStructure->iChannelUniqueId; }
193
196 void SetChannelNumber(unsigned int channelNumber)
197 {
198 m_cStructure->iChannelNumber = channelNumber;
199 }
200
202 unsigned int GetChannelNumber() const { return m_cStructure->iChannelNumber; }
203
206 void SetSubChannelNumber(unsigned int subChannelNumber)
207 {
208 m_cStructure->iSubChannelNumber = subChannelNumber;
209 }
210
212 unsigned int GetSubChannelNumber() const { return m_cStructure->iSubChannelNumber; }
213
216 void SetOrder(bool order) { m_cStructure->iOrder = order; }
217
219 bool GetOrder() const { return m_cStructure->iOrder; }
220
222
223private:
224 PVRChannelGroupMember(const PVR_CHANNEL_GROUP_MEMBER* channel) : CStructHdl(channel) {}
225 PVRChannelGroupMember(PVR_CHANNEL_GROUP_MEMBER* channel) : CStructHdl(channel) {}
226};
228//------------------------------------------------------------------------------
229
230//==============================================================================
238{
239public:
242 PVRChannelGroupMembersResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle)
243 : m_instance(instance), m_handle(handle)
244 {
245 }
250
255 {
256 m_instance->toKodi->TransferChannelGroupMember(m_instance->toKodi->kodiInstance, m_handle, tag);
257 }
258
260
261private:
262 const AddonInstance_PVR* m_instance = nullptr;
263 const ADDON_HANDLE m_handle;
264};
266//------------------------------------------------------------------------------
267
268} /* namespace addon */
269} /* namespace kodi */
270
271#endif /* __cplusplus */
Definition: PVR.h:385
Definition: AddonBase.h:250
Definition: ChannelGroups.h:38
Definition: ChannelGroups.h:149
Definition: ChannelGroups.h:238
Definition: ChannelGroups.h:103
void SetPosition(unsigned int position)
optional Sort position of the group (0 indicates that the backend doesn't support sorting of groups).
Definition: ChannelGroups.h:81
void SetIsRadio(bool isRadio)
required true If this is a radio channel group, false otherwise.
Definition: ChannelGroups.h:73
unsigned int GetPosition() const
To get with SetPosition changed values.
Definition: ChannelGroups.h:84
bool GetIsRadio() const
To get with SetIsRadio changed values.
Definition: ChannelGroups.h:76
void SetGroupName(const std::string &groupName)
required Name of this channel group.
Definition: ChannelGroups.h:63
std::string GetGroupName() const
To get with SetGroupName changed values.
Definition: ChannelGroups.h:69
void SetOrder(bool order)
optional The value denoting the order of this channel in the 'All channels' group.
Definition: ChannelGroups.h:216
unsigned int GetSubChannelNumber() const
To get with SetSubChannelNumber changed values.
Definition: ChannelGroups.h:212
void SetChannelNumber(unsigned int channelNumber)
optional Channel number within the group.
Definition: ChannelGroups.h:196
void SetSubChannelNumber(unsigned int subChannelNumber)
optional Sub channel number within the group (ATSC).
Definition: ChannelGroups.h:206
void SetChannelUniqueId(unsigned int channelUniqueId)
required Unique id of the member.
Definition: ChannelGroups.h:186
unsigned int GetChannelUniqueId() const
To get with SetChannelUniqueId changed values.
Definition: ChannelGroups.h:192
void SetGroupName(const std::string &groupName)
required Name of the channel group to add the channel to.
Definition: ChannelGroups.h:176
std::string GetGroupName() const
To get with SetGroupName changed values.
Definition: ChannelGroups.h:182
unsigned int GetChannelNumber() const
To get with SetChannelNumber changed values.
Definition: ChannelGroups.h:202
bool GetOrder() const
To get with SetOrder changed values.
Definition: ChannelGroups.h:219
void Add(const kodi::addon::PVRChannelGroupMember &tag)
To add and give content from addon to Kodi on related call.
Definition: ChannelGroups.h:254
void Add(const kodi::addon::PVRChannelGroup &tag)
To add and give content from addon to Kodi on related call.
Definition: ChannelGroups.h:120
Definition: pvr.h:322
"C" PVR add-on channel group member.
Definition: pvr_channel_groups.h:45
"C" PVR add-on channel group.
Definition: pvr_channel_groups.h:31