add a blinking point to the infobar
[enigma2.git] / lib / dvb / db.h
1 #ifndef __db_h
2 #define __db_h
3
4 #include <lib/base/eptrlist.h>
5 #include <lib/dvb/idvb.h>
6 #include <set>
7
8 class ServiceDescriptionSection;
9
10 class eDVBDB: public iDVBChannelList
11 {
12 DECLARE_REF(eDVBDB);
13         friend class eDVBDBQuery;
14         friend class eDVBDBBouquetQuery;
15 private:
16         struct channel
17         {
18                 ePtr<iDVBFrontendParameters> m_frontendParameters;
19         };
20         
21         std::map<eDVBChannelID, channel> m_channels;
22         
23         std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_services;
24         
25         std::map<std::string, eBouquet> m_bouquets;
26 public:
27         void load();
28         void save();
29
30         void loadBouquet(const char *path);
31         void loadBouquets();
32
33         eDVBDB();
34         virtual ~eDVBDB();
35         
36         RESULT addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters *feparm);
37         RESULT removeChannel(const eDVBChannelID &id);
38
39         RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr<iDVBFrontendParameters> &parm);
40         
41         RESULT addService(const eServiceReferenceDVB &service, eDVBService *service);
42         RESULT getService(const eServiceReferenceDVB &reference, ePtr<eDVBService> &service);
43         RESULT flush();
44
45         RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *query, const eServiceReference &source);
46
47         RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet);
48 };
49
50         // we have to add a possibility to invalidate here.
51 class eDVBDBQueryBase: public iDVBChannelListQuery
52 {
53 DECLARE_REF(eDVBDBQueryBase);
54 protected:
55         std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_cursor;
56         ePtr<eDVBDB> m_db;
57         ePtr<eDVBChannelQuery> m_query;
58         eServiceReference m_source;
59 public:
60         eDVBDBQueryBase(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
61         int compareLessEqual(const eServiceReferenceDVB &a, const eServiceReferenceDVB &b);
62 };
63
64 class eDVBDBQuery: public eDVBDBQueryBase
65 {
66         std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_cursor;
67 public:
68         eDVBDBQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
69         RESULT getNextResult(eServiceReferenceDVB &ref);
70 };
71
72 class eDVBDBBouquetQuery: public eDVBDBQueryBase
73 {
74         std::list<eServiceReference>::iterator m_cursor;
75 public:
76         eDVBDBBouquetQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
77         RESULT getNextResult(eServiceReferenceDVB &ref);
78 };
79
80 #endif