zapit/src/transponder.cpp: add static ::pol to get polarization letter

Origin commit data
------------------
Commit: d1801782a3
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-16 (Mon, 16 Apr 2012)
This commit is contained in:
[CST] Focus
2012-04-16 16:42:27 +04:00
parent 50f4b9d1dc
commit a86d4f4158
2 changed files with 18 additions and 5 deletions

View File

@@ -47,6 +47,7 @@ public:
void dumpServiceXml(FILE * fd); void dumpServiceXml(FILE * fd);
void dump(std::string label = "tp"); void dump(std::string label = "tp");
void ddump(std::string label = "tp"); void ddump(std::string label = "tp");
static char pol(unsigned char pol);
}; };
typedef std::map <transponder_id_t, transponder> transponder_list_t; typedef std::map <transponder_id_t, transponder> transponder_list_t;

View File

@@ -32,7 +32,7 @@ transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const str
updated = 0; updated = 0;
scanned = 0; scanned = 0;
satellitePosition = GET_SATELLITEPOSITION_FROM_TRANSPONDER_ID(transponder_id); satellitePosition = GET_SATELLITEPOSITION_FROM_TRANSPONDER_ID(transponder_id);
if(satellitePosition & 0xF000) if (satellitePosition & 0xF000)
satellitePosition = -(satellitePosition & 0xFFF); satellitePosition = -(satellitePosition & 0xFFF);
else else
satellitePosition = satellitePosition & 0xFFF; satellitePosition = satellitePosition & 0xFFF;
@@ -53,7 +53,7 @@ bool transponder::operator==(const transponder& t) const
bool transponder::compare(const transponder& t) const bool transponder::compare(const transponder& t) const
{ {
bool ret = false; bool ret = false;
if(type == FE_QAM) { if (type == FE_QAM) {
ret = ( ret = (
(t == (*this)) && (t == (*this)) &&
(feparams.u.qam.symbol_rate == t.feparams.u.qam.symbol_rate) && (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) void transponder::dumpServiceXml(FILE * fd)
{ {
if(type == FE_QAM) { if (type == FE_QAM) {
fprintf(fd, "\t\t<TS id=\"%04x\" on=\"%04x\" frq=\"%u\" inv=\"%hu\" sr=\"%u\" fec=\"%hu\" mod=\"%hu\">\n", fprintf(fd, "\t\t<TS id=\"%04x\" on=\"%04x\" frq=\"%u\" inv=\"%hu\" sr=\"%u\" fec=\"%hu\" mod=\"%hu\">\n",
transport_stream_id, original_network_id, transport_stream_id, original_network_id,
feparams.frequency, feparams.inversion, feparams.frequency, feparams.inversion,
@@ -93,7 +93,7 @@ void transponder::dumpServiceXml(FILE * fd)
void transponder::dump(std::string label) 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(), 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, transponder_id, feparams.frequency, feparams.u.qam.symbol_rate,
feparams.u.qam.fec_inner, feparams.u.qam.modulation); 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) void transponder::ddump(std::string label)
{ {
if(zapit_debug) if (zapit_debug)
dump(label); 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';
}