1 #include <lib/dvb/dvb.h>
2 #include <lib/dvb/db.h>
3 #include <lib/components/scan.h>
4 #include <lib/base/eerror.h>
5 #include <lib/dvb/scan.h>
7 DEFINE_REF(eComponentScan);
9 void eComponentScan::scanEvent(int evt)
11 eDebug("scan event %d!", evt);
13 if (evt == eDVBScan::evtFinish)
16 ePtr<iDVBChannelList> db;
17 ePtr<eDVBResourceManager> res;
20 if ((err = eDVBResourceManager::getInstance(res)) != 0)
22 eDebug("no resource manager");
24 } else if ((err = res->getChannelList(db)) != 0)
27 eDebug("no channel list");
30 m_scan->insertInto(db);
35 if (evt == eDVBScan::evtFail)
37 eDebug("scan failed.");
45 eComponentScan::eComponentScan(): m_done(-1), m_failed(0)
49 eComponentScan::~eComponentScan()
53 int eComponentScan::start()
59 ePtr<eDVBResourceManager> mgr;
61 eDVBResourceManager::getInstance(mgr);
63 eDVBFrontendParameters *fe = new eDVBFrontendParameters();
65 eDVBFrontendParametersSatellite fesat;
67 fesat.frequency = 11817000; // 12070000;
68 fesat.symbol_rate = 27500000;
69 fesat.polarisation = eDVBFrontendParametersSatellite::Polarisation::Vertical;
70 fesat.fec = eDVBFrontendParametersSatellite::FEC::f3_4;
71 fesat.inversion = eDVBFrontendParametersSatellite::Inversion::Off;
72 fesat.orbital_position = 192;
78 eDVBFrontendParametersTerrestrial fet;
79 fet.frequency = 626000000;
80 fet.inversion = eDVBFrontendParametersTerrestrial::Inversion::Unknown;
81 fet.bandwidth = eDVBFrontendParametersTerrestrial::Bandwidth::Bw8MHz;
82 fet.code_rate_HP = fet.code_rate_LP = eDVBFrontendParametersTerrestrial::FEC::fAuto;
83 fet.modulation = eDVBFrontendParametersTerrestrial::Modulation::QAM16;
84 fet.transmission_mode = eDVBFrontendParametersTerrestrial::TransmissionMode::TM8k;
85 fet.guard_interval = eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_32;
86 fet.hierarchy = eDVBFrontendParametersTerrestrial::Hierarchy::HNone;
89 ePtr<iDVBChannel> channel;
91 if (mgr->allocateRawChannel(channel))
93 eDebug("scan: allocating raw channel failed!");
97 std::list<ePtr<iDVBFrontendParameters> > list;
101 m_scan = new eDVBScan(channel);
102 m_scan->connectEvent(slot(*this, &eComponentScan::scanEvent), m_scan_event_connection);
108 int eComponentScan::getProgress()
112 int done, total, services;
113 m_scan->getStats(done, total, services);
116 return done * 100 / total;
119 int eComponentScan::getNumServices()
123 int done, total, services;
124 m_scan->getStats(done, total, services);
128 int eComponentScan::isDone()
133 int eComponentScan::getError()