scansetup: add DVB-T

Conflicts:
	src/gui/scan_setup.cpp
	src/gui/scan_setup.h


Origin commit data
------------------
Commit: 1a4f65302e
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-05-12 (Sun, 12 May 2013)
This commit is contained in:
Stefan Seyfried
2013-05-12 02:47:00 +02:00
committed by [CST] Focus
parent 2bfe31821f
commit 02fc993e74
3 changed files with 79 additions and 25 deletions

View File

@@ -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,10 +149,13 @@ 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);
paintLine(xpos2, ypos_cur_satellite, w - 95, pname.c_str());
paintLine(xpos2, ypos_frequency, w, buffer);
@@ -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

View File

@@ -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 (!sfound && !fname.empty()) {
if (r_system == DVB_C)
scansettings.cableName = fname;
if (r_system == DVB_T)
scansettings.terrName = fname;
}
}
int CScanSetup::showScanMenuSatFind()
@@ -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);
}
@@ -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;
}

View File

@@ -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);