add summary screen for task view
[enigma2.git] / lib / dvb_ci / dvbci.h
index e8f30ab6449e117706639fa0c2f4f7cf89a0c973..8fa313e2709c8cfaa4d2e153a8b603e60c12fd62 100644 (file)
@@ -1,9 +1,13 @@
 #ifndef __dvbci_dvbci_h
 #define __dvbci_dvbci_h
 
-#include <lib/base/ebase.h>
+#ifndef SWIG
 
+#include <lib/base/ebase.h>
+#include <lib/service/iservice.h>
+#include <lib/python/python.h>
 #include <set>
+#include <queue>
 
 class eDVBCISession;
 class eDVBCIApplicationManagerSession;
@@ -11,25 +15,52 @@ 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
+};
 
 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;
-
        int state;
-       enum {stateRemoved, stateInserted};
-       uint8_t prev_sent_capmt_version;
+       std::map<uint16_t, uint8_t> running_services;
        eDVBCIApplicationManagerSession *application_manager;
        eDVBCICAManagerSession *ca_manager;
        eDVBCIMMISession *mmi_session;
-public:
+       std::priority_queue<queueData> sendqueue;
+       std::set<uint16_t> possible_caids;
+       std::set<eServiceReference> possible_services;
+       std::set<std::string> possible_providers;
        int use_count;
-
+       eDVBCISlot *linked_next; // needed for linked CI handling
+       data_source current_source;
+       int current_tuner;
+       void data(int);
+public:
+       enum {stateRemoved, stateInserted, stateInvalid, stateResetted};
        eDVBCISlot(eMainloop *context, int nr);
        ~eDVBCISlot();
        
@@ -43,22 +74,19 @@ public:
        eDVBCIMMISession *getMMIManager() { return mmi_session; }
        eDVBCICAManagerSession *getCAManager() { return ca_manager; }
 
+       int getState() { return state; }
        int getSlotID();
        int reset();
-       int initialize();
        int startMMI();
        int stopMMI();
        int answerText(int answer);
        int answerEnq(char *value);
        int cancelEnq();
        int getMMIState();
-       void resendCAPMT();
        int sendCAPMT(eDVBServicePMTHandler *ptr, const std::vector<uint16_t> &caids=std::vector<uint16_t>());
-       uint8_t getPrevSentCAPMTVersion() const { return prev_sent_capmt_version; }
-       void resetPrevSentCAPMTVersion() { prev_sent_capmt_version = 0xFF; }
-       
-       int enableTS(int enable, int tuner=0);
-
+       void removeService(uint16_t program_number=0xFFFF);
+       int getNumOfServices() { return running_services.size(); }
+       int setSource(data_source source);
 };
 
 struct CIPmtHandler
@@ -79,25 +107,28 @@ struct CIPmtHandler
 
 typedef std::list<CIPmtHandler> PMTHandlerList;
 
+#endif // SWIG
+
 class eDVBCIInterfaces
 {
-DECLARE_REF(eDVBCIInterfaces);
+       DECLARE_REF(eDVBCIInterfaces);
        static eDVBCIInterfaces *instance;
-private:
-       eSmartPtrList<eDVBCISlot>       m_slots;
+       eSmartPtrList<eDVBCISlot> 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);
 
-       static eDVBCIInterfaces *getInstance();
-       
        int reset(int slot);
        int initialize(int slot);
        int startMMI(int slot);
@@ -106,8 +137,15 @@ public:
        int answerEnq(int slot, char *value);
        int cancelEnq(int slot);
        int getMMIState(int slot);
-       int enableTS(int slot, int enable);
        int sendCAPMT(int slot);
+       int setInputSource(int tunerno, data_source source);
+#ifdef SWIG
+public:
+#endif
+       static eDVBCIInterfaces *getInstance();
+       int getNumOfSlots() { return m_slots.size(); }
+       PyObject *getDescrambleRules(int slotid);
+       RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) );
 };
 
 #endif