diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index ccb917346..642cea1c4 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -170,6 +170,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; @@ -194,7 +195,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(); @@ -243,8 +249,6 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) 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; -#if 0 -/* TODO: FIXME */ } 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); @@ -258,7 +262,6 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) 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; -#endif } else { TP.feparams.dvb_feparams.frequency = atoi(scansettings.cable_TP_freq); TP.feparams.dvb_feparams.u.qam.symbol_rate = atoi(scansettings.cable_TP_rate); diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index efe375e61..a3e687797 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -220,6 +220,7 @@ CScanSetup::CScanSetup(bool wizard_mode) satSelect = NULL; cableSelect = NULL; + terrSelect = NULL; satOnOff = NULL; fautoScanAll = NULL; frontendSetup = NULL; @@ -320,7 +321,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++) @@ -374,6 +380,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; @@ -513,6 +520,42 @@ int CScanSetup::showScanMenu() fcableScan->setHint("", LOCALE_MENU_HINT_SCAN_CABLE_SIMPLE); settings->addItem(fcableScan); } + if (CFEManager::getInstance()->haveTerr()) { + r_system = DVB_T; + + 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); + //-------------------------------------------------------------- + settings->addItem(GenericMenuSeparatorLine); + //-------------------------------------------------------------- + fillCableSelect(terrSelect); + // tune timeout, "Setup tuner" is not shown for only one non-sat tuner + if (CFEManager::getInstance()->getFrontendCount() <= 1) { + CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100); + nc->setHint("", LOCALE_MENU_HINT_SCAN_FETIMEOUT); + settings->addItem(nc); + } + + //auto scan + char autoscan[64]; + std::string s_capt_part = g_Locale->getText(LOCALE_TERRESTRIALSETUP_PROVIDER); + snprintf(autoscan, 64, g_Locale->getText(LOCALE_SATSETUP_AUTO_SCAN), s_capt_part.c_str()); + bool have_other = ! CFEManager::getInstance()->terrOnly(); + + /* FIXME leak, satSelect added to both auto and manual scan, so one of them cannot be deleted */ + CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w, MN_WIDGET_ID_SCAN_AUTO_SCAN); + addScanMenuAutoScan(autoScan); + mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_other ? CRCInput::RC_nokey : CRCInput::RC_green, have_other ? NULL : NEUTRINO_ICON_BUTTON_GREEN); + mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); + settings->addItem(mf); + + //manual scan + CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w, MN_WIDGET_ID_SCAN_MANUAL_SCAN); + addScanMenuManualScan(manualScan); + mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_other ? CRCInput::RC_nokey : CRCInput::RC_yellow, have_other ? NULL : NEUTRINO_ICON_BUTTON_YELLOW); + mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); + settings->addItem(mf); + } #if 0 //-------------------------------------------------------------- settings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCANTS_PREVERENCES_SCAN)); @@ -969,17 +1012,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()) @@ -988,10 +1034,14 @@ void CScanSetup::fillCableSelect(CMenuOptionStringChooser * select) if (!sfound && strcmp(scansettings.cableName, sit->second.name.c_str()) == 0) 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) + snprintf(scansettings.cableName, sizeof(scansettings.cableName), "%s", fname.c_str()); + if (r_system == DVB_T) + snprintf(scansettings.terrName, sizeof(scansettings.terrName), "%s", fname.c_str()); } - if (!sfound && !fname.empty()) - snprintf(scansettings.cableName, sizeof(scansettings.cableName), "%s", fname.c_str()); } int CScanSetup::showScanMenuSatFind() @@ -1125,6 +1175,9 @@ 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) { + manual_Scan->addItem(terrSelect); + mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "terrestrial", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } else { manual_Scan->addItem(satSelect); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "sat", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); @@ -1215,20 +1268,27 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) CMenuForwarder * mf; auto_Scan->addIntroItems(); + const char *action; if (r_system == DVB_C) { //cable auto_Scan->addItem(cableSelect); mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); auto_Scan->addItem(mf); - } else + action = "cauto"; + } else if (r_system == DVB_T) { + auto_Scan->addItem(terrSelect); + action = "tauto"; + } else { auto_Scan->addItem(satSelect); + action = "sauto"; + } auto_Scan->addItem(GenericMenuSeparatorLine); //---------------------------------------------------------------------- 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); } @@ -1296,8 +1356,8 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc { printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); int shortCut = shortcut; - - /* TODO: DVB-T scan options */ + fec_count = (r_system == DVB_S) ? SATSETUP_SCANTP_FEC_COUNT : CABLESETUP_SCANTP_FEC_COUNT; + freq_length = (r_system == DVB_S) ? 8 : 6; CMenuOptionChooser *fec = NULL; CMenuOptionChooser *mod_pol = NULL; @@ -1325,6 +1385,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, (char *)scansettings.terr_TP_freq, freq_length, 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); @@ -1558,6 +1622,8 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) char * name; if (actionkey == "sat") name = scansettings.satName; + else if (actionkey == "terrestrial") + name = scansettings.terrName; else name = scansettings.cableName; @@ -1630,6 +1696,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: + sprintf(scansettings.terr_TP_freq, "%d", tmpI->second.feparams.dvb_feparams.frequency); + break; case FE_ATSC: break; } diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index abe24f95c..096756ae7 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -52,6 +52,7 @@ class CScanSetup : public CMenuTarget, public CChangeObserver private: CMenuOptionStringChooser *satSelect; CMenuOptionStringChooser *cableSelect; + CMenuOptionStringChooser *terrSelect; CMenuWidget *satOnOff; /* global items to be enabled/disabled in notify */ diff --git a/src/system/settings.h b/src/system/settings.h index 867d54cdc..2aca3223a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -735,6 +735,8 @@ class CScanSettings char cable_TP_freq[10]; char cable_TP_rate[9]; + char terrName[50]; + char terr_TP_freq[10]; CScanSettings(); //void useDefaults(const delivery_system_t _delivery_system);