aboutsummaryrefslogtreecommitdiff
path: root/lib/components
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-02-09 22:59:04 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-02-09 22:59:04 +0000
commit54bd4123728628a6f77bad2584b70d1353a91666 (patch)
tree51fe5fa7108c770670ce4304b6d704eff292722b /lib/components
parentd9ee52e4f0fbe9a1ae00d0e66f9e6f0a07fa319f (diff)
downloadenigma2-54bd4123728628a6f77bad2584b70d1353a91666.tar.gz
enigma2-54bd4123728628a6f77bad2584b70d1353a91666.zip
- fixed console input mode restore
- added "scan" component - scan possible from main menu
Diffstat (limited to 'lib/components')
-rw-r--r--lib/components/Makefile.am7
-rw-r--r--lib/components/scan.cpp109
-rw-r--r--lib/components/scan.h35
3 files changed, 151 insertions, 0 deletions
diff --git a/lib/components/Makefile.am b/lib/components/Makefile.am
new file mode 100644
index 00000000..d40a1667
--- /dev/null
+++ b/lib/components/Makefile.am
@@ -0,0 +1,7 @@
+INCLUDES = \
+ -I$(top_srcdir)/include
+
+noinst_LIBRARIES = libenigma_components.a
+
+libenigma_components_a_SOURCES = scan.cpp
+ \ No newline at end of file
diff --git a/lib/components/scan.cpp b/lib/components/scan.cpp
new file mode 100644
index 00000000..4d8d8b78
--- /dev/null
+++ b/lib/components/scan.cpp
@@ -0,0 +1,109 @@
+#include <lib/dvb/dvb.h>
+#include <lib/dvb/db.h>
+#include <lib/components/scan.h>
+#include <lib/base/eerror.h>
+#include <lib/dvb/scan.h>
+
+DEFINE_REF(eComponentScan);
+
+void eComponentScan::scanEvent(int evt)
+{
+ eDebug("scan event %d!", evt);
+
+ if (evt == eDVBScan::evtFinish)
+ {
+ m_done = 1;
+ ePtr<iDVBChannelList> db;
+ ePtr<eDVBResourceManager> res;
+
+ int err;
+ if ((err = eDVBResourceManager::getInstance(res)) != 0)
+ {
+ eDebug("no resource manager");
+ return;
+ }
+ if ((err = res->getChannelList(db)) != 0)
+ {
+ eDebug("no channel list");
+ return;
+ }
+
+ m_scan->insertInto(db);
+
+ eDebug("scan done!");
+ }
+
+ statusChanged();
+}
+
+eComponentScan::eComponentScan(): m_done(-1)
+{
+}
+
+eComponentScan::~eComponentScan()
+{
+}
+
+int eComponentScan::start()
+{
+ if (m_done != -1)
+ return -1;
+
+ m_done = 0;
+ ePtr<eDVBResourceManager> mgr;
+
+ eDVBResourceManager::getInstance(mgr);
+
+ 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);
+
+ ePtr<iDVBChannel> channel;
+
+ if (mgr->allocateRawChannel(channel))
+ eDebug("scan: allocating raw channel failed!");
+
+ std::list<ePtr<iDVBFrontendParameters> > list;
+
+ list.push_back(fe);
+
+ m_scan = new eDVBScan(channel);
+ m_scan->start(list);
+ m_scan->connectEvent(slot(*this, &eComponentScan::scanEvent), m_scan_event_connection);
+
+ return 0;
+}
+
+int eComponentScan::getProgress()
+{
+ if (!m_scan)
+ return 0;
+ int done, total, services;
+ m_scan->getStats(done, total, services);
+ if (!total)
+ return 0;
+ return done * 100 / total;
+}
+
+int eComponentScan::getNumServices()
+{
+ if (!m_scan)
+ return 0;
+ int done, total, services;
+ m_scan->getStats(done, total, services);
+ return services;
+}
+
+int eComponentScan::isDone()
+{
+ return m_done;
+}
diff --git a/lib/components/scan.h b/lib/components/scan.h
new file mode 100644
index 00000000..afa68689
--- /dev/null
+++ b/lib/components/scan.h
@@ -0,0 +1,35 @@
+#ifndef __lib_components_scan_h
+#define __lib_components_scan_h
+
+#include <lib/base/object.h>
+
+class eDVBScan;
+
+class eComponentScan: public Object, public iObject
+{
+DECLARE_REF;
+private:
+ void scanEvent(int event);
+ ePtr<eConnection> m_scan_event_connection;
+ ePtr<eDVBScan> m_scan;
+
+ int m_done;
+public:
+ eComponentScan();
+ ~eComponentScan();
+
+ PSignal0<void> statusChanged;
+
+ /* progress between 0 and 100 */
+ int getProgress();
+
+ /* get number of services */
+ int getNumServices();
+
+ /* true when done. */
+ int isDone();
+
+ int start();
+};
+
+#endif