5 #include <lib/dvb/idvb.h>
6 #include <lib/base/eptrlist.h>
8 class ServiceDescriptionSection;
11 class eDVBDB: public iDVBChannelList
14 static eDVBDB *instance;
15 friend class eDVBDBQuery;
16 friend class eDVBDBBouquetQuery;
17 friend class eDVBDBSatellitesQuery;
18 friend class eDVBDBProvidersQuery;
22 ePtr<iDVBFrontendParameters> m_frontendParameters;
25 std::map<eDVBChannelID, channel> m_channels;
27 std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_services;
29 std::map<std::string, eBouquet> m_bouquets;
36 RESULT removeFlags(unsigned int flagmask, int dvb_namespace=-1, int tsid=-1, int onid=-1, unsigned int orb_pos=0xFFFFFFFF);
37 RESULT removeServices(int dvb_namespace=-1, int tsid=-1, int onid=-1, unsigned int orb_pos=0xFFFFFFFF);
38 RESULT removeService(const eServiceReference &service);
39 RESULT addFlag(const eServiceReference &service, unsigned int flagmask);
40 RESULT removeFlag(const eServiceReference &service, unsigned int flagmask);
41 PyObject *readSatellites(SWIG_PYOBJECT(ePyObject) sat_list, SWIG_PYOBJECT(ePyObject) sat_dict, SWIG_PYOBJECT(ePyObject) tp_dict);
42 PyObject *readTerrestrials(SWIG_PYOBJECT(ePyObject) ter_list, SWIG_PYOBJECT(ePyObject) tp_dict);
43 PyObject *readCables(SWIG_PYOBJECT(ePyObject) cab_list, SWIG_PYOBJECT(ePyObject) tp_dict);
45 RESULT removeFlags(unsigned int flagmask, eDVBChannelID chid, unsigned int orb_pos);
46 RESULT removeServices(eDVBChannelID chid, unsigned int orb_pos);
47 RESULT removeServices(iDVBFrontendParameters *feparm);
49 RESULT addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters *feparm);
50 RESULT removeChannel(const eDVBChannelID &id);
52 RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr<iDVBFrontendParameters> &parm);
54 RESULT addService(const eServiceReferenceDVB &referenc, eDVBService *service);
55 RESULT getService(const eServiceReferenceDVB &reference, ePtr<eDVBService> &service);
58 RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *q, const eServiceReference &source);
60 RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet);
62 void loadBouquet(const char *path);
63 eServiceReference searchReference(int tsid, int onid, int sid);
64 void searchAllReferences(std::vector<eServiceReference> &result, int tsid, int onid, int sid);
68 void loadServicelist(const char *filename);
69 static eDVBDB *getInstance() { return instance; }
70 void reloadServicelist();
71 void saveServicelist();
72 void saveServicelist(const char *file);
73 void reloadBouquets();
74 void parseServiceData(ePtr<eDVBService> s, std::string str);
78 // we have to add a possibility to invalidate here.
79 class eDVBDBQueryBase: public iDVBChannelListQuery
81 DECLARE_REF(eDVBDBQueryBase);
84 ePtr<eDVBChannelQuery> m_query;
85 eServiceReference m_source;
87 eDVBDBQueryBase(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
88 virtual int compareLessEqual(const eServiceReferenceDVB &a, const eServiceReferenceDVB &b);
91 class eDVBDBQuery: public eDVBDBQueryBase
93 std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_cursor;
95 eDVBDBQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
96 RESULT getNextResult(eServiceReferenceDVB &ref);
99 class eDVBDBBouquetQuery: public eDVBDBQueryBase
101 std::list<eServiceReference>::iterator m_cursor;
103 eDVBDBBouquetQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
104 RESULT getNextResult(eServiceReferenceDVB &ref);
107 class eDVBDBListQuery: public eDVBDBQueryBase
110 std::list<eServiceReferenceDVB> m_list;
111 std::list<eServiceReferenceDVB>::iterator m_cursor;
113 eDVBDBListQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
114 RESULT getNextResult(eServiceReferenceDVB &ref);
115 int compareLessEqual(const eServiceReferenceDVB &a, const eServiceReferenceDVB &b);
118 class eDVBDBSatellitesQuery: public eDVBDBListQuery
121 eDVBDBSatellitesQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
124 class eDVBDBProvidersQuery: public eDVBDBListQuery
127 eDVBDBProvidersQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);