1 #ifndef __dvbci_dvbci_h
2 #define __dvbci_dvbci_h
6 #include <lib/base/ebase.h>
7 #include <lib/service/iservice.h>
8 #include <lib/python/python.h>
13 class eDVBCIApplicationManagerSession;
14 class eDVBCICAManagerSession;
15 class eDVBCIMMISession;
16 class eDVBServicePMTHandler;
18 class eDVBCIInterfaces;
25 queueData( unsigned char *data, unsigned int len, __u8 prio = 0 )
26 :prio(prio), data(data), len(len)
30 bool operator < ( const struct queueData &a ) const
38 TUNER_A, TUNER_B, TUNER_C, TUNER_D, CI_A, CI_B, CI_C, CI_D
41 class eDVBCISlot: public iObject, public Object
43 friend class eDVBCIInterfaces;
44 DECLARE_REF(eDVBCISlot);
47 ePtr<eSocketNotifier> notifier;
49 std::map<uint16_t, uint8_t> running_services;
50 eDVBCIApplicationManagerSession *application_manager;
51 eDVBCICAManagerSession *ca_manager;
52 eDVBCIMMISession *mmi_session;
53 std::priority_queue<queueData> sendqueue;
54 std::set<uint16_t> possible_caids;
55 std::set<eServiceReference> possible_services;
56 std::set<std::string> possible_providers;
58 eDVBCISlot *linked_next; // needed for linked CI handling
59 data_source current_source;
63 enum {stateRemoved, stateInserted, stateInvalid, stateResetted};
64 eDVBCISlot(eMainloop *context, int nr);
67 int send(const unsigned char *data, size_t len);
69 void setAppManager( eDVBCIApplicationManagerSession *session );
70 void setMMIManager( eDVBCIMMISession *session );
71 void setCAManager( eDVBCICAManagerSession *session );
73 eDVBCIApplicationManagerSession *getAppManager() { return application_manager; }
74 eDVBCIMMISession *getMMIManager() { return mmi_session; }
75 eDVBCICAManagerSession *getCAManager() { return ca_manager; }
77 int getState() { return state; }
82 int answerText(int answer);
83 int answerEnq(char *value);
86 int sendCAPMT(eDVBServicePMTHandler *ptr, const std::vector<uint16_t> &caids=std::vector<uint16_t>());
87 void removeService(uint16_t program_number=0xFFFF);
88 int getNumOfServices() { return running_services.size(); }
89 int setSource(data_source source);
94 eDVBServicePMTHandler *pmthandler;
97 :pmthandler(NULL), cislot(NULL)
99 CIPmtHandler( const CIPmtHandler &x )
100 :pmthandler(x.pmthandler), cislot(x.cislot)
102 CIPmtHandler( eDVBServicePMTHandler *ptr )
103 :pmthandler(ptr), cislot(NULL)
105 bool operator==(const CIPmtHandler &x) const { return x.pmthandler == pmthandler; }
108 typedef std::list<CIPmtHandler> PMTHandlerList;
112 class eDVBCIInterfaces
114 DECLARE_REF(eDVBCIInterfaces);
115 static eDVBCIInterfaces *instance;
116 eSmartPtrList<eDVBCISlot> m_slots;
117 eDVBCISlot *getSlot(int slotid);
118 PMTHandlerList m_pmt_handlers;
125 void addPMTHandler(eDVBServicePMTHandler *pmthandler);
126 void removePMTHandler(eDVBServicePMTHandler *pmthandler);
127 void recheckPMTHandlers();
128 void gotPMT(eDVBServicePMTHandler *pmthandler);
129 void ciRemoved(eDVBCISlot *slot);
130 int getSlotState(int slot);
133 int initialize(int slot);
134 int startMMI(int slot);
135 int stopMMI(int slot);
136 int answerText(int slot, int answer);
137 int answerEnq(int slot, char *value);
138 int cancelEnq(int slot);
139 int getMMIState(int slot);
140 int sendCAPMT(int slot);
141 int setInputSource(int tunerno, data_source source);
145 static eDVBCIInterfaces *getInstance();
146 int getNumOfSlots() { return m_slots.size(); }
147 PyObject *getDescrambleRules(int slotid);
148 RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) );