zapit/src/scan.cpp: add scan flags enum

This commit is contained in:
[CST] Focus
2012-03-25 16:36:41 +04:00
parent 90db393eeb
commit 019b7a810b
2 changed files with 31 additions and 18 deletions

View File

@@ -27,6 +27,13 @@ class CServiceScan : public OpenThreads::Thread
SCAN_TRANSPONDER, SCAN_TRANSPONDER,
SCAN_FAST SCAN_FAST
} scan_type_t; } scan_type_t;
typedef enum scan_flags {
SCAN_NIT = 0x01,
SCAN_BAT = 0x02,
SCAN_FTA = 0x04,
SCAN_RESET_NUMBERS = 0x08,
SCAN_LOGICAL_NUMBERS = 0x10
} scan_flags_t;
private: private:
bool started; bool started;
@@ -34,7 +41,7 @@ class CServiceScan : public OpenThreads::Thread
bool cable; bool cable;
bool abort_scan; bool abort_scan;
scan_type_t scan_mode; scan_type_t scan_mode;
bool scan_nit; int flags;
void * scan_arg; void * scan_arg;
uint32_t fake_tid, fake_nid; uint32_t fake_tid, fake_nid;
@@ -105,6 +112,7 @@ class CServiceScan : public OpenThreads::Thread
uint32_t & FoundTransponders() { return found_transponders; }; uint32_t & FoundTransponders() { return found_transponders; };
uint32_t & FoundChannels() { return found_channels; }; uint32_t & FoundChannels() { return found_channels; };
void SetCableNID(unsigned short nid) { cable_nid = nid; } void SetCableNID(unsigned short nid) { cable_nid = nid; }
bool isFtaOnly() { return flags & SCAN_FTA; }
}; };
#endif /* __scan_h__ */ #endif /* __scan_h__ */

View File

