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;
72 ePtr<eDVBECMParser> m_ecm[NUM_OF_ECM];
75 enum {stateRemoved, stateInserted, stateInvalid, stateResetted};
76 eDVBCISlot(eMainloop *context, int nr);
79 int send(const unsigned char *data, size_t len);
81 void setAppManager( eDVBCIApplicationManagerSession *session );
82 void setMMIManager( eDVBCIMMISession *session );
83 void setCAManager( eDVBCICAManagerSession *session );
85 eDVBCIApplicationManagerSession *getAppManager() { return application_manager; }
86 eDVBCIMMISession *getMMIManager() { return mmi_session; }
87 eDVBCICAManagerSession *getCAManager() { return ca_manager; }
89 int getState() { return state; }
94 int answerText(int answer);
95 int answerEnq(char *value);
98 int sendCAPMT(eDVBServicePMTHandler *ptr, const std::vector<uint16_t> &caids=std::vector<uint16_t>());
99 void removeService(uint16_t program_number=0xFFFF);
100 int getNumOfServices() { return running_services.size(); }
101 int setSource(data_source source);
102 int setClockRate(int);
103 void addVtunerPid(eDVBServicePMTHandler *pmthandler);
104 void removeVtunerPid(void);
109 eDVBServicePMTHandler *pmthandler;
112 :pmthandler(NULL), cislot(NULL)
114 CIPmtHandler( const CIPmtHandler &x )
115 :pmthandler(x.pmthandler), cislot(x.cislot)
117 CIPmtHandler( eDVBServicePMTHandler *ptr )
118 :pmthandler(ptr), cislot(NULL)
120 bool operator==(const CIPmtHandler &x) const { return x.pmthandler == pmthandler; }
123 typedef std::list<CIPmtHandler> PMTHandlerList;
127 class eDVBCIInterfaces
129 DECLARE_REF(eDVBCIInterfaces);
130 static eDVBCIInterfaces *instance;
131 eSmartPtrList<eDVBCISlot> m_slots;
132 eDVBCISlot *getSlot(int slotid);
133 PMTHandlerList m_pmt_handlers;
140 void addPMTHandler(eDVBServicePMTHandler *pmthandler);
141 void removePMTHandler(eDVBServicePMTHandler *pmthandler);
142 void recheckPMTHandlers();
143 void gotPMT(eDVBServicePMTHandler *pmthandler);
144 bool isCiConnected(eDVBServicePMTHandler *pmthandler);
145 void ciRemoved(eDVBCISlot *slot);
146 int getSlotState(int slot);
149 int initialize(int slot);
150 int startMMI(int slot);
151 int stopMMI(int slot);
152 int answerText(int slot, int answer);
153 int answerEnq(int slot, char *value);
154 int cancelEnq(int slot);
155 int getMMIState(int slot);
156 int sendCAPMT(int slot);
157 int setInputSource(int tunerno, data_source source);
158 int setCIClockRate(int slot, int rate);
162 static eDVBCIInterfaces *getInstance();
163 int getNumOfSlots() { return m_slots.size(); }
164 PyObject *getDescrambleRules(int slotid);
165 RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) );
166 PyObject *readCICaIds(int slotid);