- fixed dvb scan
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 31 Jan 2005 22:51:14 +0000 (22:51 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 31 Jan 2005 22:51:14 +0000 (22:51 +0000)
 - fixed dvbdb (reading/writing lamedb)
 - fixed (i.e. disallow) operator= in iObject (destroyed refcounts before)
 - implemented listboxcontent for servicelists
 - implemented getServiceInformation for non-playing services (still not happy with the result, though)
 - implemented first try of serviceSelector component

27 files changed:
components.py
include/connection.h
lib/base/Makefile.am
lib/base/object.h
lib/dvb/db.cpp
lib/dvb/db.h
lib/dvb/demux.cpp
lib/dvb/esection.cpp
lib/dvb/esection.h
lib/dvb/isection.h
lib/dvb/scan.cpp
lib/dvb/scan.h
lib/gui/elistbox.h
lib/gui/elistboxcontent.h
lib/python/enigma_python.i
lib/service/Makefile.am
lib/service/iservice.h
lib/service/service.cpp
lib/service/service.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicefs.cpp
lib/service/servicefs.h
lib/service/servicemp3.cpp
lib/service/servicemp3.h
main/enigma.cpp
screens.py

index bd4c068f39854f57dc4f28fc304b7c2af21664d7..8015621f7e1609437d997cc12cbe060cf043514e 100644 (file)
@@ -241,3 +241,19 @@ class MenuList(HTMLComponent, GUIComponent):
        
        def GUIdeleteInstance(self, g):
                g.setContent(None)
        
        def GUIdeleteInstance(self, g):
                g.setContent(None)
+
+class ServiceList(HTMLComponent, GUIComponent):
+       def __init__(self):
+               GUIComponent.__init__(self)
+               self.l = eListboxServiceContent()
+
+       def GUIcreateInstance(self, priv, parent, skindata):
+               g = eListbox(parent)
+               g.setContent(self.l)
+               return g
+       
+       def GUIdeleteInstance(self, g):
+               g.setContent(None)
+
+       def setRoot(self, root):
+               self.l.setRoot(root)
index ae799c98675759332125810bfa09903eef520c84..5ae90d5bf834f1a202eca708fe3ed9d01f12f63a 100644 (file)
@@ -6,10 +6,9 @@
 
 class eConnection: public iObject, public Connection
 {
 
 class eConnection: public iObject, public Connection
 {
-       int ref;
+DECLARE_REF;
+private:
        ePtr<iObject> m_owner;
        ePtr<iObject> m_owner;
-public:
-DEFINE_REF(eConnection);
 public:
        eConnection(iObject *owner, const Connection &conn): Connection(conn), m_owner(owner) { };
        virtual ~eConnection() { disconnect(); }
 public:
        eConnection(iObject *owner, const Connection &conn): Connection(conn), m_owner(owner) { };
        virtual ~eConnection() { disconnect(); }
index 955d9e4ac92007ea71e100170fc422c10960c8e3..6094fb480021983379481e739c00c9950893bb4c 100644 (file)
@@ -6,4 +6,4 @@ noinst_LIBRARIES = libenigma_base.a
 libenigma_base_a_SOURCES = \
        buffer.cpp ebase.cpp econfig.cpp eerror.cpp elock.cpp \
        init.cpp message.cpp thread.cpp \
 libenigma_base_a_SOURCES = \
        buffer.cpp ebase.cpp econfig.cpp eerror.cpp elock.cpp \
        init.cpp message.cpp thread.cpp \
-       smartptr.cpp estring.cpp
+       smartptr.cpp estring.cpp connection.cpp
index ddb4512c2dea94c2b775c015768fbfc23ccccda5..64d9a88f6866cb5d2138901ef20d5a27c768ad1a 100644 (file)
@@ -14,6 +14,11 @@ typedef int RESULT;
 
 class iObject
 {
 
 class iObject
 {
+private:
+               /* we don't allow the default operator here, as it would break the refcount. */
+       void operator=(const iObject &);
+protected:
+       virtual ~iObject() { }
 public:
        virtual void AddRef()=0;
        virtual void Release()=0;
 public:
        virtual void AddRef()=0;
        virtual void Release()=0;
@@ -25,6 +30,11 @@ class oRefCount
 public:
        oRefCount(): ref(0) { }
        operator int&() { return ref; }
 public:
        oRefCount(): ref(0) { }
        operator int&() { return ref; }
+       ~oRefCount() { 
+#ifdef OBJECT_DEBUG
+               if (ref) eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, ref); else eDebug("OBJECT_DEBUG refcount ok! (%p)", this); 
+#endif
+       }
 };
 
 #define DECLARE_REF private: oRefCount ref; public: void AddRef(); void Release();
 };
 
 #define DECLARE_REF private: oRefCount ref; public: void AddRef(); void Release();
index 1a2cd7df711893f9879333d4a9c71f02d42c7e4b..810aba046735b48e4f6d9f05f70316d4da492685 100644 (file)
@@ -17,6 +17,16 @@ eDVBService::~eDVBService()
 {
 }
 
 {
 }
 
+eDVBService &eDVBService::operator=(const eDVBService &s)
+{
+       m_service_name = s.m_service_name;
+       m_provider_name = s.m_provider_name;
+       m_flags = s.m_flags;
+       m_ca = s.m_ca;
+       m_cache = s.m_cache;
+       return *this;
+}
+
 DEFINE_REF(eDVBDB);
 
 eDVBDB::eDVBDB()
 DEFINE_REF(eDVBDB);
 
 eDVBDB::eDVBDB()
@@ -67,7 +77,7 @@ eDVBDB::eDVBDB()
                        {
                                eDVBFrontendParametersSatellite sat;
                                int frequency, symbol_rate, polarisation, fec, orbital_position, inversion;
                        {
                                eDVBFrontendParametersSatellite sat;
                                int frequency, symbol_rate, polarisation, fec, orbital_position, inversion;
-                               sscanf(line+2, "%d:%d:%d:%d:%d:%d", &frequency, &symbol_rate, &polarisation, &fec, &orbital_position, &inversion);
+                               sscanf(line+2, "%d:%d:%d:%d:%d:%d", &frequency, &symbol_rate, &polarisation, &fec, &inversion, &orbital_position);
                                sat.frequency = frequency;
                                sat.symbol_rate = symbol_rate;
                                sat.polarisation = polarisation;
                                sat.frequency = frequency;
                                sat.symbol_rate = symbol_rate;
                                sat.polarisation = polarisation;
@@ -209,15 +219,15 @@ eDVBDB::~eDVBDB()
                const eServiceReferenceDVB &s = i->first;
                fprintf(f, "%04x:%08x:%04x:%04x:%d:%d\n", 
                                s.getServiceID().get(), s.getDVBNamespace().get(), 
                const eServiceReferenceDVB &s = i->first;
                fprintf(f, "%04x:%08x:%04x:%04x:%d:%d\n", 
                                s.getServiceID().get(), s.getDVBNamespace().get(), 
-                               s.getOriginalNetworkID().get(), s.getTransportStreamID().get(),
+                               s.getTransportStreamID().get(),s.getOriginalNetworkID().get(), 
                                s.getServiceType(),
                                0);
                
                fprintf(f, "%s\n", i->second->m_service_name.c_str());
                                s.getServiceType(),
                                0);
                
                fprintf(f, "%s\n", i->second->m_service_name.c_str());
-               fprintf(f, "p=%s", i->second->m_provider_name.c_str());
+               fprintf(f, "p:%s", i->second->m_provider_name.c_str());
                for (std::set<int>::const_iterator ca(i->second->m_ca.begin());
                        ca != i->second->m_ca.end(); ++ca)
                for (std::set<int>::const_iterator ca(i->second->m_ca.begin());
                        ca != i->second->m_ca.end(); ++ca)
-                       fprintf(f, ",C=%04x", *ca);
+                       fprintf(f, ",C:%04x", *ca);
                fprintf(f, "\n");
                services++;
        }
                fprintf(f, "\n");
                services++;
        }
index 5a67870d1d92493ed48ecd39ff149448b7befffb..e673b9e68f2444aeb285209cb4c69fffe3ea1319 100644 (file)
@@ -16,6 +16,8 @@ public:
        std::set<int> m_ca;
        std::map<int,int> m_cache;
        virtual ~eDVBService();
        std::set<int> m_ca;
        std::map<int,int> m_cache;
        virtual ~eDVBService();
+       
+       eDVBService &operator=(const eDVBService &);
 };
 
 class ServiceDescriptionTable;
 };
 
 class ServiceDescriptionTable;
