diff --git a/src/zapit/include/zapit/transponder.h b/src/zapit/include/zapit/transponder.h index 1f13ba8f6..74ccdc536 100644 --- a/src/zapit/include/zapit/transponder.h +++ b/src/zapit/include/zapit/transponder.h @@ -33,16 +33,19 @@ public: t_original_network_id original_network_id; transponder_id_t transponder_id; t_satellite_position satellitePosition; + uint8_t type; struct dvb_frontend_parameters feparams; unsigned char polarization; bool updated; bool scanned; - transponder(const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization = 0); + transponder(fe_type_t fType, const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization = 0); bool operator==(const transponder& t) const; - void dump(std::string label = "tp", bool cable = 0); + bool compare (const transponder& t) const; + void dump(std::string label = "tp"); + void dumpServiceXml(FILE * fd); }; typedef std::map transponder_list_t; diff --git a/src/zapit/src/transponder.cpp b/src/zapit/src/transponder.cpp index d4e82cffa..b4d957152 100644 --- a/src/zapit/src/transponder.cpp +++ b/src/zapit/src/transponder.cpp @@ -21,7 +21,7 @@ #include #include -transponder::transponder(const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization) +transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization) { transponder_id = t_id; transport_stream_id = GET_TRANSPORT_STREAM_ID_FROM_TRANSPONDER_ID(t_id); @@ -35,6 +35,7 @@ transponder::transponder(const transponder_id_t t_id, const struct dvb_frontend_ satellitePosition = -(satellitePosition & 0xFFF); else satellitePosition = satellitePosition & 0xFFF; + type = fType; } bool transponder::operator==(const transponder& t) const @@ -48,14 +49,55 @@ bool transponder::operator==(const transponder& t) const ); } -void transponder::dump(std::string label, bool cable) +bool transponder::compare(const transponder& t) const { - if(cable) - printf("%s: tp-id %016llx freq %d rate %d fec %d mod %d\n", label.c_str(), + bool ret = false; + if(type == FE_QAM) { + ret = ( + (t == (*this)) && + (feparams.u.qam.symbol_rate == t.feparams.u.qam.symbol_rate) && + (feparams.u.qam.fec_inner == t.feparams.u.qam.fec_inner || + feparams.u.qam.fec_inner == FEC_AUTO || t.feparams.u.qam.fec_inner == FEC_AUTO) && + (feparams.u.qam.modulation == t.feparams.u.qam.modulation || + feparams.u.qam.modulation == QAM_AUTO || t.feparams.u.qam.modulation == QAM_AUTO) + ); + } else { + ret = ( + (t == (*this)) && + (feparams.u.qpsk.symbol_rate == t.feparams.u.qpsk.symbol_rate) && + (feparams.u.qpsk.fec_inner == t.feparams.u.qpsk.fec_inner || + feparams.u.qpsk.fec_inner == FEC_AUTO || t.feparams.u.qpsk.fec_inner == FEC_AUTO) + ); + } + return ret; +} + +void transponder::dumpServiceXml(FILE * fd) +{ + if(type == FE_QAM) { + fprintf(fd, "\t\t\n", + transport_stream_id, original_network_id, + feparams.frequency, feparams.inversion, + feparams.u.qam.symbol_rate, feparams.u.qam.fec_inner, + feparams.u.qam.modulation); + + } else { + fprintf(fd, "\t\t\n", + transport_stream_id, original_network_id, + feparams.frequency, feparams.inversion, + feparams.u.qpsk.symbol_rate, feparams.u.qpsk.fec_inner, + polarization); + } +} + +void transponder::dump(std::string label) +{ + 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); else - printf("%s: tp-id %016llx freq %d rate %d fec %d pol %d\n", label.c_str(), + printf("%s tp-id %016llx freq %d rate %d fec %d pol %d\n", label.c_str(), transponder_id, feparams.frequency, feparams.u.qpsk.symbol_rate, feparams.u.qpsk.fec_inner, polarization); }