frontend: add helpers for DVB-T

Conflicts:
	src/zapit/include/zapit/femanager.h
	src/zapit/src/femanager.cpp
This commit is contained in:
Stefan Seyfried
2013-05-11 23:59:26 +02:00
committed by [CST] Focus
parent 5f4c1b986c
commit 1486109a28
3 changed files with 24 additions and 5 deletions

View File

@@ -84,6 +84,7 @@ class CFEManager
bool have_sat; bool have_sat;
bool have_cable; bool have_cable;
bool have_terr;
bool have_locked; bool have_locked;
OpenThreads::ReentrantMutex mutex; OpenThreads::ReentrantMutex mutex;
@@ -140,10 +141,11 @@ class CFEManager
bool haveFreeDemux(); bool haveFreeDemux();
bool haveSat() { return have_sat; } bool haveSat() { return have_sat; }
bool haveCable() { return have_cable; } bool haveCable() { return have_cable; }
bool satOnly() { return (have_sat && !have_cable); } bool haveTerr() { return have_terr; }
bool cableOnly() { return (have_cable && !have_sat); } bool satOnly() { return (have_sat && !have_cable && !have_terr); }
bool cableOnly() { return (have_cable && !have_sat && ! have_terr); }
bool terrOnly() { return (have_terr && !have_sat && ! have_cable); }
void Lock() { mutex.lock(); } void Lock() { mutex.lock(); }
void Unlock() { mutex.unlock(); } void Unlock() { mutex.unlock(); }
}; };
#endif /* __femanager_h__ */ #endif /* __femanager_h__ */

View File

@@ -262,6 +262,7 @@ class CFrontend
} }
bool isCable() { return (info.type == FE_QAM); } bool isCable() { return (info.type == FE_QAM); }
bool isSat() { return (info.type == FE_QPSK); } bool isSat() { return (info.type == FE_QPSK); }
bool isTerr() { return (info.type == FE_OFDM); }
fe_type_t getType() { return info.type; } fe_type_t getType() { return info.type; }
}; };
#endif /* __zapit_frontend_h__ */ #endif /* __zapit_frontend_h__ */

View File

@@ -92,7 +92,7 @@ bool CFEManager::Init()
unsigned short fekey; unsigned short fekey;
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);
have_sat = have_cable = false; have_sat = have_cable = have_terr = false;
for(int i = 0; i < MAX_ADAPTERS; i++) { for(int i = 0; i < MAX_ADAPTERS; i++) {
for(int j = 0; j < MAX_FE; j++) { for(int j = 0; j < MAX_FE; j++) {
fe = new CFrontend(j, i); fe = new CFrontend(j, i);
@@ -106,6 +106,8 @@ bool CFEManager::Init()
have_sat = true; have_sat = true;
else if (fe->getInfo()->type == FE_QAM) else if (fe->getInfo()->type == FE_QAM)
have_cable = true; have_cable = true;
else if (fe->isTerr())
have_terr = true;
} else } else
delete fe; delete fe;
} }
@@ -227,6 +229,7 @@ bool CFEManager::loadSettings()
} }
bool fsat = true; bool fsat = true;
//bool fcable = true; //bool fcable = true;
bool fterr = true;
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second; CFrontend * fe = it->second;
frontend_config_t & fe_config = fe->getConfig(); frontend_config_t & fe_config = fe->getConfig();
@@ -260,6 +263,14 @@ bool CFEManager::loadSettings()
#endif #endif
def_mode = CFrontend::FE_MODE_INDEPENDENT; def_mode = CFrontend::FE_MODE_INDEPENDENT;
} }
if (fe->isTerr()) {
if (fterr) {
fterr = false;
def_mode = def_mode0;
}
if (def_mode > CFrontend::FE_MODE_INDEPENDENT)
def_mode = CFrontend::FE_MODE_INDEPENDENT;
}
if (femap.size() == 1) if (femap.size() == 1)
def_mode = CFrontend::FE_MODE_INDEPENDENT; def_mode = CFrontend::FE_MODE_INDEPENDENT;
@@ -699,6 +710,11 @@ CFrontend * CFEManager::getScanFrontend(t_satellite_position satellitePosition)
frontend = mfe; frontend = mfe;
break; break;
} }
} else if (mfe->isTerr()) {
if ((mfe->getMode() != CFrontend::FE_MODE_UNUSED) && (satellitePosition & 0xF00) == 0xE00) {
frontend = mfe;
break;
}
} else { } else {
if (mfe->getMode() == CFrontend::FE_MODE_UNUSED || CFrontend::linked(mfe->getMode())) if (mfe->getMode() == CFrontend::FE_MODE_UNUSED || CFrontend::linked(mfe->getMode()))
continue; continue;