index 286821c318992999b4716d73cd4a841d7232cc52..191d9c38354651effd335537de18afc522b0c5b7 100644 (file)
@@ -74,6 +74,8 @@ eDVBSectionReader::eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESUL
 #endif
        fd = ::open(filename, O_RDWR);
        
 #endif
        fd = ::open(filename, O_RDWR);
        
+       eDebug("eDVBSectionReader has fd %d", fd);
+       
        if (fd >= 0)
        {
                notifier=new eSocketNotifier(context, fd, eSocketNotifier::Read);
        if (fd >= 0)
        {
                notifier=new eSocketNotifier(context, fd, eSocketNotifier::Read);
index 42a056d285fd3a6ec8548d32bce3e99cd0ad65b0..dbb9bf7881a546d8c3baf8ff793450e126813078 100644 (file)
@@ -22,7 +22,8 @@ void eGTable::sectionRead(const __u8 *d)
 
 void eGTable::timeout()
 {
 
 void eGTable::timeout()
 {
-       eDebug("timeout!");
+       printf("timeout!\n");
+//     eDebug("timeout!");
        m_reader->stop();
        ready = 1;
        error = -1;
        m_reader->stop();
        ready = 1;
        error = -1;
index 78895e769ee398f9d42ef8ca71ef931858bd43bb..6b8c87843fcede09df35054522dccc12114f012d 100644 (file)
@@ -52,11 +52,13 @@ protected:
                        else
                                printf("-");
                                
                        else
                                printf("-");
                                
-               printf(" %d/%d\n", avail.size(), max);
+               printf(" %d/%d TID %02x\n", avail.size(), max, data[0]);
 
                if (avail.size() == max)
 
                if (avail.size() == max)
+               {
+                       printf("done!\n");
                        return 1;
                        return 1;
-               else
+               else
                        return 0;
        }
 public:
                        return 0;
        }
 public:
index f44c163246b630a40fb88e64f507c3820818f40a..1ed53699158f3260ae99ef523c0da10336e0a721 100644 (file)
@@ -48,6 +48,7 @@ public:
        virtual RESULT start(const eDVBSectionFilterMask &mask)=0;
        virtual RESULT stop()=0;
        virtual RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn)=0;
        virtual RESULT start(const eDVBSectionFilterMask &mask)=0;
        virtual RESULT stop()=0;
        virtual RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn)=0;
+       virtual ~iDVBSectionReader() { };
 };
 
 #endif
 };
 
 #endif
index 5571a810feb7923eee08c0f44f6c83d4587ae0f8..322f35c3ce01abcc34705fdd6c1c10628f0b0e7c 100644 (file)
 #include <lib/base/eerror.h>
 #include <errno.h>
 
 #include <lib/base/eerror.h>
 #include <errno.h>
 
