From a86d4f415855ae000b44de3ef9f9ef8c1e3ba93e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 16 Apr 2012 16:42:27 +0400 Subject: [PATCH] zapit/src/transponder.cpp: add static ::pol to get polarization letter Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d1801782a3ff8d117aeba5b00c6e28ee1614a2d3 Author: [CST] Focus Date: 2012-04-16 (Mon, 16 Apr 2012) --- src/zapit/include/zapit/transponder.h | 1 + src/zapit/src/transponder.cpp | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/zapit/include/zapit/transponder.h b/src/zapit/include/zapit/transponder.h index dbd7edd94..d0aaceb5c 100644 --- a/src/zapit/include/zapit/transponder.h +++ b/src/zapit/include/zapit/transponder.h @@ -47,6 +47,7 @@ public: void dumpServiceXml(FILE * fd); void dump(std::string label = "tp"); void ddump(std::string label = "tp"); + static char pol(unsigned char pol); }; typedef std::map transponder_list_t; diff --git a/src/zapit/src/transponder.cpp b/src/zapit/src/transponder.cpp index bfb37dc94..c72a0b0b6 100644 --- a/src/zapit/src/transponder.cpp +++ b/src/zapit/src/transponder.cpp @@ -32,7 +32,7 @@ transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const str updated = 0; scanned = 0; satellitePosition = GET_SATELLITEPOSITION_FROM_TRANSPONDER_ID(transponder_id); - if(satellitePosition & 0xF000) + if (satellitePosition & 0xF000) satellitePosition = -(satellitePosition & 0xFFF); else satellitePosition = satellitePosition & 0xFFF; @@ -53,7 +53,7 @@ bool transponder::operator==(const transponder& t) const bool transponder::compare(const transponder& t) const { bool ret = false; - if(type == FE_QAM) { + if (type == FE_QAM) { ret = ( (t == (*this)) && (feparams.u.qam.symbol_rate == t.feparams.u.qam.symbol_rate) && @@ -75,7 +75,7 @@ bool transponder::compare(const transponder& t) const void transponder::dumpServiceXml(FILE * fd) { - if(type == FE_QAM) { + if (type == FE_QAM) { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, feparams.frequency, feparams.inversion, @@ -93,7 +93,7 @@ void transponder::dumpServiceXml(FILE * fd) void transponder::dump(std::string label) { - if(type == FE_QAM) + if (type == FE_QAM) printf("%s tp-id %016llx freq %d rate %d fec %d mod %d\n", label.c_str(), transponder_id, feparams.frequency, feparams.u.qam.symbol_rate, feparams.u.qam.fec_inner, feparams.u.qam.modulation); @@ -105,6 +105,18 @@ void transponder::dump(std::string label) void transponder::ddump(std::string label) { - if(zapit_debug) + if (zapit_debug) dump(label); } + +char transponder::pol(unsigned char p) +{ + if (p == 0) + return 'H'; + else if (p == 1) + return 'V'; + else if (p == 2) + return 'L'; + else + return 'R'; +}