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 typedef std::pair<std::string, uint32_t> providerPair;
42 typedef std::set<providerPair> providerSet;
43 typedef std::set<uint16_t> caidSet;
44 typedef std::set<eServiceReference> serviceSet;
46 class eDVBCISlot: public iObject, public Object
48 friend class eDVBCIInterfaces;
49 DECLARE_REF(eDVBCISlot);
52 ePtr<eSocketNotifier> notifier;
54 std::map<uint16_t, uint8_t> running_services;
55 eDVBCIApplicationManagerSession *application_manager;
56 eDVBCICAManagerSession *ca_manager;
57 eDVBCIMMISession *mmi_session;
58 std::priority_queue<queueData> sendqueue;
59 caidSet possible_caids;
60 serviceSet possible_services;
61 providerSet possible_providers;
63 eDVBCISlot *linked_next; // needed for linked CI handling
64 data_source current_source;
70 enum {stateRemoved, stateInserted, stateInvalid, stateResetted};
71 eDVBCISlot(eMainloop *context, int nr);
74 int send(const unsigned char *data, size_t len);
76 void setAppManager( eDVBCIApplicationManagerSession *session );
77 void setMMIManager( eDVBCIMMISession *session );
78 void setCAManager( eDVBCICAManagerSession *session );
80 eDVBCIApplicationManagerSession *getAppManager() { return application_manager; }
81 eDVBCIMMISession *getMMIManager() { return mmi_session; }
82 eDVBCICAManagerSession *getCAManager() { return ca_manager; }
84 int getState() { return state; }
89 int answerText(int answer);
90 int answerEnq(char *value);
93 int sendCAPMT(eDVBServicePMTHandler *ptr, const std::vector<uint16_t> &caids=std::vector<uint16_t>());
94 void removeService(uint16_t program_number=0xFFFF);
95 int getNumOfServices() { return running_services.size(); }
96 int setSource(data_source source);
97 int setClockRate(int);
102 eDVBServicePMTHandler *pmthandler;
105 :pmthandler(NULL), cislot(NULL)
107 CIPmtHandler( const CIPmtHandler &x )
108 :pmthandler(x.pmthandler), cislot(x.cislot)
110 CIPmtHandler( eDVBServicePMTHandler *ptr )
111 :pmthandler(ptr), cislot(NULL)
113 bool operator==(const CIPmtHandler &x) const { return x.pmthandler == pmthandler; }
116 typedef std::list<CIPmtHandler> PMTHandlerList;
120 class eDVBCIInterfaces
122 DECLARE_REF(eDVBCIInterfaces);
123 static eDVBCIInterfaces *instance;
124 eSmartPtrList<eDVBCISlot> m_slots;
125 eDVBCISlot *getSlot(int slotid);
126 PMTHandlerList m_pmt_handlers;
133 void addPMTHandler(eDVBServicePMTHandler *pmthandler);
134 void removePMTHandler(eDVBServicePMTHandler *pmthandler);
135 void recheckPMTHandlers();
136 void gotPMT(eDVBServicePMTHandler *pmthandler);
137 void ciRemoved(eDVBCISlot *slot);
138 int getSlotState(int slot);
141 int initialize(int slot);
142 int startMMI(int slot);
143 int stopMMI(int slot);
144 int answerText(int slot, int answer);
145 int answerEnq(int slot, char *value);
146 int cancelEnq(int slot);
147 int getMMIState(int slot);
148 int sendCAPMT(int slot);
149 int setInputSource(int tunerno, data_source source);
150 int setCIClockRate(int slot, int rate);
154 static eDVBCIInterfaces *getInstance();
155 int getNumOfSlots() { return m_slots.size(); }
156 PyObject *getDescrambleRules(int slotid);
157 RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) );
158 PyObject *readCICaIds(int slotid);