+#define SCAN_eDebug(x...)
+#define SCAN_eDebugNoNewLine(x...)
+
+DEFINE_REF(eDVBScan);
+
 eDVBScan::eDVBScan(iDVBChannel *channel): m_channel(channel)
 {
        if (m_channel->getDemux(m_demux))
 eDVBScan::eDVBScan(iDVBChannel *channel): m_channel(channel)
 {
        if (m_channel->getDemux(m_demux))
-               eDebug("scan: failed to allocate demux!");
+               SCAN_eDebug("scan: failed to allocate demux!");
        m_channel->connectStateChange(slot(*this, &eDVBScan::stateChange), m_stateChanged_connection);
 }
 
        m_channel->connectStateChange(slot(*this, &eDVBScan::stateChange), m_stateChanged_connection);
 }
 
@@ -126,7 +131,7 @@ RESULT eDVBScan::startFilter()
 
 void eDVBScan::SDTready(int err)
 {
 
 void eDVBScan::SDTready(int err)
 {
-       eDebug("got sdt");
+       SCAN_eDebug("got sdt");
        m_ready |= readySDT;
        if (!err)
                m_ready |= validSDT;
        m_ready |= readySDT;
        if (!err)
                m_ready |= validSDT;
@@ -135,7 +140,7 @@ void eDVBScan::SDTready(int err)
 
 void eDVBScan::NITready(int err)
 {
 
 void eDVBScan::NITready(int err)
 {
-       eDebug("got nit, err %d", err);
+       SCAN_eDebug("got nit, err %d", err);
        m_ready |= readyNIT;
        if (!err)
                m_ready |= validNIT;
        m_ready |= readyNIT;
        if (!err)
                m_ready |= validNIT;
@@ -144,7 +149,7 @@ void eDVBScan::NITready(int err)
 
 void eDVBScan::BATready(int err)
 {
 
 void eDVBScan::BATready(int err)
 {
-       eDebug("got bat");
+       SCAN_eDebug("got bat");
        m_ready |= readyBAT;
        if (!err)
                m_ready |= validBAT;
        m_ready |= readyBAT;
        if (!err)
                m_ready |= validBAT;
@@ -204,7 +209,7 @@ void eDVBScan::channelDone()
                        (**m_SDT->getSections().begin()).getTransportStreamId(),
                        hash);
                
                        (**m_SDT->getSections().begin()).getTransportStreamId(),
                        hash);
                
-               eDebug("SDT: ");
+               SCAN_eDebug("SDT: ");
                ServiceDescriptionTableConstIterator i;
                for (i = m_SDT->getSections().begin(); i != m_SDT->getSections().end(); ++i)
                        processSDT(dvbnamespace, **i);
                ServiceDescriptionTableConstIterator i;
                for (i = m_SDT->getSections().begin(); i != m_SDT->getSections().end(); ++i)
                        processSDT(dvbnamespace, **i);
@@ -213,7 +218,7 @@ void eDVBScan::channelDone()
        
        if (m_ready & validNIT)
        {
        
        if (m_ready & validNIT)
        {
-               eDebug("dumping NIT");
+               SCAN_eDebug("dumping NIT");
                NetworkInformationTableConstIterator i;
                for (i = m_NIT->getSections().begin(); i != m_NIT->getSections().end(); ++i)
                {
                NetworkInformationTableConstIterator i;
                for (i = m_NIT->getSections().begin(); i != m_NIT->getSections().end(); ++i)
                {
@@ -222,7 +227,7 @@ void eDVBScan::channelDone()
                        for (TransportStreamInfoConstIterator tsinfo(tsinfovec.begin()); 
                                tsinfo != tsinfovec.end(); ++tsinfo)
                        {
                        for (TransportStreamInfoConstIterator tsinfo(tsinfovec.begin()); 
                                tsinfo != tsinfovec.end(); ++tsinfo)
                        {
-                               eDebug("TSID: %04x ONID: %04x", (*tsinfo)->getTransportStreamId(),
+                               SCAN_eDebug("TSID: %04x ONID: %04x", (*tsinfo)->getTransportStreamId(),
                                        (*tsinfo)->getOriginalNetworkId());
                                
                                eOriginalNetworkID onid = (*tsinfo)->getOriginalNetworkId();
                                        (*tsinfo)->getOriginalNetworkId());
                                
                                eOriginalNetworkID onid = (*tsinfo)->getOriginalNetworkId();
@@ -237,7 +242,7 @@ void eDVBScan::channelDone()
                                        case SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR:
                                        {
                                                SatelliteDeliverySystemDescriptor &d = (SatelliteDeliverySystemDescriptor&)**desc;
                                        case SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR:
                                        {
                                                SatelliteDeliverySystemDescriptor &d = (SatelliteDeliverySystemDescriptor&)**desc;
-                                               eDebug("%d kHz, %d%d%d.%d%c %s MOD:%d %d symb/s, fec %d", 
+                                               SCAN_eDebug("%d kHz, %d%d%d.%d%c %s MOD:%d %d symb/s, fec %d", 
                                                                d.getFrequency(), 
                                                                (d.getOrbitalPosition()>>12)&0xF,
                                                                (d.getOrbitalPosition()>>8)&0xF,
                                                                d.getFrequency(), 
                                                                (d.getOrbitalPosition()>>12)&0xF,
                                                                (d.getOrbitalPosition()>>8)&0xF,
@@ -265,7 +270,7 @@ void eDVBScan::channelDone()
                                                break;
                                        }
                                        default:
                                                break;
                                        }
                                        default:
-                                               eDebug("descr<%x>", (*desc)->getTag());
+                                               SCAN_eDebug("descr<%x>", (*desc)->getTag());
                                                break;
                                        }
                                }
                                                break;
                                        }
                                }
@@ -277,7 +282,7 @@ void eDVBScan::channelDone()
        
        if ((m_ready  & readyAll) != readyAll)
                return;
        
        if ((m_ready  & readyAll) != readyAll)
                return;
-       eDebug("channel done!");
+       SCAN_eDebug("channel done!");
        m_ch_scanned.push_back(m_ch_current);
        nextChannel();
 }
        m_ch_scanned.push_back(m_ch_current);
        nextChannel();
 }
@@ -312,12 +317,12 @@ void eDVBScan::insertInto(eDVBDB *db)
 RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescriptionTable &sdt)
 {
        const ServiceDescriptionVector &services = *sdt.getDescriptions();
 RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescriptionTable &sdt)
 {
        const ServiceDescriptionVector &services = *sdt.getDescriptions();
-       eDebug("ONID: %04x", sdt.getOriginalNetworkId());
+       SCAN_eDebug("ONID: %04x", sdt.getOriginalNetworkId());
        eDVBChannelID chid(dvbnamespace, sdt.getTransportStreamId(), sdt.getOriginalNetworkId());
        
        for (ServiceDescriptionConstIterator s(services.begin()); s != services.end(); ++s)
        {
        eDVBChannelID chid(dvbnamespace, sdt.getTransportStreamId(), sdt.getOriginalNetworkId());
        
        for (ServiceDescriptionConstIterator s(services.begin()); s != services.end(); ++s)
        {
-               eDebugNoNewLine("SID %04x: ", (*s)->getServiceId());
+               SCAN_eDebugNoNewLine("SID %04x: ", (*s)->getServiceId());
 
                eServiceReferenceDVB ref;
                ePtr<eDVBService> service = new eDVBService;
 
                eServiceReferenceDVB ref;
                ePtr<eDVBService> service = new eDVBService;
@@ -338,7 +343,7 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription
                        case SERVICE_DESCRIPTOR:
                        {
                                ServiceDescriptor &d = (ServiceDescriptor&)**desc;
                        case SERVICE_DESCRIPTOR:
                        {
                                ServiceDescriptor &d = (ServiceDescriptor&)**desc;
-                               eDebug("name '%s', provider_name '%s'", d.getServiceName().c_str(), d.getServiceProviderName().c_str());
+                               SCAN_eDebug("name '%s', provider_name '%s'", d.getServiceName().c_str(), d.getServiceProviderName().c_str());
                                service->m_service_name = d.getServiceName();
                                service->m_provider_name = d.getServiceProviderName();
                                break;
                                service->m_service_name = d.getServiceName();
                                service->m_provider_name = d.getServiceProviderName();
                                break;
@@ -347,17 +352,17 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription
                        {
                                CaIdentifierDescriptor &d = (CaIdentifierDescriptor&)**desc;
                                const CaSystemIdVector &caids = *d.getCaSystemIds();
                        {
                                CaIdentifierDescriptor &d = (CaIdentifierDescriptor&)**desc;
                                const CaSystemIdVector &caids = *d.getCaSystemIds();
-                               eDebugNoNewLine("CA ");
+                               SCAN_eDebugNoNewLine("CA ");
                                for (CaSystemIdVector::const_iterator i(caids.begin()); i != caids.end(); ++i)
                                {
                                for (CaSystemIdVector::const_iterator i(caids.begin()); i != caids.end(); ++i)
                                {
-                                       eDebugNoNewLine("%04x ", *i);
+                                       SCAN_eDebugNoNewLine("%04x ", *i);
                                        service->m_ca.insert(*i);
                                }
                                        service->m_ca.insert(*i);
                                }
-                               eDebug("");
+                               SCAN_eDebug("");
                                break;
                        }
                        default:
                                break;
                        }
                        default:
-                               eDebug("descr<%x>", (*desc)->getTag());
+                               SCAN_eDebug("descr<%x>", (*desc)->getTag());
                                break;
                        }
                }
                                break;
                        }
                }
index 61a211ba74b6ea10e78daf9bc1a183f2d65dbda7..f7cb5d26251f43479b1c3b9a64023f81710c1812 100644 (file)
@@ -8,6 +8,8 @@
 
 class eDVBScan: public Object, public iObject
 {
 
 class eDVBScan: public Object, public iObject
 {
+DECLARE_REF;
+private:
                /* chid helper functions: */
                
                /* heuristically determine if onid/tsid is valid */
                /* chid helper functions: */
                
                /* heuristically determine if onid/tsid is valid */
index 4c06e2886a5cb4eef5ae8c5192bcf4b7f328f833..d5464868e540cca509ec66ec046de599da315b5e 100644 (file)
@@ -19,7 +19,9 @@ public:
                   to stay on the same data, however when the current
                   item is removed, this won't work. you'll be notified
                   anyway. */
                   to stay on the same data, however when the current
                   item is removed, this won't work. you'll be notified
                   anyway. */
-                 
+#ifndef SWIG   
+protected:
+       friend class eListbox;
        virtual void cursorHome()=0;
        virtual void cursorEnd()=0;
        virtual int cursorMove(int count=1)=0;
        virtual void cursorHome()=0;
        virtual void cursorEnd()=0;
        virtual int cursorMove(int count=1)=0;
@@ -39,6 +41,7 @@ public:
        
                /* the following functions always refer to the selected item */
        virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)=0;
        
                /* the following functions always refer to the selected item */
        virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)=0;
+#endif
 };
 
 class eListbox: public eWidget
 };
 
 class eListbox: public eWidget
index 6219cec6b59c1eea5cfeebb5e515c285cab1629d..7ef6011616a192f61000957ba06cdb2ecd6c8206 100644 (file)
@@ -2,11 +2,15 @@
 #define __lib_gui_elistboxcontent_h
 
 #include <lib/python/python.h>
 #define __lib_gui_elistboxcontent_h
 
 #include <lib/python/python.h>
+#include <lib/gui/elistbox.h>
 
 class eListboxTestContent: public virtual iListboxContent
 {
        DECLARE_REF;
 public:
 
 class eListboxTestContent: public virtual iListboxContent
 {
        DECLARE_REF;
 public:
+
+#ifndef SWIG
+protected:
        void cursorHome();
        void cursorEnd();
        int cursorMove(int count=1);
        void cursorHome();
        void cursorEnd();
        int cursorMove(int count=1);
@@ -28,6 +32,7 @@ public:
 private:
        int m_cursor, m_saved_cursor;
        eSize m_size;
 private:
        int m_cursor, m_saved_cursor;
        eSize m_size;
+#endif
 };
 
 class eListboxStringContent: public virtual iListboxContent
 };
 
 class eListboxStringContent: public virtual iListboxContent
@@ -35,6 +40,9 @@ class eListboxStringContent: public virtual iListboxContent
        DECLARE_REF;
 public:
        eListboxStringContent();
        DECLARE_REF;
 public:
        eListboxStringContent();
+       void setList(std::list<std::string> &list);
+#ifndef SWI
+protected:
        
        void cursorHome();
        void cursorEnd();
        
        void cursorHome();
        void cursorEnd();
@@ -54,8 +62,6 @@ public:
        
                /* the following functions always refer to the selected item */
        void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
        
                /* the following functions always refer to the selected item */
        void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
-       
-       void setList(std::list<std::string> &list);
 private:
        typedef std::list<std::string> list;
        
 private:
        typedef std::list<std::string> list;
        
@@ -66,6 +72,7 @@ private:
        int m_size;
        
        eSize m_itemsize;
        int m_size;
        
        eSize m_itemsize;
+#endif
 };
 
 class eListboxPythonStringContent: public virtual iListboxContent
 };
 
 class eListboxPythonStringContent: public virtual iListboxContent
@@ -74,6 +81,11 @@ class eListboxPythonStringContent: public virtual iListboxContent
 public:
        eListboxPythonStringContent();
        ~eListboxPythonStringContent();
 public:
        eListboxPythonStringContent();
        ~eListboxPythonStringContent();
+
+       void setList(PyObject *list);
+       PyObject *getCurrentSelection();
+#ifndef SWIG
+protected:
        void cursorHome();
        void cursorEnd();
        int cursorMove(int count=1);
        void cursorHome();
        void cursorEnd();
        int cursorMove(int count=1);
@@ -92,15 +104,12 @@ public:
        
                /* the following functions always refer to the selected item */
        void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
        
                /* the following functions always refer to the selected item */
        void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
-       
-       void setList(PyObject *list);
-       
-       PyObject *getCurrentSelection();
-       
+
 private:
        PyObject *m_list;
        int m_cursor, m_saved_cursor;
        eSize m_itemsize;
 private:
        PyObject *m_list;
        int m_cursor, m_saved_cursor;
        eSize m_itemsize;
+#endif
 };
 
 #endif
 };
 
 #endif
