zapit/src/femanager.cpp: add cached have_sat/cable flags

Origin commit data
------------------
Branch: ni/coolstream
Commit: 6753630b68
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-04-02 (Tue, 02 Apr 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2013-04-02 14:30:01 +04:00
parent 108c61b111
commit 87eb85b6bb
2 changed files with 11 additions and 24 deletions

View File

@@ -82,6 +82,8 @@ class CFEManager
common_fe_config_t config;
bool config_exist;
bool have_sat;
bool have_cable;
bool have_locked;
OpenThreads::Mutex mutex;
@@ -136,9 +138,9 @@ class CFEManager
bool lockDemux(int i, transponder_id_t id);
void unlockDemux(int i);
bool haveFreeDemux();
bool haveSat();
bool haveCable();
bool satOnly() { return (haveSat() && !haveCable()); }
bool cableOnly() { return (haveCable() && !haveSat()); }
bool haveSat() { return have_sat; }
bool haveCable() { return have_cable; }
bool satOnly() { return (have_sat && !have_cable); }
bool cableOnly() { return (have_cable && !have_sat); }
};
#endif /* __femanager_h__ */

View File

@@ -90,6 +90,7 @@ bool CFEManager::Init()
unsigned short fekey;
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);
have_sat = have_cable = false;
for(int i = 0; i < MAX_ADAPTERS; i++) {
for(int j = 0; j < MAX_FE; j++) {
fe = new CFrontend(j, i);
@@ -99,6 +100,10 @@ bool CFEManager::Init()
INFO("add fe %d", fe->fenumber);
if(livefe == NULL)
livefe = fe;
if (fe->getInfo()->type == FE_QPSK)
have_sat = true;
else if (fe->getInfo()->type == FE_QAM)
have_cable = true;
} else
delete fe;
}
@@ -751,26 +756,6 @@ bool CFEManager::haveFreeFrontend()
return true;
}
bool CFEManager::haveSat()
{
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second;
if (fe->getInfo()->type == FE_QPSK)
return true;
}
return false;
}
bool CFEManager::haveCable()
{
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second;
if (fe->getInfo()->type == FE_QAM)
return true;
}
return false;
}
int CFEManager::getEnabledCount()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);