aboutsummaryrefslogtreecommitdiff
path: root/lib/components/scan.cpp
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/scan.cpp
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/scan.cpp')
-rw-r--r--lib/components/scan.cpp109
1 files changed, 109 insertions, 0 deletions
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;
+}