X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb_ci%2Fdvbci.h;h=de84e181cabbb24cd485fb257d45b172054f63ba;hp=eb4b6b041aca99d4976292f63246a9ce916a6f8b;hb=287f7c2cfaf264b079cce1bf789d118ee444180f;hpb=61402686fd1130b5b183fbe853927180be1ba1e1 diff --git a/lib/dvb_ci/dvbci.h b/lib/dvb_ci/dvbci.h index eb4b6b0..de84e18 100644 --- a/lib/dvb_ci/dvbci.h +++ b/lib/dvb_ci/dvbci.h @@ -1,40 +1,161 @@ #ifndef __dvbci_dvbci_h #define __dvbci_dvbci_h +#ifndef SWIG + #include +#include +#include +#include +#include class eDVBCISession; class eDVBCIApplicationManagerSession; class eDVBCICAManagerSession; +class eDVBCIMMISession; +class eDVBServicePMTHandler; +class eDVBCISlot; +class eDVBCIInterfaces; + +struct queueData +{ + __u8 prio; + unsigned char *data; + unsigned int len; + queueData( unsigned char *data, unsigned int len, __u8 prio = 0 ) + :prio(prio), data(data), len(len) + { + + } + bool operator < ( const struct queueData &a ) const + { + return prio < a.prio; + } +}; + +enum data_source +{ + TUNER_A, TUNER_B, TUNER_C, TUNER_D, CI_A, CI_B, CI_C, CI_D +}; + +typedef std::pair providerPair; +typedef std::set providerSet; +typedef std::set caidSet; +typedef std::set serviceSet; class eDVBCISlot: public iObject, public Object { -DECLARE_REF(eDVBCISlot); -private: + friend class eDVBCIInterfaces; + DECLARE_REF(eDVBCISlot); + int slotid; int fd; - void data(int); - eSocketNotifier *notifier; - + ePtr notifier; int state; - enum {stateRemoved, stateInserted}; + std::map running_services; + eDVBCIApplicationManagerSession *application_manager; + eDVBCICAManagerSession *ca_manager; + eDVBCIMMISession *mmi_session; + std::priority_queue sendqueue; + caidSet possible_caids; + serviceSet possible_services; + providerSet possible_providers; + int use_count; + eDVBCISlot *linked_next; // needed for linked CI handling + data_source current_source; + int current_tuner; + bool user_mapped; + void data(int); + bool plugged; public: + enum {stateRemoved, stateInserted, stateInvalid, stateResetted}; eDVBCISlot(eMainloop *context, int nr); ~eDVBCISlot(); int send(const unsigned char *data, size_t len); - - eDVBCIApplicationManagerSession *application_manager; - eDVBCICAManagerSession *ca_manager; + + void setAppManager( eDVBCIApplicationManagerSession *session ); + void setMMIManager( eDVBCIMMISession *session ); + void setCAManager( eDVBCICAManagerSession *session ); + + eDVBCIApplicationManagerSession *getAppManager() { return application_manager; } + eDVBCIMMISession *getMMIManager() { return mmi_session; } + eDVBCICAManagerSession *getCAManager() { return ca_manager; } + + int getState() { return state; } + int getSlotID(); + int reset(); + int startMMI(); + int stopMMI(); + int answerText(int answer); + int answerEnq(char *value); + int cancelEnq(); + int getMMIState(); + int sendCAPMT(eDVBServicePMTHandler *ptr, const std::vector &caids=std::vector()); + void removeService(uint16_t program_number=0xFFFF); + int getNumOfServices() { return running_services.size(); } + int setSource(data_source source); + int setClockRate(int); +}; + +struct CIPmtHandler +{ + eDVBServicePMTHandler *pmthandler; + eDVBCISlot *cislot; + CIPmtHandler() + :pmthandler(NULL), cislot(NULL) + {} + CIPmtHandler( const CIPmtHandler &x ) + :pmthandler(x.pmthandler), cislot(x.cislot) + {} + CIPmtHandler( eDVBServicePMTHandler *ptr ) + :pmthandler(ptr), cislot(NULL) + {} + bool operator==(const CIPmtHandler &x) const { return x.pmthandler == pmthandler; } }; +typedef std::list PMTHandlerList; + +#endif // SWIG + class eDVBCIInterfaces { -DECLARE_REF(eDVBCIInterfaces); -private: - eSmartPtrList m_slots; + DECLARE_REF(eDVBCIInterfaces); + static eDVBCIInterfaces *instance; + eSmartPtrList m_slots; + eDVBCISlot *getSlot(int slotid); + PMTHandlerList m_pmt_handlers; +#ifndef SWIG public: +#endif eDVBCIInterfaces(); ~eDVBCIInterfaces(); + + void addPMTHandler(eDVBServicePMTHandler *pmthandler); + void removePMTHandler(eDVBServicePMTHandler *pmthandler); + void recheckPMTHandlers(); + void gotPMT(eDVBServicePMTHandler *pmthandler); + void ciRemoved(eDVBCISlot *slot); + int getSlotState(int slot); + + int reset(int slot); + int initialize(int slot); + int startMMI(int slot); + int stopMMI(int slot); + int answerText(int slot, int answer); + int answerEnq(int slot, char *value); + int cancelEnq(int slot); + int getMMIState(int slot); + int sendCAPMT(int slot); + int setInputSource(int tunerno, data_source source); + int setCIClockRate(int slot, int rate); +#ifdef SWIG +public: +#endif + static eDVBCIInterfaces *getInstance(); + int getNumOfSlots() { return m_slots.size(); } + PyObject *getDescrambleRules(int slotid); + RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) ); + PyObject *readCICaIds(int slotid); }; #endif