you can now delete characters in the timerentry description with the mute-key
[enigma2.git] / lib / dvb_ci / dvbci.h
1 #ifndef __dvbci_dvbci_h
2 #define __dvbci_dvbci_h
3
4 #include <lib/base/ebase.h>
5
6 #include <set>
7
8 class eDVBCISession;
9 class eDVBCIApplicationManagerSession;
10 class eDVBCICAManagerSession;
11 class eDVBCIMMISession;
12 class eDVBServicePMTHandler;
13 class eDVBCISlot;
14
15 class eDVBCISlot: public iObject, public Object
16 {
17 DECLARE_REF(eDVBCISlot);
18 private:
19         int slotid;
20         int fd;
21         void data(int);
22         eSocketNotifier *notifier;
23
24         int state;
25         enum {stateRemoved, stateInserted};
26         uint8_t prev_sent_capmt_version;
27 public:
28         int use_count;
29
30         eDVBCISlot(eMainloop *context, int nr);
31         ~eDVBCISlot();
32         
33         int send(const unsigned char *data, size_t len);
34         
35         eDVBCIApplicationManagerSession *application_manager;
36         eDVBCICAManagerSession *ca_manager;
37         eDVBCIMMISession *mmi_session;
38         
39         int getSlotID();
40         int reset();
41         int initialize();
42         int startMMI();
43         int stopMMI();
44         int answerText(int answer);
45         int answerEnq(char *value);
46         int cancelEnq();
47         int getMMIState();
48         int sendCAPMT(eDVBServicePMTHandler *ptr, const std::vector<uint16_t> &caids=std::vector<uint16_t>());
49         uint8_t getPrevSentCAPMTVersion() const { return prev_sent_capmt_version; }
50         void resetPrevSentCAPMTVersion() { prev_sent_capmt_version = 0xFF; }
51 };
52
53 struct CIPmtHandler
54 {
55         eDVBServicePMTHandler *pmthandler;
56         eDVBCISlot *cislot;
57         CIPmtHandler()
58                 :pmthandler(NULL), cislot(NULL)
59         {}
60         CIPmtHandler( const CIPmtHandler &x )
61                 :pmthandler(x.pmthandler), cislot(x.cislot)
62         {}
63         CIPmtHandler( eDVBServicePMTHandler *ptr )
64                 :pmthandler(ptr), cislot(NULL)
65         {}
66         bool operator==(const CIPmtHandler &x) const { return x.pmthandler == pmthandler; }
67 };
68
69 typedef std::list<CIPmtHandler> PMTHandlerList;
70
71 class eDVBCIInterfaces
72 {
73 DECLARE_REF(eDVBCIInterfaces);
74         static eDVBCIInterfaces *instance;
75 private:
76         eSmartPtrList<eDVBCISlot>       m_slots;
77         eDVBCISlot *getSlot(int slotid);
78
79         PMTHandlerList m_pmt_handlers; 
80 public:
81         eDVBCIInterfaces();
82         ~eDVBCIInterfaces();
83
84         void addPMTHandler(eDVBServicePMTHandler *pmthandler);
85         void removePMTHandler(eDVBServicePMTHandler *pmthandler);
86         void gotPMT(eDVBServicePMTHandler *pmthandler);
87
88         static eDVBCIInterfaces *getInstance();
89         
90         int reset(int slot);
91         int initialize(int slot);
92         int startMMI(int slot);
93         int stopMMI(int slot);
94         int answerText(int slot, int answer);
95         int answerEnq(int slot, char *value);
96         int cancelEnq(int slot);
97         int getMMIState(int slot);
98 };
99
100 #endif