diff options
66 files changed, 89 insertions, 2260 deletions
diff --git a/docs/sphinx/source/gr/filter_blk.rst b/docs/sphinx/source/gr/filter_blk.rst index a73ddda2a8..35b0aa866c 100644 --- a/docs/sphinx/source/gr/filter_blk.rst +++ b/docs/sphinx/source/gr/filter_blk.rst @@ -34,10 +34,6 @@ gnuradio.gr: Filters .. autooldblock:: gnuradio.gr.rational_resampler_base_scc .. autooldblock:: gnuradio.gr.single_pole_iir_filter_cc .. autooldblock:: gnuradio.gr.single_pole_iir_filter_ff -.. autooldblock:: gnuradio.gr.moving_average_cc -.. autooldblock:: gnuradio.gr.moving_average_ff -.. autooldblock:: gnuradio.gr.moving_average_ii -.. autooldblock:: gnuradio.gr.moving_average_ss .. autooldblock:: gnuradio.gr.pfb_arb_resampler_ccf .. autooldblock:: gnuradio.gr.pfb_channelizer_ccf .. autooldblock:: gnuradio.gr.pfb_clock_sync_ccf diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index bcebcd6c5a..387f857f5e 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -30,7 +30,6 @@ Signal Sources gnuradio.gr.vector_source_s gnuradio.gr.file_descriptor_source gnuradio.gr.file_source - gnuradio.gr.message_source gnuradio.gr.udp_source gnuradio.gr.wavfile_source @@ -52,7 +51,6 @@ Signal Sinks gnuradio.gr.file_descriptor_sink gnuradio.gr.file_sink gnuradio.gr.histo_sink_f - gnuradio.gr.message_sink gnuradio.gr.oscope_sink_f gnuradio.gr.udp_sink gnuradio.gr.wavfile_sink @@ -96,10 +94,6 @@ Filters gnuradio.gr.rational_resampler_base_scc gnuradio.gr.single_pole_iir_filter_cc gnuradio.gr.single_pole_iir_filter_ff - gnuradio.gr.moving_average_cc - gnuradio.gr.moving_average_ff - gnuradio.gr.moving_average_ii - gnuradio.gr.moving_average_ss gnuradio.gr.pfb_arb_resampler_ccf gnuradio.gr.pfb_channelizer_ccf gnuradio.gr.pfb_clock_sync_ccf @@ -132,15 +126,6 @@ Type Conversions gnuradio.gr.complex_to_mag_squared gnuradio.gr.complex_to_arg -Signal Level Control (AGC) -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.peak_detector_fb - gnuradio.gr.peak_detector_ib - gnuradio.gr.peak_detector_sb Fourier Transform ^^^^^^^^^^^^^^^^^ diff --git a/docs/sphinx/source/gr/level_blk.rst b/docs/sphinx/source/gr/level_blk.rst deleted file mode 100644 index b37fd63253..0000000000 --- a/docs/sphinx/source/gr/level_blk.rst +++ /dev/null @@ -1,8 +0,0 @@ -gnuradio.gr: Signal Level Control (AGC) -======================================= - -.. autooldblock:: gnuradio.gr.dpll_bb -.. autooldblock:: gnuradio.gr.peak_detector_fb -.. autooldblock:: gnuradio.gr.peak_detector_ib -.. autooldblock:: gnuradio.gr.peak_detector_sb - diff --git a/docs/sphinx/source/gr/sink_blk.rst b/docs/sphinx/source/gr/sink_blk.rst index e5c45cd790..1be1130dce 100644 --- a/docs/sphinx/source/gr/sink_blk.rst +++ b/docs/sphinx/source/gr/sink_blk.rst @@ -13,7 +13,6 @@ gnuradio.gr: Signal Sinks .. autooldblock:: gnuradio.gr.file_descriptor_sink .. autooldblock:: gnuradio.gr.file_sink .. autooldblock:: gnuradio.gr.histo_sink_f -.. autooldblock:: gnuradio.gr.message_sink .. autooldblock:: gnuradio.gr.oscope_sink_f .. autooldblock:: gnuradio.gr.udp_sink .. autooldblock:: gnuradio.gr.wavfile_sink diff --git a/docs/sphinx/source/gr/source_blk.rst b/docs/sphinx/source/gr/source_blk.rst index 8e9f67980c..f3a1b4954f 100644 --- a/docs/sphinx/source/gr/source_blk.rst +++ b/docs/sphinx/source/gr/source_blk.rst @@ -10,7 +10,6 @@ gnuradio.gr: Signal Sources .. autooldblock:: gnuradio.gr.vector_source_s .. autooldblock:: gnuradio.gr.file_descriptor_source .. autooldblock:: gnuradio.gr.file_source -.. autooldblock:: gnuradio.gr.message_source .. autooldblock:: gnuradio.gr.udp_source .. autooldblock:: gnuradio.gr.wavfile_source diff --git a/gnuradio-core/src/examples/CMakeLists.txt b/gnuradio-core/src/examples/CMakeLists.txt index 24ed5e881f..5a0df064d6 100644 --- a/gnuradio-core/src/examples/CMakeLists.txt +++ b/gnuradio-core/src/examples/CMakeLists.txt @@ -18,7 +18,6 @@ # Boston, MA 02110-1301, USA. add_subdirectory(mp-sched) -add_subdirectory(msg_passing) add_subdirectory(network) add_subdirectory(tags) add_subdirectory(volk_benchmark) diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 12e0bf0346..de1ad59092 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -174,7 +174,6 @@ set(gr_core_general_triple_threats gr_annotator_raw gr_burst_tagger gr_tag_debug - gr_message_strobe ) if(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 04d524ee5c..030dce92a2 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -56,7 +56,6 @@ #include <gr_burst_tagger.h> #include <gr_vector_map.h> #include <gr_tag_debug.h> -#include <gr_message_strobe.h> %} %include "gri_control_loop.i" @@ -94,7 +93,6 @@ %include "gr_vector_map.i" %include "gr_tag_debug.i" %include "gr_block_gateway.i" -%include "gr_message_strobe.i" #ifdef GR_CTRLPORT diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.cc b/gnuradio-core/src/lib/general/gr_message_strobe.cc deleted file mode 100644 index 6a9f807d18..0000000000 --- a/gnuradio-core/src/lib/general/gr_message_strobe.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_strobe.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <iostream> - -// public constructor that returns a shared_ptr - -gr_message_strobe_sptr -gr_make_message_strobe (pmt::pmt_t msg, float period_ms) -{ - return gnuradio::get_initial_sptr(new gr_message_strobe(msg, period_ms)); -} - -gr_message_strobe::gr_message_strobe (pmt::pmt_t msg, float period_ms) - : gr_block("message_strobe", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), - d_finished(false), - d_period_ms(period_ms), - d_msg(msg) -{ - message_port_register_out(pmt::mp("strobe")); - d_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&gr_message_strobe::run, this))); - - message_port_register_in(pmt::mp("set_msg")); - set_msg_handler(pmt::mp("set_msg"), boost::bind(&gr_message_strobe::set_msg, this, _1)); -} - -gr_message_strobe::~gr_message_strobe() -{ - d_finished = true; - d_thread->interrupt(); - d_thread->join(); -} - -void gr_message_strobe::run(){ - while(!d_finished) { - boost::this_thread::sleep(boost::posix_time::milliseconds(d_period_ms)); - if(d_finished){ return; } - - message_port_pub( pmt::mp("strobe"), d_msg ); - } -} diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.h b/gnuradio-core/src/lib/general/gr_message_strobe.h deleted file mode 100644 index 89046ffc05..0000000000 --- a/gnuradio-core/src/lib/general/gr_message_strobe.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_STROBE_H -#define INCLUDED_GR_MESSAGE_STROBE_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_strobe; -typedef boost::shared_ptr<gr_message_strobe> gr_message_strobe_sptr; - -GR_CORE_API gr_message_strobe_sptr gr_make_message_strobe (pmt::pmt_t msg, float period_ms); - -/*! - * \brief Send message at defined interval - * \ingroup msg_blk - */ -class GR_CORE_API gr_message_strobe : public gr_block -{ - private: - friend GR_CORE_API gr_message_strobe_sptr - gr_make_message_strobe(pmt::pmt_t msg, float period_ms); - - boost::shared_ptr<boost::thread> d_thread; - bool d_finished; - float d_period_ms; - pmt::pmt_t d_msg; - - void run(); - - protected: - gr_message_strobe (pmt::pmt_t msg, float period_ms); - - public: - ~gr_message_strobe (); - - void set_msg(pmt::pmt_t msg){ d_msg = msg; } -}; - -#endif /* INCLUDED_GR_MESSAGE_STROBE_H */ diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.i b/gnuradio-core/src/lib/general/gr_message_strobe.i deleted file mode 100644 index 490aa8e8a1..0000000000 --- a/gnuradio-core/src/lib/general/gr_message_strobe.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_strobe); - -%{ -#include <gr_message_strobe.h> -%} - -%include "gr_message_strobe.h" - diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index b3852973e3..45834ced5f 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -85,10 +85,6 @@ expand_h_cc_i(gr_vector_source_X b s i f c) expand_h_cc_i(gr_vector_insert_X b) expand_h_cc_i(gr_vector_sink_X b s i f c) -expand_h_cc_i(gr_moving_average_XX ss ii ff cc) - -expand_h_cc_i(gr_peak_detector_XX fb ib sb) - add_custom_target(gengen_generated DEPENDS ${generated_gengen_includes} ${generated_gengen_swigs} diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 4d9c56dc00..68913f9a75 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -37,15 +37,6 @@ ss_roots = [ # regular blocks reg_signatures = ['ss', 'ii', 'ff', 'cc'] -reg_roots = [ - 'gr_moving_average_XX', - ] - -# other blocks -others = ( - ('gr_peak_detector_XX', ('fb','ib','sb')), - ) - def expand_h_cc_i (root, sig): # root looks like 'gr_vector_sink_X' @@ -62,15 +53,6 @@ def generate (): for r in ss_roots: for s in ss_signatures: expand_h_cc_i (r, s) - for r in reg_roots : - for s in reg_signatures: - expand_h_cc_i (r, s) - - for root, sigs in others: - for s in sigs: - expand_h_cc_i (root, s) - - if __name__ == '__main__': generate () diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t deleted file mode 100644 index ddee30bd77..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter) -{ - return gnuradio::get_initial_sptr (new @NAME@ (length, scale, max_iter)); -} - -@NAME@::@NAME@ (int length, @O_TYPE@ scale, int max_iter) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_length(length), - d_scale(scale), - d_max_iter(max_iter), - d_new_length(length), - d_new_scale(scale), - d_updated(false) -{ - set_history(length); -} - -@NAME@::~@NAME@ () -{ -} - -void -@NAME@::set_length_and_scale(int length, @O_TYPE@ scale) -{ - d_new_length = length; - d_new_scale = scale; - d_updated = true; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - if (d_updated) { - d_length = d_new_length; - d_scale = d_new_scale; - set_history(d_length); - d_updated = false; - return 0; // history requirements might have changed - } - - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - @I_TYPE@ sum = 0; - int num_iter = (noutput_items>d_max_iter) ? d_max_iter : noutput_items; - for (int i = 0; i < d_length-1 ; i++) { - sum += in[i]; - } - - for (int i = 0; i < num_iter; i++) { - sum += in[i+d_length-1]; - out[i] = sum * d_scale; - sum -= in[i]; - } - - return num_iter; -} diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t deleted file mode 100644 index 37678abe13..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; - -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096); - -/*! - * \brief output is the moving sum of the last N samples, scaled by the scale factor - * \ingroup filter_blk - * - * max_iter limits how long we go without flushing the accumulator - * This is necessary to avoid numerical instability for float and complex. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ -private: - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@(int length, @O_TYPE@ scale, int max_iter); - - @NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096); - - int d_length; - @O_TYPE@ d_scale; - int d_max_iter; - - int d_new_length; - @O_TYPE@ d_new_scale; - bool d_updated; - -public: - ~@NAME@ (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int length() const { return d_new_length; } - @O_TYPE@ scale() const { return d_new_scale; } - - void set_length_and_scale(int length, @O_TYPE@ scale); -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t deleted file mode 100644 index 6e3b9ca9bc..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter=4096); - -class @NAME@ : public gr_sync_block -{ -private: - @NAME@ (); - - public: - int length() const; - @O_TYPE@ scale() const; - void set_length_and_scale(int length, @O_TYPE@ scale); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t deleted file mode 100644 index 54af3c0cd4..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <string.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha) -{ - return gnuradio::get_initial_sptr (new @NAME@ (threshold_factor_rise, - threshold_factor_fall, - look_ahead, alpha)); -} - -@NAME@::@NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (char))), - d_threshold_factor_rise(threshold_factor_rise), - d_threshold_factor_fall(threshold_factor_fall), - d_look_ahead(look_ahead), d_avg_alpha(alpha), d_avg(0), d_found(0) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; - char *optr = (char *) output_items[0]; - - memset(optr, 0, noutput_items*sizeof(char)); - - @I_TYPE@ peak_val = -(@I_TYPE@)INFINITY; - int peak_ind = 0; - unsigned char state = 0; - int i = 0; - - //printf("noutput_items %d\n",noutput_items); - while(i < noutput_items) { - if(state == 0) { // below threshold - if(iptr[i] > d_avg*d_threshold_factor_rise) { - state = 1; - } - else { - d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg; - i++; - } - } - else if(state == 1) { // above threshold, have not found peak - //printf("Entered State 1: %f i: %d noutput_items: %d\n", iptr[i], i, noutput_items); - if(iptr[i] > peak_val) { - peak_val = iptr[i]; - peak_ind = i; - d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg; - i++; - } - else if (iptr[i] > d_avg*d_threshold_factor_fall) { - d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg; - i++; - } - else { - optr[peak_ind] = 1; - state = 0; - peak_val = -(@I_TYPE@)INFINITY; - //printf("Leaving State 1: Peak: %f Peak Ind: %d i: %d noutput_items: %d\n", - //peak_val, peak_ind, i, noutput_items); - } - } - } - - if(state == 0) { - //printf("Leave in State 0, produced %d\n",noutput_items); - return noutput_items; - } - else { // only return up to passing the threshold - //printf("Leave in State 1, only produced %d of %d\n",peak_ind,noutput_items); - return peak_ind+1; - } -} diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t deleted file mode 100644 index 3e05594fbd..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25, - float threshold_factor_fall = 0.40, - int look_ahead = 10, - float alpha = 0.001); - -/*! - * \brief Detect the peak of a signal - * \ingroup level_blk - * - * If a peak is detected, this block outputs a 1, - * or it outputs 0's. - * - * \param threshold_factor_rise The threshold factor determins when a peak - * has started. An average of the signal is calculated and when the - * value of the signal goes over threshold_factor_rise*average, we - * start looking for a peak. - * \param threshold_factor_fall The threshold factor determins when a peak - * has ended. An average of the signal is calculated and when the - * value of the signal goes bellow threshold_factor_fall*average, we - * stop looking for a peak. - * \param look_ahead The look-ahead value is used when the threshold is - * found to look if there another peak within this step range. - * If there is a larger value, we set that as the peak and look ahead - * again. This is continued until the highest point is found with - * This look-ahead range. - * \param alpha The gain value of a moving average filter - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha); - - @NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha); - - private: - float d_threshold_factor_rise; - float d_threshold_factor_fall; - int d_look_ahead; - float d_avg_alpha; - float d_avg; - unsigned char d_found; - - public: - - /*! \brief Set the threshold factor value for the rise time - * \param thr new threshold factor - */ - void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; } - - /*! \brief Set the threshold factor value for the fall time - * \param thr new threshold factor - */ - void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; } - - /*! \brief Set the look-ahead factor - * \param look new look-ahead factor - */ - void set_look_ahead(int look) { d_look_ahead = look; } - - /*! \brief Set the running average alpha - * \param alpha new alpha for running average - */ - void set_alpha(int alpha) { d_avg_alpha = alpha; } - - /*! \brief Get the threshold factor value for the rise time - * \return threshold factor - */ - float threshold_factor_rise() { return d_threshold_factor_rise; } - - /*! \brief Get the threshold factor value for the fall time - * \return threshold factor - */ - float threshold_factor_fall() { return d_threshold_factor_fall; } - - /*! \brief Get the look-ahead factor value - * \return look-ahead factor - */ - int look_ahead() { return d_look_ahead; } - - /*! \brief Get the alpha value of the running average - * \return alpha - */ - float alpha() { return d_avg_alpha; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t deleted file mode 100644 index 212ce0c946..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25, - float threshold_factor_fall = 0.40, - int look_ahead = 10, - float alpha=0.001); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha); - - public: - void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; } - void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; } - void set_look_ahead(int look) { d_look_ahead = look; } - void set_alpha(int alpha) { d_avg_alpha = alpha; } - - float threshold_factor_rise() { return d_threshold_factor_rise; } - float threshold_factor_fall() { return d_threshold_factor_fall; } - int look_ahead() { return d_look_ahead; } - float alpha() { return d_avg_alpha; } -}; diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt index 7368283dab..dc0ffe62b1 100644 --- a/gnuradio-core/src/lib/io/CMakeLists.txt +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -85,10 +85,6 @@ set(gr_core_io_triple_threats gr_file_source gr_file_descriptor_sink gr_file_descriptor_source - gr_message_debug - gr_message_sink - gr_message_source - gr_message_burst_source microtune_xxxx_eval_board microtune_4702_eval_board microtune_4937_eval_board diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.cc b/gnuradio-core/src/lib/io/gr_message_burst_source.cc deleted file mode 100644 index 968df6ec38..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_burst_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <gr_tags.h> - -// public constructor that returns a shared_ptr - -gr_message_burst_source_sptr -gr_make_message_burst_source(size_t itemsize, int msgq_limit) -{ - return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq_limit)); -} - -// public constructor that takes existing message queue -gr_message_burst_source_sptr -gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq) -{ - return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq)); -} - -gr_message_burst_source::gr_message_burst_source (size_t itemsize, int msgq_limit) - : gr_sync_block("message_burst_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false) -{ - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); -} - -gr_message_burst_source::gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq) - : gr_sync_block("message_burst_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false) -{ - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); -} - -gr_message_burst_source::~gr_message_burst_source() -{ -} - -int -gr_message_burst_source::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - int nn = 0; - - uint64_t abs_sample_count = nitems_written(0); - - while (nn < noutput_items){ - if (d_msg){ - // - // Consume whatever we can from the current message - // - - int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if (d_msg_offset == d_msg->length()){ - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - //tag end of burst - add_item_tag(0, //stream ID - abs_sample_count+nn-1, //sample number - pmt::string_to_symbol("tx_eob"), - pmt::from_bool(1), - d_me //block src id - ); - } - } - else { - // - // No current message - // - if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got - break; - } - - if (d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - //tag start of burst - add_item_tag(0, //stream ID - abs_sample_count+nn, //sample number - pmt::string_to_symbol("tx_sob"), - pmt::from_bool(1), - d_me //block src id - ); - - - if ((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - } - - return nn; -} diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.h b/gnuradio-core/src/lib/io/gr_message_burst_source.h deleted file mode 100644 index 63e2201139..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_H -#define INCLUDED_GR_MESSAGE_BURST_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_burst_source; -typedef boost::shared_ptr<gr_message_burst_source> gr_message_burst_source_sptr; - -GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0); -GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - -/*! - * \brief Turn received messages into a stream and tag them for UHD to send. - * \ingroup source_blk - */ -class GR_CORE_API gr_message_burst_source : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - pmt::pmt_t d_me; - - friend GR_CORE_API gr_message_burst_source_sptr - gr_make_message_burst_source(size_t itemsize, int msgq_limit); - friend GR_CORE_API gr_message_burst_source_sptr - gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq); - - protected: - gr_message_burst_source (size_t itemsize, int msgq_limit); - gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_burst_source (); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_gr_message_burst_source_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.i b/gnuradio-core/src/lib/io/gr_message_burst_source.i deleted file mode 100644 index f7ad840c22..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.i +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_burst_source); - -gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0); -gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - -class gr_message_burst_source : public gr_sync_block -{ - protected: - gr_message_burst_source (size_t itemsize, int msgq_limit); - gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_burst_source (); - - gr_msg_queue_sptr msgq() const; -}; diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc deleted file mode 100644 index 07c0af1e34..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_debug.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <iostream> - -// public constructor that returns a shared_ptr - -gr_message_debug_sptr -gr_make_message_debug () -{ - return gnuradio::get_initial_sptr(new gr_message_debug()); -} - -void -gr_message_debug::print(pmt::pmt_t msg) -{ - std::cout << "******* MESSAGE DEBUG PRINT ********\n"; - pmt::print(msg); - std::cout << "************************************\n"; -} - -void -gr_message_debug::store(pmt::pmt_t msg) -{ - gruel::scoped_lock guard(d_mutex); - d_messages.push_back(msg); -} - -void -gr_message_debug::print_pdu(pmt::pmt_t pdu) -{ - pmt::pmt_t meta = pmt::car(pdu); - pmt::pmt_t vector = pmt::cdr(pdu); - - std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n"; - pmt::print(meta); - size_t len = pmt::length(vector); - std::cout << "pdu_length = " << len << std::endl; - std::cout << "contents = " << std::endl; - size_t offset(0); - const uint8_t* d = (const uint8_t*) uniform_vector_elements(vector, offset); - for(size_t i=0; i<len; i+=16){ - printf("%04x: ", ((unsigned int)i)); - for(size_t j=i; j<std::min(i+16,len); j++){ - printf("%02x ",d[j] ); - } - - std::cout << std::endl; - } - - std::cout << "***********************************\n"; -} - -int -gr_message_debug::num_messages() -{ - return (int)d_messages.size(); -} - -pmt::pmt_t -gr_message_debug::get_message(int i) -{ - gruel::scoped_lock guard(d_mutex); - - if((size_t)i >= d_messages.size()) { - throw std::runtime_error("gr_message_debug: index for message out of bounds.\n"); - } - - return d_messages[i]; -} - -gr_message_debug::gr_message_debug() - : gr_block("message_debug", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)) -{ - message_port_register_in(pmt::mp("print")); - set_msg_handler(pmt::mp("print"), boost::bind(&gr_message_debug::print, this, _1)); - - message_port_register_in(pmt::mp("store")); - set_msg_handler(pmt::mp("store"), boost::bind(&gr_message_debug::store, this, _1)); - - message_port_register_in(pmt::mp("print_pdu")); - set_msg_handler(pmt::mp("print_pdu"), boost::bind(&gr_message_debug::print_pdu, this, _1)); -} - -gr_message_debug::~gr_message_debug() -{ -} diff --git a/gnuradio-core/src/lib/io/gr_message_debug.h b/gnuradio-core/src/lib/io/gr_message_debug.h deleted file mode 100644 index f1374e8062..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_DEBUG_H -#define INCLUDED_GR_MESSAGE_DEBUG_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> -#include <gruel/thread.h> - -class gr_message_debug; -typedef boost::shared_ptr<gr_message_debug> gr_message_debug_sptr; - -GR_CORE_API gr_message_debug_sptr gr_make_message_debug(); - -/*! - * \brief Print received messages to stdout - * \ingroup sink_blk - */ -class GR_CORE_API gr_message_debug : public gr_block -{ - private: - friend GR_CORE_API gr_message_debug_sptr - gr_make_message_debug(); - - /*! - * \brief Messages received in this port are printed to stdout. - * - * This port receives messages from the scheduler's message handling - * mechanism and prints it to stdout. This message handler function - * is only meant to be used by the scheduler to handle messages - * posted to port 'print'. - * - * \param msg A pmt message passed from the scheduler's message handling. - */ - void print(pmt::pmt_t msg); - - /*! - * \brief PDU formatted messages received in this port are printed to stdout. - * - * This port receives messages from the scheduler's message handling - * mechanism and prints it to stdout. This message handler function - * is only meant to be used by the scheduler to handle messages - * posted to port 'print'. - * - * \param pdu A PDU message passed from the scheduler's message handling. - */ - void print_pdu(pmt::pmt_t pdu); - - /*! - * \brief Messages received in this port are stored in a vector. - * - * This port receives messages from the scheduler's message handling - * mechanism and stores it in a vector. Messages can be retrieved - * later using the 'get_message' function. This message handler - * function is only meant to be used by the scheduler to handle - * messages posted to port 'store'. - * - * \param msg A pmt message passed from the scheduler's message handling. - */ - void store(pmt::pmt_t msg); - - gruel::mutex d_mutex; - std::vector<pmt::pmt_t> d_messages; - - protected: - gr_message_debug (); - - public: - ~gr_message_debug (); - - /*! - * \brief Reports the number of messages received by this block. - */ - int num_messages(); - - /*! - * \brief Get a message (as a PMT) from the message vector at index \p i. - * - * Messages passed to the 'store' port will be stored in a - * vector. This function retrieves those messages by index. They are - * index in order of when they were received (all messages are just - * pushed onto the back of a vector). This is mostly useful in - * debugging message passing graphs and in QA code. - * - * \param i The index in the vector for the message to retrieve. - * - * \return a message at index \p i as a pmt_t. - */ - pmt::pmt_t get_message(int i); -}; - -#endif /* INCLUDED_GR_MESSAGE_DEBUG_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_debug.i b/gnuradio-core/src/lib/io/gr_message_debug.i deleted file mode 100644 index 65d3bfc4aa..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_debug); - -%{ -#include <gr_message_debug.h> -%} - -%include "gr_message_debug.h" - diff --git a/gnuradio-core/src/lib/io/gr_message_sink.cc b/gnuradio-core/src/lib/io/gr_message_sink.cc deleted file mode 100644 index ae0b5c7649..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_sink.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - - -// public constructor that returns a shared_ptr - -gr_message_sink_sptr -gr_make_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block) -{ - return gnuradio::get_initial_sptr(new gr_message_sink(itemsize, msgq, dont_block)); -} - -gr_message_sink::gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block) - : gr_sync_block("message_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), - d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block) -{ -} - -gr_message_sink::~gr_message_sink() -{ -} - -int -gr_message_sink::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - - // if we'd block, drop the data on the floor and say everything is OK - if (d_dont_block && d_msgq->full_p()) - return noutput_items; - - // build a message to hold whatever we've got - gr_message_sptr msg = gr_make_message(0, // msg type - d_itemsize, // arg1 for other end - noutput_items, // arg2 for other end (redundant) - noutput_items * d_itemsize); // len of msg - memcpy(msg->msg(), in, noutput_items * d_itemsize); - - d_msgq->handle(msg); // send it - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/io/gr_message_sink.h b/gnuradio-core/src/lib/io/gr_message_sink.h deleted file mode 100644 index 84005694a1..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SINK_H -#define INCLUDED_GR_MESSAGE_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_sink; -typedef boost::shared_ptr<gr_message_sink> gr_message_sink_sptr; - -GR_CORE_API gr_message_sink_sptr gr_make_message_sink (size_t itemsize, - gr_msg_queue_sptr msgq, - bool dont_block); - -/*! - * \brief Gather received items into messages and insert into msgq - * \ingroup sink_blk - */ -class GR_CORE_API gr_message_sink : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - bool d_dont_block; - - friend GR_CORE_API gr_message_sink_sptr - gr_make_message_sink(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - protected: - gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - public: - ~gr_message_sink (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MESSAGE_SINK_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_sink.i b/gnuradio-core/src/lib/io/gr_message_sink.i deleted file mode 100644 index 8415cbd66d..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_sink); - -gr_message_sink_sptr gr_make_message_sink (size_t itemsize, - gr_msg_queue_sptr msgq, - bool dont_block); - -class gr_message_sink : public gr_sync_block -{ - protected: - gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - public: - ~gr_message_sink (); -}; diff --git a/gnuradio-core/src/lib/io/gr_message_source.cc b/gnuradio-core/src/lib/io/gr_message_source.cc deleted file mode 100644 index fb3da89a8b..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - - -// public constructor that returns a shared_ptr - -gr_message_source_sptr -gr_make_message_source(size_t itemsize, int msgq_limit) -{ - return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq_limit)); -} - -// public constructor that takes existing message queue -gr_message_source_sptr -gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq) -{ - return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq)); -} - -gr_message_source::gr_message_source (size_t itemsize, int msgq_limit) - : gr_sync_block("message_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false) -{ -} - -gr_message_source::gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq) - : gr_sync_block("message_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false) -{ -} - -gr_message_source::~gr_message_source() -{ -} - -int -gr_message_source::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - int nn = 0; - - while (nn < noutput_items){ - if (d_msg){ - // - // Consume whatever we can from the current message - // - int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if (d_msg_offset == d_msg->length()){ - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - } - } - else { - // - // No current message - // - if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got - break; - } - - if (d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - - if ((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - } - - return nn; -} diff --git a/gnuradio-core/src/lib/io/gr_message_source.h b/gnuradio-core/src/lib/io/gr_message_source.h deleted file mode 100644 index c510d1775f..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SOURCE_H -#define INCLUDED_GR_MESSAGE_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_source; -typedef boost::shared_ptr<gr_message_source> gr_message_source_sptr; - -GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); -GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - -/*! - * \brief Turn received messages into a stream - * \ingroup source_blk - */ -class GR_CORE_API gr_message_source : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - friend GR_CORE_API gr_message_source_sptr - gr_make_message_source(size_t itemsize, int msgq_limit); - friend GR_CORE_API gr_message_source_sptr - gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq); - - protected: - gr_message_source (size_t itemsize, int msgq_limit); - gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_source (); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MESSAGE_SOURCE_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_source.i b/gnuradio-core/src/lib/io/gr_message_source.i deleted file mode 100644 index 9ee9157e8c..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.i +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_source); - -gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); -gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - -class gr_message_source : public gr_sync_block -{ - protected: - gr_message_source (size_t itemsize, int msgq_limit); - gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_source (); - - gr_msg_queue_sptr msgq() const; -}; diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index 01a174903d..be2ce99374 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -37,15 +37,11 @@ #include <gr_oscope_sink_x.h> #include <gr_oscope_sink_f.h> #include <ppio.h> -#include <gr_message_source.h> -#include <gr_message_burst_source.h> -#include <gr_message_sink.h> #include <gr_udp_sink.h> #include <gr_udp_source.h> #include <gr_wavfile_sink.h> #include <gr_wavfile_source.h> #include <gr_tagged_file_sink.h> -#include <gr_message_debug.h> %} %include "gr_file_sink_base.i" @@ -60,14 +56,10 @@ %include "sdr_1000.i" %include "gr_oscope_sink.i" %include "ppio.i" -%include "gr_message_source.i" -%include "gr_message_burst_source.i" -%include "gr_message_sink.i" %include "gr_udp_sink.i" %include "gr_udp_source.i" %include "gr_wavfile_sink.i" %include "gr_wavfile_source.i" %include "gr_tagged_file_sink.i" -%include "gr_message_debug.i" diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_message.py b/gnuradio-core/src/python/gnuradio/gr/qa_message.py deleted file mode 100755 index 4cef39bd76..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_message.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest - - -def all_counts (): - return (gr.block_ncurrently_allocated (), - gr.block_detail_ncurrently_allocated (), - gr.buffer_ncurrently_allocated (), - gr.buffer_reader_ncurrently_allocated (), - gr.message_ncurrently_allocated ()) - - -class test_message (gr_unittest.TestCase): - - def setUp (self): - self.msgq = gr.msg_queue () - - def tearDown (self): - self.msgq = None - - def leak_check (self, fct): - begin = all_counts () - fct () - # tear down early so we can check for leaks - self.tearDown () - end = all_counts () - self.assertEqual (begin, end) - - def test_100 (self): - msg = gr.message (0, 1.5, 2.3) - self.assertEquals (0, msg.type()) - self.assertAlmostEqual (1.5, msg.arg1()) - self.assertAlmostEqual (2.3, msg.arg2()) - self.assertEquals (0, msg.length()) - - def test_101 (self): - s = 'This is a test' - msg = gr.message_from_string(s) - self.assertEquals(s, msg.to_string()) - - def test_200 (self): - self.leak_check (self.body_200) - - def body_200 (self): - self.msgq.insert_tail (gr.message (0)) - self.assertEquals (1, self.msgq.count()) - self.msgq.insert_tail (gr.message (1)) - self.assertEquals (2, self.msgq.count()) - msg0 = self.msgq.delete_head () - self.assertEquals (0, msg0.type()) - msg1 = self.msgq.delete_head () - self.assertEquals (1, msg1.type()) - self.assertEquals (0, self.msgq.count()) - - def test_201 (self): - self.leak_check (self.body_201) - - def body_201 (self): - self.msgq.insert_tail (gr.message (0)) - self.assertEquals (1, self.msgq.count()) - self.msgq.insert_tail (gr.message (1)) - self.assertEquals (2, self.msgq.count()) - - def test_202 (self): - self.leak_check (self.body_202) - - def body_202 (self): - # global msg - msg = gr.message (666) - - def test_300(self): - input_data = (0,1,2,3,4,5,6,7,8,9) - src = gr.vector_source_b(input_data) - dst = gr.vector_sink_b() - tb = gr.top_block() - tb.connect(src, dst) - tb.run() - self.assertEquals(input_data, dst.data()) - - def test_301(self): - # Use itemsize, limit constructor - src = gr.message_source(gr.sizeof_char) - dst = gr.vector_sink_b() - tb = gr.top_block() - tb.connect(src, dst) - src.msgq().insert_tail(gr.message_from_string('01234')) - src.msgq().insert_tail(gr.message_from_string('5')) - src.msgq().insert_tail(gr.message_from_string('')) - src.msgq().insert_tail(gr.message_from_string('6789')) - src.msgq().insert_tail(gr.message(1)) # send EOF - tb.run() - self.assertEquals(tuple(map(ord, '0123456789')), dst.data()) - - def test_302(self): - # Use itemsize, msgq constructor - msgq = gr.msg_queue() - src = gr.message_source(gr.sizeof_char, msgq) - dst = gr.vector_sink_b() - tb = gr.top_block() - tb.connect(src, dst) - src.msgq().insert_tail(gr.message_from_string('01234')) - src.msgq().insert_tail(gr.message_from_string('5')) - src.msgq().insert_tail(gr.message_from_string('')) - src.msgq().insert_tail(gr.message_from_string('6789')) - src.msgq().insert_tail(gr.message(1)) # send EOF - tb.run() - self.assertEquals(tuple(map(ord, '0123456789')), dst.data()) - -if __name__ == '__main__': - gr_unittest.run(test_message, "test_message.xml") diff --git a/gnuradio-core/src/examples/msg_passing/CMakeLists.txt b/gr-blocks/examples/msg_passing/CMakeLists.txt index c4b207a1e4..c4b207a1e4 100644 --- a/gnuradio-core/src/examples/msg_passing/CMakeLists.txt +++ b/gr-blocks/examples/msg_passing/CMakeLists.txt diff --git a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc b/gr-blocks/examples/msg_passing/hier/test_msg_hier.grc index 0f25597666..4fa8a18d83 100644 --- a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc +++ b/gr-blocks/examples/msg_passing/hier/test_msg_hier.grc @@ -131,10 +131,10 @@ </param> </block> <block> - <key>gr_message_strobe</key> + <key>blocks_message_strobe</key> <param> <key>id</key> - <value>gr_message_strobe_0</value> + <value>blocks_message_strobe_0</value> </param> <param> <key>_enabled</key> @@ -193,10 +193,10 @@ </param> </block> <block> - <key>gr_message_strobe</key> + <key>blocks_message_strobe</key> <param> <key>id</key> - <value>gr_message_strobe_0_1</value> + <value>blocks_message_strobe_0_1</value> </param> <param> <key>_enabled</key> @@ -256,30 +256,30 @@ </block> <connection> <source_block_id>pad_source_0_0</source_block_id> - <sink_block_id>gr_message_strobe_0</sink_block_id> + <sink_block_id>blocks_message_strobe_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>pad_source_0</source_block_id> - <sink_block_id>gr_message_strobe_0</sink_block_id> + <sink_block_id>blocks_message_strobe_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_message_strobe_0</source_block_id> + <source_block_id>blocks_message_strobe_0</source_block_id> <sink_block_id>pad_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_message_strobe_0_1</source_block_id> + <source_block_id>blocks_message_strobe_0_1</source_block_id> <sink_block_id>pad_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_message_strobe_0_1</source_block_id> + <source_block_id>blocks_message_strobe_0_1</source_block_id> <sink_block_id>pad_sink_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc b/gr-blocks/examples/msg_passing/hier/test_msg_hier_topblock.grc index d9d9e62c38..896e42b5e4 100644 --- a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc +++ b/gr-blocks/examples/msg_passing/hier/test_msg_hier_topblock.grc @@ -61,10 +61,10 @@ </param> </block> <block> - <key>gr_message_strobe</key> + <key>blocks_message_strobe</key> <param> <key>id</key> - <value>gr_message_strobe_0_0</value> + <value>blocks_message_strobe_0_0</value> </param> <param> <key>_enabled</key> @@ -88,10 +88,10 @@ </param> </block> <block> - <key>gr_message_strobe</key> + <key>blocks_message_strobe</key> <param> <key>id</key> - <value>gr_message_strobe_0</value> + <value>blocks_message_strobe_0</value> </param> <param> <key>_enabled</key> @@ -115,10 +115,10 @@ </param> </block> <block> - <key>gr_message_debug</key> + <key>blocks_message_debug</key> <param> <key>id</key> - <value>gr_message_debug_0</value> + <value>blocks_message_debug_0</value> </param> <param> <key>_enabled</key> @@ -154,31 +154,31 @@ </block> <connection> <source_block_id>TEST_MSG_HIER_0</source_block_id> - <sink_block_id>gr_message_debug_0</sink_block_id> + <sink_block_id>blocks_message_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_message_strobe_0</source_block_id> + <source_block_id>blocks_message_strobe_0</source_block_id> <sink_block_id>TEST_MSG_HIER_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_message_strobe_0_0</source_block_id> + <source_block_id>blocks_message_strobe_0_0</source_block_id> <sink_block_id>TEST_MSG_HIER_0</sink_block_id> <source_key>0</source_key> <sink_key>1</sink_key> </connection> <connection> <source_block_id>TEST_MSG_HIER_0</source_block_id> - <sink_block_id>gr_message_debug_0</sink_block_id> + <sink_block_id>blocks_message_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>1</sink_key> </connection> <connection> <source_block_id>TEST_MSG_HIER_0</source_block_id> - <sink_block_id>gr_message_debug_0</sink_block_id> + <sink_block_id>blocks_message_debug_0</sink_block_id> <source_key>1</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/msg_passing/strobe.grc b/gr-blocks/examples/msg_passing/strobe.grc index ce97389782..d9d4ce43cb 100644 --- a/gnuradio-core/src/examples/msg_passing/strobe.grc +++ b/gr-blocks/examples/msg_passing/strobe.grc @@ -48,10 +48,10 @@ </param> </block> <block> - <key>gr_message_debug</key> + <key>blocks_message_debug</key> <param> <key>id</key> - <value>gr_message_debug_0</value> + <value>blocks_message_debug_0</value> </param> <param> <key>_enabled</key> @@ -121,10 +121,10 @@ </param> </block> <block> - <key>gr_message_strobe</key> + <key>blocks_message_strobe</key> <param> <key>id</key> - <value>gr_message_strobe_0</value> + <value>blocks_message_strobe_0</value> </param> <param> <key>_enabled</key> @@ -148,10 +148,10 @@ </param> </block> <block> - <key>gr_message_strobe</key> + <key>blocks_message_strobe</key> <param> <key>id</key> - <value>gr_message_strobe_0_0</value> + <value>blocks_message_strobe_0_0</value> </param> <param> <key>_enabled</key> @@ -234,20 +234,20 @@ </param> </block> <connection> - <source_block_id>gr_message_strobe_0_0</source_block_id> + <source_block_id>blocks_message_strobe_0_0</source_block_id> <sink_block_id>gr_pdu_to_tagged_stream_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_message_strobe_0</source_block_id> - <sink_block_id>gr_message_debug_0</sink_block_id> + <source_block_id>blocks_message_strobe_0</source_block_id> + <sink_block_id>blocks_message_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>gr_tagged_stream_to_pdu_0</source_block_id> - <sink_block_id>gr_message_debug_0</sink_block_id> + <sink_block_id>blocks_message_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/lib/message_burst_source_impl.cc b/gr-blocks/lib/message_burst_source_impl.cc index f3c90eda31..5ac417f7a5 100644 --- a/gr-blocks/lib/message_burst_source_impl.cc +++ b/gr-blocks/lib/message_burst_source_impl.cc @@ -61,7 +61,7 @@ namespace gr { { std::stringstream id; id << name() << unique_id(); - d_me = pmt::pmt_string_to_symbol(id.str()); + d_me = pmt::string_to_symbol(id.str()); } message_burst_source_impl::message_burst_source_impl(size_t itemsize, gr_msg_queue_sptr msgq) @@ -73,7 +73,7 @@ namespace gr { { std::stringstream id; id << name() << unique_id(); - d_me = pmt::pmt_string_to_symbol(id.str()); + d_me = pmt::string_to_symbol(id.str()); } message_burst_source_impl::~message_burst_source_impl() @@ -112,8 +112,8 @@ namespace gr { //tag end of burst add_item_tag(0, //stream ID abs_sample_count+nn-1, //sample number - pmt::pmt_string_to_symbol("tx_eob"), - pmt::pmt_from_bool(1), + pmt::string_to_symbol("tx_eob"), + pmt::from_bool(1), d_me); //block src id } } @@ -133,8 +133,8 @@ namespace gr { //tag start of burst add_item_tag(0, //stream ID abs_sample_count+nn, //sample number - pmt::pmt_string_to_symbol("tx_sob"), - pmt::pmt_from_bool(1), + pmt::string_to_symbol("tx_sob"), + pmt::from_bool(1), d_me); //block src id if((d_msg->length() % d_itemsize) != 0) diff --git a/gr-blocks/lib/message_debug_impl.cc b/gr-blocks/lib/message_debug_impl.cc index d7b1e5db09..6455513d76 100644 --- a/gr-blocks/lib/message_debug_impl.cc +++ b/gr-blocks/lib/message_debug_impl.cc @@ -43,7 +43,7 @@ namespace gr { message_debug_impl::print(pmt::pmt_t msg) { std::cout << "******* MESSAGE DEBUG PRINT ********\n"; - pmt::pmt_print(msg); + pmt::print(msg); std::cout << "************************************\n"; } @@ -57,15 +57,15 @@ namespace gr { void message_debug_impl::print_pdu(pmt::pmt_t pdu) { - pmt::pmt_t meta = pmt::pmt_car(pdu); - pmt::pmt_t vector = pmt::pmt_cdr(pdu); + pmt::pmt_t meta = pmt::car(pdu); + pmt::pmt_t vector = pmt::cdr(pdu); std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n"; - pmt::pmt_print(meta); - size_t len = pmt::pmt_length(vector); + pmt::print(meta); + size_t len = pmt::length(vector); std::cout << "pdu_length = " << len << std::endl; std::cout << "contents = " << std::endl; size_t offset(0); - const uint8_t* d = (const uint8_t*) pmt_uniform_vector_elements(vector, offset); + const uint8_t* d = (const uint8_t*) pmt::uniform_vector_elements(vector, offset); for(size_t i=0; i<len; i+=16){ printf("%04x: ", ((unsigned int)i)); for(size_t j=i; j<std::min(i+16,len); j++){ diff --git a/gr-blocks/python/qa_message.py b/gr-blocks/python/qa_message.py index 551fdd6259..a556f65cee 100755 --- a/gr-blocks/python/qa_message.py +++ b/gr-blocks/python/qa_message.py @@ -130,7 +130,7 @@ class test_message(gr_unittest.TestCase): self.assertEquals(tuple(map(ord, '0123456789')), dst.data()) def test_debug_401(self): - msg = pmt.pmt_intern("TESTING") + msg = pmt.intern("TESTING") src = blocks.message_strobe(msg, 500) snk = blocks.message_debug() @@ -142,7 +142,7 @@ class test_message(gr_unittest.TestCase): tb.wait() rec_msg = snk.get_message(0) - self.assertTrue(pmt.pmt_eqv(rec_msg, msg)) + self.assertTrue(pmt.eqv(rec_msg, msg)) if __name__ == '__main__': diff --git a/gr-blocks/python/qa_pdu.py b/gr-blocks/python/qa_pdu.py index b421f9ce63..8f708a2a86 100755 --- a/gr-blocks/python/qa_pdu.py +++ b/gr-blocks/python/qa_pdu.py @@ -43,7 +43,7 @@ class test_pdu(gr_unittest.TestCase): snk = gr.tag_debug(1, "test") snk.set_display(False) - dbg = gr.message_debug() + dbg = blocks.message_debug() # Test that the right number of ports exist. pi = snk3.message_ports_in() diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py index a9cb0c0702..f5d12b5689 100755 --- a/gr-digital/examples/narrowband/rx_voice.py +++ b/gr-digital/examples/narrowband/rx_voice.py @@ -50,7 +50,7 @@ class audio_tx(gr.hier_block2): gr.io_signature(0, 0, 0)) # Output signature self.sample_rate = sample_rate = 8000 - self.packet_src = gr.message_source(33) + self.packet_src = blocks.message_source(33) voice_decoder = vocoder.gsm_fr_decode_ps() s2f = blocks.short_to_float() sink_scale = blocks.multiply_const_ff(1.0/32767.) diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py index d3c81694ab..3fc4fa46f3 100755 --- a/gr-digital/examples/narrowband/tx_voice.py +++ b/gr-digital/examples/narrowband/tx_voice.py @@ -55,7 +55,7 @@ class audio_rx(gr.hier_block2): f2s = blocks.float_to_short() voice_coder = vocoder.gsm_fr_encode_sp() self.packets_from_encoder = gr.msg_queue() - packet_sink = gr.message_sink(33, self.packets_from_encoder, False) + packet_sink = blocks.message_sink(33, self.packets_from_encoder, False) self.connect(src, src_scale, f2s, voice_coder, packet_sink) def get_encoded_voice_packet(self): diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py index cab6ffda6c..69cfcbc7ea 100644 --- a/gr-digital/python/ofdm_sync_ml.py +++ b/gr-digital/python/ofdm_sync_ml.py @@ -84,8 +84,8 @@ class ofdm_sync_ml(gr.hier_block2): self.movingsum2 = filter.fir_filter_ccf(1,movingsum2_taps) # Correlator data handler - self.c2mag = gr.complex_to_mag() - self.angle = gr.complex_to_arg() + self.c2mag = blocks.complex_to_mag() + self.angle = blocks.complex_to_arg() self.connect(self.input,(self.mixer,1)) self.connect(self.delay,self.conjg,(self.mixer,0)) self.connect(self.mixer,self.movingsum2,self.c2mag) @@ -98,7 +98,7 @@ class ofdm_sync_ml(gr.hier_block2): #ML measurements input to sampler block and detect self.f2c = blocks.float_to_complex() - self.pk_detect = gr.peak_detector_fb(0.2, 0.25, 30, 0.0005) + self.pk_detect = blocks.peak_detector_fb(0.2, 0.25, 30, 0.0005) self.sample_and_hold = blocks.sample_and_hold_ff() # use the sync loop values to set the sampler and the NCO diff --git a/gr-digital/python/pkt.py b/gr-digital/python/pkt.py index d084c3ff0f..434548906e 100644 --- a/gr-digital/python/pkt.py +++ b/gr-digital/python/pkt.py @@ -25,6 +25,10 @@ import gnuradio.gr.gr_threading as _threading import packet_utils import digital_swig as digital +try: + from gnuradio import blocks +except ImportError: + import blocks_swig as blocks # ///////////////////////////////////////////////////////////////////////////// # mod/demod with packets as i/o @@ -70,7 +74,7 @@ class mod_pkts(gr.hier_block2): self._access_code = access_code # accepts messages from the outside world - self._pkt_input = gr.message_source(gr.sizeof_char, msgq_limit) + self._pkt_input = blocks.message_source(gr.sizeof_char, msgq_limit) self.connect(self._pkt_input, self._modulator, self) def send_pkt(self, payload='', eof=False): diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc index b8a93d56e3..0b490269b4 100644 --- a/gr-noaa/examples/file_rx_hrpt.grc +++ b/gr-noaa/examples/file_rx_hrpt.grc @@ -283,10 +283,10 @@ </param> </block> <block> - <key>gr_moving_average_xx</key> + <key>blocks_moving_average_xx</key> <param> <key>id</key> - <value>gr_moving_average_xx_0</value> + <value>blocks_moving_average_xx_0</value> </param> <param> <key>_enabled</key> @@ -841,14 +841,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> + <source_block_id>blocks_moving_average_xx_0</source_block_id> <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> + <sink_block_id>blocks_moving_average_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-noaa/examples/hrpt_demod.grc b/gr-noaa/examples/hrpt_demod.grc index 54dbf73ce7..feb352d9d2 100644 --- a/gr-noaa/examples/hrpt_demod.grc +++ b/gr-noaa/examples/hrpt_demod.grc @@ -556,10 +556,10 @@ </param> </block> <block> - <key>gr_moving_average_xx</key> + <key>blocks_moving_average_xx</key> <param> <key>id</key> - <value>gr_moving_average_xx_0</value> + <value>blocks_moving_average_xx_0</value> </param> <param> <key>_enabled</key> @@ -702,7 +702,7 @@ </connection> <connection> <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> + <sink_block_id>blocks_moving_average_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -731,7 +731,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> + <source_block_id>blocks_moving_average_xx_0</source_block_id> <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-noaa/examples/usrp_rx_hrpt.grc b/gr-noaa/examples/usrp_rx_hrpt.grc index 26af48ff0b..2cf2a7fe0c 100644 --- a/gr-noaa/examples/usrp_rx_hrpt.grc +++ b/gr-noaa/examples/usrp_rx_hrpt.grc @@ -1683,10 +1683,10 @@ </param> </block> <block> - <key>gr_moving_average_xx</key> + <key>blocks_moving_average_xx</key> <param> <key>id</key> - <value>gr_moving_average_xx_0</value> + <value>blocks_moving_average_xx_0</value> </param> <param> <key>_enabled</key> @@ -1938,18 +1938,18 @@ </connection> <connection> <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> + <sink_block_id>blocks_moving_average_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> + <source_block_id>blocks_moving_average_xx_0</source_block_id> <sink_block_id>demod_scope</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> + <source_block_id>blocks_moving_average_xx_0</source_block_id> <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-noaa/examples/usrp_rx_hrpt_nogui.grc b/gr-noaa/examples/usrp_rx_hrpt_nogui.grc index 5936c94c83..cfaa8c6310 100644 --- a/gr-noaa/examples/usrp_rx_hrpt_nogui.grc +++ b/gr-noaa/examples/usrp_rx_hrpt_nogui.grc @@ -1215,10 +1215,10 @@ </param> </block> <block> - <key>gr_moving_average_xx</key> + <key>blocks_moving_average_xx</key> <param> <key>id</key> - <value>gr_moving_average_xx_0</value> + <value>blocks_moving_average_xx_0</value> </param> <param> <key>_enabled</key> @@ -1422,14 +1422,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> + <source_block_id>blocks_moving_average_xx_0</source_block_id> <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> + <sink_block_id>blocks_moving_average_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-wxgui/python/constsink_gl.py b/gr-wxgui/python/constsink_gl.py index 4765e7a6eb..0313e7fea0 100644 --- a/gr-wxgui/python/constsink_gl.py +++ b/gr-wxgui/python/constsink_gl.py @@ -102,7 +102,7 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): #) agc = gr.feedforward_agc_cc(16, 1) msgq = gr.msg_queue(2) - sink = gr.message_sink(gr.sizeof_gr_complex*const_size, msgq, True) + sink = blocks.message_sink(gr.sizeof_gr_complex*const_size, msgq, True) #controller def setter(p, k, x): p[k] = x self.controller = pubsub() diff --git a/gr-wxgui/python/fftsink_gl.py b/gr-wxgui/python/fftsink_gl.py index 88a5968e2c..b5bb5c6c60 100644 --- a/gr-wxgui/python/fftsink_gl.py +++ b/gr-wxgui/python/fftsink_gl.py @@ -92,7 +92,7 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb): win=win, ) msgq = gr.msg_queue(2) - sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True) + sink = blocks.message_sink(gr.sizeof_float*fft_size, msgq, True) #controller diff --git a/gr-wxgui/python/fftsink_nongl.py b/gr-wxgui/python/fftsink_nongl.py index d13b296d56..ee5145dfd7 100644 --- a/gr-wxgui/python/fftsink_nongl.py +++ b/gr-wxgui/python/fftsink_nongl.py @@ -139,7 +139,7 @@ class fft_sink_f(gr.hier_block2, fft_sink_base): -10*math.log10(power/self.fft_size) # Adjust for windowing loss -20*math.log10(ref_scale/2)) # Adjust for reference scale - self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) + self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink) self.win = fft_window(self, parent, size=size) @@ -185,7 +185,7 @@ class fft_sink_c(gr.hier_block2, fft_sink_base): -10*math.log10(power/self.fft_size) # Adjust for windowing loss -20*math.log10(ref_scale/2)) # Adjust for reference scale - self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) + self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink) self.win = fft_window(self, parent, size=size) diff --git a/gr-wxgui/python/numbersink2.py b/gr-wxgui/python/numbersink2.py index 395bddbd61..62a096e112 100644 --- a/gr-wxgui/python/numbersink2.py +++ b/gr-wxgui/python/numbersink2.py @@ -82,7 +82,7 @@ class _number_sink_base(gr.hier_block2, common.wxgui_hb): add = blocks.add_const_cc(ref_level) avg = filter.single_pole_iir_filter_cc(1.0) msgq = gr.msg_queue(2) - sink = gr.message_sink(self._item_size, msgq, True) + sink = blocks.message_sink(self._item_size, msgq, True) #controller self.controller = pubsub() self.controller.subscribe(SAMPLE_RATE_KEY, sd.set_sample_rate) diff --git a/gr-wxgui/python/waterfallsink_gl.py b/gr-wxgui/python/waterfallsink_gl.py index dba50ce551..ead97df1e7 100644 --- a/gr-wxgui/python/waterfallsink_gl.py +++ b/gr-wxgui/python/waterfallsink_gl.py @@ -77,7 +77,7 @@ class _waterfall_sink_base(gr.hier_block2, common.wxgui_hb): win=win, ) msgq = gr.msg_queue(2) - sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True) + sink = blocks.message_sink(gr.sizeof_float*fft_size, msgq, True) #controller self.controller = pubsub() self.controller.subscribe(AVERAGE_KEY, fft.set_average) diff --git a/gr-wxgui/python/waterfallsink_nongl.py b/gr-wxgui/python/waterfallsink_nongl.py index df1534f993..11dfd106c5 100644 --- a/gr-wxgui/python/waterfallsink_nongl.py +++ b/gr-wxgui/python/waterfallsink_nongl.py @@ -98,7 +98,7 @@ class waterfall_sink_f(gr.hier_block2, waterfall_sink_base): self.c2mag = gr.complex_to_mag(self.fft_size) self.avg = filter.single_pole_iir_filter_ff(1.0, self.fft_size) self.log = blocks.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size)) - self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) + self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink) self.win = waterfall_window(self, parent, size=size) @@ -129,7 +129,7 @@ class waterfall_sink_c(gr.hier_block2, waterfall_sink_base): self.c2mag = gr.complex_to_mag(self.fft_size) self.avg = filter.single_pole_iir_filter_ff(1.0, self.fft_size) self.log = blocks.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size)) - self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) + self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink) self.win = waterfall_window(self, parent, size=size) diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index f7e69c947f..61455b9861 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -15,8 +15,6 @@ <block>blks2_tcp_source</block> <block>gr_udp_source</block> <block>gr_wavfile_source</block> - <block>gr_message_source</block> - <block>gr_message_burst_source</block> <block>pad_source</block> <block>virtual_source</block> </cat> @@ -28,16 +26,10 @@ <block>blks2_tcp_sink</block> <block>gr_udp_sink</block> <block>gr_wavfile_sink</block> - <block>gr_message_sink</block> <block>pad_sink</block> <block>virtual_sink</block> <block>gr_tag_debug</block> </cat> - <cat> - <name>Message Tools</name> - <block>gr_message_debug</block> - <block>gr_message_strobe</block> - </cat> <cat> <name>Operators</name> <block>gr_vector_insert_x</block> @@ -68,15 +60,6 @@ <block>blks2_packet_encoder</block> </cat> <cat> - <name>Level Controls</name> - <block>gr_peak_detector_xb</block> - </cat> - <cat> - <name>Filters</name> - <!-- Other filters --> - <block>gr_moving_average_xx</block> - </cat> - <cat> <name>Modulators</name> <block>gr_vco_f</block> </cat> diff --git a/grc/blocks/gr_message_burst_source.xml b/grc/blocks/gr_message_burst_source.xml deleted file mode 100644 index e835d2a2ce..0000000000 --- a/grc/blocks/gr_message_burst_source.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Burst Source (the sink port is a message) -################################################### - --> -<block> - <name>Message Burst Source</name> - <key>gr_message_burst_source</key> - <import>from gnuradio import gr</import> - <make>gr.message_burst_source($type.size*$vlen, $(id)_msgq_in)</make> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>msg</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> -</block> diff --git a/grc/blocks/gr_message_debug.xml b/grc/blocks/gr_message_debug.xml deleted file mode 100644 index 964f957569..0000000000 --- a/grc/blocks/gr_message_debug.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Debug -################################################### - --> -<block> - <name>Message Debug</name> - <key>gr_message_debug</key> - <import>from gnuradio import gr</import> - <make>gr.message_debug()</make> - <sink> - <name>print</name> - <type>message</type> - <optional>1</optional> - </sink> - <sink> - <name>store</name> - <type>message</type> - <optional>1</optional> - </sink> - <sink> - <name>print_pdu</name> - <type>message</type> - <optional>1</optional> - </sink> -</block> diff --git a/grc/blocks/gr_message_sink.xml b/grc/blocks/gr_message_sink.xml deleted file mode 100644 index 18e92adb97..0000000000 --- a/grc/blocks/gr_message_sink.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Sink (the source port is a message) -################################################### - --> -<block> - <name>Message Sink</name> - <key>gr_message_sink</key> - <import>from gnuradio import gr</import> - <make>gr.message_sink($type.size*$vlen, $(id)_msgq_out, $dont_block)</make> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Don't Block</name> - <key>dont_block</key> - <value>False</value> - <type>enum</type> - <option> - <name>Don't Block</name> - <key>True</key> - </option> - <option> - <name>Block</name> - <key>False</key> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - </sink> - <source> - <name>out</name> - <type>msg</type> - </source> -</block> diff --git a/grc/blocks/gr_message_source.xml b/grc/blocks/gr_message_source.xml deleted file mode 100644 index 72367b21b0..0000000000 --- a/grc/blocks/gr_message_source.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Source (the sink port is a message) -################################################### - --> -<block> - <name>Message Source</name> - <key>gr_message_source</key> - <import>from gnuradio import gr</import> - <make>gr.message_source($type.size*$vlen, $(id)_msgq_in)</make> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>msg</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> -</block> diff --git a/grc/blocks/gr_message_strobe.xml b/grc/blocks/gr_message_strobe.xml deleted file mode 100644 index 067d345c8e..0000000000 --- a/grc/blocks/gr_message_strobe.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Strobe -################################################### - --> -<block> - <name>Message Strobe</name> - <key>gr_message_strobe</key> - <import>from gnuradio import gr</import> - <import>from gruel import pmt</import> - <make>gr.message_strobe($msg, $period)</make> - <param> - <name>Message PMT</name> - <key>msg</key> - <value>pmt.intern("TEST")</value> - <type>raw</type> - </param> - <param> - <name>Period (ms)</name> - <key>period</key> - <value>1000</value> - <type>real</type> - </param> - <sink> - <name>set_msg</name> - <type>message</type> - <optional>1</optional> - </sink> - <source> - <name>strobe</name> - <type>message</type> - <optional>1</optional> - </source> -</block> diff --git a/grc/blocks/gr_moving_average_xx.xml b/grc/blocks/gr_moving_average_xx.xml deleted file mode 100644 index b70943c785..0000000000 --- a/grc/blocks/gr_moving_average_xx.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Moving Average -################################################### - --> -<block> - <name>Moving Average</name> - <key>gr_moving_average_xx</key> - <import>from gnuradio import gr</import> - <make>gr.moving_average_$(type.fcn)($length, $scale, $max_iter)</make> - <callback>set_length_and_scale($length, $scale)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:cc</opt> - <opt>scale:complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:ff</opt> - <opt>scale:real</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:ii</opt> - <opt>scale:int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:ss</opt> - <opt>scale:int</opt> - </option> - </param> - <param> - <name>Length</name> - <key>length</key> - <value>1000</value> - <type>int</type> - </param> - <param> - <name>Scale</name> - <key>scale</key> - <value>1</value> - <type>$type.scale</type> - </param> - <param> - <name>Max Iter</name> - <key>max_iter</key> - <value>4000</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/grc/blocks/gr_peak_detector_xb.xml b/grc/blocks/gr_peak_detector_xb.xml deleted file mode 100644 index 394b0697f8..0000000000 --- a/grc/blocks/gr_peak_detector_xb.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Peak Detector -################################################### - --> -<block> - <name>Peak Detector</name> - <key>gr_peak_detector_xb</key> - <import>from gnuradio import gr</import> - <make>gr.peak_detector_$(type.fcn)b($threshold_factor_rise, $threshold_factor_fall, $look_ahead, $alpha)</make> - <callback>set_threshold_factor_rise($threshold_factor_rise)</callback> - <callback>set_threshold_factor_fall($threshold_factor_fall)</callback> - <callback>set_look_ahead($look_ahead)</callback> - <callback>set_alpha($alpha)</callback> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:i</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - </param> - <param> - <name>TH Factor Rise</name> - <key>threshold_factor_rise</key> - <type>real</type> - </param> - <param> - <name>TH Factor Fall</name> - <key>threshold_factor_fall</key> - <type>real</type> - </param> - <param> - <name>Look Ahead</name> - <key>look_ahead</key> - <type>int</type> - </param> - <param> - <name>Alpha</name> - <key>alpha</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/grc_gnuradio/blks2/error_rate.py b/grc/grc_gnuradio/blks2/error_rate.py index 7f53f7af65..7970f29bae 100644 --- a/grc/grc_gnuradio/blks2/error_rate.py +++ b/grc/grc_gnuradio/blks2/error_rate.py @@ -79,10 +79,10 @@ class error_rate(gr.hier_block2): self._max_samples = win_size self._bits_per_symbol = bits_per_symbol #setup message queue - msg_source = gr.message_source(gr.sizeof_float, 1) + msg_source = blocks.message_source(gr.sizeof_float, 1) self._msgq_source = msg_source.msgq() msgq_sink = gr.msg_queue(2) - msg_sink = gr.message_sink(gr.sizeof_char, msgq_sink, False) #False -> blocking + msg_sink = blocks.message_sink(gr.sizeof_char, msgq_sink, False) #False -> blocking inter = blocks.interleave(gr.sizeof_char) #start thread self._num_errs = 0 @@ -113,7 +113,7 @@ class error_rate(gr.hier_block2): #write sample arr[i] = float(self._num_errs)/float(self._num_samps*self._bits_per_symbol) #write message - msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num) + msg = blocks.message_from_string(arr.tostring(), 0, gr.sizeof_float, num) self._msgq_source.insert_tail(msg) def _handler_ser(self, samples): @@ -136,5 +136,5 @@ class error_rate(gr.hier_block2): #write sample arr[i] = float(self._num_errs)/float(self._num_samps) #write message - msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num) + msg = blocks.message_from_string(arr.tostring(), 0, gr.sizeof_float, num) self._msgq_source.insert_tail(msg) diff --git a/grc/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py index cceb4da650..eeadfb4a60 100644 --- a/grc/grc_gnuradio/blks2/packet.py +++ b/grc/grc_gnuradio/blks2/packet.py @@ -19,6 +19,7 @@ # from gnuradio import gr, digital +from gnuradio import blocks from gnuradio.digital import packet_utils import gnuradio.gr.gr_threading as _threading @@ -89,7 +90,7 @@ class packet_encoder(gr.hier_block2): self._access_code = access_code self._pad_for_usrp = pad_for_usrp #create blocks - msg_source = gr.message_source(gr.sizeof_char, DEFAULT_MSGQ_LIMIT) + msg_source = blocks.message_source(gr.sizeof_char, DEFAULT_MSGQ_LIMIT) self._msgq_out = msg_source.msgq() #initialize hier2 gr.hier_block2.__init__( @@ -199,7 +200,7 @@ class packet_mod_base(gr.hier_block2): ) #create blocks msgq = gr.msg_queue(DEFAULT_MSGQ_LIMIT) - msg_sink = gr.message_sink(self._item_size_in, msgq, False) #False -> blocking + msg_sink = blocks.message_sink(self._item_size_in, msgq, False) #False -> blocking #connect self.connect(self, msg_sink) self.connect(packet_source, self) @@ -229,7 +230,7 @@ class packet_demod_base(gr.hier_block2): gr.io_signature(1, 1, self._item_size_out) # Output signature ) #create blocks - msg_source = gr.message_source(self._item_size_out, DEFAULT_MSGQ_LIMIT) + msg_source = blocks.message_source(self._item_size_out, DEFAULT_MSGQ_LIMIT) self._msgq_out = msg_source.msgq() #connect self.connect(self, packet_sink) @@ -238,7 +239,7 @@ class packet_demod_base(gr.hier_block2): self.connect(packet_sink, gr.null_sink(packet_sink._hb.output_signature().sizeof_stream_item(0))) def recv_pkt(self, ok, payload): - msg = gr.message_from_string(payload, 0, self._item_size_out, len(payload)/self._item_size_out) + msg = blocks.message_from_string(payload, 0, self._item_size_out, len(payload)/self._item_size_out) if ok: self._msgq_out.insert_tail(msg) class packet_demod_b(packet_demod_base): _item_size_out = gr.sizeof_char |