- fixed dvb scan
[vuplus_dvbapp] / main / enigma.cpp
index df28bcd..60bea8f 100644 (file)
@@ -21,6 +21,8 @@
 #include <lib/python/python.h>
 #include <lib/python/connections.h>
 
+#include <lib/gui/elistboxcontent.h>
+
 #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;
@@ -84,6 +75,81 @@ void keyEvent(const eRCKey &key)
                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
@@ -91,9 +157,10 @@ int main(int argc, char **argv)
 #endif
 
 
-#if 1
+       ePython python;
        eMain main;
 
+#if 1
        ePtr<gFBDC> my_dc;
        gFBDC::getInstance(my_dc);
 
@@ -129,11 +196,11 @@ int main(int argc, char **argv)
        
        eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
        
-       ePython python;
-       
        printf("executing main\n");
        python.execute("mytest", "__main__");
 
+//     eApp->exec();
+
        return 0;
 }