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_cable;
bool have_terr;
bool have_locked;
OpenThreads::ReentrantMutex mutex;
@@ -140,10 +141,11 @@ class CFEManager
bool haveFreeDemux();
bool haveSat() { return have_sat; }
bool haveCable() { return have_cable; }
bool satOnly() { return (have_sat && !have_cable); }
bool cableOnly() { return (have_cable && !have_sat); }
bool haveTerr() { return have_terr; }
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 Unlock() { mutex.unlock(); }
};
#endif /* __femanager_h__ */

View File

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

View File

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