diff --git a/grc/m17_m17_decoder.block.yml b/grc/m17_m17_decoder.block.yml index 22fc073..201b8a2 100644 --- a/grc/m17_m17_decoder.block.yml +++ b/grc/m17_m17_decoder.block.yml @@ -3,17 +3,23 @@ label: m17_decoder category: '[m17]' parameters: -- id: debug - label: Debug +- id: debug_data + label: Debug Data + dtype: bool + default: 'False' + options: ['True', 'False'] +- id: debug_ctrl + label: Debug Control dtype: bool default: 'False' options: ['True', 'False'] templates: imports: from gnuradio import m17 - make: m17.m17_decoder(${debug}) + make: m17.m17_decoder(${debug_data},${debug_ctrl}) callbacks: - - set_debug(${debug}) + - set_debug_data(${debug_data}) + - set_debug_ctrl(${debug_ctrl}) # Make one 'inputs' list entry per input and one 'outputs' list entry per output. # Keys include: diff --git a/include/gnuradio/m17/m17_decoder.h b/include/gnuradio/m17/m17_decoder.h index 631077e..93d02ae 100644 --- a/include/gnuradio/m17/m17_decoder.h +++ b/include/gnuradio/m17/m17_decoder.h @@ -32,8 +32,9 @@ public: * class. m17::m17_decoder::make is the public interface for * creating new instances. */ - static sptr make(bool debug); - virtual void set_debug(bool debug)=0; + static sptr make(bool debug_data,bool debug_ctrl); + virtual void set_debug_data(bool debug)=0; + virtual void set_debug_ctrl(bool debug)=0; }; } // namespace m17 diff --git a/lib/m17_decoder_impl.cc b/lib/m17_decoder_impl.cc index fc286d7..4524f31 100644 --- a/lib/m17_decoder_impl.cc +++ b/lib/m17_decoder_impl.cc @@ -108,22 +108,23 @@ void decode_callsign(uint8_t *outp, const uint8_t *inp) } m17_decoder::sptr - m17_decoder::make(bool debug) + m17_decoder::make(bool debug_data,bool debug_ctrl) { return gnuradio::get_initial_sptr - (new m17_decoder_impl(debug)); + (new m17_decoder_impl(debug_data,debug_ctrl)); } /* * The private constructor */ - m17_decoder_impl::m17_decoder_impl(bool debug) + m17_decoder_impl::m17_decoder_impl(bool debug_data,bool debug_ctrl) : gr::block("m17_decoder", gr::io_signature::make(1, 1, sizeof(float)), gr::io_signature::make(1, 1, sizeof(char))), - _debug(debug) - {set_debug(debug);} + _debug_data(debug_data), _debug_ctrl(debug_ctrl) + {set_debug_data(debug_data); + set_debug_ctrl(debug_ctrl);} /* * Our virtual destructor. @@ -132,9 +133,14 @@ void decode_callsign(uint8_t *outp, const uint8_t *inp) { } -void m17_decoder_impl::set_debug(bool debug) -{_debug=debug; - if (_debug==true) printf("true\n"); else printf("Debug false\n"); +void m17_decoder_impl::set_debug_data(bool debug) +{_debug_data=debug; + if (_debug_data==true) printf("Data debug: true\n"); else printf("Data debug: false\n"); +} + +void m17_decoder_impl::set_debug_ctrl(bool debug) +{_debug_ctrl=debug; + if (_debug_ctrl==true) printf("Debug control: true\n"); else printf("Debug control: false\n"); } void @@ -301,7 +307,7 @@ uint8_t pushed; //counter for pushed symbols decode_callsign(d_dst, &lsf[0]); decode_callsign(d_src, &lsf[6]); -if (_debug==true) { +if (_debug_ctrl==true) { //DST printf("DST: %-9s ", d_dst); @@ -353,9 +359,9 @@ if (_debug==true) { } //decode - uint32_t e=decodePunctured(frame_data, enc_data, P_2, 272, 12); + decodePunctured(frame_data, enc_data, P_2, 272, 12); -if (_debug==true) { +if (_debug_data==true) { //dump data - first byte is empty printf("FN: %02X%02X PLD: ", frame_data[1], frame_data[2]); for(uint8_t i=3; i<19; i++) @@ -367,18 +373,18 @@ if (_debug==true) { printf(" e=%1.1f\n", (float)e/0xFFFF); #else printf("\n"); - #endif } + #endif //send codec2 stream to stdout //write(STDOUT_FILENO, &frame_data[3], 16); } else //lsf { -if (_debug==true) { +if (_debug_ctrl==true) { printf("LSF\n"); } //decode - uint32_t e=decodePunctured(lsf, d_soft_bit, P_1, 2*SYM_PER_PLD, 61); + decodePunctured(lsf, d_soft_bit, P_1, 2*SYM_PER_PLD, 61); //shift the buffer 1 position left - get rid of the encoded flushing bits for(uint8_t i=0; i<30; i++) @@ -391,7 +397,7 @@ if (_debug==true) { decode_callsign(d_dst, &lsf[0]); decode_callsign(d_src, &lsf[6]); -if (_debug==true) { + if (_debug_ctrl==true) { //DST printf("DST: %-9s ", d_dst); @@ -437,7 +443,7 @@ if (_debug==true) { #else printf("\n"); #endif -} + } } //job done diff --git a/lib/m17_decoder_impl.h b/lib/m17_decoder_impl.h index d395798..5063225 100644 --- a/lib/m17_decoder_impl.h +++ b/lib/m17_decoder_impl.h @@ -16,12 +16,14 @@ namespace m17 { class m17_decoder_impl : public m17_decoder { private: - bool _debug=false; + bool _debug_data=false; + bool _debug_ctrl=false; public: - m17_decoder_impl(bool debug); + m17_decoder_impl(bool debug_data,bool debug_ctrl); ~m17_decoder_impl(); - void set_debug(bool debug); + void set_debug_data(bool debug); + void set_debug_ctrl(bool debug); // Where all the action really happens void forecast(int noutput_items, gr_vector_int& ninput_items_required);