diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 4725abf55..3e90157b5 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -4,13 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2011-2012 Stefan Seyfried License: GPL @@ -125,6 +119,18 @@ void CScanTs::prev_next_TP( bool up) 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; + } else if (deltype == FE_OFDM) { + /* DVB-T. TODO: proper menu and parameter setup, not all "AUTO" */ + if (TP.feparams.dvb_feparams.frequency < 300000) + TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_7_MHZ; + else + TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_8_MHZ; + TP.feparams.dvb_feparams.u.ofdm.code_rate_HP = FEC_AUTO; + TP.feparams.dvb_feparams.u.ofdm.code_rate_LP = FEC_AUTO; + TP.feparams.dvb_feparams.u.ofdm.constellation = QAM_AUTO; + TP.feparams.dvb_feparams.u.ofdm.transmission_mode = TRANSMISSION_MODE_AUTO; + TP.feparams.dvb_feparams.u.ofdm.guard_interval = GUARD_INTERVAL_AUTO; + TP.feparams.dvb_feparams.u.ofdm.hierarchy_information = HIERARCHY_AUTO; } else { TP.feparams.dvb_feparams.u.qam.symbol_rate = tI->second.feparams.dvb_feparams.u.qam.symbol_rate; TP.feparams.dvb_feparams.u.qam.fec_inner = tI->second.feparams.dvb_feparams.u.qam.fec_inner; @@ -143,11 +149,14 @@ void CScanTs::testFunc() 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 { + } else if (deltype == FE_QAM) { 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); + } else if (deltype == FE_OFDM) { + sprintf(buffer, "%u", TP.feparams.dvb_feparams.frequency); /* no way int can overflow the buffer */ } -printf("CScanTs::testFunc: %s\n", buffer); + + printf("CScanTs::testFunc: %s\n", buffer); paintLine(xpos2, ypos_cur_satellite, w - 95, pname.c_str()); paintLine(xpos2, ypos_frequency, w, buffer); success = g_Zapit->tune_TP(TP); @@ -155,6 +164,7 @@ printf("CScanTs::testFunc: %s\n", buffer); int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) { + printf("CScanTs::exec %s\n", actionKey.c_str()); neutrino_msg_t msg; neutrino_msg_data_t data; @@ -179,7 +189,12 @@ 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; + switch (deltype) { + case FE_QPSK: pname = scansettings.satName; break; + case FE_QAM: pname = scansettings.cableName; break; + case FE_OFDM: pname = scansettings.terrName; break; + default: printf("CScanTs::exec:%d unknown deltype %d\n", __LINE__, deltype); + } int scan_pids = CZapit::getInstance()->scanPids(); @@ -223,6 +238,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) TP.polarization = scansettings.sat_TP_pol; } else if (deltype == FE_OFDM) { /* DVB-T. TODO: proper menu and parameter setup, not all "AUTO" */ + TP.feparams.dvb_feparams.frequency = atoi(scansettings.terr_TP_freq.c_str()); if (TP.feparams.dvb_feparams.frequency < 300000) TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_7_MHZ; else diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index c84e5c8e8..2db44b9b5 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -310,7 +310,12 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) std::string scants_key[] = {"all", "manual", "test", "fast", "auto"/*doesn't exists in CScanTs!*/}; if (actionKey.size() > 1) { - int delsys = actionKey[0] == 's' ? FE_QPSK : FE_QAM; + int delsys; + switch (actionKey[0]) { + case 's': delsys = FE_QPSK; break; + case 't': delsys = FE_OFDM; break; + default: delsys = FE_QAM; break; + } std::string as = actionKey.substr(1); printf("[neutrino] CScanSetup::%s scan %c in %s mode...\n", __FUNCTION__, actionKey[0], as.c_str()); for (uint i=0; i< (sizeof(scants_key)/sizeof(scants_key[0])); i++) @@ -368,6 +373,7 @@ int CScanSetup::showScanMenu() printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); int shortcut = 1; int w = getSatMenuListWidth(); + printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager::getInstance()->haveSat(), CFEManager::getInstance()->haveTerr()); CMenuForwarder * mf; CMenuOptionChooser * mc; @@ -956,17 +962,20 @@ void CScanSetup::fillSatSelect(CMenuOptionStringChooser * select) //init cable provider menu void CScanSetup::fillCableSelect(CMenuOptionStringChooser * select) { - printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); + const char *what = r_system == DVB_C ? "cable" : "terrestrial"; + printf("[neutrino] CScanSetup call %s (%s)...\n", __func__, what); //don't misunderstand the name "satSelect", in this context it's actually for cable providers satellite_map_t satmap = CServiceManager::getInstance()->SatelliteList(); bool sfound = false; std::string fname; for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); sit++) { - if (sit->second.deltype != FE_QAM) + if (r_system == DVB_C && sit->second.deltype != FE_QAM) + continue; + if (r_system == DVB_T && sit->second.deltype != FE_OFDM) continue; - printf("Adding cable menu for %s position %d\n", sit->second.name.c_str(), sit->first); + printf("Adding %s menu for %s position %d\n", what, sit->second.name.c_str(), sit->first); select->addOption(sit->second.name.c_str()); if (fname.empty()) @@ -975,10 +984,14 @@ void CScanSetup::fillCableSelect(CMenuOptionStringChooser * select) if (!sfound && (scansettings.cableName == sit->second.name)) sfound = true; - dprintf(DEBUG_DEBUG, "got scanprovider (cable): %s\n", sit->second.name.c_str()); + dprintf(DEBUG_DEBUG, "got scanprovider (%s): %s\n", what, sit->second.name.c_str()); + } + if (!sfound && !fname.empty()) { + if (r_system == DVB_C) + scansettings.cableName = fname; + if (r_system == DVB_T) + scansettings.terrName = fname; } - if (!sfound && !fname.empty()) - scansettings.cableName = fname; } int CScanSetup::showScanMenuSatFind() @@ -1062,7 +1075,7 @@ void CScanSetup::addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t & satcon motor->setHint("", LOCALE_MENU_HINT_SCAN_MOTORPOS); usals = new CMenuOptionChooser(LOCALE_EXTRA_USE_GOTOXX, &satconfig.use_usals, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true /*dmode == DISEQC_ADVANCED*/); usals->setHint("", LOCALE_MENU_HINT_SCAN_USEUSALS); - }else{ + } else { if (satconfig.diseqc < 0) satconfig.diseqc = 0; unilnb = new CMenuOptionNumberChooser(LOCALE_UNICABLE_LNB, &satconfig.diseqc, true, 0, 1); @@ -1102,8 +1115,10 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) CMenuForwarder * mf; manual_Scan->addIntroItems(); + const char *act_test, *act_manual; //---------------------------------------------------------------------- if (r_system == DVB_C) { + act_test = "ctest"; act_manual = "cmanual"; CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, &scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); fillCableSelect(cableSelect); @@ -1112,7 +1127,15 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); manual_Scan->addItem(mf); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "cable", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + } else if (r_system == DVB_T) { + act_test = "ttest"; act_manual = "tmanual"; + CMenuOptionStringChooser * terrSelect = new CMenuOptionStringChooser(LOCALE_TERRESTRIALSETUP_PROVIDER, &scansettings.terrName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + //terrSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(terrSelect); + manual_Scan->addItem(terrSelect); + mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "terrestrial", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } else { + act_test = "stest"; act_manual = "smanual"; CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, &scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); /* add configured satellites to satSelect */ @@ -1131,11 +1154,11 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) //---------------------------------------------------------------------- manual_Scan->addItem(GenericMenuSeparatorLine); - mf = new CMenuForwarder(LOCALE_SCANTS_TEST, allow_start, NULL, this, r_system == DVB_C ? "ctest" : "stest", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf = new CMenuForwarder(LOCALE_SCANTS_TEST, allow_start, NULL, this, act_test, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); mf->setHint("", LOCALE_MENU_HINT_SCAN_TEST); manual_Scan->addItem(mf); - mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, r_system == DVB_C ? "cmanual" : "smanual", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, act_manual, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); mf->setHint("", LOCALE_MENU_HINT_SCAN_START); manual_Scan->addItem(mf); } @@ -1206,6 +1229,7 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) CMenuForwarder * mf; auto_Scan->addIntroItems(); + const char *action; if (r_system == DVB_C) { //cable CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, &scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); @@ -1214,12 +1238,20 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); auto_Scan->addItem(mf); + action = "cauto"; + } else if (r_system == DVB_T) { + CMenuOptionStringChooser * terrSelect = new CMenuOptionStringChooser(LOCALE_TERRESTRIALSETUP_PROVIDER, &scansettings.terrName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + //terrSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(terrSelect); + auto_Scan->addItem(terrSelect); + action = "tauto"; } else { CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, &scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); /* add configured satellites to satSelect */ fillSatSelect(satSelect); auto_Scan->addItem(satSelect); + action = "sauto"; } auto_Scan->addItem(GenericMenuSeparatorLine); @@ -1227,7 +1259,7 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) addListFlagsItems(auto_Scan, 1); //---------------------------------------------------------------------- auto_Scan->addItem(GenericMenuSeparatorLine); - mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, r_system == DVB_C ? "cauto" : "sauto", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, action, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", LOCALE_MENU_HINT_SCAN_START); auto_Scan->addItem(mf); } @@ -1322,10 +1354,10 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc Rate->setHint("", LOCALE_MENU_HINT_SCAN_RATE); mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_MOD, (int *)&scansettings.cable_TP_mod, SATSETUP_SCANTP_MOD, SATSETUP_SCANTP_MOD_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_MOD); - } else if (r_system == DVB_T) { - CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, &scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); - Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); - Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); + } else if (r_system == DVB_T) { + CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, &scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); + Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); + Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); } options_menu->addItem(Freq); @@ -1547,6 +1579,8 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) std::string name; if (actionkey == "sat") name = scansettings.satName; + else if (actionkey == "terrestrial") + name = scansettings.terrName; else name = scansettings.cableName; @@ -1619,6 +1653,8 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) scansettings.cable_TP_mod = tmpI->second.feparams.dvb_feparams.u.qam.modulation; break; case FE_OFDM: + scansettings.terr_TP_freq = to_string(tmpI->second.feparams.dvb_feparams.frequency); + break; case FE_ATSC: break; } diff --git a/src/system/settings.h b/src/system/settings.h index a162462cc..ab0a6cf6b 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -789,6 +789,8 @@ class CScanSettings std::string cable_TP_freq; std::string cable_TP_rate; + std::string terrName; + std::string terr_TP_freq; CScanSettings(); //void useDefaults(const delivery_system_t _delivery_system);