port tuxbox plugins plugin to the new plugin interface
[enigma2.git] / lib / dvb / scan.h
index 61a211ba74b6ea10e78daf9bc1a183f2d65dbda7..2756fb1257a545e072bb2606df649867a74cb871 100644 (file)
@@ -1,22 +1,26 @@
 #ifndef __lib_dvb_scan_h
 #define __lib_dvb_scan_h
 
 #ifndef __lib_dvb_scan_h
 #define __lib_dvb_scan_h
 
-#include <lib/dvb_si/nit.h>
-#include <lib/dvb_si/sdt.h>
-#include <lib/dvb_si/bat.h>
+#include <dvbsi++/network_information_section.h>
+#include <dvbsi++/service_description_section.h>
+#include <dvbsi++/bouquet_association_section.h>
+#include <lib/dvb/idemux.h>
+#include <lib/dvb/esection.h>
 #include <lib/dvb/db.h>
 
 class eDVBScan: public Object, public iObject
 {
 #include <lib/dvb/db.h>
 
 class eDVBScan: public Object, public iObject
 {
+DECLARE_REF(eDVBScan);
+private:
                /* chid helper functions: */
                
                /* heuristically determine if onid/tsid is valid */
                /* chid helper functions: */
                
                /* heuristically determine if onid/tsid is valid */
-       int isValidONIDTSID(eOriginalNetworkID onid, eTransportStreamID tsid);
+       int isValidONIDTSID(int orbital_position, eOriginalNetworkID onid, eTransportStreamID tsid);
                /* build dvb namespace */
        eDVBNamespace buildNamespace(eOriginalNetworkID onid, eTransportStreamID tsid, unsigned long hash);
        
                /* scan resources */    
                /* build dvb namespace */
        eDVBNamespace buildNamespace(eOriginalNetworkID onid, eTransportStreamID tsid, unsigned long hash);
        
                /* scan resources */    
-       ePtr<iDVBChannel> m_channel;
+       eUsePtr<iDVBChannel> m_channel;
        ePtr<iDVBDemux> m_demux;
        
                /* infrastructure */
        ePtr<iDVBDemux> m_demux;
        
                /* infrastructure */
@@ -27,43 +31,52 @@ class eDVBScan: public Object, public iObject
        RESULT nextChannel();
        
        RESULT startFilter();   
        RESULT nextChannel();
        
        RESULT startFilter();   
-       enum { readySDT=1, readyNIT=2, readyBAT=4, readyAll=7,
+       enum { readySDT=1, readyNIT=2, readyBAT=4,
               validSDT=8, validNIT=16, validBAT=32};
 
                /* scan state variables */
        int m_channel_state;
               validSDT=8, validNIT=16, validBAT=32};
 
                /* scan state variables */
        int m_channel_state;
-       int m_ready;
+       int m_ready, m_ready_all;
        
        std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> > m_new_channels;
        std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_new_services;
        
        std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> > m_new_channels;
        std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_new_services;
+       std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_last_service;
        
        std::list<ePtr<iDVBFrontendParameters> > m_ch_toScan, m_ch_scanned, m_ch_unavailable;
        ePtr<iDVBFrontendParameters> m_ch_current;
        
        std::list<ePtr<iDVBFrontendParameters> > m_ch_toScan, m_ch_scanned, m_ch_unavailable;
        ePtr<iDVBFrontendParameters> m_ch_current;
+       eDVBChannelID m_chid_current;
        
        
-       ePtr<eTable<ServiceDescriptionTable> > m_SDT;
-       ePtr<eTable<NetworkInformationTable> > m_NIT;
-       ePtr<eTable<BouquetAssociationTable> > m_BAT;
+       ePtr<eTable<ServiceDescriptionSection> > m_SDT;
+       ePtr<eTable<NetworkInformationSection> > m_NIT;
+       ePtr<eTable<BouquetAssociationSection> > m_BAT;
        
        void SDTready(int err);
        void NITready(int err);
        void BATready(int err);
        
        
        void SDTready(int err);
        void NITready(int err);
        void BATready(int err);
        
-       void addChannel(const eDVBChannelID &chid, iDVBFrontendParameters *feparm);
+       void addKnownGoodChannel(const eDVBChannelID &chid, iDVBFrontendParameters *feparm);
+       void addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameters *feparm);
        int  sameChannel(iDVBFrontendParameters *ch1, iDVBFrontendParameters *ch2) const;
        
        void channelDone();
        
        Signal1<void,int> m_event;
        int  sameChannel(iDVBFrontendParameters *ch1, iDVBFrontendParameters *ch2) const;
        
        void channelDone();
        
        Signal1<void,int> m_event;
-       RESULT processSDT(eDVBNamespace dvbnamespace, const ServiceDescriptionTable &sdt);
+       RESULT processSDT(eDVBNamespace dvbnamespace, const ServiceDescriptionSection &sdt);
+       
+       int m_flags;
 public:
        eDVBScan(iDVBChannel *channel);
        ~eDVBScan();
        
 public:
        eDVBScan(iDVBChannel *channel);
        ~eDVBScan();
        
-       void start(const std::list<ePtr<iDVBFrontendParameters> > &known_transponders);
+       enum { scanNetworkSearch = 1, scanSearchBAT = 2 };
+       void start(const eSmartPtrList<iDVBFrontendParameters> &known_transponders, int flags);
 
 
-       enum { evtUpdate, evtFinish };
-  RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &connection);
-       void insertInto(eDVBDB *db);
+       enum { evtUpdate, evtNewService, evtFinish, evtFail };
+       RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &connection);
+       void insertInto(iDVBChannelList *db);
+       
+       void getStats(int &transponders_done, int &transponders_total, int &services);
+       void getLastServiceName(std::string &name);
 };
 
 #endif
 };
 
 #endif