diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index e3b50c908..d30030f63 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -74,7 +74,7 @@ extern cVideo * videoDecoder; #define BAR_WIDTH 150 #define BAR_HEIGHT 16//(13 + BAR_BORDER*2) -CScanTs::CScanTs() +CScanTs::CScanTs(int dtype) { frameBuffer = CFrameBuffer::getInstance(); radar = 0; @@ -83,13 +83,17 @@ CScanTs::CScanTs() sigscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); snrscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); + deltype = dtype; } void CScanTs::prev_next_TP( bool up) { t_satellite_position position = 0; - position = CServiceManager::getInstance()->GetSatellitePosition(scansettings.satNameNoDiseqc); + if (deltype == FE_QPSK) + position = CServiceManager::getInstance()->GetSatellitePosition(scansettings.satName); + else + position = CServiceManager::getInstance()->GetSatellitePosition(scansettings.cableName); transponder_list_t &select_transponders = CServiceManager::getInstance()->GetSatelliteTransponders(position); transponder_list_t::iterator tI; @@ -114,7 +118,7 @@ void CScanTs::prev_next_TP( bool up) if(next_tp) { TP.feparams.dvb_feparams.frequency = tI->second.feparams.dvb_feparams.frequency; - if(g_info.delivery_system == DVB_S) { + if (deltype == FE_QPSK) { TP.feparams.dvb_feparams.u.qpsk.symbol_rate = tI->second.feparams.dvb_feparams.u.qpsk.symbol_rate; TP.feparams.dvb_feparams.u.qpsk.fec_inner = tI->second.feparams.dvb_feparams.u.qpsk.fec_inner; TP.polarization = tI->second.polarization; @@ -133,15 +137,15 @@ void CScanTs::testFunc() char buffer[128]; char * f, *s, *m; - CFrontend * frontend = CServiceScan::getInstance()->GetFrontend(); - if(frontend->getInfo()->type == FE_QPSK) { - frontend->getDelSys(TP.feparams.dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation((fe_code_rate_t)TP.feparams.dvb_feparams.u.qpsk.fec_inner), f, s, m); + if(deltype == FE_QPSK) { + CFrontend::getDelSys(deltype, TP.feparams.dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation((fe_code_rate_t)TP.feparams.dvb_feparams.u.qpsk.fec_inner), f, s, m); snprintf(buffer,sizeof(buffer), "%u %c %d %s %s %s", TP.feparams.dvb_feparams.frequency/1000, transponder::pol(TP.polarization), TP.feparams.dvb_feparams.u.qpsk.symbol_rate/1000, f, s, m); - } else if(frontend->getInfo()->type == FE_QAM) { - frontend->getDelSys(scansettings.TP_fec, scansettings.TP_mod, f, s, m); - snprintf(buffer,sizeof(buffer), "%u %d %s %s %s", atoi(scansettings.TP_freq)/1000, atoi(scansettings.TP_rate)/1000, f, s, m); + } else { + CFrontend::getDelSys(deltype, TP.feparams.dvb_feparams.u.qam.fec_inner, TP.feparams.dvb_feparams.u.qam.modulation, f, s, m); + snprintf(buffer,sizeof(buffer), "%u %d %s %s %s", TP.feparams.dvb_feparams.frequency/1000, TP.feparams.dvb_feparams.u.qam.symbol_rate/1000, f, s, m); } - paintLine(xpos2, ypos_cur_satellite, w - 95, scansettings.satNameNoDiseqc); +printf("CScanTs::testFunc: %s\n", buffer); + paintLine(xpos2, ypos_cur_satellite, w - 95, pname); paintLine(xpos2, ypos_frequency, w, buffer); success = g_Zapit->tune_TP(TP); } @@ -172,6 +176,8 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) bool manual = (actionKey == "manual") || test; bool fast = (actionKey == "fast"); + pname = (deltype == FE_QPSK) ? scansettings.satName : scansettings.cableName; + int scan_pids = CZapit::getInstance()->scanPids(); hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -208,22 +214,23 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) if(scansettings.scan_nit_manual) scan_flags |= CServiceScan::SCAN_NIT; TP.scan_mode = scan_flags; - TP.feparams.dvb_feparams.frequency = atoi(scansettings.TP_freq); - if(g_info.delivery_system == DVB_S) { - TP.feparams.dvb_feparams.u.qpsk.symbol_rate = atoi(scansettings.TP_rate); - TP.feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) scansettings.TP_fec; - TP.polarization = scansettings.TP_pol; + if (deltype == FE_QPSK) { + TP.feparams.dvb_feparams.frequency = atoi(scansettings.sat_TP_freq); + TP.feparams.dvb_feparams.u.qpsk.symbol_rate = atoi(scansettings.sat_TP_rate); + TP.feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) scansettings.sat_TP_fec; + TP.polarization = scansettings.sat_TP_pol; } else { - TP.feparams.dvb_feparams.u.qam.symbol_rate = atoi(scansettings.TP_rate); - TP.feparams.dvb_feparams.u.qam.fec_inner = (fe_code_rate_t)scansettings.TP_fec; - TP.feparams.dvb_feparams.u.qam.modulation = (fe_modulation_t) scansettings.TP_mod; + TP.feparams.dvb_feparams.frequency = atoi(scansettings.cable_TP_freq); + TP.feparams.dvb_feparams.u.qam.symbol_rate = atoi(scansettings.cable_TP_rate); + TP.feparams.dvb_feparams.u.qam.fec_inner = (fe_code_rate_t)scansettings.cable_TP_fec; + TP.feparams.dvb_feparams.u.qam.modulation = (fe_modulation_t) scansettings.cable_TP_mod; } //printf("[neutrino] freq %d rate %d fec %d pol %d\n", TP.feparams.dvb_feparams.frequency, TP.feparams.dvb_feparams.u.qpsk.symbol_rate, TP.feparams.dvb_feparams.u.qpsk.fec_inner, TP.polarization); } else { if(scansettings.scan_nit) scan_flags |= CServiceScan::SCAN_NIT; } - if(g_info.delivery_system == DVB_C) + if(deltype == FE_QAM) CServiceScan::getInstance()->SetCableNID(scansettings.cable_nid); CZapitClient::commandSetScanSatelliteList sat; @@ -232,8 +239,8 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) if(fast) { } else if(manual || !scan_all) { - sat.position = CServiceManager::getInstance()->GetSatellitePosition(scansettings.satNameNoDiseqc); - strncpy(sat.satName, scansettings.satNameNoDiseqc, 49); + sat.position = CServiceManager::getInstance()->GetSatellitePosition(pname); + strncpy(sat.satName, pname, 49); satList.push_back(sat); } else { satellite_map_t & satmap = CServiceManager::getInstance()->SatelliteList(); @@ -493,12 +500,12 @@ void CScanTs::paint(bool fortest) ypos_cur_satellite = ypos; - if (g_info.delivery_system == DVB_S) + if(deltype == FE_QPSK) { //sat paintLineLocale(xpos1, &ypos, width - xpos1, LOCALE_SCANTS_ACTSATELLITE); xpos2 = xpos1 + 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE), true); // UTF-8 } - if (g_info.delivery_system == DVB_C) + if(deltype == FE_QAM) { //cable paintLineLocale(xpos1, &ypos, width - xpos1, LOCALE_SCANTS_ACTCABLE); xpos2 = xpos1 + 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(LOCALE_SCANTS_ACTCABLE), true); // UTF-8 diff --git a/src/gui/scan.h b/src/gui/scan.h index db871bcc0..9a1d32cad 100644 --- a/src/gui/scan.h +++ b/src/gui/scan.h @@ -80,9 +80,11 @@ class CScanTs : public CMenuTarget void testFunc(); void prev_next_TP(bool); TP_params TP; + int deltype; + char * pname; public: - CScanTs(); + CScanTs(int dtype = FE_QPSK); void hide(); int exec(CMenuTarget* parent, const std::string & actionKey); };