X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/54bd4123728628a6f77bad2584b70d1353a91666..9df197b0346cdea53967bf9ed578ff30e2424100:/lib/components/scan.cpp diff --git a/lib/components/scan.cpp b/lib/components/scan.cpp index 4d8d8b78..c21e8f4b 100644 --- a/lib/components/scan.cpp +++ b/lib/components/scan.cpp @@ -20,23 +20,36 @@ void eComponentScan::scanEvent(int evt) if ((err = eDVBResourceManager::getInstance(res)) != 0) { eDebug("no resource manager"); - return; - } - if ((err = res->getChannelList(db)) != 0) + m_failed = 2; + } else if ((err = res->getChannelList(db)) != 0) { + m_failed = 3; eDebug("no channel list"); - return; + } else + { + m_scan->insertInto(db); + db->flush(); + eDebug("scan done!"); } - - m_scan->insertInto(db); - - eDebug("scan done!"); + } + + if (evt == eDVBScan::evtNewService) + { + newService(); + return; + } + + if (evt == eDVBScan::evtFail) + { + eDebug("scan failed."); + m_failed = 1; + m_done = 1; } statusChanged(); } -eComponentScan::eComponentScan(): m_done(-1) +eComponentScan::eComponentScan(): m_done(-1), m_failed(0) { } @@ -44,8 +57,38 @@ eComponentScan::~eComponentScan() { } -int eComponentScan::start() +void eComponentScan::clear() { + m_initial.clear(); +} + +void eComponentScan::addInitial(const eDVBFrontendParametersSatellite &p) +{ + ePtr parm = new eDVBFrontendParameters(); + parm->setDVBS(p); + m_initial.push_back(parm); +} + +void eComponentScan::addInitial(const eDVBFrontendParametersCable &p) +{ + ePtr parm = new eDVBFrontendParameters(); + parm->setDVBC(p); + m_initial.push_back(parm); +} + +void eComponentScan::addInitial(const eDVBFrontendParametersTerrestrial &p) +{ + ePtr parm = new eDVBFrontendParameters(); + parm->setDVBT(p); + m_initial.push_back(parm); +} + + +int eComponentScan::start(int feid, int flags) +{ + if (m_initial.empty()) + return -2; + if (m_done != -1) return -1; @@ -53,33 +96,21 @@ int eComponentScan::start() ePtr 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 channel; - if (mgr->allocateRawChannel(channel)) - eDebug("scan: allocating raw channel failed!"); + eUsePtr channel; + + if (mgr->allocateRawChannel(channel, feid)) + { + eDebug("scan: allocating raw channel (on frontend %d) failed!", feid); + return -1; + } std::list > 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); - + m_scan->start(m_initial, flags); + return 0; } @@ -107,3 +138,15 @@ int eComponentScan::isDone() { return m_done; } + +int eComponentScan::getError() +{ + return m_failed; +} + +void eComponentScan::getLastServiceName(std::string &string) +{ + if (!m_scan) + return; + m_scan->getLastServiceName(string); +}