index ae15d0d9b451e00ca9d67a1fa87b1f922a897675..8e55b74fc8d419585d9fec77d54c6572a9d17f4c 100644 (file)
@@ -58,6 +58,7 @@ is usually caused by not marking PSignals as immutable.
 #include <lib/python/connections.h>
 #include <lib/gui/elistbox.h>
 #include <lib/gui/elistboxcontent.h>
 #include <lib/python/connections.h>
 #include <lib/gui/elistbox.h>
 #include <lib/gui/elistboxcontent.h>
+#include <lib/service/listboxservice.h>
 
 extern void runMainloop();
 
 
 extern void runMainloop();
 
@@ -90,6 +91,7 @@ RefCount(eListboxPythonStringContent)
 %include <lib/gui/ewidgetdesktop.h>
 %include <lib/gui/elistbox.h>
 %include <lib/gui/elistboxcontent.h>
 %include <lib/gui/ewidgetdesktop.h>
 %include <lib/gui/elistbox.h>
 %include <lib/gui/elistboxcontent.h>
+%include <lib/service/listboxservice.h>
 
 template<class R> class PSignal0
 {
 
 template<class R> class PSignal0
 {
index 09ba4ce80ce6ce2f8462e2fb6f64612d0e9bed8f..a3c05cfa7e24ab29862c6d259278790d306735f7 100644 (file)
@@ -4,5 +4,5 @@ INCLUDES = \
 noinst_LIBRARIES = libenigma_service.a
 
 libenigma_service_a_SOURCES = \
 noinst_LIBRARIES = libenigma_service.a
 
 libenigma_service_a_SOURCES = \
-       service.cpp servicemp3.cpp servicedvb.cpp servicefs.cpp
+       listboxservice.cpp service.cpp servicemp3.cpp servicedvb.cpp servicefs.cpp
        
        
index 766d850eb748d3607b7d10c71e00ad00b7ff4ef6..01c61fcc77947d364e8310f64feafa119781fed4 100644 (file)
@@ -142,10 +142,15 @@ public:
        }
 };
 
        }
 };
 
