1 #ifndef __dvbci_dvbci_h
2 #define __dvbci_dvbci_h
6 #include <lib/base/ebase.h>
7 #include <lib/dvb/ecm.h>
8 #include <lib/service/iservice.h>
9 #include <lib/python/python.h>
14 class eDVBCIApplicationManagerSession;
15 class eDVBCICAManagerSession;
16 class eDVBCIMMISession;
17 class eDVBServicePMTHandler;
19 class eDVBCIInterfaces;
26 queueData( unsigned char *data, unsigned int len, __u8 prio = 0 )
27 :prio(prio), data(data), len(len)
31 bool operator < ( const struct queueData &a ) const
39 TUNER_A=0, TUNER_B, TUNER_C, TUNER_D, TUNER_E, TUNER_F, TUNER_G, TUNER_H, TUNER_I, TUNER_J, TUNER_K, TUNER_L, TUNER_M, TUNER_N, TUNER_O, TUNER_P, TUNER_Q, TUNER_R, TUNER_S, TUNER_T, TUNER_U, TUNER_V, CI_A, CI_B, CI_C, CI_D, PVR, PVR_NONE
42 typedef std::pair<std::string, uint32_t> providerPair;
43 typedef std::set<providerPair> providerSet;
44 typedef std::set<uint16_t> caidSet;
45 typedef std::set<eServiceReference> serviceSet;
47 class eDVBCISlot: public iObject, public Object
49 friend class eDVBCIInterfaces;
50 DECLARE_REF(eDVBCISlot);
53 ePtr<eSocketNotifier> notifier;
55 std::map<uint16_t, uint8_t> running_services;
56 eDVBCIApplicationManagerSession *application_manager;
57 eDVBCICAManagerSession *ca_manager;
58 eDVBCIMMISession *mmi_session;
59 std::priority_queue<queueData> sendqueue;
60 caidSet possible_caids;
61 serviceSet possible_services;
62 providerSet possible_providers;
64 eDVBCISlot *linked_next; // needed for linked CI handling
65 data_source current_source;
70 eSmartPtrList<eDVBECMParser> m_ecms;
72 enum {stateRemoved, stateInserted, stateInvalid, stateResetted};
73 eDVBCISlot(eMainloop *context, int nr);
76 int send(const unsigned char *data, size_t len);
78 void setAppManager( eDVBCIApplicationManagerSession *session );
79 void setMMIManager( eDVBCIMMISession *session );
80 void setCAManager( eDVBCICAManagerSession *session );
82 eDVBCIApplicationManagerSession *getAppManager() { return application_manager; }
83 eDVBCIMMISession *getMMIManager() { return mmi_session; }
84 eDVBCICAManagerSession *getCAManager() { return ca_manager; }
86 int getState() { return state; }
91 int answerText(int answer);
92 int answerEnq(char *value);
95 int sendCAPMT(eDVBServicePMTHandler *ptr, const std::vector<uint16_t> &caids=std::vector<uint16_t>());
96 void removeService(uint16_t program_number=0xFFFF);
97 int getNumOfServices() { return running_services.size(); }
98 int setSource(data_source source);
99 int setClockRate(int);
100 void addVtunerPid(eDVBServicePMTHandler *pmthandler);
101 void removeVtunerPid(void);
106 eDVBServicePMTHandler *pmthandler;
109 :pmthandler(NULL), cislot(NULL)
111 CIPmtHandler( const CIPmtHandler &x )
112 :pmthandler(x.pmthandler), cislot(x.cislot)
114 CIPmtHandler( eDVBServicePMTHandler *ptr )
115 :pmthandler(ptr), cislot(NULL)
117 bool operator==(const CIPmtHandler &x) const { return x.pmthandler == pmthandler; }
120 typedef std::list<CIPmtHandler> PMTHandlerList;
124 class eDVBCIInterfaces
126 DECLARE_REF(eDVBCIInterfaces);
127 static eDVBCIInterfaces *instance;
128 eSmartPtrList<eDVBCISlot> m_slots;
129 eDVBCISlot *getSlot(int slotid);
130 PMTHandlerList m_pmt_handlers;
137 void addPMTHandler(eDVBServicePMTHandler *pmthandler);
138 void removePMTHandler(eDVBServicePMTHandler *pmthandler);
139 void recheckPMTHandlers();
140 void gotPMT(eDVBServicePMTHandler *pmthandler);
141 bool isCiConnected(eDVBServicePMTHandler *pmthandler);
142 void ciRemoved(eDVBCISlot *slot);
143 int getSlotState(int slot);
146 int initialize(int slot);
147 int startMMI(int slot);
148 int stopMMI(int slot);
149 int answerText(int slot, int answer);
150 int answerEnq(int slot, char *value);
151 int cancelEnq(int slot);
152 int getMMIState(int slot);
153 int sendCAPMT(int slot);
154 int setInputSource(int tunerno, data_source source);
155 int setCIClockRate(int slot, int rate);
159 static eDVBCIInterfaces *getInstance();
160 int getNumOfSlots() { return m_slots.size(); }
161 PyObject *getDescrambleRules(int slotid);
162 RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) );
163 PyObject *readCICaIds(int slotid);