diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 62eb2728f..ca8562edc 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -235,9 +235,15 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) TP.feparams.delsys = (delivery_system_t)scansettings.sat_TP_delsys; TP.feparams.modulation = (fe_modulation_t) scansettings.sat_TP_mod; TP.feparams.pilot = (zapit_pilot_t) scansettings.sat_TP_pilot; - TP.feparams.plp_id = atoi(scansettings.sat_TP_pli.c_str()); - TP.feparams.pls_code = atoi(scansettings.sat_TP_plc.c_str()); + TP.feparams.plp_id = (unsigned int)atoi(scansettings.sat_TP_pli.c_str()); + if (TP.feparams.plp_id == 0) + TP.feparams.plp_id = NO_STREAM_ID_FILTER; + TP.feparams.pls_code = (uint32_t)atoi(scansettings.sat_TP_plc.c_str()); + if (TP.feparams.pls_code == 0) + TP.feparams.pls_code = PLS_Default_Gold_Code; TP.feparams.pls_mode = (fe_pls_mode_t) scansettings.sat_TP_plm; + if (TP.feparams.pls_mode == 0) + TP.feparams.pls_mode = PLS_Gold; } else if (CFrontend::isTerr(delsys)) { /* DVB-T. TODO: proper menu and parameter setup, not all "AUTO" */ TP.feparams.frequency = atoi(scansettings.terrestrial_TP_freq.c_str()); @@ -253,7 +259,9 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) TP.feparams.guard_interval = (fe_guard_interval_t)scansettings.terrestrial_TP_guard; TP.feparams.hierarchy = (fe_hierarchy_t)scansettings.terrestrial_TP_hierarchy; TP.feparams.delsys = (delivery_system_t)scansettings.terrestrial_TP_delsys; - TP.feparams.plp_id = atoi(scansettings.terrestrial_TP_pli.c_str()); + TP.feparams.plp_id = (unsigned int)atoi(scansettings.terrestrial_TP_pli.c_str()); + if (TP.feparams.plp_id == 0) + TP.feparams.plp_id = NO_STREAM_ID_FILTER; } else if (CFrontend::isCable(delsys)) { TP.feparams.frequency = atoi(scansettings.cable_TP_freq.c_str()); TP.feparams.symbol_rate = atoi(scansettings.cable_TP_rate.c_str()); @@ -442,7 +450,10 @@ neutrino_msg_t CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) if (CFrontend::isSat(feparams->delsys)) { CFrontend::getDelSys(feparams->delsys, feparams->fec_inner, feparams->modulation, f, s, m); - snprintf(buffer,sizeof(buffer), "%u %c %d %s %s %s (%d/%d/%s) ", freq, transponder::pol(feparams->polarization), feparams->symbol_rate/1000, f, s, m, feparams->plp_id, feparams->pls_code, transponder::getPLSMode(feparams->pls_mode).c_str()); + if (feparams->plp_id == NO_STREAM_ID_FILTER) + snprintf(buffer,sizeof(buffer), "%u %c %d %s %s %s ", freq, transponder::pol(feparams->polarization), feparams->symbol_rate/1000, f, s, m); + else + snprintf(buffer,sizeof(buffer), "%u %c %d %s %s %s (%u/%s/%s) ", freq, transponder::pol(feparams->polarization), feparams->symbol_rate/1000, f, s, m, feparams->plp_id, transponder::getPLSCode(feparams->pls_code).c_str(), transponder::getPLSMode(feparams->pls_mode).c_str()); } else if (CFrontend::isCable(feparams->delsys)) { @@ -453,7 +464,10 @@ neutrino_msg_t CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) { CFrontend::getDelSys(feparams->delsys, feparams->code_rate_HP, feparams->modulation, f, s, m); CFrontend::getDelSys(feparams->delsys, feparams->code_rate_LP, feparams->modulation, f2, s, m); - snprintf(buffer,sizeof(buffer), "%u %d %s %s %s %d ", freq, CFrontend::getFEBandwidth(feparams->bandwidth)/1000, f, f2, m, feparams->plp_id); + if (feparams->plp_id == NO_STREAM_ID_FILTER) + snprintf(buffer,sizeof(buffer), "%u %d %s %s %s ", freq, CFrontend::getFEBandwidth(feparams->bandwidth)/1000, f, f2, m); + else + snprintf(buffer,sizeof(buffer), "%u %d %s %s %s %u ", freq, CFrontend::getFEBandwidth(feparams->bandwidth)/1000, f, f2, m, feparams->plp_id); } paintLine(xpos2, ypos_frequency, (ypos_frequency > ypos_radar + 66) ? w : w_to_radar, buffer); } diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 39a35cc7c..a1c579d42 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -1803,7 +1803,7 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc coderateLP->setHint("", LOCALE_MENU_HINT_SCAN_FEC); tm = new CMenuOptionChooser(LOCALE_EXTRA_TP_TRANSMIT_MODE, (int *)&scansettings.terrestrial_TP_transmit_mode, TERRSETUP_SCANTP_TRANSMIT_MODE, TERRSETUP_SCANTP_TRANSMIT_MODE_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); tm->setHint("", LOCALE_MENU_HINT_SCAN_TRANSMIT_MODE); - CStringInput *pli = new CStringInput(LOCALE_EXTRA_TP_PLI, &scansettings.terrestrial_TP_pli, 1, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); + CStringInput *pli = new CStringInput(LOCALE_EXTRA_TP_PLI, &scansettings.terrestrial_TP_pli, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); Pli = new CMenuDForwarder(LOCALE_EXTRA_TP_PLI, true, scansettings.terrestrial_TP_pli, pli, "", CRCInput::convertDigitToKey(shortCut++)); } @@ -2028,7 +2028,7 @@ void CScanSetup::updateManualSettings() scansettings.sat_TP_delsys = tI->second.feparams.delsys; scansettings.sat_TP_mod = tI->second.feparams.modulation; scansettings.satName = CServiceManager::getInstance()->GetSatelliteName(channel->getSatellitePosition()); - scansettings.sat_TP_pli = to_string(tI->second.feparams.plp_id); + scansettings.sat_TP_pli = (tI->second.feparams.plp_id == NO_STREAM_ID_FILTER ? "0" : to_string(tI->second.feparams.plp_id)); scansettings.sat_TP_plc = to_string(tI->second.feparams.pls_code); scansettings.sat_TP_plm = tI->second.feparams.pls_mode; } else if (CFrontend::isCable(tI->second.feparams.delsys)) { @@ -2047,7 +2047,7 @@ void CScanSetup::updateManualSettings() scansettings.terrestrial_TP_transmit_mode = tI->second.feparams.transmission_mode; scansettings.terrestrial_TP_coderate_HP = tI->second.feparams.code_rate_HP; scansettings.terrestrial_TP_coderate_LP = tI->second.feparams.code_rate_LP; - scansettings.terrestrial_TP_pli = to_string(tI->second.feparams.plp_id); + scansettings.terrestrial_TP_pli = (tI->second.feparams.plp_id == NO_STREAM_ID_FILTER ? "0" : to_string(tI->second.feparams.plp_id)); scansettings.terrestrialName = CServiceManager::getInstance()->GetSatelliteName(channel->getSatellitePosition()); } @@ -2153,7 +2153,7 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) scansettings.sat_TP_delsys = tmpI->second.feparams.delsys; scansettings.sat_TP_mod = tmpI->second.feparams.modulation; scansettings.sat_TP_pilot = tmpI->second.feparams.pilot; - scansettings.sat_TP_pli = to_string(tmpI->second.feparams.plp_id); + scansettings.sat_TP_pli = (tmpI->second.feparams.plp_id == NO_STREAM_ID_FILTER ? "0" : to_string(tmpI->second.feparams.plp_id)); scansettings.sat_TP_plc = to_string(tmpI->second.feparams.pls_code); scansettings.sat_TP_plm = tmpI->second.feparams.pls_mode; } @@ -2172,7 +2172,7 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) scansettings.terrestrial_TP_transmit_mode = tmpI->second.feparams.transmission_mode; scansettings.terrestrial_TP_coderate_HP = tmpI->second.feparams.code_rate_HP; scansettings.terrestrial_TP_coderate_LP = tmpI->second.feparams.code_rate_LP; - scansettings.terrestrial_TP_pli = to_string(tmpI->second.feparams.plp_id); + scansettings.terrestrial_TP_pli = (tmpI->second.feparams.plp_id == NO_STREAM_ID_FILTER ? "0" : to_string(tmpI->second.feparams.plp_id)); //scansettings.terrestrialName = CServiceManager::getInstance()->GetSatelliteName(channel->getSatellitePosition()); } } diff --git a/src/system/settings.cpp b/src/system/settings.cpp index 122728a73..547fe2662 100644 --- a/src/system/settings.cpp +++ b/src/system/settings.cpp @@ -153,7 +153,7 @@ bool CScanSettings::loadSettings(const char * const fileName) sat_TP_delsys = configfile.getInt32("sat_TP_delsys", DVB_S); sat_TP_pilot = configfile.getInt32("sat_TP_pilot", ZPILOT_AUTO); sat_TP_pli = configfile.getString("sat_TP_pli", "0"); - sat_TP_plc = configfile.getString("sat_TP_plc", "1"); + sat_TP_plc = configfile.getString("sat_TP_plc", "0"); sat_TP_plm = configfile.getInt32("sat_TP_plm", 0); cableName = configfile.getString("cableName", cableName); @@ -214,9 +214,18 @@ bool CScanSettings::saveSettings(const char * const fileName) configfile.setInt32("sat_TP_delsys", sat_TP_delsys); configfile.setInt32("sat_TP_mod", sat_TP_mod); configfile.setInt32("sat_TP_pilot", sat_TP_pilot); - configfile.setString("sat_TP_pli", sat_TP_pli); - configfile.setString("sat_TP_plc", sat_TP_plc); - configfile.setInt32("sat_TP_plm", sat_TP_plm); + if (atoi(sat_TP_pli.c_str()) == 0) + { + configfile.setString("sat_TP_pli", "0"); + configfile.setString("sat_TP_plc", "0"); + configfile.setInt32("sat_TP_plm", 0); + } + else + { + configfile.setString("sat_TP_pli", sat_TP_pli); + configfile.setString("sat_TP_plc", sat_TP_plc); + configfile.setInt32("sat_TP_plm", sat_TP_plm); + } configfile.setString("cableName", cableName); configfile.setInt32("cable_TP_fec", cable_TP_fec); @@ -235,7 +244,10 @@ bool CScanSettings::saveSettings(const char * const fileName) configfile.setInt32("terrestrial_TP_guard", terrestrial_TP_guard); configfile.setInt32("terrestrial_TP_transmit_mode", terrestrial_TP_transmit_mode); configfile.setInt32("terrestrial_TP_delsys", terrestrial_TP_delsys); - configfile.setString("terrestrial_TP_pli", terrestrial_TP_pli); + if (atoi(terrestrial_TP_pli.c_str()) == 0) + configfile.setString("terrestrial_TP_pli", "0"); + else + configfile.setString("terrestrial_TP_pli", terrestrial_TP_pli); if(configfile.getModifiedFlag()) configfile.saveConfig(fileName); diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index 152f902f3..8035e12d5 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -159,8 +159,6 @@ class CFrontend //uint32_t numDeliverySystems; t_channel_id channel_id; - bool buildProperties(const FrontendParameters*, struct dtv_properties &, bool can_multistream); - FrontendParameters getFrontend(void) const; void secSetTone(const fe_sec_tone_mode_t mode, const uint32_t ms); void secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms); diff --git a/src/zapit/include/zapit/frontend_types.h b/src/zapit/include/zapit/frontend_types.h index d3e288aff..5f036eaf5 100644 --- a/src/zapit/include/zapit/frontend_types.h +++ b/src/zapit/include/zapit/frontend_types.h @@ -115,6 +115,16 @@ typedef enum { PLS_Unknown } fe_pls_mode_t; +typedef enum { + PLS_Default_Gold_Code, + PLS_Default_Root_Code +} fe_pls_code_t; + +typedef enum { + No_T2MI_PLP_Id = NO_STREAM_ID_FILTER, + T2MI_Default_Pid = 4096 +} fe_t2mi_pid_t; + typedef struct { delivery_system_t delsys; uint32_t frequency; @@ -136,7 +146,7 @@ typedef struct { enum fe_interleaving interleaving; #endif uint8_t polarization; - uint8_t plp_id; //0-255 + unsigned int plp_id; //0-255 fe_pls_mode_t pls_mode; uint32_t pls_code; //0-262142 } FrontendParameters; diff --git a/src/zapit/include/zapit/transponder.h b/src/zapit/include/zapit/transponder.h index e76181c3b..5dd224cb6 100644 --- a/src/zapit/include/zapit/transponder.h +++ b/src/zapit/include/zapit/transponder.h @@ -49,6 +49,7 @@ public: static char pol(unsigned char pol); std::string description(void); static std::string getPLSMode(const uint8_t pls_mode); + static std::string getPLSCode(const uint32_t pls_code); delivery_system_t getDelSys(void) { return feparams.delsys; } t_transport_stream_id getTransportStreamId(void) { return transport_stream_id; } diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 5dbe58e3f..4dc3ea30a 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -54,122 +54,7 @@ extern int zapit_debug; #define WEST 1 #define USALS -#define CLEAR 0 -// Common properties -#define FREQUENCY 1 -#define MODULATION 2 -#define INVERSION 3 -// common to S/S2/C -#define SYMBOL_RATE 4 -#define DELIVERY_SYSTEM 5 -#define INNER_FEC 6 -// DVB-S/S2 specific -#define PILOTS 7 -#define ROLLOFF 8 -// DVB-S2X specific -#define MIS 9 -// DVB-T specific -#define BANDWIDTH 4 -#define CODE_RATE_HP 6 -#define CODE_RATE_LP 7 -#define TRANSMISSION_MODE 8 -#define GUARD_INTERVAL 9 -#define HIERARCHY 10 -// DVB-T2 specific -#define PLP_ID 11 - -#define FE_COMMON_PROPS 2 -#define FE_DVBS_PROPS 6 -#define FE_DVBS2_PROPS 8 -#define FE_DVBS2X_PROPS 9 -#define FE_DVBC_PROPS 6 -#define FE_DVBT_PROPS 10 -#define FE_DVBT2_PROPS 11 - -/* stolen from dvb.c from vlc */ -static const struct dtv_property dvbs_cmdargs[] = { - { DTV_CLEAR, {0,0,0}, { 0 }, 0 }, - { DTV_FREQUENCY, {} , { 0 }, 0 }, - { DTV_MODULATION, {} , { QPSK }, 0 }, - { DTV_INVERSION, {} , { INVERSION_AUTO }, 0 }, - { DTV_SYMBOL_RATE, {} , { 27500000 }, 0 }, - { DTV_DELIVERY_SYSTEM, {} , { SYS_DVBS }, 0 }, - { DTV_INNER_FEC, {} , { FEC_AUTO }, 0 }, - { DTV_TUNE, {} , { 0 }, 0 } -}; - -static const struct dtv_property dvbs2_cmdargs[] = { - { DTV_CLEAR, {0,0,0}, { 0 }, 0 }, - { DTV_FREQUENCY, {} , { 0 }, 0 }, - { DTV_MODULATION, {} , { PSK_8 }, 0 }, - { DTV_INVERSION, {} , { INVERSION_AUTO }, 0 }, - { DTV_SYMBOL_RATE, {} , { 27500000 }, 0 }, - { DTV_DELIVERY_SYSTEM, {} , { SYS_DVBS2 }, 0 }, - { DTV_INNER_FEC, {} , { FEC_AUTO }, 0 }, - { DTV_PILOT, {} , { PILOT_AUTO }, 0 }, - { DTV_ROLLOFF, {} , { ROLLOFF_AUTO }, 0 }, - { DTV_TUNE, {} , { 0 }, 0 } -}; - -static const struct dtv_property dvbs2x_cmdargs[] = { - { DTV_CLEAR, {0,0,0}, { 0 }, 0 }, - { DTV_FREQUENCY, {} , { 0 }, 0 }, - { DTV_MODULATION, {} , { PSK_8 }, 0 }, - { DTV_INVERSION, {} , { INVERSION_AUTO }, 0 }, - { DTV_SYMBOL_RATE, {} , { 27500000 }, 0 }, - { DTV_DELIVERY_SYSTEM, {} , { SYS_DVBS2 }, 0 }, - { DTV_INNER_FEC, {} , { FEC_AUTO }, 0 }, - { DTV_PILOT, {} , { PILOT_AUTO }, 0 }, - { DTV_ROLLOFF, {} , { ROLLOFF_AUTO }, 0 }, - { DTV_STREAM_ID, {} , { NO_STREAM_ID_FILTER }, 0 }, - { DTV_TUNE, {} , { 0 }, 0 } -}; - -static const struct dtv_property dvbc_cmdargs[] = { - { DTV_CLEAR, {0,0,0}, { 0 }, 0 }, - { DTV_FREQUENCY, {} , { 0 }, 0 }, - { DTV_MODULATION, {} , { QAM_AUTO }, 0 }, - { DTV_INVERSION, {} , { INVERSION_AUTO }, 0 }, - { DTV_SYMBOL_RATE, {} , { 27500000 }, 0 }, - { DTV_DELIVERY_SYSTEM, {} , { SYS_DVBC_ANNEX_AC }, 0 }, - { DTV_INNER_FEC, {} , { FEC_AUTO }, 0 }, - { DTV_TUNE, {} , { 0 }, 0 } -}; - -static const struct dtv_property dvbt_cmdargs[] = { - { DTV_CLEAR, {0,0,0}, { 0 }, 0 }, - { DTV_FREQUENCY, {} , { 0 }, 0 }, - { DTV_MODULATION, {} , { QAM_AUTO }, 0 }, - { DTV_INVERSION, {} , { INVERSION_AUTO }, 0 }, - { DTV_BANDWIDTH_HZ, {} , { 8000000 }, 0 }, - { DTV_DELIVERY_SYSTEM, {} , { SYS_DVBT }, 0 }, - { DTV_CODE_RATE_HP, {} , { FEC_AUTO }, 0 }, - { DTV_CODE_RATE_LP, {} , { FEC_AUTO }, 0 }, - { DTV_TRANSMISSION_MODE,{} , { TRANSMISSION_MODE_AUTO }, 0 }, - { DTV_GUARD_INTERVAL, {} , { GUARD_INTERVAL_AUTO }, 0 }, - { DTV_HIERARCHY, {} , { HIERARCHY_AUTO }, 0 }, - { DTV_TUNE, {} , { 0 }, 0 } -}; - -static const struct dtv_property dvbt2_cmdargs[] = { - { DTV_CLEAR, {0,0,0}, { 0 }, 0 }, - { DTV_FREQUENCY, {} , { 0 }, 0 }, - { DTV_MODULATION, {} , { QAM_AUTO }, 0 }, - { DTV_INVERSION, {} , { INVERSION_AUTO }, 0 }, - { DTV_BANDWIDTH_HZ, {} , { 8000000 }, 0 }, - { DTV_DELIVERY_SYSTEM, {} , { SYS_DVBT2 }, 0 }, - { DTV_CODE_RATE_HP, {} , { FEC_AUTO }, 0 }, - { DTV_CODE_RATE_LP, {} , { FEC_AUTO }, 0 }, - { DTV_TRANSMISSION_MODE,{} , { TRANSMISSION_MODE_AUTO }, 0 }, - { DTV_GUARD_INTERVAL, {} , { GUARD_INTERVAL_AUTO }, 0 }, - { DTV_HIERARCHY, {} , { HIERARCHY_AUTO }, 0 }, -#if defined DTV_STREAM_ID - { DTV_STREAM_ID, {} , { NO_STREAM_ID_FILTER }, 0 }, -#elif defined DTV_DVBT2_PLP_ID - { DTV_DVBT2_PLP_ID, {} , { NO_STREAM_ID_FILTER }, 0 }, -#endif - { DTV_TUNE, {} , { 0 }, 0 } -}; +#define FE_MAX_PROPS 18 #define diff(x,y) (max(x,y) - min(x,y)) @@ -1310,10 +1195,8 @@ fe_delivery_system_t CFrontend::getFEDeliverySystem(delivery_system_t Delsys) delsys = SYS_DVBS; break; case DVB_S2: - delsys = SYS_DVBS2; - break; case DVB_S2X: - delsys = SYS_DVBS2X; + delsys = SYS_DVBS2; break; case DVB_T: delsys = SYS_DVBT; @@ -1449,10 +1332,22 @@ uint32_t CFrontend::getFEBandwidth(fe_bandwidth_t bandwidth) return bandwidth_hz; } -bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_properties& cmdseq, bool can_multistream) +int CFrontend::setFrontend(const FrontendParameters *feparams, bool nowait) { + tuned = false; + + struct dvb_frontend_event ev; + { + // Erase previous events + while (1) { + if (ioctl(fd, FE_GET_EVENT, &ev) < 0) + break; + //printf("[fe%d/%d] DEMOD: event status %d\n", adapter, fenumber, ev.status); + } + } + fe_pilot_t pilot = PILOT_OFF; - int fec; + int fec = FEC_AUTO; fe_code_rate_t fec_inner = feparams->fec_inner; /* cast to int is ncesessary because many of the FEC_S2 values are not @@ -1464,7 +1359,7 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p break; case FEC_2_3: fec = FEC_2_3; - if ((feparams->delsys == DVB_S2 || feparams->delsys == DVB_S2X) && feparams->modulation == PSK_8) + if ((getFEDeliverySystem(feparams->delsys) == SYS_DVBS2) && feparams->modulation == PSK_8) #if BOXMODEL_VUPLUS_ARM pilot = PILOT_AUTO; #else @@ -1473,7 +1368,7 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p break; case FEC_3_4: fec = FEC_3_4; - if ((feparams->delsys == DVB_S2 || feparams->delsys == DVB_S2X) && feparams->modulation == PSK_8) + if ((getFEDeliverySystem(feparams->delsys) == SYS_DVBS2) && feparams->modulation == PSK_8) #if BOXMODEL_VUPLUS_ARM pilot = PILOT_AUTO; #else @@ -1485,7 +1380,7 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p break; case FEC_5_6: fec = FEC_5_6; - if ((feparams->delsys == DVB_S2 || feparams->delsys == DVB_S2X) && feparams->modulation == PSK_8) + if ((getFEDeliverySystem(feparams->delsys) == SYS_DVBS2) && feparams->modulation == PSK_8) #if BOXMODEL_VUPLUS_ARM pilot = PILOT_AUTO; #else @@ -1503,7 +1398,7 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p break; case FEC_3_5: fec = FEC_3_5; - if ((feparams->delsys == DVB_S2 || feparams->delsys == DVB_S2X) && feparams->modulation == PSK_8) + if ((getFEDeliverySystem(feparams->delsys) == SYS_DVBS2) && feparams->modulation == PSK_8) #if BOXMODEL_VUPLUS_ARM pilot = PILOT_AUTO; #else @@ -1577,159 +1472,114 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p break; default: INFO("[fe%d/%d] DEMOD: unknown FEC: %d\n", adapter, fenumber, fec_inner); - /* fall through */ + /* fall through */ case FEC_AUTO: fec = FEC_AUTO; break; } switch(feparams->pilot) { - case ZPILOT_ON: - pilot = PILOT_ON; - break; - case ZPILOT_OFF: - pilot = PILOT_OFF; - break; - case ZPILOT_AUTO: - default: - pilot = PILOT_AUTO; - break; + case ZPILOT_ON: + pilot = PILOT_ON; + break; + case ZPILOT_OFF: + pilot = PILOT_OFF; + break; + case ZPILOT_AUTO: + default: + pilot = PILOT_AUTO; + break; } - int nrOfProps = 0; + struct dtv_property p[FE_MAX_PROPS]; + memset(p, 0, sizeof(p)); + struct dtv_properties cmdseq; + cmdseq.props = p; + cmdseq.num = 0; + p[cmdseq.num].cmd = DTV_CLEAR; cmdseq.num++; switch (feparams->delsys) { case DVB_S: case DVB_S2: case DVB_S2X: - if (feparams->delsys == DVB_S2 || feparams->delsys == DVB_S2X) - { - if (can_multistream) - { - nrOfProps = FE_DVBS2X_PROPS; - memcpy(cmdseq.props, dvbs2x_cmdargs, sizeof(dvbs2x_cmdargs)); - cmdseq.props[MIS].u.data = feparams->plp_id | (feparams->pls_code << 8) | (feparams->pls_mode << 26); - } - else - { - nrOfProps = FE_DVBS2_PROPS; - memcpy(cmdseq.props, dvbs2_cmdargs, sizeof(dvbs2_cmdargs)); - } - cmdseq.props[MODULATION].u.data = feparams->modulation; - cmdseq.props[ROLLOFF].u.data = feparams->rolloff; - cmdseq.props[PILOTS].u.data = pilot; - } + p[cmdseq.num].cmd = DTV_DELIVERY_SYSTEM, p[cmdseq.num].u.data = getFEDeliverySystem(feparams->delsys), cmdseq.num++; + if (config.diseqcType == DISEQC_UNICABLE) + p[cmdseq.num].cmd = DTV_FREQUENCY, + p[cmdseq.num].u.data = sendEN50494TuningCommand(feparams->frequency, currentToneMode == SEC_TONE_ON, + currentVoltage == SEC_VOLTAGE_18, !!config.uni_lnb), cmdseq.num++; + + else if (config.diseqcType == DISEQC_UNICABLE2) + p[cmdseq.num].cmd = DTV_FREQUENCY, + p[cmdseq.num].u.data = sendEN50607TuningCommand(feparams->frequency, currentToneMode == SEC_TONE_ON, + currentVoltage == SEC_VOLTAGE_18, config.uni_lnb), cmdseq.num++; else + p[cmdseq.num].cmd = DTV_FREQUENCY, p[cmdseq.num].u.data = feparams->frequency, cmdseq.num++; + p[cmdseq.num].cmd = DTV_MODULATION, p[cmdseq.num].u.data = feparams->modulation, cmdseq.num++; + p[cmdseq.num].cmd = DTV_SYMBOL_RATE, p[cmdseq.num].u.data = feparams->symbol_rate, cmdseq.num++; + p[cmdseq.num].cmd = DTV_INNER_FEC, p[cmdseq.num].u.data = fec, cmdseq.num++; + p[cmdseq.num].cmd = DTV_INVERSION, p[cmdseq.num].u.data = feparams->inversion, cmdseq.num++; + if (getFEDeliverySystem(feparams->delsys) == SYS_DVBS2) { - memcpy(cmdseq.props, dvbs_cmdargs, sizeof(dvbs_cmdargs)); - nrOfProps = FE_DVBS_PROPS; + p[cmdseq.num].cmd = DTV_ROLLOFF, p[cmdseq.num].u.data = feparams->rolloff, cmdseq.num++; + p[cmdseq.num].cmd = DTV_PILOT, p[cmdseq.num].u.data = pilot, cmdseq.num++; + if (fe_can_multistream) + { +#if (DVB_API_VERSION >= 5 && DVB_API_VERSION_MINOR >= 11) + p[cmdseq.num].cmd = DTV_STREAM_ID, p[cmdseq.num].u.data = feparams->plp_id, cmdseq.num++; + p[cmdseq.num].cmd = DTV_SCRAMBLING_SEQUENCE_INDEX, p[cmdseq.num].u.data = feparams->pls_code, cmdseq.num++; +#else + p[cmdseq.num].cmd = DTV_STREAM_ID, p[cmdseq.num].u.data = feparams->plp_id | (feparams->pls_code << 8) | (feparams->pls_mode << 26), cmdseq.num++; +#endif + } + p[cmdseq.num].cmd = DTV_ISDBT_SB_SEGMENT_IDX, p[cmdseq.num].u.data = (feparams->plp_id == NO_STREAM_ID_FILTER ? 0 : (0x80000000 | (T2MI_Default_Pid << 16) | feparams->plp_id)), cmdseq.num++; } - cmdseq.props[FREQUENCY].u.data = feparams->frequency; - cmdseq.props[SYMBOL_RATE].u.data = feparams->symbol_rate; - cmdseq.props[INNER_FEC].u.data = fec; /*_inner*/ ; - if (can_multistream) + if (fe_can_multistream) INFO("[fe%d/%d] tuner pilot %d (feparams %d) streamid (%d/%d/%d)\n", adapter, fenumber, pilot, feparams->pilot, feparams->plp_id, feparams->pls_code, feparams->pls_mode ); else INFO("[fe%d/%d] tuner pilot %d (feparams %d)\n", adapter, fenumber, pilot, feparams->pilot); break; case DVB_C: - memcpy(cmdseq.props, dvbc_cmdargs, sizeof(dvbc_cmdargs)); - nrOfProps = FE_DVBC_PROPS; - cmdseq.props[FREQUENCY].u.data = feparams->frequency; - cmdseq.props[MODULATION].u.data = feparams->modulation; - cmdseq.props[SYMBOL_RATE].u.data = feparams->symbol_rate; - cmdseq.props[INNER_FEC].u.data = fec_inner; + p[cmdseq.num].cmd = DTV_DELIVERY_SYSTEM, p[cmdseq.num].u.data = getFEDeliverySystem(feparams->delsys), cmdseq.num++; + p[cmdseq.num].cmd = DTV_FREQUENCY, p[cmdseq.num].u.data = feparams->frequency, cmdseq.num++; + p[cmdseq.num].cmd = DTV_MODULATION, p[cmdseq.num].u.data = feparams->modulation, cmdseq.num++; + p[cmdseq.num].cmd = DTV_SYMBOL_RATE, p[cmdseq.num].u.data = feparams->symbol_rate, cmdseq.num++; + p[cmdseq.num].cmd = DTV_INNER_FEC, p[cmdseq.num].u.data = feparams->fec_inner, cmdseq.num++; + p[cmdseq.num].cmd = DTV_INVERSION, p[cmdseq.num].u.data = feparams->inversion, cmdseq.num++; break; case DVB_T: - case DTMB: - memcpy(cmdseq.props, dvbt_cmdargs, sizeof(dvbt_cmdargs)); - nrOfProps = FE_DVBT_PROPS; - cmdseq.props[FREQUENCY].u.data = feparams->frequency; - cmdseq.props[MODULATION].u.data = feparams->modulation; - cmdseq.props[INVERSION].u.data = feparams->inversion; - cmdseq.props[CODE_RATE_HP].u.data = feparams->code_rate_HP; - cmdseq.props[CODE_RATE_LP].u.data = feparams->code_rate_LP; - cmdseq.props[TRANSMISSION_MODE].u.data = feparams->transmission_mode; - cmdseq.props[GUARD_INTERVAL].u.data = feparams->guard_interval; - cmdseq.props[HIERARCHY].u.data = feparams->hierarchy; - cmdseq.props[DELIVERY_SYSTEM].u.data = getFEDeliverySystem(feparams->delsys); - cmdseq.props[BANDWIDTH].u.data = getFEBandwidth(feparams->bandwidth); - break; case DVB_T2: - memcpy(cmdseq.props, dvbt2_cmdargs, sizeof(dvbt2_cmdargs)); - nrOfProps = FE_DVBT2_PROPS; - cmdseq.props[FREQUENCY].u.data = feparams->frequency; - cmdseq.props[MODULATION].u.data = feparams->modulation; - cmdseq.props[INVERSION].u.data = feparams->inversion; - cmdseq.props[CODE_RATE_HP].u.data = feparams->code_rate_HP; - cmdseq.props[CODE_RATE_LP].u.data = feparams->code_rate_LP; - cmdseq.props[TRANSMISSION_MODE].u.data = feparams->transmission_mode; - cmdseq.props[GUARD_INTERVAL].u.data = feparams->guard_interval; - cmdseq.props[HIERARCHY].u.data = feparams->hierarchy; - cmdseq.props[DELIVERY_SYSTEM].u.data = getFEDeliverySystem(feparams->delsys); - cmdseq.props[BANDWIDTH].u.data = getFEBandwidth(feparams->bandwidth); - cmdseq.props[PLP_ID].u.data = feparams->plp_id; + case DTMB: + p[cmdseq.num].cmd = DTV_DELIVERY_SYSTEM, p[cmdseq.num].u.data = getFEDeliverySystem(feparams->delsys), cmdseq.num++; + p[cmdseq.num].cmd = DTV_FREQUENCY, p[cmdseq.num].u.data = feparams->frequency, cmdseq.num++; + p[cmdseq.num].cmd = DTV_CODE_RATE_LP, p[cmdseq.num].u.data = feparams->code_rate_LP, cmdseq.num++; + p[cmdseq.num].cmd = DTV_CODE_RATE_HP, p[cmdseq.num].u.data = feparams->code_rate_HP, cmdseq.num++; + p[cmdseq.num].cmd = DTV_MODULATION, p[cmdseq.num].u.data = feparams->modulation, cmdseq.num++; + p[cmdseq.num].cmd = DTV_TRANSMISSION_MODE, p[cmdseq.num].u.data = feparams->transmission_mode, cmdseq.num++; + p[cmdseq.num].cmd = DTV_GUARD_INTERVAL, p[cmdseq.num].u.data = feparams->guard_interval, cmdseq.num++; + p[cmdseq.num].cmd = DTV_HIERARCHY, p[cmdseq.num].u.data = feparams->hierarchy, cmdseq.num++; + p[cmdseq.num].cmd = DTV_BANDWIDTH_HZ, p[cmdseq.num].u.data = getFEBandwidth(feparams->bandwidth), cmdseq.num++; + p[cmdseq.num].cmd = DTV_INVERSION, p[cmdseq.num].u.data = feparams->inversion, cmdseq.num++; + if (getFEDeliverySystem(feparams->delsys) == SYS_DVBT2) + { +#if defined DTV_STREAM_ID + p[cmdseq.num].cmd = DTV_STREAM_ID, p[cmdseq.num].u.data = feparams->plp_id, cmdseq.num++; +#elif defined DTV_DVBT2_PLP_ID + p[cmdseq.num].cmd = DTV_DVBT2_PLP_ID, p[cmdseq.num].u.data = feparams->plp_id, cmdseq.num++; +#endif + } break; default: INFO("[fe%d/%d] unknown frontend type, exiting\n", adapter, fenumber); - return false; - } - - - if (config.diseqcType == DISEQC_UNICABLE) - cmdseq.props[FREQUENCY].u.data = sendEN50494TuningCommand(feparams->frequency, - currentToneMode == SEC_TONE_ON, - currentVoltage == SEC_VOLTAGE_18, - !!config.uni_lnb); - - if (config.diseqcType == DISEQC_UNICABLE2) - cmdseq.props[FREQUENCY].u.data = sendEN50607TuningCommand(feparams->frequency, - currentToneMode == SEC_TONE_ON, - currentVoltage == SEC_VOLTAGE_18, - config.uni_lnb); - - cmdseq.num += nrOfProps; - - return true; -} - -int CFrontend::setFrontend(const FrontendParameters *feparams, bool nowait) -{ - struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBT2_PROPS]; // WARNING: increase when needed more space - struct dtv_properties cmdseq; -#ifdef PEDANTIC_VALGRIND_SETUP - memset(&cmdargs, 0, sizeof(cmdargs)); - memset(&cmdseq, 0, sizeof(cmdseq)); -#endif - - cmdseq.num = FE_COMMON_PROPS; - cmdseq.props = cmdargs; - - tuned = false; - - struct dvb_frontend_event ev; - { - // Erase previous events - while (1) { - if (ioctl(fd, FE_GET_EVENT, &ev) < 0) - break; - //printf("[fe%d/%d] DEMOD: event status %d\n", adapter, fenumber, ev.status); - } - } - - if (!buildProperties(feparams, cmdseq, fe_can_multistream)) return 0; - - { - //FE_TIMER_INIT(); - //FE_TIMER_START(); - if ((ioctl(fd, FE_SET_PROPERTY, &cmdseq)) < 0) { - ERROR("FE_SET_PROPERTY"); - return false; - } - //FE_TIMER_STOP("FE_SET_PROPERTY took"); } + p[cmdseq.num].cmd = DTV_TUNE, cmdseq.num++; + + if ((ioctl(fd, FE_SET_PROPERTY, &cmdseq)) < 0) { + ERROR("FE_SET_PROPERTY"); + return 0; + } + if (nowait) return 0; { diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 909a43839..dadf822eb 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -426,12 +426,20 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000); /* TODO: add xml tag ? */ feparams.pilot = ZPILOT_AUTO; - feparams.plp_id = xmlGetNumericAttribute(node, "pli", 0); + + feparams.plp_id = (unsigned int) xmlGetNumericAttribute(node, "pli", 0); + if (feparams.plp_id == 0) + feparams.plp_id = NO_STREAM_ID_FILTER; + feparams.pls_mode = (fe_pls_mode_t) xmlGetNumericAttribute(node, "plm", 0); + if (feparams.pls_mode == 0) + feparams.pls_mode = PLS_Gold; + feparams.pls_code = xmlGetNumericAttribute(node, "plc", 0); if (feparams.pls_code == 0) - feparams.pls_code = 1; - if ((feparams.delsys == DVB_S2) && (feparams.pls_mode > 0) && (feparams.pls_code > 1)) + feparams.pls_code = PLS_Default_Gold_Code; + + if ((feparams.delsys == DVB_S2) && feparams.plp_id != NO_STREAM_ID_FILTER) feparams.delsys = DVB_S2X; } else if (CFrontend::isTerr(delsys)) { @@ -444,7 +452,9 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa feparams.code_rate_LP = (fe_code_rate_t) xmlGetNumericAttribute(node, "lp", 0); feparams.guard_interval = (fe_guard_interval_t) xmlGetNumericAttribute(node, "gi", 0); feparams.hierarchy = (fe_hierarchy_t) xmlGetNumericAttribute(node, "hi", 0); - feparams.plp_id = (uint8_t) xmlGetNumericAttribute(node, "pli", 0); + feparams.plp_id = (unsigned int) xmlGetNumericAttribute(node, "pli", 0); + if (feparams.plp_id == 0) + feparams.plp_id = NO_STREAM_ID_FILTER; if (feparams.frequency < 1000*1000) feparams.frequency = feparams.frequency*1000; @@ -636,9 +646,9 @@ void CServiceManager::ParseSatTransponders(delivery_system_t delsys, xmlNodePtr feparams.frequency = xmlGetNumericAttribute(tps, "centre_frequency", 0); feparams.inversion = INVERSION_AUTO; - feparams.plp_id = 0; // NO_STREAM_ID_FILTER = ~0U, seems not suitable here - feparams.pls_mode = PLS_Root; - feparams.pls_code = 1; + feparams.plp_id = NO_STREAM_ID_FILTER; + feparams.pls_mode = PLS_Gold; + feparams.pls_code = PLS_Default_Gold_Code; if (CFrontend::isCable(delsys)) { const char *system = xmlGetAttribute(tps, "system"); @@ -740,12 +750,20 @@ void CServiceManager::ParseSatTransponders(delivery_system_t delsys, xmlNodePtr #endif feparams.fec_inner = (fe_code_rate_t) xml_fec; feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000); - feparams.plp_id = xmlGetNumericAttribute(tps, "is_id", 0); + + feparams.plp_id = (unsigned int) xmlGetNumericAttribute(tps, "is_id", 0); + if (feparams.plp_id == 0) + feparams.plp_id = NO_STREAM_ID_FILTER; + feparams.pls_mode = (fe_pls_mode_t) xmlGetNumericAttribute(tps, "pls_mode", 0); + if (feparams.pls_mode == 0) + feparams.pls_mode = PLS_Gold; + feparams.pls_code = xmlGetNumericAttribute(tps, "pls_code", 0); if (feparams.pls_code == 0) - feparams.pls_code = 1; - if ((feparams.delsys == DVB_S2) && (feparams.pls_mode > 0) && (feparams.pls_code > 1)) + feparams.pls_code = PLS_Default_Gold_Code; + + if ((feparams.delsys == DVB_S2) && feparams.plp_id != NO_STREAM_ID_FILTER) feparams.delsys = DVB_S2X; } else if (CFrontend::isTerr(delsys)) { @@ -786,8 +804,11 @@ void CServiceManager::ParseSatTransponders(delivery_system_t delsys, xmlNodePtr xmlGetNumericAttribute(tps, "guard_interval", 0); feparams.hierarchy = (fe_hierarchy_t) xmlGetNumericAttribute(tps, "hierarchy", 0); - feparams.plp_id = (uint8_t) + feparams.plp_id = (unsigned int) xmlGetNumericAttribute(tps, "plp_id", 0); + if (feparams.plp_id == 0) + feparams.plp_id = NO_STREAM_ID_FILTER; + if (feparams.frequency < 1000*1000) feparams.frequency *= 1000; } diff --git a/src/zapit/src/scannit.cpp b/src/zapit/src/scannit.cpp index df846a258..28c486014 100644 --- a/src/zapit/src/scannit.cpp +++ b/src/zapit/src/scannit.cpp @@ -333,9 +333,9 @@ bool CNit::ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, Tran memset(&feparams, 0, sizeof(feparams)); feparams.polarization = sd->getPolarization(); feparams.pilot = ZPILOT_AUTO; - feparams.plp_id = 0; - feparams.pls_code = 1; - feparams.pls_mode = PLS_Root; + feparams.plp_id = NO_STREAM_ID_FILTER; + feparams.pls_code = PLS_Default_Gold_Code; + feparams.pls_mode = PLS_Gold; switch (modulation_system) { case 0: // DVB-S @@ -458,7 +458,9 @@ bool CNit::ParseTerrestrial2Descriptor(T2DeliverySystemDescriptor * sd, Transpor feparams.delsys = DVB_T2; feparams.inversion = INVERSION_AUTO; - feparams.plp_id = sd->getPlpId(); + feparams.plp_id = (unsigned int)sd->getPlpId(); + if (feparams.plp_id == 0) + feparams.plp_id = NO_STREAM_ID_FILTER; feparams.code_rate_HP = CFrontend::getCodeRate(FEC_AUTO, DVB_T2); feparams.code_rate_LP = CFrontend::getCodeRate(FEC_AUTO, DVB_T2); feparams.modulation = CFrontend::getConstellation(QAM_AUTO); diff --git a/src/zapit/src/transponder.cpp b/src/zapit/src/transponder.cpp index 1fde68857..f8db756c4 100644 --- a/src/zapit/src/transponder.cpp +++ b/src/zapit/src/transponder.cpp @@ -134,6 +134,20 @@ void transponder::dumpServiceXml(FILE * fd) getFEParams()->modulation, CFrontend::getXMLDeliverySystem(getFEParams()->delsys)); } else if (CFrontend::isSat(feparams.delsys)) { + if (getFEParams()->plp_id == NO_STREAM_ID_FILTER) + { + fprintf(fd, "\t\t\n", + transport_stream_id, original_network_id, + getFEParams()->frequency, + getFEParams()->inversion, + getFEParams()->symbol_rate, + getFEParams()->fec_inner, + getFEParams()->polarization, + getFEParams()->modulation, + CFrontend::getXMLDeliverySystem(getFEParams()->delsys)); + } + else + { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, getFEParams()->frequency, @@ -146,7 +160,25 @@ void transponder::dumpServiceXml(FILE * fd) getFEParams()->pls_code, getFEParams()->pls_mode, CFrontend::getXMLDeliverySystem(getFEParams()->delsys)); + } } else if (CFrontend::isTerr(feparams.delsys)) { + if (getFEParams()->plp_id == NO_STREAM_ID_FILTER) + { + fprintf(fd, "\t\t\n", + transport_stream_id, original_network_id, + getFEParams()->frequency, + getFEParams()->inversion, + getFEParams()->bandwidth, + getFEParams()->code_rate_HP, + getFEParams()->code_rate_LP, + getFEParams()->modulation, + getFEParams()->transmission_mode, + getFEParams()->guard_interval, + getFEParams()->hierarchy, + CFrontend::getXMLDeliverySystem(getFEParams()->delsys)); + } + else + { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, getFEParams()->frequency, @@ -160,6 +192,7 @@ void transponder::dumpServiceXml(FILE * fd) getFEParams()->hierarchy, getFEParams()->plp_id, CFrontend::getXMLDeliverySystem(getFEParams()->delsys)); + } } } @@ -174,7 +207,9 @@ void transponder::dump(std::string label) getFEParams()->modulation, getFEParams()->delsys); } else if (CFrontend::isSat(feparams.delsys)) { - printf("%s tp-id %016" PRIx64 " freq %d rate %d fec %d pol %d mod %d sys %d\n", label.c_str(), + if (getFEParams()->plp_id == NO_STREAM_ID_FILTER) + { + printf("%s tp-id %016" PRIx64 " freq %d rate %d fec %d pol %d mod %d sys %d\n", label.c_str(), transponder_id, getFEParams()->frequency, getFEParams()->symbol_rate, @@ -182,8 +217,37 @@ void transponder::dump(std::string label) getFEParams()->polarization, getFEParams()->modulation, getFEParams()->delsys); + } + else + { + printf("%s tp-id %016" PRIx64 " freq %d rate %d fec %d pol %d mod %d pli %u plc %u plm %u sys %d\n", label.c_str(), + transponder_id, + getFEParams()->frequency, + getFEParams()->symbol_rate, + getFEParams()->fec_inner, + getFEParams()->polarization, + getFEParams()->modulation, + getFEParams()->plp_id, + getFEParams()->pls_code, + getFEParams()->pls_mode, + getFEParams()->delsys); + } } else if (CFrontend::isTerr(feparams.delsys)) { - printf("%s tp-id %016" PRIx64 " freq %d bw %d coderate_HP %d coderate_LP %d const %d guard %d pli %d delsys %d\n", label.c_str(), + if (getFEParams()->plp_id == NO_STREAM_ID_FILTER) + { + printf("%s tp-id %016" PRIx64 " freq %d bw %d coderate_HP %d coderate_LP %d const %d guard %d sys %d\n", label.c_str(), + transponder_id, + getFEParams()->frequency, + getFEParams()->bandwidth, + getFEParams()->code_rate_HP, + getFEParams()->code_rate_LP, + getFEParams()->modulation, + getFEParams()->guard_interval, + getFEParams()->delsys); + } + else + { + printf("%s tp-id %016" PRIx64 " freq %d bw %d coderate_HP %d coderate_LP %d const %d guard %d pli %u sys %d\n", label.c_str(), transponder_id, getFEParams()->frequency, getFEParams()->bandwidth, @@ -193,6 +257,7 @@ void transponder::dump(std::string label) getFEParams()->guard_interval, getFEParams()->plp_id, getFEParams()->delsys); + } } } @@ -224,14 +289,20 @@ std::string transponder::description() if (CFrontend::isSat(feparams.delsys)) { CFrontend::getDelSys(feparams.delsys, getFEParams()->fec_inner, getFEParams()->modulation, f, s, m); - snprintf(buf, sizeof(buf), "%d %c %d %s %s %s (%d/%d/%s)", getFEParams()->frequency/1000, pol(getFEParams()->polarization), getFEParams()->symbol_rate/1000, f, s, m, getFEParams()->plp_id, getFEParams()->pls_code, getPLSMode(getFEParams()->pls_mode).c_str()); + if (getFEParams()->plp_id == NO_STREAM_ID_FILTER) + snprintf(buf, sizeof(buf), "%d %c %d %s %s %s", getFEParams()->frequency/1000, pol(getFEParams()->polarization), getFEParams()->symbol_rate/1000, f, s, m); + else + snprintf(buf, sizeof(buf), "%d %c %d %s %s %s (%u/%s/%s)", getFEParams()->frequency/1000, pol(getFEParams()->polarization), getFEParams()->symbol_rate/1000, f, s, m, getFEParams()->plp_id, getPLSCode(getFEParams()->pls_code).c_str(), getPLSMode(getFEParams()->pls_mode).c_str()); } else if (CFrontend::isCable(feparams.delsys)) { CFrontend::getDelSys(feparams.delsys, getFEParams()->fec_inner, getFEParams()->modulation, f, s, m); snprintf(buf, sizeof(buf), "%d %d %s %s %s ", getFEParams()->frequency/1000, getFEParams()->symbol_rate/1000, f, s, m); } else if (CFrontend::isTerr(feparams.delsys)) { CFrontend::getDelSys(feparams.delsys, getFEParams()->code_rate_HP, getFEParams()->modulation, f, s, m); CFrontend::getDelSys(feparams.delsys, getFEParams()->code_rate_LP, getFEParams()->modulation, f2, s, m); - snprintf(buf, sizeof(buf), "%d %d %s %s %s %d ", getFEParams()->frequency/1000, CFrontend::getFEBandwidth(getFEParams()->bandwidth)/1000, f, f2, m, getFEParams()->plp_id); + if (getFEParams()->plp_id == NO_STREAM_ID_FILTER) + snprintf(buf, sizeof(buf), "%d %d %s %s %s ", getFEParams()->frequency/1000, CFrontend::getFEBandwidth(getFEParams()->bandwidth)/1000, f, f2, m); + else + snprintf(buf, sizeof(buf), "%d %d %s %s %s %u ", getFEParams()->frequency/1000, CFrontend::getFEBandwidth(getFEParams()->bandwidth)/1000, f, f2, m, getFEParams()->plp_id); } return std::string(buf); @@ -252,3 +323,15 @@ std::string transponder::getPLSMode(const uint8_t pls_mode) return "Root"; } } + +std::string transponder::getPLSCode(const uint32_t pls_code) +{ + switch (pls_code) { + case 0x00: + return "Default_Gold_Code"; + case 0x01: + return "Default_Root_Code"; + default: + return "Default_Gold_Code"; + } +}