better readable code
[enigma2.git] / lib / dvb / scan.h
index 11d0efdcdabb2f45a98890fc389e15e8aae05d29..0f32d67862a11c1f40e2c5505e5c4e69c0340dea 100644 (file)
@@ -1,9 +1,10 @@
 #ifndef __lib_dvb_scan_h
 #define __lib_dvb_scan_h
 
-#include <dvbsi++/network_information_section.h>
 #include <dvbsi++/service_description_section.h>
+#include <dvbsi++/network_information_section.h>
 #include <dvbsi++/bouquet_association_section.h>
+#include <dvbsi++/program_association_section.h>
 #include <lib/dvb/idemux.h>
 #include <lib/dvb/esection.h>
 #include <lib/dvb/db.h>
@@ -31,8 +32,8 @@ private:
        RESULT nextChannel();
        
        RESULT startFilter();   
-       enum { readySDT=1, readyNIT=2, readyBAT=4,
-              validSDT=8, validNIT=16, validBAT=32};
+       enum { readyPAT=1, readySDT=2, readyNIT=4, readyBAT=8,
+              validPAT=16, validSDT=32, validNIT=64, validBAT=128};
 
                /* scan state variables */
        int m_channel_state;
@@ -40,6 +41,7 @@ private:
        
        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;
@@ -48,11 +50,13 @@ private:
        ePtr<eTable<ServiceDescriptionSection> > m_SDT;
        ePtr<eTable<NetworkInformationSection> > m_NIT;
        ePtr<eTable<BouquetAssociationSection> > m_BAT;
-       
+       ePtr<eTable<ProgramAssociationSection> > m_PAT;
+               
        void SDTready(int err);
        void NITready(int err);
        void BATready(int err);
-       
+       void PATready(int err);
+               
        void addKnownGoodChannel(const eDVBChannelID &chid, iDVBFrontendParameters *feparm);
        void addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameters *feparm);
        int  sameChannel(iDVBFrontendParameters *ch1, iDVBFrontendParameters *ch2) const;
@@ -63,18 +67,20 @@ private:
        RESULT processSDT(eDVBNamespace dvbnamespace, const ServiceDescriptionSection &sdt);
        
        int m_flags;
+       bool m_usePAT;
 public:
-       eDVBScan(iDVBChannel *channel);
+       eDVBScan(iDVBChannel *channel, bool usePAT=true, bool debug=true );
        ~eDVBScan();
-       
-       enum { scanNetworkSearch = 1, scanSearchBAT = 2 };
+
+       enum { scanNetworkSearch = 1, scanSearchBAT = 2, scanRemoveServices = 4, scanDontRemoveFeeds=8 };
        void start(const eSmartPtrList<iDVBFrontendParameters> &known_transponders, int flags);
 
-       enum { evtUpdate, evtFinish, evtFail };
+       enum { evtUpdate, evtNewService, evtFinish, evtFail };
        RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &connection);
-       void insertInto(iDVBChannelList *db);
+       void insertInto(iDVBChannelList *db, bool dontRemoveNewFlags=false);
        
        void getStats(int &transponders_done, int &transponders_total, int &services);
+       void getLastServiceName(std::string &name);
 };
 
 #endif