+       /* the reason we have the servicereference as additional argument is
+          that we don't have to create one object for every entry in a possibly
+          large list, provided that no state information is nessesary to deliver
+          the required information. Anyway - ref *must* be the same as the argument
+          to the info() or getIServiceInformation call! */
 class iServiceInformation: public iObject
 {
 public:
 class iServiceInformation: public iObject
 {
 public:
-       virtual RESULT getName(std::string &name)=0;
+       virtual RESULT getName(const eServiceReference &ref, std::string &name)=0;
 };
 
 typedef ePtr<iServiceInformation> iServiceInformationPtr;
 };
 
 typedef ePtr<iServiceInformation> iServiceInformationPtr;
@@ -203,6 +208,7 @@ public:
        virtual RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr)=0;
        virtual RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr)=0;
        virtual RESULT list(const eServiceReference &, ePtr<iListableService> &ptr)=0;
        virtual RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr)=0;
        virtual RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr)=0;
        virtual RESULT list(const eServiceReference &, ePtr<iListableService> &ptr)=0;
+       virtual RESULT info(const eServiceReference &, ePtr<iServiceInformation> &ptr);
 };
 
 typedef ePtr<iServiceHandler> iServiceHandlerPtr;
 };
 
 typedef ePtr<iServiceHandler> iServiceHandlerPtr;