@@ -61,9 +61,10 @@ CServiceScan * CServiceScan::getInstance()
CServiceScan::CServiceScan() CServiceScan::CServiceScan()
{ {
started = false; started = false;
scan_nit = false;
running = false; running = false;
cable_nid = 0; cable_nid = 0;
frontend = CFEManager::getInstance()->getFE(0); frontend = CFEManager::getInstance()->getFE(0);
} }
@@ -266,30 +267,32 @@ _repeat:
CNit nit(satellitePosition, freq, cable_nid); CNit nit(satellitePosition, freq, cable_nid);
#ifdef NIT_THREAD #ifdef NIT_THREAD
if(scan_nit) if(flags & SCAN_NIT)
nit.Start(); nit.Start();
#endif #endif
#ifdef USE_BAT #ifdef USE_BAT
CBat bat(satellitePosition, freq); CBat bat(satellitePosition, freq);
bat.Start(); if(flags & SCAN_BAT)
bat.Start();
#endif #endif
CSdt sdt(satellitePosition, freq); CSdt sdt(satellitePosition, freq);
bool sdt_parsed = sdt.Parse(tI->second.transport_stream_id, tI->second.original_network_id); bool sdt_parsed = sdt.Parse(tI->second.transport_stream_id, tI->second.original_network_id);
#ifdef NIT_THREAD #ifdef NIT_THREAD
if(scan_nit) if(flags & SCAN_NIT)
nit.Stop(); nit.Stop();
#endif #endif
#ifdef USE_BAT #ifdef USE_BAT
bat.Stop(); if(flags & SCAN_BAT)
bat.Stop();
#endif #endif
if(!sdt_parsed) { if(!sdt_parsed) {
printf("[scan] SDT failed !\n"); printf("[scan] SDT failed !\n");
continue; continue;
} }
#ifndef NIT_THREAD #ifndef NIT_THREAD
if(scan_nit) if(flags & SCAN_NIT)
nit.Parse(); nit.Parse();
#endif #endif
@@ -315,7 +318,7 @@ _repeat:
printf("[scan] tpid ready: %llx\n", TsidOnid); printf("[scan] tpid ready: %llx\n", TsidOnid);
} }
if(scan_nit) { if(flags & SCAN_NIT) {
printf("[scan] found %d transponders (%d failed) and %d channels\n", found_transponders, failed_transponders, found_channels); printf("[scan] found %d transponders (%d failed) and %d channels\n", found_transponders, failed_transponders, found_channels);
scantransponders.clear(); scantransponders.clear();
for (tI = nittransponders.begin(); tI != nittransponders.end(); tI++) { for (tI = nittransponders.begin(); tI != nittransponders.end(); tI++) {
@@ -505,7 +508,8 @@ bool CServiceScan::ScanProviders()
uint8_t diseqc_pos = 0; uint8_t diseqc_pos = 0;
scanBouquetManager = new CBouquetManager(); scanBouquetManager = new CBouquetManager();
bool satfeed = false; bool satfeed = false;
int mode = (int) scan_arg;
flags = (int) scan_arg;
curr_sat = 0; curr_sat = 0;
@@ -515,10 +519,9 @@ bool CServiceScan::ScanProviders()
else else
frontendType = "sat"; frontendType = "sat";
scan_nit = (mode & 0xFF) == 0; // NIT (0) or fast (1) printf("[scan] NIT %s, fta only: %s, satellites %s\n", flags & SCAN_NIT ? "yes" : "no",
int scan_sat_mode = mode & 0xFF00; // single = 0, all = 1 flags & SCAN_FTA ? "yes" : "no", scanProviders.size() == 1 ? "single" : "multi");
printf("[zapit] scan mode %s, satellites %s\n", scan_nit ? "NIT" : "fast", scan_sat_mode ? "all" : "single");
CZapitClient myZapitClient; CZapitClient myZapitClient;
/* get first child */ /* get first child */
@@ -611,17 +614,19 @@ bool CServiceScan::ScanTransponder()
strcpy(providerName, scanProviders.size() > 0 ? scanProviders.begin()->second.c_str() : "unknown provider"); strcpy(providerName, scanProviders.size() > 0 ? scanProviders.begin()->second.c_str() : "unknown provider");
printf("[scan_transponder] scanning sat %s position %d\n", providerName, satellitePosition); printf("[scan] scanning sat %s position %d\n", providerName, satellitePosition);
CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, providerName, strlen(providerName) + 1); CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, providerName, strlen(providerName) + 1);
scan_nit = (TP->scan_mode & 0xFF) == 0; // NIT (0) or fast (1)
TP->feparams.inversion = INVERSION_AUTO; TP->feparams.inversion = INVERSION_AUTO;
if (!cable) { if (cable) {
printf("[scan_transponder] freq %d rate %d fec %d pol %d NIT %s\n", TP->feparams.frequency, TP->feparams.u.qpsk.symbol_rate, TP->feparams.u.qpsk.fec_inner, TP->polarization, scan_nit ? "no" : "yes"); printf("[scan] freq %d rate %d fec %d mod %d\n", TP->feparams.frequency, TP->feparams.u.qam.symbol_rate, TP->feparams.u.qam.fec_inner, TP->feparams.u.qam.modulation);
} else } else
printf("[scan_transponder] freq %d rate %d fec %d mod %d\n", TP->feparams.frequency, TP->feparams.u.qam.symbol_rate, TP->feparams.u.qam.fec_inner, TP->feparams.u.qam.modulation); printf("[scan] freq %d rate %d fec %d pol %d\n", TP->feparams.frequency, TP->feparams.u.qpsk.symbol_rate, TP->feparams.u.qpsk.fec_inner, TP->polarization);
flags = TP->scan_mode;
printf("[scan] NIT %s, fta only: %s, satellites %s\n", flags & SCAN_NIT ? "yes" : "no",
flags & SCAN_FTA ? "yes" : "no", scanProviders.size() == 1 ? "single" : "multi");
freq_id_t freq; freq_id_t freq;
if(cable) if(cable)