| 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 "threads/CriticalSection.h" |
| 12 |
#include "utils/IArchivable.h" |
| 13 |
#include "utils/ISerializable.h" |
| 14 |
|
| 15 |
#include <deque> |
| 16 |
#include <string> |
| 17 |
|
| 18 |
namespace PVR |
| 19 |
{ |
| 20 |
|
| 21 |
class CPVRRadioRDSInfoTag final : public IArchivable, public ISerializable |
| 22 |
{ |
| 23 |
public: |
| 24 |
CPVRRadioRDSInfoTag(); |
| 25 |
|
| 26 |
bool operator ==(const CPVRRadioRDSInfoTag& right) const; |
| 27 |
bool operator !=(const CPVRRadioRDSInfoTag& right) const; |
| 28 |
|
| 29 |
void Archive(CArchive& ar) override; |
| 30 |
void Serialize(CVariant& value) const override; |
| 31 |
|
| 32 |
void Clear(); |
| 33 |
void ResetSongInformation(); |
| 34 |
|
| 35 |
/**! Basic RDS related information */ |
| 36 |
void SetSpeechActive(bool active); |
| 37 |
void SetLanguage(const std::string& strLanguage); |
| 38 |
const std::string& GetLanguage() const; |
| 39 |
void SetCountry(const std::string& strCountry); |
| 40 |
const std::string& GetCountry() const; |
| 41 |
void SetRadioText(const std::string& strRadioText); |
| 42 |
std::string GetRadioText(unsigned int line) const; |
| 43 |
void SetProgramServiceText(const std::string& strPSText); |
| 44 |
|
| 45 |
/**! RDS RadioText related information */ |
| 46 |
void SetTitle(const std::string& strTitle); |
| 47 |
void SetBand(const std::string& strBand); |
| 48 |
void SetArtist(const std::string& strArtist); |
| 49 |
void SetComposer(const std::string& strComposer); |
| 50 |
void SetConductor(const std::string& strConductor); |
| 51 |
void SetAlbum(const std::string& strAlbum); |
| 52 |
void SetComment(const std::string& strComment); |
| 53 |
void SetAlbumTrackNumber(int track); |
| 54 |
|
| 55 |
const std::string& GetTitle() const; |
| 56 |
const std::string& GetBand() const; |
| 57 |
const std::string& GetArtist() const; |
| 58 |
const std::string& GetComposer() const; |
| 59 |
const std::string& GetConductor() const; |
| 60 |
const std::string& GetAlbum() const; |
| 61 |
const std::string& GetComment() const; |
| 62 |
int GetAlbumTrackNumber() const; |
| 63 |
|
| 64 |
void SetProgStation(const std::string& strProgStation); |
| 65 |
void SetProgStyle(const std::string& strProgStyle); |
| 66 |
void SetProgHost(const std::string& strProgHost); |
| 67 |
void SetProgWebsite(const std::string& strWebsite); |
| 68 |
void SetProgNow(const std::string& strNow); |
| 69 |
void SetProgNext(const std::string& strNext); |
| 70 |
void SetPhoneHotline(const std::string& strHotline); |
| 71 |
void SetEMailHotline(const std::string& strHotline); |
| 72 |
void SetPhoneStudio(const std::string& strPhone); |
| 73 |
void SetEMailStudio(const std::string& strEMail); |
| 74 |
void SetSMSStudio(const std::string& strSMS); |
| 75 |
|
| 76 |
const std::string& GetProgStation() const; |
| 77 |
const std::string& GetProgStyle() const; |
| 78 |
const std::string& GetProgHost() const; |
| 79 |
const std::string& GetProgWebsite() const; |
| 80 |
const std::string& GetProgNow() const; |
| 81 |
const std::string& GetProgNext() const; |
| 82 |
const std::string& GetPhoneHotline() const; |
| 83 |
const std::string& GetEMailHotline() const; |
| 84 |
const std::string& GetPhoneStudio() const; |
| 85 |
const std::string& GetEMailStudio() const; |
| 86 |
const std::string& GetSMSStudio() const; |
| 87 |
|
| 88 |
void SetInfoNews(const std::string& strNews); |
| 89 |
const std::string GetInfoNews() const; |
| 90 |
|
| 91 |
void SetInfoNewsLocal(const std::string& strNews); |
| 92 |
const std::string GetInfoNewsLocal() const; |
| 93 |
|
| 94 |
void SetInfoSport(const std::string& strSport); |
| 95 |
const std::string GetInfoSport() const; |
| 96 |
|
| 97 |
void SetInfoStock(const std::string& strSport); |
| 98 |
const std::string GetInfoStock() const; |
| 99 |
|
| 100 |
void SetInfoWeather(const std::string& strWeather); |
| 101 |
const std::string GetInfoWeather() const; |
| 102 |
|
| 103 |
void SetInfoHoroscope(const std::string& strHoroscope); |
| 104 |
const std::string GetInfoHoroscope() const; |
| 105 |
|
| 106 |
void SetInfoCinema(const std::string& strCinema); |
| 107 |
const std::string GetInfoCinema() const; |
| 108 |
|
| 109 |
void SetInfoLottery(const std::string& strLottery); |
| 110 |
const std::string GetInfoLottery() const; |
| 111 |
|
| 112 |
void SetInfoOther(const std::string& strOther); |
| 113 |
const std::string GetInfoOther() const; |
| 114 |
|
| 115 |
void SetEditorialStaff(const std::string& strEditorialStaff); |
| 116 |
const std::string GetEditorialStaff() const; |
| 117 |
|
| 118 |
void SetRadioStyle(const std::string& style); |
| 119 |
const std::string GetRadioStyle() const; |
| 120 |
|
| 121 |
void SetPlayingRadioText(bool yesNo); |
| 122 |
bool IsPlayingRadioText() const; |
| 123 |
|
| 124 |
void SetPlayingRadioTextPlus(bool yesNo); |
| 125 |
bool IsPlayingRadioTextPlus() const; |
| 126 |
|
| 127 |
private: |
| 128 |
CPVRRadioRDSInfoTag(const CPVRRadioRDSInfoTag& tag) = delete; |
| 129 |
const CPVRRadioRDSInfoTag& operator =(const CPVRRadioRDSInfoTag& tag) = delete; |
| 130 |
|
| 131 |
static std::string Trim(const std::string& value); |
| 132 |
|
| 133 |
mutable CCriticalSection m_critSection; |
| 134 |
|
| 135 |
bool m_RDS_SpeechActive; |
| 136 |
|
| 137 |
std::string m_strLanguage; |
| 138 |
std::string m_strCountry; |
| 139 |
std::string m_strTitle; |
| 140 |
std::string m_strBand; |
| 141 |
std::string m_strArtist; |
| 142 |
std::string m_strComposer; |
| 143 |
std::string m_strConductor; |
| 144 |
std::string m_strAlbum; |
| 145 |
std::string m_strComment; |
| 146 |
int m_iAlbumTracknumber; |
| 147 |
std::string m_strRadioStyle; |
| 148 |
|
| 149 |
class Info |
| 150 |
{ |
| 151 |
public: |
| 152 |
Info() = delete; |
| 153 |
Info(size_t maxSize, bool prependData) : m_maxSize(maxSize), m_prependData(prependData) {} |
| 154 |
|
| 155 |
bool operator==(const Info& right) const; |
| 156 |
|
| 157 |
size_t Size() const { return m_data.size(); } |
| 158 |
size_t MaxSize() const { return m_maxSize; } |
| 159 |
|
| 160 |
void Clear(); |
| 161 |
void Add(const std::string& text); |
| 162 |
|
| 163 |
const std::string& GetText() const { return m_infoText; } |
| 164 |
std::string GetLine(unsigned int line) const |
| 165 |
{ |
| 166 |
return line < m_data.size() ? m_data.at(line) : ""; |
| 167 |
} |
| 168 |
|
| 169 |
private: |
| 170 |
const size_t m_maxSize = 10; |
| 171 |
const bool m_prependData = false; |
| 172 |
std::deque<std::string> m_data; |
| 173 |
std::string m_infoText; |
| 174 |
}; |
| 175 |
|
| 176 |
Info m_strInfoNews{10, false}; |
| 177 |
Info m_strInfoNewsLocal{10, false}; |
| 178 |
Info m_strInfoSport{10, false}; |
| 179 |
Info m_strInfoStock{10, false}; |
| 180 |
Info m_strInfoWeather{10, false}; |
| 181 |
Info m_strInfoLottery{10, false}; |
| 182 |
Info m_strInfoOther{10, false}; |
| 183 |
Info m_strInfoHoroscope{10, false}; |
| 184 |
Info m_strInfoCinema{10, false}; |
| 185 |
Info m_strEditorialStaff{10, false}; |
| 186 |
|
| 187 |
Info m_strRadioText{6, true}; |
| 188 |
|
| 189 |
Info m_strProgramServiceText{12, false}; |
| 190 |
std::string m_strProgramServiceLine0; |
| 191 |
std::string m_strProgramServiceLine1; |
| 192 |
|
| 193 |
std::string m_strProgStyle; |
| 194 |
std::string m_strProgHost; |
| 195 |
std::string m_strProgStation; |
| 196 |
std::string m_strProgWebsite; |
| 197 |
std::string m_strProgNow; |
| 198 |
std::string m_strProgNext; |
| 199 |
std::string m_strPhoneHotline; |
| 200 |
std::string m_strEMailHotline; |
| 201 |
std::string m_strPhoneStudio; |
| 202 |
std::string m_strEMailStudio; |
| 203 |
std::string m_strSMSStudio; |
| 204 |
|
| 205 |
bool m_bHaveRadioText; |
| 206 |
bool m_bHaveRadioTextPlus; |
| 207 |
}; |
| 208 |
} |