index d18b8eee7c655720d2af060b2514b5947dbd6ccf..40cbf8dffa0c5aa9631f398c632d00d6bcc628b5 100644 (file)
@@ -90,6 +90,17 @@ RESULT eServiceCenter::list(const eServiceReference &ref, ePtr<iListableService>
        return i->second->list(ref, ptr);
 }
 
        return i->second->list(ref, ptr);
 }
 
+RESULT eServiceCenter::info(const eServiceReference &ref, ePtr<iServiceInformation> &ptr)
+{
+       std::map<int,ePtr<iServiceHandler> >::iterator i = handler.find(ref.type);
+       if (i == handler.end())
+       {
+               ptr = 0;
+               return -1;
+       }
+       return i->second->info(ref, ptr);
+}
+
 RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd)
 {
        handler.insert(std::pair<int,ePtr<iServiceHandler> >(id, hnd));
 RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd)
 {
        handler.insert(std::pair<int,ePtr<iServiceHandler> >(id, hnd));
@@ -102,4 +113,11 @@ RESULT eServiceCenter::removeServiceFactory(int id)
        return 0;
 }
 
        return 0;
 }
 
+       /* default handlers */
+RESULT iServiceHandler::info(const eServiceReference &, ePtr<iServiceInformation> &ptr)
+{
+       ptr = 0;
+       return -1;
+}
+
 eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");
 eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");
index fbe34278d3556b611f340d95b9e77343879435c5..c3f0c482808b9a777ecf01c3a4996bbb5faf25c6 100644 (file)
@@ -23,6 +23,7 @@ public:
        RESULT play(const eServiceReference &, iPlayableServicePtr &ptr);
        RESULT record(const eServiceReference &, iRecordableServicePtr &ptr);
        RESULT list(const eServiceReference &, iListableServicePtr &ptr);
        RESULT play(const eServiceReference &, iPlayableServicePtr &ptr);
        RESULT record(const eServiceReference &, iRecordableServicePtr &ptr);
        RESULT list(const eServiceReference &, iListableServicePtr &ptr);
+       RESULT info(const eServiceReference &, ePtr<iServiceInformation> &ptr);
        
                // eServiceCenter
        static RESULT getInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
        
                // eServiceCenter
        static RESULT getInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
index 3b22ab7b2db3325279ca8cdf5be8b201f144b013..0c6d72bd59b92a332323ae50e81649b30974bc0c 100644 (file)
@@ -158,7 +158,7 @@ RESULT eDVBServicePlay::getIServiceInformation(ePtr<iServiceInformation> &ptr)
        return 0;
 }
 
        return 0;
 }
 
-RESULT eDVBServicePlay::getName(std::string &name)
+RESULT eDVBServicePlay::getName(const eServiceReference &ref, std::string &name)
 {
        name = "DVB service";
        return 0;
 {
        name = "DVB service";
        return 0;
index 42ca30f79cceba65b1f44c71f5af2ce06705f665..c54eb5c0b0afc683c563511adbc266c68ebd3712 100644 (file)
@@ -45,7 +45,7 @@ public:
        RESULT getIServiceInformation(ePtr<iServiceInformation> &ptr);
        
                // iServiceInformation
        RESULT getIServiceInformation(ePtr<iServiceInformation> &ptr);
        
                // iServiceInformation
-       RESULT getName(std::string &name);
+       RESULT getName(const eServiceReference &ref, std::string &name);
 };
 
 #endif
 };
 
 #endif
index f4a9b737c022820937aa821d875278e893eb8909..de75cc672fe6b35053a151995b3c1a76bbe1c035 100644 (file)
 #include <sys/stat.h>
 #include <unistd.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
 
+
+class eServiceFSInformation: public iServiceInformation
+{
+       DECLARE_REF;
+public:
+       RESULT getName(const eServiceReference &ref, std::string &name);
+};
+
+DEFINE_REF(eServiceFSInformation);
+
+RESULT eServiceFSInformation::getName(const eServiceReference &ref, std::string &name)
+{
+       name = ref.path;
+}
+
 // eServiceFactoryFS
 
 eServiceFactoryFS::eServiceFactoryFS()
 // eServiceFactoryFS
 
 eServiceFactoryFS::eServiceFactoryFS()
@@ -20,6 +35,8 @@ eServiceFactoryFS::eServiceFactoryFS()
        eServiceCenter::getInstance(sc);
        if (sc)
                sc->addServiceFactory(eServiceFactoryFS::id, this);
        eServiceCenter::getInstance(sc);
        if (sc)
                sc->addServiceFactory(eServiceFactoryFS::id, this);
+       
+       m_service_information = new eServiceFSInformation();
 }
 
 eServiceFactoryFS::~eServiceFactoryFS()
 }
 
 eServiceFactoryFS::~eServiceFactoryFS()
@@ -52,6 +69,12 @@ RESULT eServiceFactoryFS::list(const eServiceReference &ref, ePtr<iListableServi
        return 0;
 }
 
        return 0;
 }
 
