openATV enigma2
openATV is an open source SetTopBox Graphical user interface.
event.h
Go to the documentation of this file.
1 #ifndef __lib_service_event_h
2 #define __lib_service_event_h
3 
4 #ifndef SWIG
5 #include <time.h>
6 #include <list>
7 #include <string>
8 class Event;
9 #endif
10 
11 #include <lib/base/object.h>
12 #include <lib/service/iservice.h>
13 #include <lib/dvb/atsc.h>
14 
17 {
18  friend class eServiceEvent;
20  uint8_t m_streamContent;
21  uint8_t m_componentType;
22  uint8_t m_componentTag;
23  std::string m_iso639LanguageCode;
24  std::string m_text;
25 public:
26  eComponentData(const eComponentData& d) { *this = d; }
29  int getStreamContent(void) const { return m_streamContent; }
30  int getComponentType(void) const { return m_componentType; }
31  int getComponentTag(void) const { return m_componentTag; }
32  std::string getIso639LanguageCode(void) const { return m_iso639LanguageCode; }
33  std::string getText(void) const { return m_text; }
34 };
36 
38 struct eGenreData
39 {
40  friend class eServiceEvent;
42  uint8_t m_level1;
43  uint8_t m_level2;
44  uint8_t m_user1;
45  uint8_t m_user2;
46 public:
47  eGenreData(const eGenreData& d) { *this = d; }
48  eGenreData& operator =(const eGenreData &) = default;
50  int getLevel1(void) const { return m_level1; }
51  int getLevel2(void) const { return m_level2; }
52  int getUser1(void) const { return m_user1; }
53  int getUser2(void) const { return m_user2; }
54 };
56 
59 {
60  friend class eServiceEvent;
62  std::string m_country_code;
63  uint8_t m_rating;
64 public:
65  eParentalData(const eParentalData& d) { *this = d; }
66  eParentalData& operator =(const eParentalData &) = default;
68  std::string getCountryCode(void) const { return m_country_code; }
69  int getRating(void) const { return m_rating; }
70 };
72 
73 
75 {
76  // CRID matches are for all CRIDs of that class:
77  // SERIES_MATCH matches both SERIES and SERIES_AU
78  enum {
79  EPISODE = 0x1,
80  SERIES = 0x2,
82 
83  // Australian CRID types are 0x31-0x33
84  // FreeTV Australia Operational Practice
85  // OP-72: Implementation of Content Reference
86  // IDs by Australian Television Broadcasters
87 
88  OFFSET_AU = 0x30,
92  };
93 };
94 
96 struct eCridData: public eCridData_ENUMS
97 {
98  friend class eServiceEvent;
100  uint8_t m_type;
101  uint8_t m_location;
102  std::string m_crid;
103 public:
104  eCridData(const eCridData& d) { *this = d; }
105  eCridData() { m_crid = ""; m_type = 0; m_location = 0; }
106  int getLocation(void) const { return m_location; }
107  int getType(void) const { return m_type; }
108  std::string getCrid(void) const { return m_crid; }
109 };
111 
112 
113 SWIG_ALLOW_OUTPUT_SIMPLE(eServiceReference); // needed for SWIG_OUTPUT in eServiceEvent::getLinkageService
114 
116 {
117 public:
118  // CRID matches are for all CRIDs of that class:
119  // SERIES_MATCH matches both SERIES and SERIES_AU
120  enum {
125  };
126 };
127 
129 class eServiceEvent: public iObject
130 {
131  DECLARE_REF(eServiceEvent);
132  static std::string crid_scheme;
133  static std::string normalise_crid(std::string crid, ePtr<eDVBService> service);
134  bool loadLanguage(Event *event, const std::string &lang, int tsidonid, int sid);
135  std::list<eComponentData> m_component_data;
136  std::list<eServiceReference> m_linkage_services;
137  std::list<eGenreData> m_genres;
138  std::list<eParentalData> m_ratings;
139  time_t m_begin;
140  int m_duration;
141  int m_event_id;
142  int m_pdc_pil;
143  int m_running_status;
144  std::string m_event_name, m_short_description, m_extended_description, m_extra_event_data, m_epg_source, m_extended_description_items;
145  std::string m_series_crid, m_episode_crid, m_recommendation_crid;
146  static std::string m_language, m_language_alternative;
147  std::list<eCridData> m_crids;
148  // .. additional info
149 public:
150  eServiceEvent();
151 #ifndef SWIG
152  RESULT parseFrom(Event *evt, int tsidonid, int sid);
153  RESULT parseFrom(Event *evt, int tsidonid=0);
154  RESULT parseFrom(ATSCEvent *evt);
156  RESULT parseFrom(const std::string& filename, int tsidonid, int sid);
157  RESULT parseFrom(const std::string& filename, int tsidonid=0);
158  static void setEPGLanguage(const std::string& language) { m_language = language; }
159  static void setEPGLanguageAlternative(const std::string& language) { m_language_alternative = language; }
160 #endif
161  time_t getBeginTime() const { return m_begin; }
162  int getDuration() const { return m_duration; }
163  int getEventId() const { return m_event_id; }
164  int getPdcPil() const { return m_pdc_pil; }
165  int getRunningStatus() const { return m_running_status; }
166  std::string getEventName() const { return m_event_name; }
167  std::string getShortDescription() const { return m_short_description; }
168  std::string getExtendedDescription() const { return m_extended_description; }
169  std::string getExtraEventData() const { return m_extra_event_data; }
170  std::string getEPGSource() const { return m_epg_source; }
171  std::string getBeginTimeString() const;
172  std::string getSeriesCRID() const { return m_series_crid; }
173  std::string getEpisodeCRID() const { return m_episode_crid; }
174  std::string getRecommendationCRID() const { return m_recommendation_crid; }
176  // Naming to parallel getGenreDataList & getParentalDataList
177  PyObject *getComponentDataList() const;
178  PyObject *getComponentData() const
179  {
180  return getComponentDataList();
181  }
182  int getNumOfLinkageServices() const { return m_linkage_services.size(); }
183  SWIG_VOID(RESULT) getLinkageService(eServiceReference &SWIG_OUTPUT, eServiceReference &parent, int num) const;
185  PyObject *getGenreDataList() const;
186  // Deprecated, doesn't differentiate from
187  // getGenreData(ePtr<eGenreData> &SWIG_OUTPUT) in Python
188  PyObject *getGenreData() const
189  {
190  return getGenreDataList();
191  }
193  PyObject *getParentalDataList() const;
194  // Deprecated, doesn't differentiate from
195  // getGenreData(ePtr<eGenreData> &SWIG_OUTPUT) in Python
196  PyObject *getParentalData() const
197  {
198  return getParentalDataList();
199  }
200 
201  PyObject *getCridData(int mask) const;
202  static void setDebug(bool debug) {m_Debug = debug;}
203  private:
204  static bool m_Debug;
205 };
208  static void setEPGLanguage(const std::string& language)
209  {
211  }
212 );
214  static void setEPGLanguageAlternative(const std::string& language)
215  {
217  }
218 );
219 
220 #ifndef SWIG
222 class eDebugClass: public iObject
223 {
224  DECLARE_REF(eDebugClass);
225 public:
226  int x;
227  static void getDebug(ePtr<eDebugClass> &ptr, int x) { ptr = new eDebugClass(x); }
228  eDebugClass(int i) { printf("build debug class %d\n", i); x = i; }
229  ~eDebugClass() { printf("remove debug class %d\n", x); }
230 };
232 #endif
233 
234 #endif
static int ptr
Definition: bcm.cpp:17
Definition: atsc.h:182
Definition: atsc.h:226
Definition: event.h:223
~eDebugClass()
Definition: event.h:229
static void getDebug(ePtr< eDebugClass > &ptr, int x)
Definition: event.h:227
int x
Definition: event.h:226
eDebugClass(int i)
Definition: event.h:228
Definition: smartptr.h:11
Definition: event.h:130
eServiceReference & parent
Definition: event.h:183
std::string getEventName() const
Definition: event.h:166
SWIG_VOID(RESULT) getParentalData(ePtr< eParentalData > &SWIG_OUTPUT) const
std::string getEPGSource() const
Definition: event.h:170
PyObject * getParentalDataList() const
Definition: event.cpp:401
static void setEPGLanguageAlternative(const std::string &language)
Definition: event.h:159
SWIG_VOID(RESULT) getComponentData(ePtr< eComponentData > &SWIG_OUTPUT
PyObject * getComponentData() const
Definition: event.h:178
std::string getRecommendationCRID() const
Definition: event.h:174
std::string getExtraEventData() const
Definition: event.h:169
static void setEPGLanguage(const std::string &language)
Definition: event.h:158
PyObject * getParentalData() const
Definition: event.h:196
int getRunningStatus() const
Definition: event.h:165
PyObject * getComponentDataList() const
Definition: event.cpp:451
int getPdcPil() const
Definition: event.h:164
int getEventId() const
Definition: event.h:163
time_t getBeginTime() const
Definition: event.h:161
int getNumOfLinkageServices() const
Definition: event.h:182
std::string getExtendedDescription() const
Definition: event.h:168
RESULT parseFrom(Event *evt, int tsidonid, int sid)
Definition: event.cpp:288
SWIG_VOID(RESULT) getGenreData(ePtr< eGenreData > &SWIG_OUTPUT) const
std::string getSeriesCRID() const
Definition: event.h:172
eServiceEvent()
Definition: event.cpp:70
std::string getEpisodeCRID() const
Definition: event.h:173
int getDuration() const
Definition: event.h:162
PyObject * getGenreData() const
Definition: event.h:188
static void setDebug(bool debug)
Definition: event.h:202
std::string getShortDescription() const
Definition: event.h:167
PyObject * getCridData(int mask) const
Definition: event.cpp:415
std::string getBeginTimeString() const
Definition: event.cpp:350
PyObject * getGenreDataList() const
Definition: event.cpp:373
Definition: iservice.h:15
Definition: object.h:15
const char * filename
Definition: epng.h:36
SWIG_ALLOW_OUTPUT_SIMPLE(eServiceReference)
SWIG_TEMPLATE_TYPEDEF(ePtr< eComponentData >, eComponentDataPtr)
SWIG_IGNORE(eComponentData)
SWIG_EXTEND(ePtr< eServiceEvent >, static void setEPGLanguage(const std::string &language) { eServiceEvent::setEPGLanguage(language);})
debug
Definition: Components/HdmiCec.py:77
language
Definition: Language.py:57
int RESULT
Definition: object.h:12
Definition: event.h:17
uint8_t m_componentType
Definition: event.h:21
int getStreamContent(void) const
Definition: event.h:29
int getComponentTag(void) const
Definition: event.h:31
eComponentData(const eComponentData &d)
Definition: event.h:26
eComponentData()
Definition: event.h:28
uint8_t m_componentTag
Definition: event.h:22
std::string getText(void) const
Definition: event.h:33
int getComponentType(void) const
Definition: event.h:30
eComponentData & operator=(const eComponentData &)=default
DECLARE_REF(eComponentData)
std::string getIso639LanguageCode(void) const
Definition: event.h:32
std::string m_iso639LanguageCode
Definition: event.h:23
uint8_t m_streamContent
Definition: event.h:20
std::string m_text
Definition: event.h:24
Definition: event.h:75
@ EPISODE
Definition: event.h:79
@ RECOMMENDATION
Definition: event.h:81
@ RECOMMENDATION_AU
Definition: event.h:91
@ SERIES_AU
Definition: event.h:90
@ SERIES
Definition: event.h:80
@ OFFSET_AU
Definition: event.h:88
@ EPISODE_AU
Definition: event.h:89
Definition: event.h:97
std::string m_crid
Definition: event.h:102
std::string getCrid(void) const
Definition: event.h:108
uint8_t m_location
Definition: event.h:101
eCridData(const eCridData &d)
Definition: event.h:104
eCridData()
Definition: event.h:105
uint8_t m_type
Definition: event.h:100
int getLocation(void) const
Definition: event.h:106
DECLARE_REF(eCridData)
int getType(void) const
Definition: event.h:107
Definition: event.h:39
eGenreData & operator=(const eGenreData &)=default
eGenreData(const eGenreData &d)
Definition: event.h:47
uint8_t m_user2
Definition: event.h:45
int getLevel1(void) const
Definition: event.h:50
uint8_t m_user1
Definition: event.h:44
uint8_t m_level2
Definition: event.h:43
eGenreData()
Definition: event.h:49
int getLevel2(void) const
Definition: event.h:51
DECLARE_REF(eGenreData)
uint8_t m_level1
Definition: event.h:42
int getUser2(void) const
Definition: event.h:53
int getUser1(void) const
Definition: event.h:52
Definition: event.h:59
std::string m_country_code
Definition: event.h:62
eParentalData(const eParentalData &d)
Definition: event.h:65
DECLARE_REF(eParentalData)
uint8_t m_rating
Definition: event.h:63
std::string getCountryCode(void) const
Definition: event.h:68
int getRating(void) const
Definition: event.h:69
eParentalData & operator=(const eParentalData &)=default
eParentalData()
Definition: event.h:67
Definition: event.h:116
@ ALL_MATCH
Definition: event.h:124
@ RECOMMENDATION_MATCH
Definition: event.h:123
@ SERIES_MATCH
Definition: event.h:121
@ EPISODE_MATCH
Definition: event.h:122
Definition: dvb/scan.h:16
#define SWIG_OUTPUT
Definition: swig.h:20