From 58d6ba7f40d04ca647969a3a62ae2334e39c7e38 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 17 Apr 2012 18:30:17 +0400 Subject: [PATCH] zapit/src/transponder.cpp: add description() to get commonly used transponder description string --- src/zapit/include/zapit/transponder.h | 3 ++- src/zapit/src/transponder.cpp | 33 ++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/zapit/include/zapit/transponder.h b/src/zapit/include/zapit/transponder.h index d0aaceb5c..34c6b77c7 100644 --- a/src/zapit/include/zapit/transponder.h +++ b/src/zapit/include/zapit/transponder.h @@ -38,9 +38,9 @@ public: struct dvb_frontend_parameters feparams; unsigned char polarization; bool updated; - bool scanned; transponder(fe_type_t fType, const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization = 0); + transponder(); bool operator==(const transponder& t) const; bool compare (const transponder& t) const; @@ -48,6 +48,7 @@ public: void dump(std::string label = "tp"); void ddump(std::string label = "tp"); static char pol(unsigned char pol); + std::string description(); }; typedef std::map transponder_list_t; diff --git a/src/zapit/src/transponder.cpp b/src/zapit/src/transponder.cpp index c72a0b0b6..0e6f54869 100644 --- a/src/zapit/src/transponder.cpp +++ b/src/zapit/src/transponder.cpp @@ -20,6 +20,7 @@ #include #include +#include #include transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization) @@ -30,7 +31,6 @@ transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const str feparams = p_feparams; polarization = p_polarization; updated = 0; - scanned = 0; satellitePosition = GET_SATELLITEPOSITION_FROM_TRANSPONDER_ID(transponder_id); if (satellitePosition & 0xF000) satellitePosition = -(satellitePosition & 0xFFF); @@ -39,6 +39,17 @@ transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const str type = fType; } +transponder::transponder() +{ + memset(&feparams, 0, sizeof(struct dvb_frontend_parameters)); + transponder_id = 0; + transport_stream_id = 0; + original_network_id = 0; + polarization = 0; + satellitePosition = 0; + type = FE_QPSK; +} + bool transponder::operator==(const transponder& t) const { return ( @@ -120,3 +131,23 @@ char transponder::pol(unsigned char p) else return 'R'; } + +std::string transponder::description() +{ + char buf[128] = {0}; + char * f, *s, *m; + switch(type) { + case FE_QPSK: + CFrontend::getDelSys(type, feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams.u.qpsk.fec_inner), f, s, m); + snprintf(buf, sizeof(buf), "%d %c %d %s %s %s ", feparams.frequency/1000, pol(polarization), feparams.u.qpsk.symbol_rate/1000, f, s, m); + break; + case FE_QAM: + CFrontend::getDelSys(type, feparams.u.qam.fec_inner, feparams.u.qam.modulation, f, s, m); + snprintf(buf, sizeof(buf), "%d %d %s %s %s ", feparams.frequency/1000, feparams.u.qam.symbol_rate/1000, f, s, m); + break; + case FE_OFDM: + case FE_ATSC: + break; + } + return std::string(buf); +}