+RESULT eServiceFactoryFS::info(const eServiceReference &ref, ePtr<iServiceInformation> &ptr)
+{
+       ptr = m_service_information;
+       return 0;
+}
+
 // eServiceFS
 
 DEFINE_REF(eServiceFS);
 // eServiceFS
 
 DEFINE_REF(eServiceFS);
index 7e66ba21b1c427bffddd3a9858cf992c6001ff07..d8e77609d511941e20dbaa840b328fcfcbbb2789 100644 (file)
@@ -15,6 +15,9 @@ public:
        RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
        RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
+       RESULT info(const eServiceReference &, ePtr<iServiceInformation> &ptr);
+private:
+       ePtr<iServiceInformation> m_service_information;
 };
 
 class eServiceFS: public iListableService
 };
 
 class eServiceFS: public iListableService
index d1c9001dcf71bb0dca668d635351f09cf7b51abb..1f883f944bfcf3632c83cba7098e37cb6da76b5b 100644 (file)
@@ -16,6 +16,8 @@ eServiceFactoryMP3::eServiceFactoryMP3()
        eServiceCenter::getInstance(sc);
        if (sc)
                sc->addServiceFactory(eServiceFactoryMP3::id, this);
        eServiceCenter::getInstance(sc);
        if (sc)
                sc->addServiceFactory(eServiceFactoryMP3::id, this);
+
+       m_service_info = new eServiceMP3Info();
 }
 
 eServiceFactoryMP3::~eServiceFactoryMP3()
 }
 
 eServiceFactoryMP3::~eServiceFactoryMP3()
@@ -49,8 +51,35 @@ RESULT eServiceFactoryMP3::list(const eServiceReference &, ePtr<iListableService
        return -1;
 }
 
        return -1;
 }
 
-// eServiceMP3
+RESULT eServiceFactoryMP3::info(const eServiceReference &ref, ePtr<iServiceInformation> &ptr)
+{
+       ptr = m_service_info;
+       return 0;
+}
+
+// eServiceMP3Info
+
+
+// eServiceMP3Info is seperated from eServiceMP3 to give information
+// about unopened files.
+
+// probably eServiceMP3 should use this class as well, and eServiceMP3Info
+// should have a database backend where ID3-files etc. are cached.
+// this would allow listing the mp3 database based on certain filters.
 
 
+DEFINE_REF(eServiceMP3Info)
+
+eServiceMP3Info::eServiceMP3Info()
+{
+}
+
+RESULT eServiceMP3Info::getName(const eServiceReference &ref, std::string &name)
+{
+       name = "MP3 file: " + ref.path;
+       return 0;
+}
+
+// eServiceMP3
 
 void eServiceMP3::test_end()
 {
 
 void eServiceMP3::test_end()
 {
@@ -113,7 +142,7 @@ RESULT eServiceMP3::unpause() { printf("mp3 unpauses!\n"); return 0; }
 
 RESULT eServiceMP3::getIServiceInformation(ePtr<iServiceInformation>&i) { i = this; return 0; }
 
 
 RESULT eServiceMP3::getIServiceInformation(ePtr<iServiceInformation>&i) { i = this; return 0; }
 
-RESULT eServiceMP3::getName(std::string &name)
+RESULT eServiceMP3::getName(const eServiceReference &ref, std::string &name)
 {
        name = "MP3 File: " + filename;
        return 0;
 {
        name = "MP3 File: " + filename;
        return 0;
index cfca4242182147105017bf15edde6adaf3fd048b..7ef84025d9ac028d081f33a17f5a6178fcc0dbf1 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <lib/service/iservice.h>
 
 
 #include <lib/service/iservice.h>
 
+class eServiceMP3Info ;
+
 class eServiceFactoryMP3: public iServiceHandler
 {
 DECLARE_REF;
 class eServiceFactoryMP3: public iServiceHandler
 {
 DECLARE_REF;
@@ -15,6 +17,18 @@ public:
        RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
        RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
+       RESULT info(const eServiceReference &, ePtr<iServiceInformation> &ptr);
+private:
+       ePtr<eServiceMP3Info> m_service_info;
+};
+
+class eServiceMP3Info: public iServiceInformation
+{
+       DECLARE_REF;
+       friend class eServiceFactoryMP3;
+       eServiceMP3Info();
+public:
+       RESULT getName(const eServiceReference &ref, std::string &name);
 };
 
 class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object
 };
 
 class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object
@@ -48,7 +62,7 @@ public:
        RESULT getIServiceInformation(ePtr<iServiceInformation>&);
        
                // iServiceInformation
        RESULT getIServiceInformation(ePtr<iServiceInformation>&);
        
                // iServiceInformation
-       RESULT getName(std::string &name);
+       RESULT getName(const eServiceReference &ref, std::string &name);
 };
 
 #endif
 };
 
 #endif
index df28bcd75c4c01bf1ef7c64884ae757018d517bf..60bea8f544e4026e21222998cdc5eaf649b21aeb 100644 (file)
@@ -21,6 +21,8 @@
 #include <lib/python/python.h>
 #include <lib/python/connections.h>
 
 #include <lib/python/python.h>
 #include <lib/python/connections.h>
 
+#include <lib/gui/elistboxcontent.h>
+
 #include <lib/driver/rc.h>
 
 #ifdef OBJECT_DEBUG
 #include <lib/driver/rc.h>
 
 #ifdef OBJECT_DEBUG
@@ -51,17 +53,6 @@ void dumpRegion(const gRegion &region)
        }
 }
 
        }
 }
 
-
-class eMain: public eApplication, public Object
-{
-       eInit init;
-public:
-       eMain()
-       {
-               init.setRunlevel(eAutoInitNumbers::main);
-       }
-};
-
 eWidgetDesktop *wdsk;
 
 // typedef struct _object PyObject;
 eWidgetDesktop *wdsk;
 
 // typedef struct _object PyObject;
