X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/cc9862b55b147eb78581813ba70d574940ac103d..96a165cdc48c3bdec6e0570186fa7843975db950:/lib/components/scan.cpp?ds=sidebyside diff --git a/lib/components/scan.cpp b/lib/components/scan.cpp index c21e8f4b..c027fe6b 100644 --- a/lib/components/scan.cpp +++ b/lib/components/scan.cpp @@ -8,44 +8,44 @@ DEFINE_REF(eComponentScan); void eComponentScan::scanEvent(int evt) { - eDebug("scan event %d!", evt); +// eDebug("scan event %d!", evt); - if (evt == eDVBScan::evtFinish) + switch(evt) { - m_done = 1; - ePtr db; - ePtr res; - - int err; - if ((err = eDVBResourceManager::getInstance(res)) != 0) + case eDVBScan::evtFinish: { - eDebug("no resource manager"); - m_failed = 2; - } else if ((err = res->getChannelList(db)) != 0) - { - m_failed = 3; - eDebug("no channel list"); - } else - { - m_scan->insertInto(db); - db->flush(); - eDebug("scan done!"); + m_done = 1; + ePtr db; + ePtr res; + + int err; + if ((err = eDVBResourceManager::getInstance(res)) != 0) + { + eDebug("no resource manager"); + m_failed = 2; + } else if ((err = res->getChannelList(db)) != 0) + { + m_failed = 3; + eDebug("no channel list"); + } else + { + m_scan->insertInto(db); + db->flush(); + eDebug("scan done!"); + } + break; } + case eDVBScan::evtNewService: + newService(); + return; + case eDVBScan::evtFail: + eDebug("scan failed."); + m_failed = 1; + m_done = 1; + break; + case eDVBScan::evtUpdate: + break; } - - if (evt == eDVBScan::evtNewService) - { - newService(); - return; - } - - if (evt == eDVBScan::evtFail) - { - eDebug("scan failed."); - m_failed = 1; - m_done = 1; - } - statusChanged(); } @@ -106,11 +106,48 @@ int eComponentScan::start(int feid, int flags) } std::list > list; - m_scan = new eDVBScan(channel); m_scan->connectEvent(slot(*this, &eComponentScan::scanEvent), m_scan_event_connection); + + if (!(flags & scanRemoveServices)) + { + ePtr db; + ePtr res; + int err; + if ((err = eDVBResourceManager::getInstance(res)) != 0) + eDebug("no resource manager"); + else if ((err = res->getChannelList(db)) != 0) + eDebug("no channel list"); + else + { + if (m_initial.size() > 1) + { + ePtr tp = m_initial.first(); + int type; + if (tp && !tp->getSystem(type)) + { + switch(type) + { + case iDVBFrontend::feSatellite: + { + eDVBFrontendParametersSatellite parm; + tp->getDVBS(parm); + db->removeFlags(eDVBService::dxNewFound, -1, -1, -1, parm.orbital_position); + break; + } + case iDVBFrontend::feCable: + db->removeFlags(eDVBService::dxNewFound, 0xFFFF0000, -1, -1, -1); + break; + case iDVBFrontend::feTerrestrial: + db->removeFlags(eDVBService::dxNewFound, 0xEEEE0000, -1, -1, -1); + break; + } + } + } + } + } m_scan->start(m_initial, flags); - + return 0; } @@ -150,3 +187,20 @@ void eComponentScan::getLastServiceName(std::string &string) return; m_scan->getLastServiceName(string); } + +RESULT eComponentScan::getFrontend(ePtr &fe) +{ + if (m_scan) + return m_scan->getFrontend(fe); + fe = 0; + return -1; +} + +RESULT eComponentScan::getCurrentTransponder(ePtr &tp) +{ + if (m_scan) + return m_scan->getCurrentTransponder(tp); + tp = 0; + return -1; +} +