diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h | 896 |
1 files changed, 896 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h new file mode 100644 index 0000000..6e05e55 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h | |||
| @@ -0,0 +1,896 @@ | |||
| 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 "General.h" | ||
| 12 | #include "../../AddonBase.h" | ||
| 13 | #include "../../c-api/addon-instance/pvr.h" | ||
| 14 | |||
| 15 | //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | ||
| 16 | // "C++" Definitions group 6 - PVR timers | ||
| 17 | #ifdef __cplusplus | ||
| 18 | |||
| 19 | namespace kodi | ||
| 20 | { | ||
| 21 | namespace addon | ||
| 22 | { | ||
| 23 | |||
| 24 | //============================================================================== | ||
| 25 | /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer class PVRTimer | ||
| 26 | /// @ingroup cpp_kodi_addon_pvr_Defs_Timer | ||
| 27 | /// @brief **PVR add-on timer type**\n | ||
| 28 | /// Representation of a timer event. | ||
| 29 | /// | ||
| 30 | /// The related values here are automatically initiated to defaults and need | ||
| 31 | /// only be set if supported and used. | ||
| 32 | /// | ||
| 33 | /// ---------------------------------------------------------------------------- | ||
| 34 | /// | ||
| 35 | /// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimer_Help | ||
| 36 | /// | ||
| 37 | ///@{ | ||
| 38 | class PVRTimer : public CStructHdl<PVRTimer, PVR_TIMER> | ||
| 39 | { | ||
| 40 | friend class CInstancePVRClient; | ||
| 41 | |||
| 42 | public: | ||
| 43 | /*! \cond PRIVATE */ | ||
| 44 | PVRTimer() | ||
| 45 | { | ||
| 46 | m_cStructure->iClientIndex = 0; | ||
| 47 | m_cStructure->state = PVR_TIMER_STATE_NEW; | ||
| 48 | m_cStructure->iTimerType = PVR_TIMER_TYPE_NONE; | ||
| 49 | m_cStructure->iParentClientIndex = 0; | ||
| 50 | m_cStructure->iClientChannelUid = PVR_TIMER_VALUE_NOT_AVAILABLE; | ||
| 51 | m_cStructure->startTime = 0; | ||
| 52 | m_cStructure->endTime = 0; | ||
| 53 | m_cStructure->bStartAnyTime = false; | ||
| 54 | m_cStructure->bEndAnyTime = false; | ||
| 55 | m_cStructure->bFullTextEpgSearch = false; | ||
| 56 | m_cStructure->iPriority = PVR_TIMER_VALUE_NOT_AVAILABLE; | ||
| 57 | m_cStructure->iLifetime = PVR_TIMER_VALUE_NOT_AVAILABLE; | ||
| 58 | m_cStructure->iMaxRecordings = PVR_TIMER_VALUE_NOT_AVAILABLE; | ||
| 59 | m_cStructure->iRecordingGroup = 0; | ||
| 60 | m_cStructure->firstDay = 0; | ||
| 61 | m_cStructure->iWeekdays = PVR_WEEKDAY_NONE; | ||
| 62 | m_cStructure->iPreventDuplicateEpisodes = 0; | ||
| 63 | m_cStructure->iEpgUid = 0; | ||
| 64 | m_cStructure->iMarginStart = 0; | ||
| 65 | m_cStructure->iMarginEnd = 0; | ||
| 66 | m_cStructure->iGenreType = PVR_TIMER_VALUE_NOT_AVAILABLE; | ||
| 67 | m_cStructure->iGenreSubType = PVR_TIMER_VALUE_NOT_AVAILABLE; | ||
| 68 | } | ||
| 69 | PVRTimer(const PVRTimer& data) : CStructHdl(data) {} | ||
| 70 | /*! \endcond */ | ||
| 71 | |||
| 72 | /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer_Help Value Help | ||
| 73 | /// @ingroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer | ||
| 74 | /// | ||
| 75 | /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimer :</b> | ||
| 76 | /// | Name | Type | Set call | Get call | Usage | ||
| 77 | /// |------|------|----------|----------|----------- | ||
| 78 | /// | **Client index** | `unsigned int` | @ref PVRTimer::SetClientIndex "SetClientIndex" | @ref PVRTimer::GetClientIndex "GetClientIndex" | *required to set* | ||
| 79 | /// | **State** | @ref PVR_TIMER_STATE | @ref PVRTimer::SetState "SetState" | @ref PVRTimer::GetState "GetState" | *required to set* | ||
| 80 | /// | **Type** | `unsigned int` | @ref PVRTimer::SetTimerType "SetTimerType" | @ref PVRTimer::GetTimerType "GetTimerType" | *required to set* | ||
| 81 | /// | **Title** | `std::string` | @ref PVRTimer::SetTitle "SetTitle" | @ref PVRTimer::GetTitle "GetTitle" | *required to set* | ||
| 82 | /// | **Parent client index** | `unsigned int` | @ref PVRTimer::SetParentClientIndex "SetParentClientIndex" | @ref PVRTimer::GetParentClientIndex "GetParentClientIndex" | *optional* | ||
| 83 | /// | **Client channel unique identifier** | `int` | @ref PVRTimer::SetClientChannelUid "SetClientChannelUid" | @ref PVRTimer::GetClientChannelUid "GetClientChannelUid" | *optional* | ||
| 84 | /// | **Start time** | `time_t` | @ref PVRTimer::SetStartTime "SetStartTime" | @ref PVRTimer::GetStartTime "GetStartTime" | *optional* | ||
| 85 | /// | **End time** | `time_t` | @ref PVRTimer::SetEndTime "SetEndTime" | @ref PVRTimer::GetEndTime "GetEndTime" | *optional* | ||
| 86 | /// | **Start any time** | `bool` | @ref PVRTimer::SetStartAnyTime "SetStartAnyTime" | @ref PVRTimer::GetStartAnyTime "GetStartAnyTime" | *optional* | ||
| 87 | /// | **End any time** | `bool` | @ref PVRTimer::SetEndAnyTime "SetEndAnyTime" | @ref PVRTimer::GetEndAnyTime "GetEndAnyTime" | *optional* | ||
| 88 | /// | **EPG search string** | `std::string` | @ref PVRTimer::SetEPGSearchString "SetEPGSearchString" | @ref PVRTimer::GetEPGSearchString "GetEPGSearchString" | *optional* | ||
| 89 | /// | **Full text EPG search** | `bool` | @ref PVRTimer::SetFullTextEpgSearch "SetFullTextEpgSearch" | @ref PVRTimer::GetFullTextEpgSearch "GetFullTextEpgSearch" | *optional* | ||
| 90 | /// | **Recording store directory** | `std::string` | @ref PVRTimer::SetDirectory "SetDirectory" | @ref PVRTimer::GetDirectory "GetDirectory" | *optional* | ||
| 91 | /// | **Timer priority** | `int` | @ref PVRTimer::SetPriority "SetPriority" | @ref PVRTimer::GetPriority "GetPriority" | *optional* | ||
| 92 | /// | **Timer lifetime** | `int` | @ref PVRTimer::SetLifetime "SetLifetime" | @ref PVRTimer::GetLifetime "GetLifetime" | *optional* | ||
| 93 | /// | **Max recordings** | `int` | @ref PVRTimer::SetMaxRecordings "SetMaxRecordings" | @ref PVRTimer::GetMaxRecordings "GetMaxRecordings" | *optional* | ||
| 94 | /// | **Recording group** | `unsigned int` | @ref PVRTimer::SetRecordingGroup "SetRecordingGroup" | @ref PVRTimer::GetRecordingGroup "GetRecordingGroup" | *optional* | ||
| 95 | /// | **First start day** | `time_t` | @ref PVRTimer::SetFirstDay "SetFirstDay" | @ref PVRTimer::GetFirstDay "GetFirstDay" | *optional* | ||
| 96 | /// | **Used timer weekdays** | `unsigned int` | @ref PVRTimer::SetWeekdays "SetWeekdays" | @ref PVRTimer::GetWeekdays "GetWeekdays" | *optional* | ||
| 97 | /// | **Prevent duplicate episodes** | `unsigned int` | @ref PVRTimer::SetPreventDuplicateEpisodes "SetPreventDuplicateEpisodes" | @ref PVRTimer::GetPreventDuplicateEpisodes "GetPreventDuplicateEpisodes" | *optional* | ||
| 98 | /// | **EPG unique identifier** | `unsigned int` | @ref PVRTimer::SetEPGUid "SetEPGUid" | @ref PVRTimer::GetEPGUid "GetEPGUid" | *optional* | ||
| 99 | /// | **Margin start** | `unsigned int` | @ref PVRTimer::SetMarginStart "SetMarginStart" | @ref PVRTimer::GetMarginStart "GetMarginStart" | *optional* | ||
| 100 | /// | **Margin end** | `unsigned int` | @ref PVRTimer::SetMarginEnd "SetMarginEnd" | @ref PVRTimer::GetMarginEnd "GetMarginEnd" | *optional* | ||
| 101 | /// | **Genre type** | `int` | @ref PVRTimer::SetGenreType "SetGenreType" | @ref PVRTimer::GetGenreType "GetGenreType" | *optional* | ||
| 102 | /// | **Genre sub type** | `int` | @ref PVRTimer::SetGenreSubType "SetGenreSubType" | @ref PVRTimer::GetGenreSubType "GetGenreSubType" | *optional* | ||
| 103 | /// | **Series link** | `std::string` | @ref PVRTimer::SetSeriesLink "SetSeriesLink" | @ref PVRTimer::GetSeriesLink "GetSeriesLink" | *optional* | ||
| 104 | |||
| 105 | /// @addtogroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer | ||
| 106 | ///@{ | ||
| 107 | |||
| 108 | /// @brief **required**\n | ||
| 109 | /// The index of this timer given by the client. | ||
| 110 | /// | ||
| 111 | /// @ref PVR_TIMER_NO_CLIENT_INDEX indicates that the index was not yet set | ||
| 112 | /// by the client, for example for new timers created by Kodi and passed the | ||
| 113 | /// first time to the client. A valid index must be greater than | ||
| 114 | /// @ref PVR_TIMER_NO_CLIENT_INDEX. | ||
| 115 | /// | ||
| 116 | void SetClientIndex(unsigned int clientIndex) { m_cStructure->iClientIndex = clientIndex; } | ||
| 117 | |||
| 118 | /// @brief To get with @ref SetClientIndex changed values. | ||
| 119 | unsigned int GetClientIndex() const { return m_cStructure->iClientIndex; } | ||
| 120 | |||
| 121 | /// @brief **required**\n | ||
| 122 | /// The state of this timer. | ||
| 123 | /// | ||
| 124 | /// @note @ref PVR_TIMER_STATE_NEW is default. | ||
| 125 | /// | ||
| 126 | /// | ||
| 127 | /// -------------------------------------------------------------------------- | ||
| 128 | /// | ||
| 129 | /// **Example:** | ||
| 130 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 131 | /// kodi::addon::PVRTimer tag; | ||
| 132 | /// tag.SetState(PVR_TIMER_STATE_RECORDING); | ||
| 133 | /// ~~~~~~~~~~~~~ | ||
| 134 | /// | ||
| 135 | void SetState(PVR_TIMER_STATE state) { m_cStructure->state = state; } | ||
| 136 | |||
| 137 | /// @brief To get with @ref SetState changed values. | ||
| 138 | PVR_TIMER_STATE GetState() const { return m_cStructure->state; } | ||
| 139 | |||
| 140 | /// @brief **required**\n | ||
| 141 | /// The type of this timer. | ||
| 142 | /// | ||
| 143 | /// It is private to the addon and can be freely defined by the addon. | ||
| 144 | /// The value must be greater than @ref PVR_TIMER_TYPE_NONE. | ||
| 145 | /// | ||
| 146 | /// Kodi does not interpret this value (except for checking for @ref PVR_TIMER_TYPE_NONE), | ||
| 147 | /// but will pass the right id to the addon with every @ref PVRTimer instance, | ||
| 148 | /// thus the addon easily can determine the timer type. | ||
| 149 | /// | ||
| 150 | /// @note @ref PVR_TIMER_TYPE_NONE is default. | ||
| 151 | /// | ||
| 152 | /// | ||
| 153 | /// -------------------------------------------------------------------------- | ||
| 154 | /// | ||
| 155 | /// **Example:** | ||
| 156 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 157 | /// kodi::addon::PVRTimer tag; | ||
| 158 | /// tag.SetTimerType(123); | ||
| 159 | /// ~~~~~~~~~~~~~ | ||
| 160 | /// | ||
| 161 | void SetTimerType(unsigned int timerType) { m_cStructure->iTimerType = timerType; } | ||
| 162 | |||
| 163 | /// @brief To get with @ref SetTimerType changed values. | ||
| 164 | unsigned int GetTimerType() const { return m_cStructure->iTimerType; } | ||
| 165 | |||
| 166 | /// @brief **required**\n | ||
| 167 | /// A title for this timer. | ||
| 168 | void SetTitle(const std::string& title) | ||
| 169 | { | ||
| 170 | strncpy(m_cStructure->strTitle, title.c_str(), sizeof(m_cStructure->strTitle) - 1); | ||
| 171 | } | ||
| 172 | |||
| 173 | /// @brief To get with @ref SetTitle changed values. | ||
| 174 | std::string GetTitle() const { return m_cStructure->strTitle; } | ||
| 175 | |||
| 176 | /// @brief **optional**\n | ||
| 177 | /// For timers scheduled by a repeating timer. | ||
| 178 | /// | ||
| 179 | /// The index of the repeating timer that scheduled this timer (it's | ||
| 180 | /// @ref clientIndex value). Use @ref PVR_TIMER_NO_PARENT to indicate that | ||
| 181 | /// this timer was no scheduled by a repeating timer. | ||
| 182 | void SetParentClientIndex(unsigned int parentClientIndex) | ||
| 183 | { | ||
| 184 | m_cStructure->iParentClientIndex = parentClientIndex; | ||
| 185 | } | ||
| 186 | |||
| 187 | /// @brief To get with @ref SetParentClientIndex changed values. | ||
| 188 | unsigned int GetParentClientIndex() const { return m_cStructure->iParentClientIndex; } | ||
| 189 | |||
| 190 | /// @brief **optional**\n | ||
| 191 | /// Unique identifier of the channel to record on. | ||
| 192 | /// | ||
| 193 | /// @ref PVR_TIMER_ANY_CHANNEL will denote "any channel", not a specific one. | ||
| 194 | /// @ref PVR_CHANNEL_INVALID_UID denotes that channel uid is not available. | ||
| 195 | void SetClientChannelUid(int clientChannelUid) | ||
| 196 | { | ||
| 197 | m_cStructure->iClientChannelUid = clientChannelUid; | ||
| 198 | } | ||
| 199 | |||
| 200 | /// @brief To get with @ref SetClientChannelUid changed values | ||
| 201 | int GetClientChannelUid() const { return m_cStructure->iClientChannelUid; } | ||
| 202 | |||
| 203 | /// @brief **optional**\n | ||
| 204 | /// Start time of the recording in UTC. | ||
| 205 | /// | ||
| 206 | /// Instant timers that are sent to the add-on by Kodi will have this value | ||
| 207 | /// set to 0. | ||
| 208 | void SetStartTime(time_t startTime) { m_cStructure->startTime = startTime; } | ||
| 209 | |||
| 210 | /// @brief To get with @ref SetStartTime changed values. | ||
| 211 | time_t GetStartTime() const { return m_cStructure->startTime; } | ||
| 212 | |||
| 213 | /// @brief **optional**\n | ||
| 214 | /// End time of the recording in UTC. | ||
| 215 | void SetEndTime(time_t endTime) { m_cStructure->endTime = endTime; } | ||
| 216 | |||
| 217 | /// @brief To get with @ref SetEndTime changed values. | ||
| 218 | time_t GetEndTime() const { return m_cStructure->endTime; } | ||
| 219 | |||
| 220 | /// @brief **optional**\n | ||
| 221 | /// For EPG based (not Manual) timers indicates startTime does not apply. | ||
| 222 | /// | ||
| 223 | /// Default = false. | ||
| 224 | void SetStartAnyTime(bool startAnyTime) { m_cStructure->bStartAnyTime = startAnyTime; } | ||
| 225 | |||
| 226 | /// @brief To get with @ref SetStartAnyTime changed values. | ||
| 227 | bool GetStartAnyTime() const { return m_cStructure->bStartAnyTime; } | ||
| 228 | |||
| 229 | /// @brief **optional**\n | ||
| 230 | /// For EPG based (not Manual) timers indicates endTime does not apply. | ||
| 231 | /// | ||
| 232 | /// Default = false | ||
| 233 | void SetEndAnyTime(bool endAnyTime) { m_cStructure->bEndAnyTime = endAnyTime; } | ||
| 234 | |||
| 235 | /// @brief To get with @ref SetEndAnyTime changed values. | ||
| 236 | bool GetEndAnyTime() const { return m_cStructure->bEndAnyTime; } | ||
| 237 | |||
| 238 | /// @brief **optional**\n | ||
| 239 | /// A string used to search epg data for repeating epg-based timers. | ||
| 240 | /// | ||
| 241 | /// Format is backend-dependent, for example regexp. | ||
| 242 | void SetEPGSearchString(const std::string& epgSearchString) | ||
| 243 | { | ||
| 244 | strncpy(m_cStructure->strEpgSearchString, epgSearchString.c_str(), | ||
| 245 | sizeof(m_cStructure->strEpgSearchString) - 1); | ||
| 246 | } | ||
| 247 | |||
| 248 | /// @brief To get with @ref SetEPGSearchString changed values | ||
| 249 | std::string GetEPGSearchString() const { return m_cStructure->strEpgSearchString; } | ||
| 250 | |||
| 251 | /// @brief **optional**\n | ||
| 252 | /// Indicates, whether @ref SetEPGSearchString() is to match against the epg | ||
| 253 | /// episode title only or also against "other" epg data (backend-dependent). | ||
| 254 | void SetFullTextEpgSearch(bool fullTextEpgSearch) | ||
| 255 | { | ||
| 256 | m_cStructure->bFullTextEpgSearch = fullTextEpgSearch; | ||
| 257 | } | ||
| 258 | |||
| 259 | /// @brief To get with @ref SetFullTextEpgSearch changed values. | ||
| 260 | bool GetFullTextEpgSearch() const { return m_cStructure->bFullTextEpgSearch; } | ||
| 261 | |||
| 262 | /// @brief **optional**\n | ||
| 263 | /// The (relative) directory where the recording will be stored in. | ||
| 264 | void SetDirectory(const std::string& directory) | ||
| 265 | { | ||
| 266 | strncpy(m_cStructure->strDirectory, directory.c_str(), sizeof(m_cStructure->strDirectory) - 1); | ||
| 267 | } | ||
| 268 | |||
| 269 | /// @brief To get with @ref SetDirectory changed values. | ||
| 270 | std::string GetDirectory() const { return m_cStructure->strDirectory; } | ||
| 271 | |||
| 272 | /// @brief **optional**\n | ||
| 273 | /// The summary for this timer. | ||
| 274 | void SetSummary(const std::string& summary) | ||
| 275 | { | ||
| 276 | strncpy(m_cStructure->strSummary, summary.c_str(), sizeof(m_cStructure->strSummary) - 1); | ||
| 277 | } | ||
| 278 | |||
| 279 | /// @brief To get with @ref SetDirectory changed values. | ||
| 280 | std::string GetSummary() const { return m_cStructure->strSummary; } | ||
| 281 | |||
| 282 | /// @brief **optional**\n | ||
| 283 | /// The priority of this timer. | ||
| 284 | void SetPriority(int priority) { m_cStructure->iPriority = priority; } | ||
| 285 | |||
| 286 | /// @brief To get with @ref SetPriority changed values. | ||
| 287 | int GetPriority() const { return m_cStructure->iPriority; } | ||
| 288 | |||
| 289 | /// @brief **optional**\n | ||
| 290 | /// Lifetime of recordings created by this timer. | ||
| 291 | /// | ||
| 292 | /// Value > 0 days after which recordings will be deleted by the backend, < 0 | ||
| 293 | /// addon defined integer list reference, == 0 disabled. | ||
| 294 | void SetLifetime(int priority) { m_cStructure->iLifetime = priority; } | ||
| 295 | |||
| 296 | /// @brief To get with @ref SetLifetime changed values. | ||
| 297 | int GetLifetime() const { return m_cStructure->iLifetime; } | ||
| 298 | |||
| 299 | /// @brief **optional**\n | ||
| 300 | /// Maximum number of recordings this timer shall create. | ||
| 301 | /// | ||
| 302 | /// Value > 0 number of recordings, < 0 addon defined integer list reference, == 0 disabled. | ||
| 303 | void SetMaxRecordings(int maxRecordings) { m_cStructure->iMaxRecordings = maxRecordings; } | ||
| 304 | |||
| 305 | /// @brief To get with @ref SetMaxRecordings changed values. | ||
| 306 | int GetMaxRecordings() const { return m_cStructure->iMaxRecordings; } | ||
| 307 | |||
| 308 | /// @brief **optional**\n | ||
| 309 | /// Integer ref to addon/backend defined list of recording groups. | ||
| 310 | void SetRecordingGroup(unsigned int recordingGroup) | ||
| 311 | { | ||
| 312 | m_cStructure->iRecordingGroup = recordingGroup; | ||
| 313 | } | ||
| 314 | |||
| 315 | /// @brief To get with @ref SetRecordingGroup changed values. | ||
| 316 | unsigned int GetRecordingGroup() const { return m_cStructure->iRecordingGroup; } | ||
| 317 | |||
| 318 | /// @brief **optional**\n | ||
| 319 | /// The first day this timer is active, for repeating timers. | ||
| 320 | void SetFirstDay(time_t firstDay) { m_cStructure->firstDay = firstDay; } | ||
| 321 | |||
| 322 | /// @brief To get with @ref SetFirstDay changed values. | ||
| 323 | time_t GetFirstDay() const { return m_cStructure->firstDay; } | ||
| 324 | |||
| 325 | /// @brief **optional**\n | ||
| 326 | /// Week days, for repeating timers (see | ||
| 327 | /// @ref cpp_kodi_addon_pvr_Defs_Timer_PVR_WEEKDAY "PVR_WEEKDAY_*" constant values) | ||
| 328 | /// | ||
| 329 | /// @note @ref PVR_WEEKDAY_NONE is default. | ||
| 330 | /// | ||
| 331 | /// | ||
| 332 | /// -------------------------------------------------------------------------- | ||
| 333 | /// | ||
| 334 | /// **Example:** | ||
| 335 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 336 | /// ... | ||
| 337 | /// kodi::addon::PVRTimer tag; | ||
| 338 | /// tag.SetWeekdays(PVR_WEEKDAY_MONDAY | PVR_WEEKDAY_SATURDAY); | ||
| 339 | /// ... | ||
| 340 | /// ~~~~~~~~~~~~~ | ||
| 341 | void SetWeekdays(unsigned int weekdays) { m_cStructure->iWeekdays = weekdays; } | ||
| 342 | |||
| 343 | /// @brief To get with @ref SetFirstDay changed values. | ||
| 344 | unsigned int GetWeekdays() const { return m_cStructure->iWeekdays; } | ||
| 345 | |||
| 346 | /// @brief **optional**\n | ||
| 347 | /// Prevent duplicate episodes. | ||
| 348 | /// | ||
| 349 | /// Should 1 if backend should only record new episodes in case of a repeating | ||
| 350 | /// epg-based timer, 0 if all episodes shall be recorded (no duplicate detection). | ||
| 351 | /// | ||
| 352 | /// Actual algorithm for duplicate detection is defined by the backend. | ||
| 353 | /// Addons may define own values for different duplicate detection | ||
| 354 | /// algorithms, thus this is not just a bool. | ||
| 355 | void SetPreventDuplicateEpisodes(unsigned int preventDuplicateEpisodes) | ||
| 356 | { | ||
| 357 | m_cStructure->iPreventDuplicateEpisodes = preventDuplicateEpisodes; | ||
| 358 | } | ||
| 359 | |||
| 360 | /// @brief To get with @ref SetPreventDuplicateEpisodes changed values. | ||
| 361 | unsigned int GetPreventDuplicateEpisodes() const | ||
| 362 | { | ||
| 363 | return m_cStructure->iPreventDuplicateEpisodes; | ||
| 364 | } | ||
| 365 | |||
| 366 | /// @brief **optional**\n | ||
| 367 | /// EPG event id associated with this timer. Event ids must be unique for a | ||
| 368 | /// channel. | ||
| 369 | /// | ||
| 370 | /// Valid ids must be greater than @ref EPG_TAG_INVALID_UID. | ||
| 371 | void SetEPGUid(unsigned int epgUid) { m_cStructure->iEpgUid = epgUid; } | ||
| 372 | |||
| 373 | /// @brief To get with @ref SetEPGUid changed values. | ||
| 374 | unsigned int GetEPGUid() const { return m_cStructure->iEpgUid; } | ||
| 375 | |||
| 376 | /// @brief **optional**\n | ||
| 377 | /// If set, the backend starts the recording selected minutes before | ||
| 378 | /// @ref SetStartTime. | ||
| 379 | void SetMarginStart(unsigned int marginStart) { m_cStructure->iMarginStart = marginStart; } | ||
| 380 | |||
| 381 | /// @brief To get with @ref SetMarginStart changed values. | ||
| 382 | unsigned int GetMarginStart() const { return m_cStructure->iMarginStart; } | ||
| 383 | |||
| 384 | /// @brief **optional**\n | ||
| 385 | /// If set, the backend ends the recording selected minutes after | ||
| 386 | /// @ref SetEndTime. | ||
| 387 | void SetMarginEnd(unsigned int marginEnd) { m_cStructure->iMarginEnd = marginEnd; } | ||
| 388 | |||
| 389 | /// @brief To get with @ref SetMarginEnd changed values. | ||
| 390 | unsigned int GetMarginEnd() const { return m_cStructure->iMarginEnd; } | ||
| 391 | |||
| 392 | /// @brief **optional**\n | ||
| 393 | /// Genre type. | ||
| 394 | /// | ||
| 395 | /// @copydetails EPG_EVENT_CONTENTMASK | ||
| 396 | /// | ||
| 397 | /// -------------------------------------------------------------------------- | ||
| 398 | /// | ||
| 399 | /// **Example:** | ||
| 400 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 401 | /// ... | ||
| 402 | /// kodi::addon::PVRTimer tag; | ||
| 403 | /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MOVIEDRAMA); | ||
| 404 | /// ... | ||
| 405 | /// ~~~~~~~~~~~~~ | ||
| 406 | /// | ||
| 407 | /// @note If confirmed that backend brings the types in [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) | ||
| 408 | /// conform values, can be @ref EPG_EVENT_CONTENTMASK ignored and to set here | ||
| 409 | /// with backend value. | ||
| 410 | /// | ||
| 411 | void SetGenreType(int genreType) { m_cStructure->iGenreType = genreType; } | ||
| 412 | |||
| 413 | /// @brief To get with @ref SetGenreType changed values. | ||
| 414 | int GetGenreType() const { return m_cStructure->iGenreType; } | ||
| 415 | |||
| 416 | /// @brief **optional**\n | ||
| 417 | /// Genre sub type. | ||
| 418 | /// | ||
| 419 | /// @copydetails EPG_EVENT_CONTENTMASK | ||
| 420 | /// | ||
| 421 | /// Subtypes groups related to set by @ref SetGenreType: | ||
| 422 | /// | Main genre type | List with available sub genre types | ||
| 423 | /// |-----------------|----------------------------------------- | ||
| 424 | /// | @ref EPG_EVENT_CONTENTMASK_UNDEFINED | Nothing, should be 0 | ||
| 425 | /// | @ref EPG_EVENT_CONTENTMASK_MOVIEDRAMA | @ref EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA | ||
| 426 | /// | @ref EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS | @ref EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS | ||
| 427 | /// | @ref EPG_EVENT_CONTENTMASK_SHOW | @ref EPG_EVENT_CONTENTSUBMASK_SHOW | ||
| 428 | /// | @ref EPG_EVENT_CONTENTMASK_SPORTS | @ref EPG_EVENT_CONTENTSUBMASK_SPORTS | ||
| 429 | /// | @ref EPG_EVENT_CONTENTMASK_CHILDRENYOUTH | @ref EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH | ||
| 430 | /// | @ref EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE | @ref EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE | ||
| 431 | /// | @ref EPG_EVENT_CONTENTMASK_ARTSCULTURE | @ref EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE | ||
| 432 | /// | @ref EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS | @ref EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS | ||
| 433 | /// | @ref EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE | @ref EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE | ||
| 434 | /// | @ref EPG_EVENT_CONTENTMASK_LEISUREHOBBIES | @ref EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES | ||
| 435 | /// | @ref EPG_EVENT_CONTENTMASK_SPECIAL | @ref EPG_EVENT_CONTENTSUBMASK_SPECIAL | ||
| 436 | /// | @ref EPG_EVENT_CONTENTMASK_USERDEFINED | Can be defined by you | ||
| 437 | /// | ||
| 438 | /// -------------------------------------------------------------------------- | ||
| 439 | /// | ||
| 440 | /// **Example:** | ||
| 441 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 442 | /// ... | ||
| 443 | /// kodi::addon::PVRTimer tag; | ||
| 444 | /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE); | ||
| 445 | /// tag.SetGenreSubType(EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_JAZZ); | ||
| 446 | /// ... | ||
| 447 | /// ~~~~~~~~~~~~~ | ||
| 448 | /// | ||
| 449 | void SetGenreSubType(int genreSubType) { m_cStructure->iGenreSubType = genreSubType; } | ||
| 450 | |||
| 451 | /// @brief To get with @ref SetGenreType changed values. | ||
| 452 | int GetGenreSubType() const { return m_cStructure->iGenreSubType; } | ||
| 453 | |||
| 454 | /// @brief **optional**\n | ||
| 455 | /// Series link for this timer. | ||
| 456 | /// | ||
| 457 | /// If set for an epg-based timer rule, matching events will be found by | ||
| 458 | /// checking with here, instead of @ref SetTitle() (and @ref SetFullTextEpgSearch()). | ||
| 459 | void SetSeriesLink(const std::string& seriesLink) | ||
| 460 | { | ||
| 461 | strncpy(m_cStructure->strSeriesLink, seriesLink.c_str(), | ||
| 462 | sizeof(m_cStructure->strSeriesLink) - 1); | ||
| 463 | } | ||
| 464 | |||
| 465 | /// @brief To get with @ref SetSeriesLink changed values. | ||
| 466 | std::string GetSeriesLink() const { return m_cStructure->strSeriesLink; } | ||
| 467 | ///@} | ||
| 468 | |||
| 469 | private: | ||
| 470 | PVRTimer(const PVR_TIMER* data) : CStructHdl(data) {} | ||
| 471 | PVRTimer(PVR_TIMER* data) : CStructHdl(data) {} | ||
| 472 | }; | ||
| 473 | |||
| 474 | ///@} | ||
| 475 | //------------------------------------------------------------------------------ | ||
| 476 | |||
| 477 | //============================================================================== | ||
| 478 | /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimersResultSet class PVRTimersResultSet | ||
| 479 | /// @ingroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer | ||
| 480 | /// @brief **PVR add-on timer transfer class**\n | ||
| 481 | /// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetTimers(). | ||
| 482 | /// | ||
| 483 | /// @note This becomes only be used on addon call above, not usable outside on | ||
| 484 | /// addon itself. | ||
| 485 | ///@{ | ||
| 486 | class PVRTimersResultSet | ||
| 487 | { | ||
| 488 | public: | ||
| 489 | /*! \cond PRIVATE */ | ||
| 490 | PVRTimersResultSet() = delete; | ||
| 491 | PVRTimersResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle) | ||
| 492 | : m_instance(instance), m_handle(handle) | ||
| 493 | { | ||
| 494 | } | ||
| 495 | /*! \endcond */ | ||
| 496 | |||
| 497 | /// @addtogroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimersResultSet | ||
| 498 | ///@{ | ||
| 499 | |||
| 500 | /// @brief To add and give content from addon to Kodi on related call. | ||
| 501 | /// | ||
| 502 | /// @param[in] tag The to transferred data. | ||
| 503 | void Add(const kodi::addon::PVRTimer& tag) | ||
| 504 | { | ||
| 505 | m_instance->toKodi->TransferTimerEntry(m_instance->toKodi->kodiInstance, m_handle, tag); | ||
| 506 | } | ||
| 507 | |||
| 508 | ///@} | ||
| 509 | |||
| 510 | private: | ||
| 511 | const AddonInstance_PVR* m_instance = nullptr; | ||
| 512 | const ADDON_HANDLE m_handle; | ||
| 513 | }; | ||
| 514 | ///@} | ||
| 515 | //------------------------------------------------------------------------------ | ||
| 516 | |||
| 517 | //============================================================================== | ||
| 518 | /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType class PVRTimerType | ||
| 519 | /// @ingroup cpp_kodi_addon_pvr_Defs_Timer | ||
| 520 | /// @brief **PVR add-on timer type**\n | ||
| 521 | /// To define the content of @ref kodi::addon::CInstancePVRClient::GetTimerTypes() | ||
| 522 | /// given groups. | ||
| 523 | /// | ||
| 524 | /// ---------------------------------------------------------------------------- | ||
| 525 | /// | ||
| 526 | /// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType_Help | ||
| 527 | /// | ||
| 528 | ///@{ | ||
| 529 | class PVRTimerType : public CStructHdl<PVRTimerType, PVR_TIMER_TYPE> | ||
| 530 | { | ||
| 531 | friend class CInstancePVRClient; | ||
| 532 | |||
| 533 | public: | ||
| 534 | /*! \cond PRIVATE */ | ||
| 535 | PVRTimerType() | ||
| 536 | { | ||
| 537 | memset(m_cStructure, 0, sizeof(PVR_TIMER_TYPE)); | ||
| 538 | m_cStructure->iPrioritiesDefault = -1; | ||
| 539 | m_cStructure->iLifetimesDefault = -1; | ||
| 540 | m_cStructure->iPreventDuplicateEpisodesDefault = -1; | ||
| 541 | m_cStructure->iRecordingGroupDefault = -1; | ||
| 542 | m_cStructure->iMaxRecordingsDefault = -1; | ||
| 543 | } | ||
| 544 | PVRTimerType(const PVRTimerType& type) : CStructHdl(type) {} | ||
| 545 | /*! \endcond */ | ||
| 546 | |||
| 547 | /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType_Help Value Help | ||
| 548 | /// @ingroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType | ||
| 549 | /// ---------------------------------------------------------------------------- | ||
| 550 | /// | ||
| 551 | /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType :</b> | ||
| 552 | /// | Name | Type | Set call | Get call | Usage | ||
| 553 | /// |------|------|----------|----------|----------- | ||
| 554 | /// | **Identifier** | `unsigned int` | @ref PVRTimerType::SetId "SetId" | @ref PVRTimerType::GetId "GetId" | *required to set* | ||
| 555 | /// | **Attributes** | `unsigned int` | @ref PVRTimerType::SetAttributes "SetAttributes" | @ref PVRTimerType::GetAttributes "GetAttributes" | *required to set* | ||
| 556 | /// | **Description** | `std::string` | @ref PVRTimerType::SetDescription "SetDescription" | @ref PVRTimerType::GetDescription "GetDescription" | *optional* | ||
| 557 | /// | | | | | | | ||
| 558 | /// | **Priority selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetPriorities "SetPriorities" | @ref PVRTimerType::GetPriorities "GetPriorities" | *optional* | ||
| 559 | /// | **Priority default selection** | `int`| @ref PVRTimerType::SetPrioritiesDefault "SetPrioritiesDefault" | @ref PVRTimerType::GetPrioritiesDefault "GetPrioritiesDefault" | *optional* | ||
| 560 | /// | | | | | | | ||
| 561 | /// | **Lifetime selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetLifetimes "SetLifetimes" | @ref PVRTimerType::GetLifetimes "GetLifetimes" | *optional* | ||
| 562 | /// | **Lifetime default selection** | `int`| @ref PVRTimerType::SetLifetimesDefault "SetLifetimesDefault" | @ref PVRTimerType::GetLifetimesDefault "GetLifetimesDefault" | *optional* | ||
| 563 | /// | | | | | | | ||
| 564 | /// | **Prevent duplicate episodes selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetPreventDuplicateEpisodes "SetPreventDuplicateEpisodes" | @ref PVRTimerType::GetPreventDuplicateEpisodes "GetPreventDuplicateEpisodes" | *optional* | ||
| 565 | /// | **Prevent duplicate episodes default** | `int`| @ref PVRTimerType::SetPreventDuplicateEpisodesDefault "SetPreventDuplicateEpisodesDefault" | @ref PVRTimerType::GetPreventDuplicateEpisodesDefault "GetPreventDuplicateEpisodesDefault" | *optional* | ||
| 566 | /// | | | | | | | ||
| 567 | /// | **Recording group selection**| @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetRecordingGroups "SetRecordingGroups" | @ref PVRTimerType::GetRecordingGroups "GetRecordingGroups" | *optional* | ||
| 568 | /// | **Recording group default** | `int`| @ref PVRTimerType::SetRecordingGroupDefault "SetRecordingGroupDefault" | @ref PVRTimerType::GetRecordingGroupDefault "GetRecordingGroupDefault" | *optional* | ||
| 569 | /// | | | | | | | ||
| 570 | /// | **Max recordings selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetMaxRecordings "SetMaxRecordings" | @ref PVRTimerType::GetMaxRecordings "GetMaxRecordings" | *optional* | ||
| 571 | /// | **Max recordings default** | `int`| @ref PVRTimerType::SetMaxRecordingsDefault "SetMaxRecordingsDefault" | @ref PVRTimerType::GetMaxRecordingsDefault "GetMaxRecordingsDefault" | *optional* | ||
| 572 | /// | ||
| 573 | |||
| 574 | /// @addtogroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType | ||
| 575 | ///@{ | ||
| 576 | |||
| 577 | /// @brief **required**\n | ||
| 578 | /// This type's identifier. Ids must be > @ref PVR_TIMER_TYPE_NONE. | ||
| 579 | void SetId(unsigned int id) { m_cStructure->iId = id; } | ||
| 580 | |||
| 581 | /// @brief To get with @ref SetAttributes changed values. | ||
| 582 | unsigned int GetId() const { return m_cStructure->iId; } | ||
| 583 | |||
| 584 | /// @brief **required**\n | ||
| 585 | /// Defines the attributes for this type (@ref cpp_kodi_addon_pvr_Defs_Timer_PVR_TIMER_TYPE "PVR_TIMER_TYPE_*" constants). | ||
| 586 | /// | ||
| 587 | /// To defines the attributes for a type. These values are bit fields that can be | ||
| 588 | /// used together. | ||
| 589 | /// | ||
| 590 | ///-------------------------------------------------------------------------- | ||
| 591 | /// | ||
| 592 | /// **Example:** | ||
| 593 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 594 | /// kodi::addon::PVRTimerType tag; | ||
| 595 | /// tag.SetAttributes(PVR_TIMER_TYPE_IS_MANUAL | PVR_TIMER_TYPE_IS_REPEATING); | ||
| 596 | /// ~~~~~~~~~~~~~ | ||
| 597 | /// | ||
| 598 | void SetAttributes(uint64_t attributes) { m_cStructure->iAttributes = attributes; } | ||
| 599 | |||
| 600 | /// @brief To get with @ref SetAttributes changed values. | ||
| 601 | uint64_t GetAttributes() const { return m_cStructure->iAttributes; } | ||
| 602 | |||
| 603 | /// @brief **optional**\n | ||
| 604 | /// A short localized string describing the purpose of the type. (e.g. | ||
| 605 | /// "Any time at this channel if title matches"). | ||
| 606 | /// | ||
| 607 | /// If left blank, Kodi will generate a description based on the attributes | ||
| 608 | /// REPEATING and MANUAL. (e.g. "Repeating EPG-based.") | ||
| 609 | void SetDescription(const std::string& description) | ||
| 610 | { | ||
| 611 | strncpy(m_cStructure->strDescription, description.c_str(), | ||
| 612 | sizeof(m_cStructure->strDescription) - 1); | ||
| 613 | } | ||
| 614 | |||
| 615 | /// @brief To get with @ref SetDescription changed values. | ||
| 616 | std::string GetDescription() const { return m_cStructure->strDescription; } | ||
| 617 | |||
| 618 | //---------------------------------------------------------------------------- | ||
| 619 | |||
| 620 | /// @brief **optional**\n | ||
| 621 | /// Priority value definitions. | ||
| 622 | /// | ||
| 623 | /// Array containing the possible values for @ref PVRTimer::SetPriority(). | ||
| 624 | /// | ||
| 625 | /// @param[in] priorities List of priority values | ||
| 626 | /// @param[in] prioritiesDefault [opt] The default value in list, can also be | ||
| 627 | /// set by @ref SetPrioritiesDefault() | ||
| 628 | /// | ||
| 629 | /// -------------------------------------------------------------------------- | ||
| 630 | /// | ||
| 631 | /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help | ||
| 632 | void SetPriorities(const std::vector<PVRTypeIntValue>& priorities, int prioritiesDefault = -1) | ||
| 633 | { | ||
| 634 | m_cStructure->iPrioritiesSize = static_cast<unsigned int>(priorities.size()); | ||
| 635 | for (unsigned int i = 0; | ||
| 636 | i < m_cStructure->iPrioritiesSize && i < sizeof(m_cStructure->priorities); ++i) | ||
| 637 | { | ||
| 638 | m_cStructure->priorities[i].iValue = priorities[i].GetCStructure()->iValue; | ||
| 639 | strncpy(m_cStructure->priorities[i].strDescription, | ||
| 640 | priorities[i].GetCStructure()->strDescription, | ||
| 641 | sizeof(m_cStructure->priorities[i].strDescription) - 1); | ||
| 642 | } | ||
| 643 | if (prioritiesDefault != -1) | ||
| 644 | m_cStructure->iPrioritiesDefault = prioritiesDefault; | ||
| 645 | } | ||
| 646 | |||
| 647 | /// @brief To get with @ref SetPriorities changed values. | ||
| 648 | std::vector<PVRTypeIntValue> GetPriorities() const | ||
| 649 | { | ||
| 650 | std::vector<PVRTypeIntValue> ret; | ||
| 651 | for (unsigned int i = 0; i < m_cStructure->iPrioritiesSize; ++i) | ||
| 652 | ret.emplace_back(m_cStructure->priorities[i].iValue, | ||
| 653 | m_cStructure->priorities[i].strDescription); | ||
| 654 | return ret; | ||
| 655 | } | ||
| 656 | |||
| 657 | /// @brief **optional**\n | ||
| 658 | /// The default value for @ref PVRTimer::SetPriority(). | ||
| 659 | /// | ||
| 660 | /// @note Must be filled if @ref SetPriorities contain values and not | ||
| 661 | /// defined there on second function value. | ||
| 662 | void SetPrioritiesDefault(int prioritiesDefault) | ||
| 663 | { | ||
| 664 | m_cStructure->iPrioritiesDefault = prioritiesDefault; | ||
| 665 | } | ||
| 666 | |||
| 667 | /// @brief To get with @ref SetPrioritiesDefault changed values. | ||
| 668 | int GetPrioritiesDefault() const { return m_cStructure->iPrioritiesDefault; } | ||
| 669 | |||
| 670 | //---------------------------------------------------------------------------- | ||
| 671 | |||
| 672 | /// @brief **optional**\n | ||
| 673 | /// Lifetime value definitions. | ||
| 674 | /// | ||
| 675 | /// Array containing the possible values for @ref PVRTimer::SetLifetime(). | ||
| 676 | /// | ||
| 677 | /// @param[in] lifetimes List of lifetimes values | ||
| 678 | /// @param[in] lifetimesDefault [opt] The default value in list, can also be | ||
| 679 | /// set by @ref SetLifetimesDefault() | ||
| 680 | /// | ||
| 681 | /// -------------------------------------------------------------------------- | ||
| 682 | /// | ||
| 683 | /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help | ||
| 684 | void SetLifetimes(const std::vector<PVRTypeIntValue>& lifetimes, int lifetimesDefault = -1) | ||
| 685 | { | ||
| 686 | m_cStructure->iLifetimesSize = static_cast<unsigned int>(lifetimes.size()); | ||
| 687 | for (unsigned int i = 0; | ||
| 688 | i < m_cStructure->iLifetimesSize && i < sizeof(m_cStructure->lifetimes); ++i) | ||
| 689 | { | ||
| 690 | m_cStructure->lifetimes[i].iValue = lifetimes[i].GetCStructure()->iValue; | ||
| 691 | strncpy(m_cStructure->lifetimes[i].strDescription, | ||
| 692 | lifetimes[i].GetCStructure()->strDescription, | ||
| 693 | sizeof(m_cStructure->lifetimes[i].strDescription) - 1); | ||
| 694 | } | ||
| 695 | if (lifetimesDefault != -1) | ||
| 696 | m_cStructure->iLifetimesDefault = lifetimesDefault; | ||
| 697 | } | ||
| 698 | |||
| 699 | /// @brief To get with @ref SetLifetimes changed values. | ||
| 700 | std::vector<PVRTypeIntValue> GetLifetimes() const | ||
| 701 | { | ||
| 702 | std::vector<PVRTypeIntValue> ret; | ||
| 703 | for (unsigned int i = 0; i < m_cStructure->iLifetimesSize; ++i) | ||
| 704 | ret.emplace_back(m_cStructure->lifetimes[i].iValue, | ||
| 705 | m_cStructure->lifetimes[i].strDescription); | ||
| 706 | return ret; | ||
| 707 | } | ||
| 708 | |||
| 709 | /// @brief **optional**\n | ||
| 710 | /// The default value for @ref SetLifetimes(). | ||
| 711 | /// | ||
| 712 | /// @note Must be filled if @ref SetLifetimes contain values and not | ||
| 713 | /// defined there on second function value. | ||
| 714 | void SetLifetimesDefault(int lifetimesDefault) | ||
| 715 | { | ||
| 716 | m_cStructure->iLifetimesDefault = lifetimesDefault; | ||
| 717 | } | ||
| 718 | |||
| 719 | /// @brief To get with @ref SetLifetimesDefault changed values. | ||
| 720 | int GetLifetimesDefault() const { return m_cStructure->iLifetimesDefault; } | ||
| 721 | |||
| 722 | //---------------------------------------------------------------------------- | ||
| 723 | |||
| 724 | /// @brief **optional**\n | ||
| 725 | /// Prevent duplicate episodes value definitions. | ||
| 726 | /// | ||
| 727 | /// Array containing the possible values for @ref PVRTimer::SetPreventDuplicateEpisodes(). | ||
| 728 | /// | ||
| 729 | /// @note Must be filled if @ref PVRTimer::SetPreventDuplicateEpisodes() is not empty. | ||
| 730 | /// | ||
| 731 | /// @param[in] preventDuplicateEpisodes List of duplicate episodes values | ||
| 732 | /// @param[in] preventDuplicateEpisodesDefault [opt] The default value in list, can also be | ||
| 733 | /// set by @ref SetPreventDuplicateEpisodesDefault() | ||
| 734 | /// | ||
| 735 | /// -------------------------------------------------------------------------- | ||
| 736 | /// | ||
| 737 | /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help | ||
| 738 | void SetPreventDuplicateEpisodes( | ||
| 739 | const std::vector<PVRTypeIntValue>& preventDuplicateEpisodes, | ||
| 740 | int preventDuplicateEpisodesDefault = -1) | ||
| 741 | { | ||
| 742 | m_cStructure->iPreventDuplicateEpisodesSize = | ||
| 743 | static_cast<unsigned int>(preventDuplicateEpisodes.size()); | ||
| 744 | for (unsigned int i = 0; i < m_cStructure->iPreventDuplicateEpisodesSize && | ||
| 745 | i < sizeof(m_cStructure->preventDuplicateEpisodes); | ||
| 746 | ++i) | ||
| 747 | { | ||
| 748 | m_cStructure->preventDuplicateEpisodes[i].iValue = | ||
| 749 | preventDuplicateEpisodes[i].GetCStructure()->iValue; | ||
| 750 | strncpy(m_cStructure->preventDuplicateEpisodes[i].strDescription, | ||
| 751 | preventDuplicateEpisodes[i].GetCStructure()->strDescription, | ||
| 752 | sizeof(m_cStructure->preventDuplicateEpisodes[i].strDescription) - 1); | ||
| 753 | } | ||
| 754 | if (preventDuplicateEpisodesDefault != -1) | ||
| 755 | m_cStructure->iPreventDuplicateEpisodesDefault = preventDuplicateEpisodesDefault; | ||
| 756 | } | ||
| 757 | |||
| 758 | /// @brief To get with @ref SetPreventDuplicateEpisodes changed values. | ||
| 759 | std::vector<PVRTypeIntValue> GetPreventDuplicateEpisodes() const | ||
| 760 | { | ||
| 761 | std::vector<PVRTypeIntValue> ret; | ||
| 762 | for (unsigned int i = 0; i < m_cStructure->iPreventDuplicateEpisodesSize; ++i) | ||
| 763 | ret.emplace_back(m_cStructure->preventDuplicateEpisodes[i].iValue, | ||
| 764 | m_cStructure->preventDuplicateEpisodes[i].strDescription); | ||
| 765 | return ret; | ||
| 766 | } | ||
| 767 | |||
| 768 | /// @brief **optional**\n | ||
| 769 | /// The default value for @ref PVRTimer::SetPreventDuplicateEpisodes(). | ||
| 770 | /// | ||
| 771 | /// @note Must be filled if @ref SetPreventDuplicateEpisodes contain values and not | ||
| 772 | /// defined there on second function value. | ||
| 773 | void SetPreventDuplicateEpisodesDefault(int preventDuplicateEpisodesDefault) | ||
| 774 | { | ||
| 775 | m_cStructure->iPreventDuplicateEpisodesDefault = preventDuplicateEpisodesDefault; | ||
| 776 | } | ||
| 777 | |||
| 778 | /// @brief To get with @ref SetPreventDuplicateEpisodesDefault changed values. | ||
| 779 | int GetPreventDuplicateEpisodesDefault() const | ||
| 780 | { | ||
| 781 | return m_cStructure->iPreventDuplicateEpisodesDefault; | ||
| 782 | } | ||
| 783 | |||
| 784 | //---------------------------------------------------------------------------- | ||
| 785 | |||
| 786 | /// @brief **optional**\n | ||
| 787 | /// Array containing the possible values of @ref PVRTimer::SetRecordingGroup() | ||
| 788 | /// | ||
| 789 | /// @param[in] recordingGroup List of recording group values | ||
| 790 | /// @param[in] recordingGroupDefault [opt] The default value in list, can also be | ||
| 791 | /// set by @ref SetRecordingGroupDefault() | ||
| 792 | /// | ||
| 793 | /// -------------------------------------------------------------------------- | ||
| 794 | /// | ||
| 795 | /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help | ||
| 796 | void SetRecordingGroups(const std::vector<PVRTypeIntValue>& recordingGroup, | ||
| 797 | int recordingGroupDefault = -1) | ||
| 798 | { | ||
| 799 | m_cStructure->iRecordingGroupSize = static_cast<unsigned int>(recordingGroup.size()); | ||
| 800 | for (unsigned int i = 0; | ||
| 801 | i < m_cStructure->iRecordingGroupSize && i < sizeof(m_cStructure->recordingGroup); ++i) | ||
| 802 | { | ||
| 803 | m_cStructure->recordingGroup[i].iValue = recordingGroup[i].GetCStructure()->iValue; | ||
| 804 | strncpy(m_cStructure->recordingGroup[i].strDescription, | ||
| 805 | recordingGroup[i].GetCStructure()->strDescription, | ||
| 806 | sizeof(m_cStructure->recordingGroup[i].strDescription) - 1); | ||
| 807 | } | ||
| 808 | if (recordingGroupDefault != -1) | ||
| 809 | m_cStructure->iRecordingGroupDefault = recordingGroupDefault; | ||
| 810 | } | ||
| 811 | |||
| 812 | /// @brief To get with @ref SetRecordingGroups changed values | ||
| 813 | std::vector<PVRTypeIntValue> GetRecordingGroups() const | ||
| 814 | { | ||
| 815 | std::vector<PVRTypeIntValue> ret; | ||
| 816 | for (unsigned int i = 0; i < m_cStructure->iRecordingGroupSize; ++i) | ||
| 817 | ret.emplace_back(m_cStructure->recordingGroup[i].iValue, | ||
| 818 | m_cStructure->recordingGroup[i].strDescription); | ||
| 819 | return ret; | ||
| 820 | } | ||
| 821 | |||
| 822 | /// @brief **optional**\n | ||
| 823 | /// The default value for @ref PVRTimer::SetRecordingGroup(). | ||
| 824 | /// | ||
| 825 | /// @note Must be filled if @ref SetRecordingGroups contain values and not | ||
| 826 | /// defined there on second function value. | ||
| 827 | void SetRecordingGroupDefault(int recordingGroupDefault) | ||
| 828 | { | ||
| 829 | m_cStructure->iRecordingGroupDefault = recordingGroupDefault; | ||
| 830 | } | ||
| 831 | |||
| 832 | /// @brief To get with @ref SetRecordingGroupDefault changed values | ||
| 833 | int GetRecordingGroupDefault() const { return m_cStructure->iRecordingGroupDefault; } | ||
| 834 | |||
| 835 | //---------------------------------------------------------------------------- | ||
| 836 | |||
| 837 | /// @brief **optional**\n | ||
| 838 | /// Array containing the possible values of @ref PVRTimer::SetMaxRecordings(). | ||
| 839 | /// | ||
| 840 | /// @param[in] maxRecordings List of lifetimes values | ||
| 841 | /// @param[in] maxRecordingsDefault [opt] The default value in list, can also be | ||
| 842 | /// set by @ref SetMaxRecordingsDefault() | ||
| 843 | /// | ||
| 844 | /// -------------------------------------------------------------------------- | ||
| 845 | /// | ||
| 846 | /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help | ||
| 847 | void SetMaxRecordings(const std::vector<PVRTypeIntValue>& maxRecordings, | ||
| 848 | int maxRecordingsDefault = -1) | ||
| 849 | { | ||
| 850 | m_cStructure->iMaxRecordingsSize = static_cast<unsigned int>(maxRecordings.size()); | ||
| 851 | for (unsigned int i = 0; | ||
| 852 | i < m_cStructure->iMaxRecordingsSize && i < sizeof(m_cStructure->maxRecordings); ++i) | ||
| 853 | { | ||
| 854 | m_cStructure->maxRecordings[i].iValue = maxRecordings[i].GetCStructure()->iValue; | ||
| 855 | strncpy(m_cStructure->maxRecordings[i].strDescription, | ||
| 856 | maxRecordings[i].GetCStructure()->strDescription, | ||
| 857 | sizeof(m_cStructure->maxRecordings[i].strDescription) - 1); | ||
| 858 | } | ||
| 859 | if (maxRecordingsDefault != -1) | ||
| 860 | m_cStructure->iMaxRecordingsDefault = maxRecordingsDefault; | ||
| 861 | } | ||
| 862 | |||
| 863 | /// @brief To get with @ref SetMaxRecordings changed values | ||
| 864 | std::vector<PVRTypeIntValue> GetMaxRecordings() const | ||
| 865 | { | ||
| 866 | std::vector<PVRTypeIntValue> ret; | ||
| 867 | for (unsigned int i = 0; i < m_cStructure->iMaxRecordingsSize; ++i) | ||
| 868 | ret.emplace_back(m_cStructure->maxRecordings[i].iValue, | ||
| 869 | m_cStructure->maxRecordings[i].strDescription); | ||
| 870 | return ret; | ||
| 871 | } | ||
| 872 | |||
| 873 | /// @brief **optional**\n | ||
| 874 | /// The default value for @ref SetMaxRecordings(). | ||
| 875 | /// | ||
| 876 | /// Can be set with here if on @ref SetMaxRecordings not given as second value. | ||
| 877 | void SetMaxRecordingsDefault(int maxRecordingsDefault) | ||
| 878 | { | ||
| 879 | m_cStructure->iMaxRecordingsDefault = maxRecordingsDefault; | ||
| 880 | } | ||
| 881 | |||
| 882 | /// @brief To get with @ref SetMaxRecordingsDefault changed values | ||
| 883 | int GetMaxRecordingsDefault() const { return m_cStructure->iMaxRecordingsDefault; } | ||
| 884 | ///@} | ||
| 885 | |||
| 886 | private: | ||
| 887 | PVRTimerType(const PVR_TIMER_TYPE* type) : CStructHdl(type) {} | ||
| 888 | PVRTimerType(PVR_TIMER_TYPE* type) : CStructHdl(type) {} | ||
| 889 | }; | ||
| 890 | ///@} | ||
| 891 | //------------------------------------------------------------------------------ | ||
| 892 | |||
| 893 | } /* namespace addon */ | ||
| 894 | } /* namespace kodi */ | ||
| 895 | |||
| 896 | #endif /* __cplusplus */ | ||