@@ -84,6 +75,81 @@ void keyEvent(const eRCKey &key)
                keyPressed(key.code);
 }
 
                keyPressed(key.code);
 }
 
+/************************************************/
+#include <lib/dvb/dvb.h>
+#include <lib/dvb/db.h>
+#include <lib/dvb/isection.h>
+#include <lib/dvb/esection.h>
+#include <lib/dvb_si/pmt.h>
+#include <lib/dvb/scan.h>
+#include <unistd.h>
+
+class eMain: public eApplication, public Object
+{
+       eInit init;
+       
+       ePtr<eDVBScan> m_scan;
+
+       ePtr<eDVBResourceManager> m_mgr;
+       ePtr<iDVBChannel> m_channel;
+       ePtr<eDVBDB> m_dvbdb;
+
+       void scanEvent(int evt)
+       {
+               eDebug("scan event %d!", evt);
+               if (evt == eDVBScan::evtFinish)
+               {
+                       m_scan->insertInto(m_dvbdb);
+                       quit(0);
+               }
+       }
+       ePtr<eConnection> m_scan_event_connection;
+public:
+       eMain()
+       {
+               init.setRunlevel(eAutoInitNumbers::main);
+
+#if 0
+               m_dvbdb = new eDVBDB();
+               m_mgr = new eDVBResourceManager();
+
+               eDVBFrontendParametersSatellite fesat;
+               
+               fesat.frequency = 11817000; // 12070000;
+               fesat.symbol_rate = 27500000;
+               fesat.polarisation = eDVBFrontendParametersSatellite::Polarisation::Vertical;
+               fesat.fec = eDVBFrontendParametersSatellite::FEC::f3_4;
+               fesat.inversion = eDVBFrontendParametersSatellite::Inversion::Off;
+               fesat.orbital_position = 192;
+
+               eDVBFrontendParameters *fe = new eDVBFrontendParameters();
+               
+               fe->setDVBS(fesat);
+
+               if (m_mgr->allocateRawChannel(m_channel))
+                       eDebug("shit it failed!");
+
+               eDebug("starting scan...");
+               
+               std::list<ePtr<iDVBFrontendParameters> > list;
+               
+               list.push_back(fe);
+               
+               m_scan = new eDVBScan(m_channel);
+               m_scan->start(list);
+               m_scan->connectEvent(slot(*this, &eMain::scanEvent), m_scan_event_connection);
+#endif
+       }
+       
+       ~eMain()
+       {
+               m_scan = 0;
+       }
+};
+
+/************************************************/
+
+
 int main(int argc, char **argv)
 {
 #ifdef OBJECT_DEBUG
 int main(int argc, char **argv)
 {
 #ifdef OBJECT_DEBUG
@@ -91,9 +157,10 @@ int main(int argc, char **argv)
 #endif
 
 
 #endif
 
 
-#if 1
+       ePython python;
        eMain main;
 
        eMain main;
 
+#if 1
        ePtr<gFBDC> my_dc;
        gFBDC::getInstance(my_dc);
 
        ePtr<gFBDC> my_dc;
        gFBDC::getInstance(my_dc);
 
@@ -129,11 +196,11 @@ int main(int argc, char **argv)
        
        eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
        
        
        eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
        
-       ePython python;
-       
        printf("executing main\n");
        python.execute("mytest", "__main__");
 
        printf("executing main\n");
        python.execute("mytest", "__main__");
 
+//     eApp->exec();
+
        return 0;
 }
 
        return 0;
 }
 
index 3dbcb4aac03c34bdf4e36fcfc163461e89c9e0bf..6aa88e803ca34cda142202ef13642dc5c466fa40 100644 (file)
@@ -25,15 +25,12 @@ class testDialog(Screen):
                self.session.open(screens["mainMenu"]())
                
        def goEmu(self):
                self.session.open(screens["mainMenu"]())
                
        def goEmu(self):
-#              self.close(1)
                self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!")
        
        def goTimeshift(self):
                self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!")
        
        def goTimeshift(self):
-#              self.close(2)
                self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
        
        def goHDTV(self):
                self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
        
        def goHDTV(self):
-#              self.close(3)
                self["title"].setText("HDTV GREEN FLASHES: ENABLED")
        
        def goClock(self):
                self["title"].setText("HDTV GREEN FLASHES: ENABLED")
        
        def goClock(self):
@@ -45,14 +42,17 @@ class testDialog(Screen):
                b.onClick = [ self.testDialogClick ]
                self["okbutton"] = b
                self["title"] = Header("Test Dialog - press ok to leave!")
                b.onClick = [ self.testDialogClick ]
                self["okbutton"] = b
                self["title"] = Header("Test Dialog - press ok to leave!")
-               self["menu"] = MenuList(
-                       [
-                               ("MAIN MENU", self.goMain), 
-                               ("EMU SETUP", self.goEmu),
-                               ("TIMESHIFT SETUP", self.goTimeshift),
-                               ("HDTV PIP CONFIG", self.goHDTV),
-                               ("wie spaet ists?!", self.goClock)
-                       ])
+#              self["menu"] = MenuList(
+#                      [
+#                              ("MAIN MENU", self.goMain), 
+#                              ("EMU SETUP", self.goEmu),
+#                              ("TIMESHIFT SETUP", self.goTimeshift),
+#                              ("HDTV PIP CONFIG", self.goHDTV),
+#                              ("wie spaet ists?!", self.goClock)
+#                      ])
+               self["menu"] = ServiceList()
+               
+               self["menu"].setRoot(eServiceReference("2:0:1:0:0:0:0:0:0:0:/"))
 
 class mainMenu(Screen):
        def __init__(self):
 
 class mainMenu(Screen):
        def __init__(self):