From f22f9ab1466b99e6f3e897f3867c2ccff4f5a2f5 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Sun, 24 Feb 2013 14:22:17 -0500 Subject: blocks: removed peak_detector2 and regenerate blocks from gnuradio-core. --- gnuradio-core/src/lib/general/CMakeLists.txt | 2 - gnuradio-core/src/lib/general/general.i | 4 - .../src/lib/general/gr_peak_detector2_fb.cc | 107 -------------------- .../src/lib/general/gr_peak_detector2_fb.h | 109 --------------------- .../src/lib/general/gr_peak_detector2_fb.i | 45 --------- gnuradio-core/src/lib/general/gr_regenerate_bb.cc | 90 ----------------- gnuradio-core/src/lib/general/gr_regenerate_bb.h | 76 -------------- gnuradio-core/src/lib/general/gr_regenerate_bb.i | 38 ------- 8 files changed, 471 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc delete mode 100644 gnuradio-core/src/lib/general/gr_peak_detector2_fb.h delete mode 100644 gnuradio-core/src/lib/general/gr_peak_detector2_fb.i delete mode 100644 gnuradio-core/src/lib/general/gr_regenerate_bb.cc delete mode 100644 gnuradio-core/src/lib/general/gr_regenerate_bb.h delete mode 100644 gnuradio-core/src/lib/general/gr_regenerate_bb.i (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index de75dee7b8..581d57f8d8 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -163,10 +163,8 @@ set(gr_core_general_triple_threats gr_null_sink gr_null_source gr_pa_2x2_phase_combiner - gr_peak_detector2_fb gr_prefs gr_random_pdu - gr_regenerate_bb gr_remez gr_skiphead gr_stretch_ff diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 092582475d..64b2816327 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -44,7 +44,6 @@ #include <gr_transcendental.h> #include <gr_vco_f.h> #include <gr_threshold_ff.h> -#include <gr_regenerate_bb.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> #include <gr_prefs.h> @@ -55,7 +54,6 @@ #include <gr_pack_k_bits_bb.h> #include <gr_feval.h> #include <gr_bin_statistics_f.h> -#include <gr_peak_detector2_fb.h> #include <gr_stretch_ff.h> #include <gr_copy.h> #include <complex_vec_test.h> @@ -90,7 +88,6 @@ %include "gr_transcendental.i" %include "gr_vco_f.i" %include "gr_threshold_ff.i" -%include "gr_regenerate_bb.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" %include "gr_prefs.i" @@ -101,7 +98,6 @@ %include "gr_pack_k_bits_bb.i" %include "gr_feval.i" %include "gr_bin_statistics_f.i" -%include "gr_peak_detector2_fb.i" %include "gr_stretch_ff.i" %include "gr_copy.i" %include "complex_vec_test.i" diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc deleted file mode 100644 index a4179a8c2a..0000000000 --- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc +++ /dev/null @@ -1,107 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_peak_detector2_fb.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_peak_detector2_fb_sptr -gr_make_peak_detector2_fb (float threshold_factor_rise, - int look_ahead, float alpha) -{ - return gnuradio::get_initial_sptr(new gr_peak_detector2_fb (threshold_factor_rise, - look_ahead, alpha)); -} - -gr_peak_detector2_fb::gr_peak_detector2_fb (float threshold_factor_rise, - int look_ahead, float alpha) - : gr_sync_block ("peak_detector2_fb", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature2 (1, 2, sizeof(char), sizeof(float))), - d_threshold_factor_rise(threshold_factor_rise), - d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false) -{ -} - -int -gr_peak_detector2_fb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) { - float *iptr = (float *) input_items[0]; - char *optr = (char *) output_items[0]; - - assert(noutput_items >= 2); - - memset(optr, 0, noutput_items*sizeof(char)); - - for (int i = 0; i < noutput_items; i++) { - - if (!d_found) { - // Have not yet detected presence of peak - if (iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) { - d_found = true; - d_look_ahead_remaining = d_look_ahead; - d_peak_val = -(float)INFINITY; - } - else { - d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg; - } - } - else { - // Detected presence of peak - if (iptr[i] > d_peak_val) { - d_peak_val = iptr[i]; - d_peak_ind = i; - } - else if (d_look_ahead_remaining <= 0) { - optr[d_peak_ind] = 1; - d_found = false; - d_avg = iptr[i]; - } - - // Have not yet located peak, loop and keep searching. - d_look_ahead_remaining--; - } - - // Every iteration of the loop, write debugging signal out if - // connected: - if (output_items.size() == 2) { - float *sigout = (float *) output_items[1]; - sigout[i] = d_avg; - } - } // loop - - if (!d_found) - return noutput_items; - - // else if detected presence, keep searching during the next call to work. - int tmp = d_peak_ind; - d_peak_ind = 1; - - return tmp - 1; -} - - diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h deleted file mode 100644 index 665a6b882c..0000000000 --- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h +++ /dev/null @@ -1,109 +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. - */ - -#ifndef INCLUDED_gr_peak_detector2_FB_H -#define INCLUDED_gr_peak_detector2_FB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_peak_detector2_fb; -typedef boost::shared_ptr<gr_peak_detector2_fb> gr_peak_detector2_fb_sptr; - -GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7, - int look_ahead = 1000, - 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. A separate debug output may be connected, to - * view the internal EWMA described below. - * - * \param threshold_factor_rise The threshold factor determins when a peak - * is present. An EWMA average of the signal is calculated and when the - * value of the signal goes over threshold_factor_rise*average, we - * call the peak. - * \param look_ahead The look-ahead value is used when the threshold is - * found to locate the peak within this range. - * \param alpha The gain value of a single-pole moving average filter - */ - -class GR_CORE_API gr_peak_detector2_fb : public gr_sync_block -{ - friend GR_CORE_API gr_peak_detector2_fb_sptr - gr_make_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha); - - gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha); - -private: - float d_threshold_factor_rise; - int d_look_ahead; - int d_look_ahead_remaining; - int d_peak_ind; - float d_peak_val; - float d_alpha; - float d_avg; - bool 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 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_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 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_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/general/gr_peak_detector2_fb.i b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i deleted file mode 100644 index ec7227e690..0000000000 --- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i +++ /dev/null @@ -1,45 +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. - */ - - -GR_SWIG_BLOCK_MAGIC(gr,peak_detector2_fb) - - gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7, - int look_ahead = 1000, - float alpha=0.001); - -class gr_peak_detector2_fb : public gr_sync_block -{ -private: - gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha); - -public: - void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = 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; } - int look_ahead() { return d_look_ahead; } - float alpha() { return d_avg_alpha; } -}; - - diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.cc b/gnuradio-core/src/lib/general/gr_regenerate_bb.cc deleted file mode 100644 index c96cf247d0..0000000000 --- a/gnuradio-core/src/lib/general/gr_regenerate_bb.cc +++ /dev/null @@ -1,90 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_regenerate_bb.h> -#include <gr_io_signature.h> - -gr_regenerate_bb_sptr -gr_make_regenerate_bb (int period, unsigned int max_regen) -{ - return gnuradio::get_initial_sptr(new gr_regenerate_bb (period, max_regen)); -} - -gr_regenerate_bb::gr_regenerate_bb (int period, unsigned int max_regen) - : gr_sync_block ("regenerate_bb", - gr_make_io_signature (1, 1, sizeof (char)), - gr_make_io_signature (1, 1, sizeof (char))), - d_period(period), - d_countdown(0), - d_max_regen(max_regen), - d_regen_count(max_regen) -{ -} - -void gr_regenerate_bb::set_max_regen(unsigned int regen) -{ - d_max_regen = regen; - d_countdown = 0; - d_regen_count = d_max_regen; -} - -void gr_regenerate_bb::set_period(int period) -{ - d_period = period; - d_countdown = 0; - d_regen_count = d_max_regen; -} - -int -gr_regenerate_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *iptr = (const char *) input_items[0]; - char *optr = (char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - optr[i] = 0; - - if(d_regen_count < d_max_regen) { - d_countdown--; - - if(d_countdown == 0) { - optr[i] = 1; - d_countdown = d_period; - d_regen_count++; - } - } - - if(iptr[i] == 1) { - d_countdown = d_period; - optr[i] = 1; - d_regen_count = 0; - } - - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.h b/gnuradio-core/src/lib/general/gr_regenerate_bb.h deleted file mode 100644 index e820db69e8..0000000000 --- a/gnuradio-core/src/lib/general/gr_regenerate_bb.h +++ /dev/null @@ -1,76 +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. - */ - -#ifndef INCLUDED_GR_REGENERATE_BB_H -#define INCLUDED_GR_REGENERATE_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_regenerate_bb; -typedef boost::shared_ptr<gr_regenerate_bb> gr_regenerate_bb_sptr; - -GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500); - -/*! - * \brief Detect the peak of a signal and repeat every period samples - * \ingroup level_blk - * - * If a peak is detected, this block outputs a 1 repeated every period samples - * until reset by detection of another 1 on the input or stopped after max_regen - * regenerations have occurred. - * - * Note that if max_regen=(-1)/ULONG_MAX then the regeneration will run forever. - */ -class GR_CORE_API gr_regenerate_bb : public gr_sync_block -{ - /*! - * \brief Make a regenerate block - * \param period The number of samples between regenerations - * \param max_regen The maximum number of regenerations to perform; if set to - * ULONG_MAX, it will regenerate continuously. - */ - friend GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen); - - gr_regenerate_bb (int period, unsigned int max_regen); - - private: - int d_period; - int d_countdown; - unsigned int d_max_regen; - unsigned int d_regen_count; - - public: - /*! \brief Reset the maximum regeneration count; this will reset the current regen. - */ - void set_max_regen(unsigned int regen); - - /*! \brief Reset the period of regenerations; this will reset the current regen. - */ - void set_period(int period); - - 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/general/gr_regenerate_bb.i b/gnuradio-core/src/lib/general/gr_regenerate_bb.i deleted file mode 100644 index 064b0a2789..0000000000 --- a/gnuradio-core/src/lib/general/gr_regenerate_bb.i +++ /dev/null @@ -1,38 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,regenerate_bb) - -gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500); - -class gr_regenerate_bb : public gr_sync_block -{ - private: - gr_regenerate_bb (int period, unsigned int max_regen); - -public: - void set_max_regen(unsigned int regen); - - /*! \brief Reset the period of regenerations; this will reset the current regen. - */ - void set_period(int period); -}; -- cgit v1.2.3 From d858f1402b4fb4e302d0b488eec0e4628b62296d Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Sun, 24 Feb 2013 19:44:25 -0500 Subject: blocks: removing throttle, threshold, stretch from gnuradio-core. --- docs/sphinx/source/gr/index.rst | 2 - docs/sphinx/source/gr/misc_blk.rst | 2 - .../src/examples/ctrlport/pfb_sync_test-qt.grc | 8 +- .../src/examples/ctrlport/pfb_sync_test.grc | 8 +- .../src/examples/mp-sched/affinity_set.py | 7 +- .../src/examples/network/dial_tone_source.py | 3 +- gnuradio-core/src/examples/tags/test_file_tags.py | 3 +- gnuradio-core/src/lib/general/CMakeLists.txt | 3 - gnuradio-core/src/lib/general/general.i | 6 -- gnuradio-core/src/lib/general/gr_stretch_ff.cc | 74 -------------- gnuradio-core/src/lib/general/gr_stretch_ff.h | 60 ----------- gnuradio-core/src/lib/general/gr_stretch_ff.i | 31 ------ gnuradio-core/src/lib/general/gr_threshold_ff.cc | 67 ------------- gnuradio-core/src/lib/general/gr_threshold_ff.h | 59 ----------- gnuradio-core/src/lib/general/gr_threshold_ff.i | 39 -------- gnuradio-core/src/lib/general/gr_throttle.cc | 110 --------------------- gnuradio-core/src/lib/general/gr_throttle.h | 51 ---------- gnuradio-core/src/lib/general/gr_throttle.i | 29 ------ .../src/python/gnuradio/ctrlport/GrDataPlotter.py | 15 +-- gr-analog/python/standard_squelch.py | 2 +- gr-audio/examples/grc/cvsd_sweep.grc | 2 +- .../examples/metadata/file_metadata_source.grc | 12 +-- .../metadata/file_metadata_vector_source.grc | 12 +-- gr-blocks/python/qa_stretch.py | 4 +- gr-channels/examples/channel_tone_response.grc | 8 +- gr-digital/examples/demod/ber_simulation.grc | 8 +- gr-digital/examples/demod/digital_freq_lock.grc | 8 +- gr-digital/examples/demod/dpsk_loopback.grc | 8 +- gr-digital/examples/demod/gfsk_loopback.grc | 8 +- gr-digital/examples/demod/gmsk_loopback.grc | 8 +- gr-digital/examples/demod/mpsk_demod.grc | 10 +- gr-digital/examples/demod/pam_sync.grc | 8 +- gr-digital/examples/demod/pam_timing.grc | 8 +- .../examples/narrowband/benchmark_add_channel.py | 2 +- gr-digital/examples/narrowband/rx_voice.py | 4 +- gr-digital/examples/ofdm/benchmark_add_channel.py | 2 +- gr-digital/python/ofdm_sync_ml.py | 2 +- gr-digital/python/ofdm_sync_pnac.py | 2 +- gr-filter/examples/gr_filtdes_live_upd.py | 3 +- gr-filter/examples/resampler_demo.grc | 64 ++++++------ gr-howto-write-a-block/apps/howto_square.grc | 2 +- gr-howto-write-a-block/apps/howto_square.py | 3 +- gr-howto-write-a-block/apps/howto_square_qt.grc | 12 +-- gr-howto-write-a-block/apps/howto_square_qt.py | 11 ++- gr-noaa/examples/file_rx_hrpt.grc | 2 +- gr-qtgui/apps/grc_qt_example.grc | 8 +- gr-qtgui/apps/qt_digital.py | 3 +- gr-qtgui/examples/pyqt_const_c.py | 2 +- gr-qtgui/examples/pyqt_example_c.py | 2 +- gr-qtgui/examples/pyqt_example_f.py | 2 +- gr-qtgui/examples/pyqt_freq_c.py | 2 +- gr-qtgui/examples/pyqt_freq_f.py | 2 +- gr-qtgui/examples/pyqt_time_c.py | 2 +- gr-qtgui/examples/pyqt_time_f.py | 2 +- gr-qtgui/examples/pyqt_time_raster_b.py | 3 +- gr-qtgui/examples/pyqt_time_raster_f.py | 3 +- gr-qtgui/examples/pyqt_waterfall_c.py | 2 +- gr-qtgui/examples/pyqt_waterfall_f.py | 2 +- .../examples/grc/interference_cancellation.grc | 8 +- gr-trellis/examples/grc/pccc.grc | 8 +- gr-trellis/examples/grc/pccc1.grc | 8 +- gr-trellis/examples/grc/sccc.grc | 8 +- gr-trellis/examples/grc/sccc1.grc | 8 +- gr-wavelet/CMakeLists.txt | 1 + gr-wavelet/lib/CMakeLists.txt | 2 + gr-wavelet/python/CMakeLists.txt | 2 + gr-wavelet/python/qa_classify.py | 3 +- gr-wavelet/swig/CMakeLists.txt | 1 + gr-wxgui/python/fftsink_gl.py | 4 +- gr-wxgui/python/fftsink_nongl.py | 4 +- gr-wxgui/python/histosink_gl.py | 3 +- gr-wxgui/python/numbersink2.py | 4 +- gr-wxgui/python/scopesink_gl.py | 2 +- gr-wxgui/python/scopesink_nongl.py | 3 +- gr-wxgui/python/waterfallsink_gl.py | 5 +- gr-wxgui/python/waterfallsink_nongl.py | 4 +- grc/blocks/block_tree.xml | 3 - grc/blocks/gr_threshold_ff.xml | 40 -------- grc/blocks/gr_throttle.xml | 67 ------------- grc/examples/simple/variable_config.grc | 8 +- grc/examples/xmlrpc/xmlrpc_server.grc | 10 +- 81 files changed, 205 insertions(+), 828 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_stretch_ff.cc delete mode 100644 gnuradio-core/src/lib/general/gr_stretch_ff.h delete mode 100644 gnuradio-core/src/lib/general/gr_stretch_ff.i delete mode 100644 gnuradio-core/src/lib/general/gr_threshold_ff.cc delete mode 100644 gnuradio-core/src/lib/general/gr_threshold_ff.h delete mode 100644 gnuradio-core/src/lib/general/gr_threshold_ff.i delete mode 100644 gnuradio-core/src/lib/general/gr_throttle.cc delete mode 100644 gnuradio-core/src/lib/general/gr_throttle.h delete mode 100644 gnuradio-core/src/lib/general/gr_throttle.i delete mode 100644 grc/blocks/gr_threshold_ff.xml delete mode 100644 grc/blocks/gr_throttle.xml (limited to 'gnuradio-core/src/lib') diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index 1617d709bb..9c4f34f93c 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -172,8 +172,6 @@ Miscellaneous Blocks gnuradio.gr.kludge_copy gnuradio.gr.nop gnuradio.gr.pa_2x2_phase_combiner - gnuradio.gr.threshold_ff - gnuradio.gr.throttle gnuradio.gr.channel_model Slicing and Dicing Streams diff --git a/docs/sphinx/source/gr/misc_blk.rst b/docs/sphinx/source/gr/misc_blk.rst index 4c1a0ee551..a4dcc58a2d 100644 --- a/docs/sphinx/source/gr/misc_blk.rst +++ b/docs/sphinx/source/gr/misc_blk.rst @@ -5,6 +5,4 @@ gnuradio.gr: Miscellaneous Blocks .. autooldblock:: gnuradio.gr.kludge_copy .. autooldblock:: gnuradio.gr.nop .. autooldblock:: gnuradio.gr.pa_2x2_phase_combiner -.. autooldblock:: gnuradio.gr.threshold_ff -.. autooldblock:: gnuradio.gr.throttle .. autooldblock:: gnuradio.gr.channel_model diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc index 15452e5399..f19c7303d2 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc @@ -613,10 +613,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -749,7 +749,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_psk_mod_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -798,7 +798,7 @@ </connection> <connection> <source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc index 36238e5c18..20e8e7f7db 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc @@ -558,10 +558,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -624,7 +624,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_psk_mod_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -661,7 +661,7 @@ </connection> <connection> <source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/mp-sched/affinity_set.py b/gnuradio-core/src/examples/mp-sched/affinity_set.py index 6db632e0fa..c1c1a33932 100755 --- a/gnuradio-core/src/examples/mp-sched/affinity_set.py +++ b/gnuradio-core/src/examples/mp-sched/affinity_set.py @@ -6,6 +6,7 @@ from gnuradio import eng_notation from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from optparse import OptionParser @@ -25,7 +26,7 @@ class affinity_set(gr.top_block): # Blocks ################################################## vec_len = 1 - self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*vec_len) self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*vec_len) self.gr_filt_0 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,]) @@ -37,8 +38,8 @@ class affinity_set(gr.top_block): ################################################## # Connections ################################################## - self.connect((self.gr_null_source_0, 0), (self.gr_throttle_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.gr_filt_0, 0)) + self.connect((self.gr_null_source_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.gr_filt_0, 0)) self.connect((self.gr_filt_0, 0), (self.gr_filt_1, 0)) self.connect((self.gr_filt_1, 0), (self.gr_null_sink_0, 0)) diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py index a8d85c4c57..d0d3cc7a8d 100755 --- a/gnuradio-core/src/examples/network/dial_tone_source.py +++ b/gnuradio-core/src/examples/network/dial_tone_source.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import sys @@ -45,7 +46,7 @@ class dial_tone_source(gr.top_block): add = blocks.add_ff() # Throttle needed here to account for the other side's audio card sampling rate - thr = gr.throttle(gr.sizeof_float, sample_rate) + thr = blocks.throttle(gr.sizeof_float, sample_rate) sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) self.connect(src0, (add, 0)) self.connect(src1, (add, 1)) diff --git a/gnuradio-core/src/examples/tags/test_file_tags.py b/gnuradio-core/src/examples/tags/test_file_tags.py index 135626d2c6..1dfc9e46cd 100755 --- a/gnuradio-core/src/examples/tags/test_file_tags.py +++ b/gnuradio-core/src/examples/tags/test_file_tags.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys try: @@ -36,7 +37,7 @@ def main(): src = gr.vector_source_s(data, True) trigger = gr.vector_source_s(trig, True) - thr = gr.throttle(gr.sizeof_short, 10e3) + thr = blocks.throttle(gr.sizeof_short, 10e3) ann = gr.annotator_alltoall(1000000, gr.sizeof_short) tagger = gr.burst_tagger(gr.sizeof_short) diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 581d57f8d8..d4287685d9 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -167,10 +167,7 @@ set(gr_core_general_triple_threats gr_random_pdu gr_remez gr_skiphead - gr_stretch_ff gr_test - gr_threshold_ff - gr_throttle gr_transcendental gr_vco_f gr_vector_map diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 64b2816327..36ae0de6f3 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -40,10 +40,8 @@ #include <gr_firdes.h> #include <gr_random_pdu.h> #include <gr_fake_channel_coder_pp.h> -#include <gr_throttle.h> #include <gr_transcendental.h> #include <gr_vco_f.h> -#include <gr_threshold_ff.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> #include <gr_prefs.h> @@ -54,7 +52,6 @@ #include <gr_pack_k_bits_bb.h> #include <gr_feval.h> #include <gr_bin_statistics_f.h> -#include <gr_stretch_ff.h> #include <gr_copy.h> #include <complex_vec_test.h> #include <gr_annotator_alltoall.h> @@ -84,10 +81,8 @@ %include "gr_firdes.i" %include "gr_random_pdu.i" %include "gr_fake_channel_coder_pp.i" -%include "gr_throttle.i" %include "gr_transcendental.i" %include "gr_vco_f.i" -%include "gr_threshold_ff.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" %include "gr_prefs.i" @@ -98,7 +93,6 @@ %include "gr_pack_k_bits_bb.i" %include "gr_feval.i" %include "gr_bin_statistics_f.i" -%include "gr_stretch_ff.i" %include "gr_copy.i" %include "complex_vec_test.i" %include "gr_annotator_alltoall.i" diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.cc b/gnuradio-core/src/lib/general/gr_stretch_ff.cc deleted file mode 100644 index e89eadf8b1..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.cc +++ /dev/null @@ -1,74 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_stretch_ff.h> -#include <gr_io_signature.h> - -gr_stretch_ff_sptr -gr_make_stretch_ff(float lo, size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_stretch_ff(lo, vlen)); -} - -gr_stretch_ff::gr_stretch_ff(float lo, size_t vlen) - : gr_sync_block("stretch_ff", - gr_make_io_signature(1, 1, vlen * sizeof(float)), - gr_make_io_signature(1, 1, vlen * sizeof(float))), - d_lo(lo), d_vlen(vlen) -{ -} - -int -gr_stretch_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - float vmax = in[0] - d_lo; - - for (unsigned int i = 1; i < d_vlen; i++) { - float vtmp = in[i] - d_lo; - if (vtmp > vmax) - vmax = vtmp; - } - - if (vmax != 0.0) - for (unsigned int i = 0; i < d_vlen; i++) - out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax); - else - for (unsigned int i = 0; i < d_vlen; i++) - out[i] = in[i]; - - in += d_vlen; - out += d_vlen; - } - - return noutput_items; -} - diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.h b/gnuradio-core/src/lib/general/gr_stretch_ff.h deleted file mode 100644 index f592c94a78..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.h +++ /dev/null @@ -1,60 +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. - */ - -#ifndef INCLUDED_GR_STRETCH_FF_H_ -# define INCLUDED_GR_STRETCH_FF_H_ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief adjust y-range of an input vector by mapping to range - * (max-of-input, stipulated-min). Primarily for spectral signature - * matching by normalizing spectrum dynamic ranges. - * \ingroup misc_blk - */ - - -class gr_stretch_ff; -typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr; - -GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - -class GR_CORE_API gr_stretch_ff : public gr_sync_block -{ - friend GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - - float d_lo; // the constant - size_t d_vlen; - gr_stretch_ff(float lo, size_t vlen); - - public: - float lo() const { return d_lo; } - void set_lo(float lo) { d_lo = lo; } - size_t vlen() const { return d_vlen; } - - 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/general/gr_stretch_ff.i b/gnuradio-core/src/lib/general/gr_stretch_ff.i deleted file mode 100644 index 81366655eb..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.i +++ /dev/null @@ -1,31 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,stretch_ff); - -gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - -class gr_stretch_ff : public gr_sync_block -{ -private: - gr_stretch_ff(float lo, size_t vlen); -}; - diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.cc b/gnuradio-core/src/lib/general/gr_threshold_ff.cc deleted file mode 100644 index 952613151f..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_threshold_ff.h> -#include <gr_io_signature.h> - -gr_threshold_ff_sptr -gr_make_threshold_ff (float lo, float hi, float initial_state) -{ - return gnuradio::get_initial_sptr(new gr_threshold_ff (lo, hi, initial_state)); -} - -gr_threshold_ff::gr_threshold_ff (float lo, float hi, float initial_state) - : gr_sync_block ("threshold_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_lo (lo), d_hi (hi), d_last_state (initial_state) -{ -} - -int -gr_threshold_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - - for(int i=0; i<noutput_items; i++) { - if (in[i] > d_hi) { - out[i] = 1.0; - d_last_state = 1.0; - } else if (in[i] < d_lo) { - out[i] = 0.0; - d_last_state = 0.0; - } else - out[i] = d_last_state; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.h b/gnuradio-core/src/lib/general/gr_threshold_ff.h deleted file mode 100644 index 678f8b1d2d..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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_THRESHOLD_FF_H -#define INCLUDED_GR_THRESHOLD_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_threshold_ff; -typedef boost::shared_ptr<gr_threshold_ff> gr_threshold_ff_sptr; - -GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); - -/*! - * \brief Please fix my documentation - * \ingroup misc_blk - */ -class GR_CORE_API gr_threshold_ff : public gr_sync_block -{ - friend GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state); - - float d_lo,d_hi; // the constant - float d_last_state; - gr_threshold_ff (float lo, float hi, float initial_state); - - public: - float lo () const { return d_lo; } - void set_lo (float lo) { d_lo = lo; } - float hi () const { return d_hi; } - void set_hi (float hi) { d_hi = hi; } - float last_state () const { return d_last_state; } - void set_last_state (float last_state) { d_last_state = last_state; } - - 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/general/gr_threshold_ff.i b/gnuradio-core/src/lib/general/gr_threshold_ff.i deleted file mode 100644 index 7584feea8a..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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,threshold_ff); - -gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); - -class gr_threshold_ff : public gr_sync_block -{ - private: - gr_threshold_ff (float lo, float hi, float initial_state); - - public: - float lo () const { return d_lo; } - void set_lo (float lo) { d_lo = lo; } - float hi () const { return d_hi; } - void set_hi (float hi) { d_hi = hi; } - float last_state () const { return d_last_state; } - void set_last_state (float last_state) { d_last_state = last_state; } -}; diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc deleted file mode 100644 index 1c6c8cf893..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 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_throttle.h> -#include <gr_io_signature.h> -#include <cstring> -#include <boost/thread/thread.hpp> - -class gr_throttle_impl : public gr_throttle{ -public: - gr_throttle_impl(size_t itemsize): - gr_sync_block("throttle", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize) - { - /* NOP */ - } - - double sample_rate(){ - return d_samps_per_us*1e6; - } - - void set_sample_rate(double rate){ - //changing the sample rate performs a reset of state params - d_start = boost::get_system_time(); - d_total_samples = 0; - d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second(); - d_samps_per_us = rate/1e6; - } - - int work ( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - //calculate the expected number of samples to have passed through - boost::system_time now = boost::get_system_time(); - boost::int64_t ticks = (now - d_start).ticks(); - uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks); - - //if the expected samples was less, we need to throttle back - if (d_total_samples > expected_samps){ - boost::this_thread::sleep(boost::posix_time::microseconds( - long((d_total_samples - expected_samps)/d_samps_per_us) - )); - } - - //copy all samples output[i] <= input[i] - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - std::memcpy(out, in, noutput_items * d_itemsize); - d_total_samples += noutput_items; - return noutput_items; - } - -private: - boost::system_time d_start; - size_t d_itemsize; - uint64_t d_total_samples; - double d_samps_per_tick, d_samps_per_us; - - void setup_rpc(){ -#ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_throttle_impl, double>( - alias(), "sample_rate", &gr_throttle_impl::sample_rate, - pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0), - "Hz", "Sample Rate", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_set<gr_throttle_impl, double>( - alias(), "sample_rate", &gr_throttle_impl::set_sample_rate, - pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0), - "Hz", "Sample Rate", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); -#endif - } -}; - -gr_throttle::sptr -gr_make_throttle(size_t itemsize, double samples_per_sec) -{ - gr_throttle::sptr throttle(new gr_throttle_impl(itemsize)); - throttle->set_sample_rate(samples_per_sec); - return throttle; -} diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h deleted file mode 100644 index 2235ffacf1..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 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_THROTTLE_H -#define INCLUDED_GR_THROTTLE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief throttle flow of samples such that the average rate does not exceed samples_per_sec. - * \ingroup misc_blk - * - * input: one stream of itemsize; output: one stream of itemsize - * - * N.B. this should only be used in GUI apps where there is no other - * rate limiting block. It is not intended nor effective at precisely - * controlling the rate of samples. That should be controlled by a - * source or sink tied to sample clock. E.g., a USRP or audio card. - */ -class GR_CORE_API gr_throttle : virtual public gr_sync_block -{ -public: - typedef boost::shared_ptr<gr_throttle> sptr; - - //! Sets the sample rate in samples per second - virtual double sample_rate() = 0; - virtual void set_sample_rate(double rate) = 0; -}; - -GR_CORE_API gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); - -#endif /* INCLUDED_GR_THROTTLE_H */ diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i deleted file mode 100644 index 5ba32de6ed..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.i +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 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. - */ - -%{ -#include <gr_throttle.h> -%} - -GR_SWIG_BLOCK_MAGIC(gr,throttle); - -%include <gr_throttle.h> diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py index 27858b575b..091f0642c6 100644 --- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys, time try: @@ -44,7 +45,7 @@ class GrDataPlotterC(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.time_sink_c(self._npts, samp_rate, self._name, 1) self.snk.enable_autoscale(True) @@ -129,7 +130,7 @@ class GrDataPlotterF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.time_sink_f(self._npts, samp_rate, self._name, 1) self.snk.enable_autoscale(True) @@ -207,7 +208,7 @@ class GrDataPlotterConst(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.const_sink_c(self._npts, self._name, 1) self.snk.enable_autoscale(True) @@ -286,7 +287,7 @@ class GrDataPlotterPsdC(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.freq_sink_c(self._fftsize, self._wintype, self._fc, self._samp_rate, self._name, 1) @@ -359,7 +360,7 @@ class GrDataPlotterPsdF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.freq_sink_f(self._fftsize, self._wintype, self._fc, self._samp_rate, self._name, 1) @@ -432,7 +433,7 @@ class GrTimeRasterF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.time_raster_sink_f(samp_rate, self._npts, self._rows, [], [], self._name, 1) @@ -499,7 +500,7 @@ class GrTimeRasterB(gr.top_block): self._data_len = 0 self.src = gr.vector_source_b([]) - self.thr = gr.throttle(gr.sizeof_char, rate) + self.thr = blocks.throttle(gr.sizeof_char, rate) self.snk = qtgui.time_raster_sink_b(samp_rate, self._npts, self._rows, [], [], self._name, 1) diff --git a/gr-analog/python/standard_squelch.py b/gr-analog/python/standard_squelch.py index c1fa406b48..3ed9ebceaa 100644 --- a/gr-analog/python/standard_squelch.py +++ b/gr-analog/python/standard_squelch.py @@ -42,7 +42,7 @@ class standard_squelch(gr.hier_block2): self.sub = blocks.sub_ff(); self.add = blocks.add_ff(); - self.gate = gr.threshold_ff(0.3,0.43,0) + self.gate = blocks.threshold_ff(0.3,0.43,0) self.squelch_lpf = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) self.div = blocks.divide_ff() diff --git a/gr-audio/examples/grc/cvsd_sweep.grc b/gr-audio/examples/grc/cvsd_sweep.grc index c0cd99ba1e..2fb4c4cc7b 100644 --- a/gr-audio/examples/grc/cvsd_sweep.grc +++ b/gr-audio/examples/grc/cvsd_sweep.grc @@ -777,7 +777,7 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> <value>throttle</value> diff --git a/gr-blocks/examples/metadata/file_metadata_source.grc b/gr-blocks/examples/metadata/file_metadata_source.grc index 23757881bc..2ce73c029f 100644 --- a/gr-blocks/examples/metadata/file_metadata_source.grc +++ b/gr-blocks/examples/metadata/file_metadata_source.grc @@ -244,10 +244,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -318,19 +318,19 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_file_sink_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_tag_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>analog_agc2_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -343,7 +343,7 @@ </connection> <connection> <source_block_id>blocks_file_meta_source_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/examples/metadata/file_metadata_vector_source.grc b/gr-blocks/examples/metadata/file_metadata_vector_source.grc index d52257e06d..2d95d4c947 100644 --- a/gr-blocks/examples/metadata/file_metadata_vector_source.grc +++ b/gr-blocks/examples/metadata/file_metadata_vector_source.grc @@ -232,10 +232,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -306,13 +306,13 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_file_sink_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_tag_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -324,14 +324,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>blocks_vector_to_stream_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>blocks_file_meta_source_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/python/qa_stretch.py b/gr-blocks/python/qa_stretch.py index 013d878a8f..078b404dbf 100755 --- a/gr-blocks/python/qa_stretch.py +++ b/gr-blocks/python/qa_stretch.py @@ -43,9 +43,9 @@ class test_stretch(gr_unittest.TestCase): src0 = gr.vector_source_f(data0, False) src1 = gr.vector_source_f(data1, False) - inter = gr.streams_to_vector(gr.sizeof_float, 2) + inter = blocks.streams_to_vector(gr.sizeof_float, 2) op = blocks.stretch_ff(0.1, 2) - deinter = gr.vector_to_streams(gr.sizeof_float, 2) + deinter = blocks.vector_to_streams(gr.sizeof_float, 2) dst0 = gr.vector_sink_f() dst1 = gr.vector_sink_f() diff --git a/gr-channels/examples/channel_tone_response.grc b/gr-channels/examples/channel_tone_response.grc index bd02f6000a..37e2171eb2 100644 --- a/gr-channels/examples/channel_tone_response.grc +++ b/gr-channels/examples/channel_tone_response.grc @@ -216,10 +216,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -748,14 +748,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_fading_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc index 515f7f91f6..b216912a6f 100644 --- a/gr-digital/examples/demod/ber_simulation.grc +++ b/gr-digital/examples/demod/ber_simulation.grc @@ -61,10 +61,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle</value> + <value>blocks_throttle</value> </param> <param> <key>_enabled</key> @@ -648,7 +648,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle</source_block_id> + <source_block_id>blocks_throttle</source_block_id> <sink_block_id>blks2_error_rate</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -667,7 +667,7 @@ </connection> <connection> <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_throttle</sink_block_id> + <sink_block_id>blocks_throttle</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc index 7597e1a0fa..965768ece3 100644 --- a/gr-digital/examples/demod/digital_freq_lock.grc +++ b/gr-digital/examples/demod/digital_freq_lock.grc @@ -771,10 +771,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -876,12 +876,12 @@ </connection> <connection> <source_block_id>digital_psk_mod_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-digital/examples/demod/dpsk_loopback.grc b/gr-digital/examples/demod/dpsk_loopback.grc index 7a6b2d293f..9befa69b6c 100644 --- a/gr-digital/examples/demod/dpsk_loopback.grc +++ b/gr-digital/examples/demod/dpsk_loopback.grc @@ -139,10 +139,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0_0</value> + <value>blocks_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -488,14 +488,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0_0</source_block_id> + <source_block_id>blocks_throttle_0_0</source_block_id> <sink_block_id>blks2_packet_encoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> + <sink_block_id>blocks_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/gfsk_loopback.grc b/gr-digital/examples/demod/gfsk_loopback.grc index 51f5ade77a..179a8102f3 100644 --- a/gr-digital/examples/demod/gfsk_loopback.grc +++ b/gr-digital/examples/demod/gfsk_loopback.grc @@ -310,10 +310,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0_0</value> + <value>blocks_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -554,7 +554,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0_0</source_block_id> + <source_block_id>blocks_throttle_0_0</source_block_id> <sink_block_id>blks2_packet_encoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -579,7 +579,7 @@ </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> + <sink_block_id>blocks_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/gmsk_loopback.grc b/gr-digital/examples/demod/gmsk_loopback.grc index c4361fbed8..710070e908 100644 --- a/gr-digital/examples/demod/gmsk_loopback.grc +++ b/gr-digital/examples/demod/gmsk_loopback.grc @@ -357,10 +357,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0_0</value> + <value>blocks_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -540,7 +540,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0_0</source_block_id> + <source_block_id>blocks_throttle_0_0</source_block_id> <sink_block_id>blks2_packet_encoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -571,7 +571,7 @@ </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> + <sink_block_id>blocks_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/mpsk_demod.grc b/gr-digital/examples/demod/mpsk_demod.grc index 61391de545..1045ef5797 100644 --- a/gr-digital/examples/demod/mpsk_demod.grc +++ b/gr-digital/examples/demod/mpsk_demod.grc @@ -385,10 +385,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -523,18 +523,18 @@ </connection> <connection> <source_block_id>channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>qtgui_freq_sink_x_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>qtgui_const_sink_x_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc index 3e7f0b3a82..4785482e3f 100644 --- a/gr-digital/examples/demod/pam_sync.grc +++ b/gr-digital/examples/demod/pam_sync.grc @@ -1124,10 +1124,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -1360,14 +1360,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>blocks_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc index 3e437a7ccc..632477821a 100644 --- a/gr-digital/examples/demod/pam_timing.grc +++ b/gr-digital/examples/demod/pam_timing.grc @@ -231,10 +231,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -1121,7 +1121,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_pfb_clock_sync_xxx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -1176,7 +1176,7 @@ </connection> <connection> <source_block_id>channels_channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py index 05b55e3755..28824dff4b 100755 --- a/gr-digital/examples/narrowband/benchmark_add_channel.py +++ b/gr-digital/examples/narrowband/benchmark_add_channel.py @@ -43,7 +43,7 @@ class my_top_block(gr.top_block): noise_voltage = math.sqrt(noise_power) self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) + #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate) self.channel = filter.channel_model(noise_voltage, frequency_offset, time_offset, noise_seed=-random.randint(0,100000)) diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py index b1a1b0782e..a9cb0c0702 100755 --- a/gr-digital/examples/narrowband/rx_voice.py +++ b/gr-digital/examples/narrowband/rx_voice.py @@ -82,12 +82,12 @@ class my_top_block(gr.top_block): self.connect(self.source, self.resampler, self.rxpath) elif(options.from_file is not None): - self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, options.bitrate) self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) self.connect(self.source, self.thr, self.rxpath) else: - self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6) + self.thr = blocks.throttle(gr.sizeof_gr_complex, 1e6) self.source = gr.null_source(gr.sizeof_gr_complex) self.connect(self.source, self.thr, self.rxpath) diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py index 369087b4c1..0d17efd052 100755 --- a/gr-digital/examples/ofdm/benchmark_add_channel.py +++ b/gr-digital/examples/ofdm/benchmark_add_channel.py @@ -45,7 +45,7 @@ class my_top_block(gr.top_block): frequency_offset = options.frequency_offset / options.fft_length self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) + #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate) self.channel = filter.channel_model(noise_voltage, frequency_offset, time_offset, noise_seed=-random.randint(0,100000)) diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py index 895ab767a0..8d81707e30 100644 --- a/gr-digital/python/ofdm_sync_ml.py +++ b/gr-digital/python/ofdm_sync_ml.py @@ -135,7 +135,7 @@ class ofdm_sync_ml(gr.hier_block2): # The output theta of the correlator above is multiplied with this correlation to # identify the proper peak and remove other products in this cross-correlation self.threshold_factor = 0.1 - self.slice = gr.threshold_ff(self.threshold_factor, self.threshold_factor, 0) + self.slice = blocks.threshold_ff(self.threshold_factor, self.threshold_factor, 0) self.f2b = blocks.float_to_char() self.b2f = blocks.char_to_float() self.mul = blocks.multiply_ff() diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py index f6627a4aba..7ffe112fb8 100644 --- a/gr-digital/python/ofdm_sync_pnac.py +++ b/gr-digital/python/ofdm_sync_pnac.py @@ -91,7 +91,7 @@ class ofdm_sync_pnac(gr.hier_block2): self.sample_and_hold = gr.sample_and_hold_ff() #ML measurements input to sampler block and detect - self.threshold = gr.threshold_ff(0,0,0) # threshold detection might need to be tweaked + self.threshold = blocks.threshold_ff(0,0,0) # threshold detection might need to be tweaked self.peaks = blocksx.float_to_char() self.connect(self, self.input) diff --git a/gr-filter/examples/gr_filtdes_live_upd.py b/gr-filter/examples/gr_filtdes_live_upd.py index b21e381a46..52985119e0 100755 --- a/gr-filter/examples/gr_filtdes_live_upd.py +++ b/gr-filter/examples/gr_filtdes_live_upd.py @@ -22,6 +22,7 @@ from gnuradio.filter import filter_design from gnuradio import gr, filter +from gnuradio import blocks import sys try: @@ -70,7 +71,7 @@ class my_top_block(gr.top_block): src = blocks.add_cc() channel = channels.channel_model(0.01) self.filt = filter.fft_filter_ccc(1, self.filt_taps) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.freq_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Freq Example", 1) diff --git a/gr-filter/examples/resampler_demo.grc b/gr-filter/examples/resampler_demo.grc index 9c19cd7dcc..62ebdd34cd 100644 --- a/gr-filter/examples/resampler_demo.grc +++ b/gr-filter/examples/resampler_demo.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat Nov 10 14:47:16 2012</timestamp> + <timestamp>Sun Feb 24 19:43:22 2013</timestamp> <block> <key>options</key> <param> @@ -235,37 +235,6 @@ <value>0</value> </param> </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(227, 493)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> <block> <key>pfb_arb_resampler_xxx</key> <param> @@ -607,6 +576,37 @@ <value>0</value> </param> </block> + <block> + <key>blocks_throttle</key> + <param> + <key>id</key> + <value>throttle</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(227, 492)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> <source_block_id>adder</source_block_id> <sink_block_id>throttle</sink_block_id> diff --git a/gr-howto-write-a-block/apps/howto_square.grc b/gr-howto-write-a-block/apps/howto_square.grc index 98f73774e3..1f3324e4eb 100644 --- a/gr-howto-write-a-block/apps/howto_square.grc +++ b/gr-howto-write-a-block/apps/howto_square.grc @@ -178,7 +178,7 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> <value>thr</value> diff --git a/gr-howto-write-a-block/apps/howto_square.py b/gr-howto-write-a-block/apps/howto_square.py index 0b293b882f..140067b59f 100755 --- a/gr-howto-write-a-block/apps/howto_square.py +++ b/gr-howto-write-a-block/apps/howto_square.py @@ -7,6 +7,7 @@ from gnuradio import eng_notation from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from gnuradio.wxgui import scopesink2 @@ -28,7 +29,7 @@ class howto_square(grc_wxgui.top_block_gui): ################################################## # Blocks ################################################## - self.thr = gr.throttle(gr.sizeof_float*1, samp_rate) + self.thr = blocks.throttle(gr.sizeof_float*1, samp_rate) self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1) self.sqr = howto.square_ff() self.sink2 = scopesink2.scope_sink_f( diff --git a/gr-howto-write-a-block/apps/howto_square_qt.grc b/gr-howto-write-a-block/apps/howto_square_qt.grc index 6281c3a310..c4c72adca0 100644 --- a/gr-howto-write-a-block/apps/howto_square_qt.grc +++ b/gr-howto-write-a-block/apps/howto_square_qt.grc @@ -173,10 +173,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -253,19 +253,19 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>howto_square2_ff_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>howto_square_ff_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>qtgui_time_sink_x_0</sink_block_id> <source_key>0</source_key> <sink_key>1</sink_key> @@ -278,7 +278,7 @@ </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-howto-write-a-block/apps/howto_square_qt.py b/gr-howto-write-a-block/apps/howto_square_qt.py index 986f1c7585..3215ea8ab4 100755 --- a/gr-howto-write-a-block/apps/howto_square_qt.py +++ b/gr-howto-write-a-block/apps/howto_square_qt.py @@ -7,6 +7,7 @@ from PyQt4 import Qt from gnuradio import analog +from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio import qtgui @@ -59,18 +60,18 @@ class howto_square_qt(gr.top_block, Qt.QWidget): self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.howto_square_ff_0 = howto.square_ff() self.howto_square2_ff_0 = howto.square2_ff() - self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate) self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) ################################################## # Connections ################################################## self.connect((self.howto_square2_ff_0, 0), (self.qtgui_time_sink_x_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.howto_square2_ff_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.howto_square_ff_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.qtgui_time_sink_x_0, 1)) + self.connect((self.blocks_throttle_0, 0), (self.howto_square2_ff_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.howto_square_ff_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.howto_square_ff_0, 0), (self.qtgui_time_sink_x_0, 2)) - self.connect((self.analog_sig_source_x_0, 0), (self.gr_throttle_0, 0)) + self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0)) # QT sink close method reimplementation def closeEvent(self, event): diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc index 664b200a5f..b8a93d56e3 100644 --- a/gr-noaa/examples/file_rx_hrpt.grc +++ b/gr-noaa/examples/file_rx_hrpt.grc @@ -438,7 +438,7 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> <value>throttle</value> diff --git a/gr-qtgui/apps/grc_qt_example.grc b/gr-qtgui/apps/grc_qt_example.grc index a0c9a0b6ae..320320edcc 100644 --- a/gr-qtgui/apps/grc_qt_example.grc +++ b/gr-qtgui/apps/grc_qt_example.grc @@ -249,10 +249,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -434,7 +434,7 @@ </block> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -445,7 +445,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py index d353e0041c..2e8cf2fd66 100755 --- a/gr-qtgui/apps/qt_digital.py +++ b/gr-qtgui/apps/qt_digital.py @@ -21,6 +21,7 @@ # from gnuradio import gr, digital +from gnuradio import blocks from gnuradio import eng_notation import sys @@ -215,7 +216,7 @@ class my_top_block(gr.top_block): self.to = 1.0 self.channel = gr.channel_model(noise, self.fo, self.to) - self.thr = gr.throttle(gr.sizeof_char, self._sample_rate) + self.thr = blocks.throttle(gr.sizeof_char, self._sample_rate) self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, self._sample_rate*self.sps, "Tx", True, True, True, True) diff --git a/gr-qtgui/examples/pyqt_const_c.py b/gr-qtgui/examples/pyqt_const_c.py index e26ce0bd90..3a43bf9a92 100755 --- a/gr-qtgui/examples/pyqt_const_c.py +++ b/gr-qtgui/examples/pyqt_const_c.py @@ -156,7 +156,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.5, 0) src = blocks.add_cc() channel = channels.channel_model(0.001) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.const_sink_c(npts, "Constellation Example", 1) self.connect(src1, (src,0)) diff --git a/gr-qtgui/examples/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py index ccacc246bf..cb708360f1 100755 --- a/gr-qtgui/examples/pyqt_example_c.py +++ b/gr-qtgui/examples/pyqt_example_c.py @@ -160,7 +160,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.001) - thr = gr.throttle(gr.sizeof_gr_complex, 100*fftsize) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*fftsize) self.snk1 = qtgui.sink_c(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Signal Example", diff --git a/gr-qtgui/examples/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py index f975bf0d1a..5bd582d1e1 100755 --- a/gr-qtgui/examples/pyqt_example_f.py +++ b/gr-qtgui/examples/pyqt_example_f.py @@ -149,7 +149,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*fftsize) + thr = blocks.throttle(gr.sizeof_float, 100*fftsize) noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001) add = blocks.add_ff() self.snk1 = qtgui.sink_f(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS, diff --git a/gr-qtgui/examples/pyqt_freq_c.py b/gr-qtgui/examples/pyqt_freq_c.py index 5941622130..7632176878 100755 --- a/gr-qtgui/examples/pyqt_freq_c.py +++ b/gr-qtgui/examples/pyqt_freq_c.py @@ -160,7 +160,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.01) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.freq_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Freq Example", 3) diff --git a/gr-qtgui/examples/pyqt_freq_f.py b/gr-qtgui/examples/pyqt_freq_f.py index 44d81314a4..668b54d249 100755 --- a/gr-qtgui/examples/pyqt_freq_f.py +++ b/gr-qtgui/examples/pyqt_freq_f.py @@ -150,7 +150,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*npts) + thr = blocks.throttle(gr.sizeof_float, 100*npts) self.snk1 = qtgui.freq_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Real freq Example", 3) diff --git a/gr-qtgui/examples/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py index 65d62c4167..ae8ebfc257 100755 --- a/gr-qtgui/examples/pyqt_time_c.py +++ b/gr-qtgui/examples/pyqt_time_c.py @@ -160,7 +160,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.01) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.time_sink_c(npts, Rs, "Complex Time Example", 1) diff --git a/gr-qtgui/examples/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py index e64d6fcfde..b733a5a809 100755 --- a/gr-qtgui/examples/pyqt_time_f.py +++ b/gr-qtgui/examples/pyqt_time_f.py @@ -149,7 +149,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*npts) + thr = blocks.throttle(gr.sizeof_float, 100*npts) noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001) add = blocks.add_ff() self.snk1 = qtgui.time_sink_f(npts, Rs, diff --git a/gr-qtgui/examples/pyqt_time_raster_b.py b/gr-qtgui/examples/pyqt_time_raster_b.py index b9db6e1e8e..b29403819d 100755 --- a/gr-qtgui/examples/pyqt_time_raster_b.py +++ b/gr-qtgui/examples/pyqt_time_raster_b.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys try: @@ -59,7 +60,7 @@ class my_top_block(gr.top_block): fs = 200 src0 = gr.vector_source_b(data0, True) src1 = gr.vector_source_b(data1, True) - thr = gr.throttle(gr.sizeof_char, 50000) + thr = blocks.throttle(gr.sizeof_char, 50000) head = gr.head(gr.sizeof_char, 10000000) self.snk1 = qtgui.time_raster_sink_b(fs, nrows, ncols, [], [], "Time Raster Example", 2) diff --git a/gr-qtgui/examples/pyqt_time_raster_f.py b/gr-qtgui/examples/pyqt_time_raster_f.py index 0b343e6a6e..957e694b38 100755 --- a/gr-qtgui/examples/pyqt_time_raster_f.py +++ b/gr-qtgui/examples/pyqt_time_raster_f.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys try: @@ -59,7 +60,7 @@ class my_top_block(gr.top_block): fs = 200 src0 = gr.vector_source_f(data0, True) src1 = gr.vector_source_f(data1, True) - thr = gr.throttle(gr.sizeof_float, 50000) + thr = blocks.throttle(gr.sizeof_float, 50000) hed = gr.head(gr.sizeof_float, 10000000) self.snk1 = qtgui.time_raster_sink_f(fs, nrows, ncols, [], [], "Float Time Raster Example", 2) diff --git a/gr-qtgui/examples/pyqt_waterfall_c.py b/gr-qtgui/examples/pyqt_waterfall_c.py index 407e8d1bb0..13168e1475 100755 --- a/gr-qtgui/examples/pyqt_waterfall_c.py +++ b/gr-qtgui/examples/pyqt_waterfall_c.py @@ -162,7 +162,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.01) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) filt = filter.fft_filter_ccc(1, taps) self.snk1 = qtgui.waterfall_sink_c(npts, gr.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, diff --git a/gr-qtgui/examples/pyqt_waterfall_f.py b/gr-qtgui/examples/pyqt_waterfall_f.py index 8843f19528..f9680c28cf 100755 --- a/gr-qtgui/examples/pyqt_waterfall_f.py +++ b/gr-qtgui/examples/pyqt_waterfall_f.py @@ -149,7 +149,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*npts) + thr = blocks.throttle(gr.sizeof_float, 100*npts) self.snk1 = qtgui.waterfall_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Real Waterfall Example", 2) diff --git a/gr-trellis/examples/grc/interference_cancellation.grc b/gr-trellis/examples/grc/interference_cancellation.grc index 891426660a..29452311c6 100644 --- a/gr-trellis/examples/grc/interference_cancellation.grc +++ b/gr-trellis/examples/grc/interference_cancellation.grc @@ -1507,10 +1507,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -2152,7 +2152,7 @@ </connection> <connection> <source_block_id>trellis_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -2163,7 +2163,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/pccc.grc b/gr-trellis/examples/grc/pccc.grc index a9f65cf856..359cfefc83 100644 --- a/gr-trellis/examples/grc/pccc.grc +++ b/gr-trellis/examples/grc/pccc.grc @@ -663,10 +663,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -807,7 +807,7 @@ </connection> <connection> <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -830,7 +830,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/pccc1.grc b/gr-trellis/examples/grc/pccc1.grc index 1bc0e189d0..8f58404794 100644 --- a/gr-trellis/examples/grc/pccc1.grc +++ b/gr-trellis/examples/grc/pccc1.grc @@ -647,10 +647,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -832,7 +832,7 @@ </connection> <connection> <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -849,7 +849,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/sccc.grc b/gr-trellis/examples/grc/sccc.grc index abfbeb8b81..ee532da9fe 100644 --- a/gr-trellis/examples/grc/sccc.grc +++ b/gr-trellis/examples/grc/sccc.grc @@ -628,10 +628,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -783,7 +783,7 @@ </connection> <connection> <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -824,7 +824,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/sccc1.grc b/gr-trellis/examples/grc/sccc1.grc index 906ca25389..fa6506ba18 100644 --- a/gr-trellis/examples/grc/sccc1.grc +++ b/gr-trellis/examples/grc/sccc1.grc @@ -647,10 +647,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -802,7 +802,7 @@ </connection> <connection> <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -849,7 +849,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt index 8d7ac65f7b..1eb536f9d9 100644 --- a/gr-wavelet/CMakeLists.txt +++ b/gr-wavelet/CMakeLists.txt @@ -32,6 +32,7 @@ include(GrComponent) GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET Boost_FOUND ENABLE_GR_CORE + ENABLE_GR_BLOCKS ENABLE_GR_ANALOG GSL_FOUND ) diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt index e49a5433f3..92f1082660 100644 --- a/gr-wavelet/lib/CMakeLists.txt +++ b/gr-wavelet/lib/CMakeLists.txt @@ -24,6 +24,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${GR_WAVELET_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} ${GNURADIO_CORE_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} @@ -47,6 +48,7 @@ list(APPEND gr_wavelet_sources list(APPEND wavelet_libs gnuradio-core + gnuradio-blocks ${Boost_LIBRARIES} ${WAVELET_LIBRARIES} ${GSL_LIBRARIES} diff --git a/gr-wavelet/python/CMakeLists.txt b/gr-wavelet/python/CMakeLists.txt index 9234c62bdb..7f7fd99ecf 100644 --- a/gr-wavelet/python/CMakeLists.txt +++ b/gr-wavelet/python/CMakeLists.txt @@ -37,6 +37,8 @@ list(APPEND GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/gr-analog/swig ${CMAKE_BINARY_DIR}/gr-wavelet/python ${CMAKE_BINARY_DIR}/gr-wavelet/swig + ${CMAKE_BINARY_DIR}/gr-blocks/python + ${CMAKE_BINARY_DIR}/gr-blocks/swig ) list(APPEND GR_TEST_TARGET_DEPS gnuradio-wavelet) diff --git a/gr-wavelet/python/qa_classify.py b/gr-wavelet/python/qa_classify.py index 0906761aca..c2972c92f2 100755 --- a/gr-wavelet/python/qa_classify.py +++ b/gr-wavelet/python/qa_classify.py @@ -27,6 +27,7 @@ import copy import math import wavelet_swig import analog_swig as analog +import blocks_swig as blocks def sqr(x): return x*x @@ -88,7 +89,7 @@ class test_classify(gr_unittest.TestCase): trg_data = copy.deepcopy(src_data) src = gr.vector_source_f(src_data, False, len(src_data)) - st = gr.stretch_ff(-1.0/5.0, len(src_data)) + st = blocks.stretch_ff(-1.0/5.0, len(src_data)) dst = gr.vector_sink_f(len(src_data)) self.tb.connect(src, st) self.tb.connect(st, dst) diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt index ea7a24b244..0c78c8936f 100644 --- a/gr-wavelet/swig/CMakeLists.txt +++ b/gr-wavelet/swig/CMakeLists.txt @@ -25,6 +25,7 @@ include(GrSwig) set(GR_SWIG_INCLUDE_DIRS ${GR_WAVELET_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} diff --git a/gr-wxgui/python/fftsink_gl.py b/gr-wxgui/python/fftsink_gl.py index e87b86ec2a..88a5968e2c 100644 --- a/gr-wxgui/python/fftsink_gl.py +++ b/gr-wxgui/python/fftsink_gl.py @@ -169,7 +169,7 @@ class test_app_block (stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3, @@ -183,7 +183,7 @@ class test_app_block (stdgui2.std_top_block): #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1) src2 = analog.sig_source_f (input_rate, analog.GR_CONST_WAVE, 57.50e3, 1) - thr2 = gr.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2, sample_rate=input_rate, baseband_freq=100e3, ref_level=0, y_per_div=20, y_divs=10) diff --git a/gr-wxgui/python/fftsink_nongl.py b/gr-wxgui/python/fftsink_nongl.py index e9308fd354..d13b296d56 100644 --- a/gr-wxgui/python/fftsink_nongl.py +++ b/gr-wxgui/python/fftsink_nongl.py @@ -613,7 +613,7 @@ class test_app_block (stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3, @@ -624,7 +624,7 @@ class test_app_block (stdgui2.std_top_block): #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 100*2e3, 1) src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 100*5.75e3, 1) - thr2 = gr.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2, sample_rate=input_rate, baseband_freq=100e3, ref_level=0, y_per_div=20, y_divs=10) diff --git a/gr-wxgui/python/histosink_gl.py b/gr-wxgui/python/histosink_gl.py index 8d90204046..6fa7539aa7 100644 --- a/gr-wxgui/python/histosink_gl.py +++ b/gr-wxgui/python/histosink_gl.py @@ -26,6 +26,7 @@ import histo_window import common from gnuradio import gr from gnuradio import analog +from gnuradio import blocks from pubsub import pubsub from constants import * @@ -97,7 +98,7 @@ class test_app_block (stdgui2.std_top_block): src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1) #src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1) - thr2 = gr.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = histo_sink_f(panel, title="Data", num_bins=31, frame_size=1000) vbox.Add(sink2.win, 1, wx.EXPAND) diff --git a/gr-wxgui/python/numbersink2.py b/gr-wxgui/python/numbersink2.py index 1619b09eb6..395bddbd61 100644 --- a/gr-wxgui/python/numbersink2.py +++ b/gr-wxgui/python/numbersink2.py @@ -149,8 +149,8 @@ class test_app_flow_graph(stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - thr1 = gr.throttle(gr.sizeof_float, input_rate) - thr2 = gr.throttle(gr.sizeof_gr_complex, input_rate) + thr1 = blocks.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = number_sink_f(panel, unit='V',label="Real Data", avg_alpha=0.001, sample_rate=input_rate, minval=-1, maxval=1, diff --git a/gr-wxgui/python/scopesink_gl.py b/gr-wxgui/python/scopesink_gl.py index 647ea60983..7d6cd09ec9 100644 --- a/gr-wxgui/python/scopesink_gl.py +++ b/gr-wxgui/python/scopesink_gl.py @@ -216,7 +216,7 @@ class test_top_block (stdgui2.std_top_block): # We add this throttle block so that this demo doesn't suck down # all the CPU available. You normally wouldn't use it... - self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate) scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate, v_scale=v_scale, t_scale=t_scale) diff --git a/gr-wxgui/python/scopesink_nongl.py b/gr-wxgui/python/scopesink_nongl.py index 6351daa723..5f44eeca74 100644 --- a/gr-wxgui/python/scopesink_nongl.py +++ b/gr-wxgui/python/scopesink_nongl.py @@ -22,6 +22,7 @@ from gnuradio import gr, gru, eng_notation from gnuradio import analog +from gnuradio import blocks from gnuradio.wxgui import stdgui2 import wx import gnuradio.wxgui.plot as plot @@ -631,7 +632,7 @@ class test_top_block(stdgui2.std_top_block): # We add this throttle block so that this demo doesn't suck down # all the CPU available. You normally wouldn't use it... - self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate) scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate, frame_decim=frame_decim, diff --git a/gr-wxgui/python/waterfallsink_gl.py b/gr-wxgui/python/waterfallsink_gl.py index 17900a6e4f..dba50ce551 100644 --- a/gr-wxgui/python/waterfallsink_gl.py +++ b/gr-wxgui/python/waterfallsink_gl.py @@ -26,6 +26,7 @@ import waterfall_window import common from gnuradio import gr, fft from gnuradio import analog +from gnuradio import blocks from gnuradio.fft import logpwrfft from pubsub import pubsub from constants import * @@ -150,7 +151,7 @@ class test_top_block(stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) @@ -159,7 +160,7 @@ class test_top_block(stdgui2.std_top_block): # generate a real sinusoid self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) - self.thr2 = gr.throttle(gr.sizeof_float, input_rate) + self.thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src2, self.thr2, sink2) diff --git a/gr-wxgui/python/waterfallsink_nongl.py b/gr-wxgui/python/waterfallsink_nongl.py index 1ff44a88c6..df1534f993 100644 --- a/gr-wxgui/python/waterfallsink_nongl.py +++ b/gr-wxgui/python/waterfallsink_nongl.py @@ -407,7 +407,7 @@ class test_top_block (stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) @@ -416,7 +416,7 @@ class test_top_block (stdgui2.std_top_block): # generate a real sinusoid self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) - self.thr2 = gr.throttle(gr.sizeof_float, input_rate) + self.thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src2, self.thr2, sink2) diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index f066af1dc6..c30808bb6b 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -89,7 +89,6 @@ <block>gr_sample_and_hold_xx</block> <block>gr_mute_xx</block> - <block>gr_threshold_ff</block> </cat> <cat> <name>Filters</name> @@ -122,8 +121,6 @@ <block>note</block> <block>import</block> - <block>gr_throttle</block> - <block>blks2_selector</block> <block>blks2_valve</block> <block>blks2_error_rate</block> diff --git a/grc/blocks/gr_threshold_ff.xml b/grc/blocks/gr_threshold_ff.xml deleted file mode 100644 index 740ce5794c..0000000000 --- a/grc/blocks/gr_threshold_ff.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Threshold -################################################### - --> -<block> - <name>Threshold</name> - <key>gr_threshold_ff</key> - <import>from gnuradio import gr</import> - <make>gr.threshold_ff($low, $high, $init)</make> - <callback>set_hi($high)</callback> - <callback>set_lo($low)</callback> - <param> - <name>Low</name> - <key>low</key> - <value>-100</value> - <type>real</type> - </param> - <param> - <name>High</name> - <key>high</key> - <value>100</value> - <type>real</type> - </param> - <param> - <name>Initial State</name> - <key>init</key> - <value>0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/grc/blocks/gr_throttle.xml b/grc/blocks/gr_throttle.xml deleted file mode 100644 index e3a5a2ba19..0000000000 --- a/grc/blocks/gr_throttle.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Throttle -################################################### - --> -<block> - <name>Throttle</name> - <key>gr_throttle</key> - <throttle>1</throttle> - <import>from gnuradio import gr</import> - <make>gr.throttle($type.size*$vlen, $samples_per_second)</make> - <callback>set_sample_rate($samples_per_second)</callback> - <param> - <name>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>Sample Rate</name> - <key>samples_per_second</key> - <value>samp_rate</value> - <type>real</type> - </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>$type</type> - <vlen>$vlen</vlen> - </source> -</block> diff --git a/grc/examples/simple/variable_config.grc b/grc/examples/simple/variable_config.grc index fc0d2fea6b..0b50b1e5bb 100644 --- a/grc/examples/simple/variable_config.grc +++ b/grc/examples/simple/variable_config.grc @@ -273,10 +273,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -347,14 +347,14 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>wxgui_fftsink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/grc/examples/xmlrpc/xmlrpc_server.grc b/grc/examples/xmlrpc/xmlrpc_server.grc index ea70ded720..7497117f28 100644 --- a/grc/examples/xmlrpc/xmlrpc_server.grc +++ b/grc/examples/xmlrpc/xmlrpc_server.grc @@ -346,10 +346,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle</value> + <value>blocks_throttle</value> </param> <param> <key>_enabled</key> @@ -420,20 +420,20 @@ </param> </block> <connection> - <source_block_id>gr_throttle</source_block_id> + <source_block_id>blocks_throttle</source_block_id> <sink_block_id>wxgui_scopesink2</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle</source_block_id> + <source_block_id>blocks_throttle</source_block_id> <sink_block_id>wxgui_fftsink2</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle</sink_block_id> + <sink_block_id>blocks_throttle</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> -- cgit v1.2.3 From f7170fa2eea2cd1e43d5e3dc895052dc2cf11e01 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Tue, 26 Feb 2013 10:43:33 -0500 Subject: blocks: removing gr_transcendental from gnuradio-core. --- gnuradio-core/src/lib/general/CMakeLists.txt | 1 - gnuradio-core/src/lib/general/general.i | 2 - gnuradio-core/src/lib/general/gr_transcendental.cc | 153 --------------------- gnuradio-core/src/lib/general/gr_transcendental.h | 49 ------- gnuradio-core/src/lib/general/gr_transcendental.i | 33 ----- grc/blocks/block_tree.xml | 2 - grc/blocks/gr_transcendental.xml | 41 ------ 7 files changed, 281 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_transcendental.cc delete mode 100644 gnuradio-core/src/lib/general/gr_transcendental.h delete mode 100644 gnuradio-core/src/lib/general/gr_transcendental.i delete mode 100644 grc/blocks/gr_transcendental.xml (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index d4287685d9..d38d478e7d 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -168,7 +168,6 @@ set(gr_core_general_triple_threats gr_remez gr_skiphead gr_test - gr_transcendental gr_vco_f gr_vector_map gr_unpack_k_bits_bb diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 36ae0de6f3..1769c1e832 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -40,7 +40,6 @@ #include <gr_firdes.h> #include <gr_random_pdu.h> #include <gr_fake_channel_coder_pp.h> -#include <gr_transcendental.h> #include <gr_vco_f.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> @@ -81,7 +80,6 @@ %include "gr_firdes.i" %include "gr_random_pdu.i" %include "gr_fake_channel_coder_pp.i" -%include "gr_transcendental.i" %include "gr_vco_f.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" diff --git a/gnuradio-core/src/lib/general/gr_transcendental.cc b/gnuradio-core/src/lib/general/gr_transcendental.cc deleted file mode 100644 index c1482491ba..0000000000 --- a/gnuradio-core/src/lib/general/gr_transcendental.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2011 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. - */ - -#include <gr_transcendental.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <complex> //complex math -#include <cmath> //real math -#include <map> - -/*********************************************************************** - * work function creation and registration - **********************************************************************/ -typedef int(*work_fcn_type)(int, gr_vector_const_void_star &, gr_vector_void_star &); -struct map_val_type{ - work_fcn_type work_fcn; - size_t io_size; -}; -typedef std::map<std::string, map_val_type> map_type; - -//construct map on first use idiom -static map_type &get_map(void){ - static map_type map; - return map; -} - -//static initialization of this object registers a function -struct gr_transcendental_registrant{ - gr_transcendental_registrant( - const std::string &key, - const work_fcn_type &work_fcn, - const size_t io_size - ){ - map_val_type val; - val.work_fcn = work_fcn; - val.io_size = io_size; - get_map()[key] = val; - } -}; - -//macro to create a work function and register it -#define REGISTER_FUNCTION(__fcn__, __type__, __key__) \ - static int __key__ ## _work( \ - int noutput_items, \ - gr_vector_const_void_star &input_items, \ - gr_vector_void_star &output_items \ - ){ \ - const __type__ *in = (const __type__ *) input_items[0]; \ - __type__ *out = (__type__ *) output_items[0]; \ - for (size_t i = 0; i < size_t(noutput_items); i++){ \ - out[i] = std::__fcn__(in[i]); \ - } \ - return noutput_items; \ - } \ - gr_transcendental_registrant __key__ ## _registrant(#__key__, &__key__ ## _work, sizeof(__type__)); - -//register work functions for real types -#define REGISTER_REAL_FUNCTIONS(__fcn__) \ - REGISTER_FUNCTION(__fcn__, float, __fcn__ ## _float) \ - REGISTER_FUNCTION(__fcn__, double, __fcn__ ## _double) - -//register work functions for complex types -#define REGISTER_COMPLEX_FUNCTIONS(__fcn__) \ - REGISTER_FUNCTION(__fcn__, std::complex<float>, __fcn__ ## _complex_float) \ - REGISTER_FUNCTION(__fcn__, std::complex<double>, __fcn__ ## _complex_double) - -//register both complex and real -#define REGISTER_FUNCTIONS(__fcn__) \ - REGISTER_REAL_FUNCTIONS(__fcn__) \ - REGISTER_COMPLEX_FUNCTIONS(__fcn__) - -//create and register transcendental work functions -REGISTER_FUNCTIONS(cos) -REGISTER_FUNCTIONS(sin) -REGISTER_FUNCTIONS(tan) -REGISTER_REAL_FUNCTIONS(acos) -REGISTER_REAL_FUNCTIONS(asin) -REGISTER_REAL_FUNCTIONS(atan) -REGISTER_FUNCTIONS(cosh) -REGISTER_FUNCTIONS(sinh) -REGISTER_FUNCTIONS(tanh) -REGISTER_FUNCTIONS(exp) -REGISTER_FUNCTIONS(log) -REGISTER_FUNCTIONS(log10) -REGISTER_FUNCTIONS(sqrt) - -/*********************************************************************** - * implementation block simply calls into the function pointer - **********************************************************************/ -class gr_transcendental_impl : public gr_transcendental{ -public: - gr_transcendental_impl( - const work_fcn_type &work_fcn, const size_t io_size - ): - gr_sync_block( - "transcendental", - gr_make_io_signature(1, 1, io_size), - gr_make_io_signature(1, 1, io_size) - ), - _work_fcn(work_fcn) - { - // NOP - } - - int work( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - return _work_fcn(noutput_items, input_items, output_items); - } - -private: - const work_fcn_type &_work_fcn; -}; - -/*********************************************************************** - * factory function to make transcendental block - **********************************************************************/ -gr_transcendental::sptr gr_make_transcendental( - const std::string &name, - const std::string &type -){ - //search for an entry in the map - const std::string key = name + "_" + type; - const bool has_key = get_map().count(key) != 0; - if (!has_key) throw std::runtime_error( - "could not find transcendental function for " + key - ); - - //make a new block with found work function - return gr_transcendental::sptr(new gr_transcendental_impl( - get_map()[key].work_fcn, get_map()[key].io_size - )); -} diff --git a/gnuradio-core/src/lib/general/gr_transcendental.h b/gnuradio-core/src/lib/general/gr_transcendental.h deleted file mode 100644 index 9841a53e95..0000000000 --- a/gnuradio-core/src/lib/general/gr_transcendental.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2011 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_TRANSCENDENTAL_H -#define INCLUDED_GR_TRANSCENDENTAL_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <string> - -/*! - * \brief A block that performs various transcendental math operations. - * - * Possible function names can be found in the cmath library. - * IO may be either complex or real, double or single precision. - * - * Possible type strings: float, double, complex_float, complex_double - * - * output[i] = trans_fcn(input[i]) - */ -class GR_CORE_API gr_transcendental : virtual public gr_sync_block{ -public: - typedef boost::shared_ptr<gr_transcendental> sptr; -}; - -GR_CORE_API gr_transcendental::sptr gr_make_transcendental( - const std::string &name, - const std::string &type = "float" -); - -#endif /* INCLUDED_GR_TRANSCENDENTAL_H */ diff --git a/gnuradio-core/src/lib/general/gr_transcendental.i b/gnuradio-core/src/lib/general/gr_transcendental.i deleted file mode 100644 index 6acdb10b7e..0000000000 --- a/gnuradio-core/src/lib/general/gr_transcendental.i +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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. - */ - -//////////////////////////////////////////////////////////////////////// -// block headers -//////////////////////////////////////////////////////////////////////// -%{ -#include <gr_transcendental.h> -%} - -//////////////////////////////////////////////////////////////////////// -// block magic -//////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(gr,transcendental) -%include <gr_transcendental.h> diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index c30808bb6b..a78184dff1 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -45,8 +45,6 @@ </cat> <cat> <name>Operators</name> - <block>gr_transcendental</block> - <block>gr_max_xx</block> <block>gr_argmax_xx</block> diff --git a/grc/blocks/gr_transcendental.xml b/grc/blocks/gr_transcendental.xml deleted file mode 100644 index eede447f98..0000000000 --- a/grc/blocks/gr_transcendental.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##transcendental functions -################################################### - --> -<block> - <name>Transcendental</name> - <key>gr_transcendental</key> - <import>from gnuradio import gr</import> - <make>gr.transcendental($name, "$type")</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex_double</key> - <opt>type:complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>type:float</opt> - </option> - </param> - <param> - <name>Function Name</name> - <key>name</key> - <value>cos</value> - <type>string</type> - </param> - <sink> - <name>in</name> - <type>$type.type</type> - </sink> - <source> - <name>out</name> - <type>$type.type</type> - </source> -</block> -- cgit v1.2.3 From d8e73d63c0af6ba6810319d866cab07b332d0e42 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Tue, 26 Feb 2013 12:00:47 -0500 Subject: core: adding a mutex as a protected member of gr_block for use in protecting set and work function access to variables. This is used in gr-analog's noise_source and gr-filter's fir_filter_XXX since these two cause particular problems (in next's channel model). This shows the use of the mutex for general protection when needed. --- gnuradio-core/src/lib/runtime/gr_block.h | 8 +++++++- gr-analog/lib/noise_source_X_impl.cc.t | 16 ++++++++++++++++ gr-analog/lib/noise_source_X_impl.h.t | 4 ++-- gr-filter/lib/fir_filter_XXX_impl.cc.t | 3 +++ 4 files changed, 28 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 6e21d5b975..0783e86848 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -484,9 +484,9 @@ class GR_CORE_API gr_block : public gr_basic_block { gr_block_detail_sptr d_detail; // implementation details unsigned d_history; bool d_fixed_rate; - int d_min_noutput_items; bool d_max_noutput_items_set; // if d_max_noutput_items is valid int d_max_noutput_items; // value of max_noutput_items for this block + int d_min_noutput_items; tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream std::vector<unsigned int> d_affinity; // thread affinity proc. mask @@ -609,6 +609,12 @@ class GR_CORE_API gr_block : public gr_basic_block { std::vector<long> d_max_output_buffer; std::vector<long> d_min_output_buffer; + /*! Used by block's setters and work functions to make + * setting/resetting of parameters thread-safe. + * + * Used by calling gruel::scoped_lock l(d_setlock); + */ + gruel::mutex d_setlock; // These are really only for internal use, but leaving them public avoids // having to work up an ever-varying list of friend GR_CORE_APIs diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t index 35dda9c5d4..40e2517d2e 100644 --- a/gr-analog/lib/noise_source_X_impl.cc.t +++ b/gr-analog/lib/noise_source_X_impl.cc.t @@ -54,11 +54,27 @@ namespace gr { { } + void + @IMPL_NAME@::set_type(noise_type_t type) + { + gruel::scoped_lock l(d_setlock); + d_type = type; + } + + void + @IMPL_NAME@::set_amplitude(float ampl) + { + gruel::scoped_lock l(d_setlock); + d_ampl = ampl; + } + int @IMPL_NAME@::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { + gruel::scoped_lock l(d_setlock); + @TYPE@ *out = (@TYPE@*)output_items[0]; switch(d_type) { diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_X_impl.h.t index 8bcc1dfde3..3a0e8d6d7c 100644 --- a/gr-analog/lib/noise_source_X_impl.h.t +++ b/gr-analog/lib/noise_source_X_impl.h.t @@ -41,8 +41,8 @@ namespace gr { @IMPL_NAME@(noise_type_t type, float ampl, long seed = 0); ~@IMPL_NAME@(); - void set_type(noise_type_t type) { d_type = type; } - void set_amplitude(float ampl) { d_ampl = ampl; } + void set_type(noise_type_t type); + void set_amplitude(float ampl); noise_type_t type() const { return d_type; } float amplitude() const { return d_ampl; } diff --git a/gr-filter/lib/fir_filter_XXX_impl.cc.t b/gr-filter/lib/fir_filter_XXX_impl.cc.t index 529c51e2bb..319c267270 100644 --- a/gr-filter/lib/fir_filter_XXX_impl.cc.t +++ b/gr-filter/lib/fir_filter_XXX_impl.cc.t @@ -64,6 +64,7 @@ namespace gr { void @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps) { + gruel::scoped_lock l(d_setlock); d_fir->set_taps(taps); d_updated = true; } @@ -79,6 +80,8 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { + gruel::scoped_lock l(d_setlock); + const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]; @O_TYPE@ *out = (@O_TYPE@*)output_items[0]; -- cgit v1.2.3 From 7388cc248d523d55e74ebfd4e434cc9d82001949 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Wed, 27 Feb 2013 10:51:56 -0500 Subject: blocks: removing (un)pack_k_bits from gnuradio-core. --- docs/sphinx/source/gr/converter_blk.rst | 1 - docs/sphinx/source/gr/index.rst | 1 - gnuradio-core/src/lib/general/CMakeLists.txt | 2 - gnuradio-core/src/lib/general/general.i | 4 -- gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc | 69 --------------------- gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h | 56 ----------------- gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i | 34 ----------- .../src/lib/general/gr_unpack_k_bits_bb.cc | 70 ---------------------- .../src/lib/general/gr_unpack_k_bits_bb.h | 56 ----------------- .../src/lib/general/gr_unpack_k_bits_bb.i | 34 ----------- .../src/python/gnuradio/gr/qa_pack_k_bits.py | 67 --------------------- .../src/python/gnuradio/gr/qa_unpack_k_bits.py | 57 ------------------ gr-digital/examples/berawgn.py | 2 +- gr-digital/python/generic_mod_demod.py | 14 ++--- gr-digital/python/qa_constellation.py | 2 +- grc/blocks/block_tree.xml | 5 -- grc/blocks/gr_pack_k_bits_bb.xml | 30 ---------- grc/blocks/gr_unpack_k_bits_bb.xml | 25 -------- 18 files changed, 9 insertions(+), 520 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc delete mode 100644 gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h delete mode 100644 gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i delete mode 100644 gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc delete mode 100644 gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h delete mode 100644 gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i delete mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py delete mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py delete mode 100644 grc/blocks/gr_pack_k_bits_bb.xml delete mode 100644 grc/blocks/gr_unpack_k_bits_bb.xml (limited to 'gnuradio-core/src/lib') diff --git a/docs/sphinx/source/gr/converter_blk.rst b/docs/sphinx/source/gr/converter_blk.rst index 81d159ece0..be643d2cb1 100644 --- a/docs/sphinx/source/gr/converter_blk.rst +++ b/docs/sphinx/source/gr/converter_blk.rst @@ -8,4 +8,3 @@ gnuradio.gr: Type Conversions .. autooldblock:: gnuradio.gr.complex_to_mag .. autooldblock:: gnuradio.gr.complex_to_mag_squared .. autooldblock:: gnuradio.gr.complex_to_arg -.. autooldblock:: gnuradio.gr.unpack_k_bits_bb diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index 9c4f34f93c..9cba4089fd 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -132,7 +132,6 @@ Type Conversions gnuradio.gr.complex_to_mag gnuradio.gr.complex_to_mag_squared gnuradio.gr.complex_to_arg - gnuradio.gr.unpack_k_bits_bb Signal Level Control (AGC) ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index d38d478e7d..b844cf302c 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -170,8 +170,6 @@ set(gr_core_general_triple_threats gr_test gr_vco_f gr_vector_map - gr_unpack_k_bits_bb - gr_pack_k_bits_bb gr_annotator_alltoall gr_annotator_1to1 gr_annotator_raw diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 1769c1e832..ff4c95631b 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -47,8 +47,6 @@ #include <gr_constants.h> #include <gr_test_types.h> #include <gr_test.h> -#include <gr_unpack_k_bits_bb.h> -#include <gr_pack_k_bits_bb.h> #include <gr_feval.h> #include <gr_bin_statistics_f.h> #include <gr_copy.h> @@ -87,8 +85,6 @@ %include "gr_constants.i" %include "gr_test_types.h" %include "gr_test.i" -%include "gr_unpack_k_bits_bb.i" -%include "gr_pack_k_bits_bb.i" %include "gr_feval.i" %include "gr_bin_statistics_f.i" %include "gr_copy.i" diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc deleted file mode 100644 index 0ea0c9e388..0000000000 --- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc +++ /dev/null @@ -1,69 +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. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pack_k_bits_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb(unsigned k) -{ - return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb(k)); -} - - -gr_pack_k_bits_bb::gr_pack_k_bits_bb (unsigned k) - : gr_sync_decimator("pack_k_bits_bb", - gr_make_io_signature (1, 1, sizeof(unsigned char)), - gr_make_io_signature (1, 1, sizeof(unsigned char)), - k), - d_k (k) -{ - if (d_k == 0) - throw std::out_of_range("interpolation must be > 0"); -} - -gr_pack_k_bits_bb::~gr_pack_k_bits_bb() -{ -} - -int -gr_pack_k_bits_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) { - out[i] = 0x00; - for(unsigned int j = 0; j < d_k; j++) { - out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1); - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h deleted file mode 100644 index 8e1508c78b..0000000000 --- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h +++ /dev/null @@ -1,56 +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_PACK_K_BITS_BB_H -#define INCLUDED_GR_PACK_K_BITS_BB_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_pack_k_bits_bb; -typedef boost::shared_ptr<gr_pack_k_bits_bb> gr_pack_k_bits_bb_sptr; -GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k); - -class gr_pack_k_bits_bb; - -/*! - * \brief Converts a stream of bytes with 1 bit in the LSB to a byte with k relevent bits. - * \ingroup converter_blk - */ -class GR_CORE_API gr_pack_k_bits_bb : public gr_sync_decimator -{ - private: - friend GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k); - - gr_pack_k_bits_bb (unsigned k); - - unsigned d_k; // number of relevent bits to pack from k input bytes - - public: - ~gr_pack_k_bits_bb (); - - 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/general/gr_pack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i deleted file mode 100644 index 6ae2095ec7..0000000000 --- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i +++ /dev/null @@ -1,34 +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,pack_k_bits_bb) - -gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (int k) throw(std::exception); - -class gr_pack_k_bits_bb : public gr_sync_decimator -{ - private: - gr_pack_k_bits_bb (int k); - - public: - ~gr_pack_k_bits_bb (); -}; diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc deleted file mode 100644 index 00b88e9724..0000000000 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc +++ /dev/null @@ -1,70 +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. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_unpack_k_bits_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k) -{ - return gnuradio::get_initial_sptr(new gr_unpack_k_bits_bb (k)); -} - - -gr_unpack_k_bits_bb::gr_unpack_k_bits_bb (unsigned k) - : gr_sync_interpolator ("unpack_k_bits_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char)), - k), - d_k (k) -{ - if (d_k == 0) - throw std::out_of_range ("interpolation must be > 0"); -} - -gr_unpack_k_bits_bb::~gr_unpack_k_bits_bb () -{ -} - -int -gr_unpack_k_bits_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - int n = 0; - for (unsigned int i = 0; i < noutput_items/d_k; i++){ - unsigned int t = in[i]; - for (int j = d_k - 1; j >= 0; j--) - out[n++] = (t >> j) & 0x01; - } - - assert(n == noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h deleted file mode 100644 index c3ea28d3fa..0000000000 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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_UNPACK_K_BITS_BB_H -#define INCLUDED_GR_UNPACK_K_BITS_BB_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_unpack_k_bits_bb; -typedef boost::shared_ptr<gr_unpack_k_bits_bb> gr_unpack_k_bits_bb_sptr; -GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); - -class gr_unpack_k_bits_bb; - -/*! - * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB. - * \ingroup converter_blk - */ -class GR_CORE_API gr_unpack_k_bits_bb : public gr_sync_interpolator -{ - private: - friend GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); - - gr_unpack_k_bits_bb (unsigned k); - - unsigned d_k; // number of relevent bits to unpack into k output bytes - - public: - ~gr_unpack_k_bits_bb (); - - 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/general/gr_unpack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i deleted file mode 100644 index de0f4b33e7..0000000000 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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,unpack_k_bits_bb) - -gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k) throw(std::exception); - -class gr_unpack_k_bits_bb : public gr_sync_interpolator -{ - private: - gr_unpack_k_bits_bb (int k); - - public: - ~gr_unpack_k_bits_bb (); -}; diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py deleted file mode 100755 index 25fc5e9fcc..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,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 -import random - -class test_pack(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def test_001(self): - src_data = (1,0,1,1,0,1,1,0) - expected_results = (1,0,1,1,0,1,1,0) - src = gr.vector_source_b(src_data,False) - op = gr.pack_k_bits_bb(1) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - def test_002(self): - src_data = (1,0,1,1,0,0,0,1) - expected_results = ( 2, 3, 0, 1) - src = gr.vector_source_b(src_data,False) - op = gr.pack_k_bits_bb(2) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - #self.assertEqual(expected_results, dst.data()) - self.assertEqual(expected_results, dst.data()) - - def test_003(self): - src_data = expected_results = map(lambda x: random.randint(0,3), range(10)); - src = gr.vector_source_b( src_data ); - pack = gr.pack_k_bits_bb(2); - unpack = gr.unpack_k_bits_bb(2); - snk = gr.vector_sink_b(); - self.tb.connect(src,unpack,pack,snk); - self.tb.run() - self.assertEqual(list(expected_results), list(snk.data())); - -if __name__ == '__main__': - gr_unittest.run(test_pack, "test_pack.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py deleted file mode 100755 index bb4e7733d4..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,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 -import random - -class test_unpack(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def test_001(self): - src_data = (1,0,1,1,0,1,1,0) - expected_results = (1,0,1,1,0,1,1,0) - src = gr.vector_source_b(src_data,False) - op = gr.unpack_k_bits_bb(1) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - def test_002(self): - src_data = ( 2, 3, 0, 1) - expected_results = (1,0,1,1,0,0,0,1) - src = gr.vector_source_b(src_data,False) - op = gr.unpack_k_bits_bb(2) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - -if __name__ == '__main__': - gr_unittest.run(test_unpack, "test_unpack.xml") - diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py index b20b17fd39..6f9679d555 100755 --- a/gr-digital/examples/berawgn.py +++ b/gr-digital/examples/berawgn.py @@ -77,7 +77,7 @@ class BitErrors(gr.hier_block2): intdump_decim = int(N_BITS) self.connect(self, comp, - gr.unpack_k_bits_bb(bits_per_byte), + blocks.unpack_k_bits_bb(bits_per_byte), blocks.uchar_to_float(), blocks.integrate_ff(intdump_decim), blocks.multiply_const_ff(1.0/N_BITS), diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index a5d1d9eb37..bc00646ccc 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -303,7 +303,7 @@ class generic_demod(gr.hier_block2): mod_codes.invert_code(self._constellation.pre_diff_code())) # unpack the k bit vector into a stream of bits - self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol()) + self.unpack = blocks.unpack_k_bits_bb(self.bits_per_symbol()) if verbose: self._print_verbage() @@ -312,14 +312,14 @@ class generic_demod(gr.hier_block2): self._setup_logging() # Connect and Initialize base class - blocks = [self, self.agc, self.freq_recov, - self.time_recov, self.receiver] + self._blocks = [self, self.agc, self.freq_recov, + self.time_recov, self.receiver] if differential: - blocks.append(self.diffdec) + self._blocks.append(self.diffdec) if self.pre_diff_code: - blocks.append(self.symbol_mapper) - blocks += [self.unpack, self] - self.connect(*blocks) + self._blocks.append(self.symbol_mapper) + self._blocks += [self.unpack, self] + self.connect(*self._blocks) def samples_per_symbol(self): return self._samples_per_symbol diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index 12dbca232f..37112f70a3 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -206,7 +206,7 @@ class mod_demod(gr.hier_block2): self.blocks.append(digital.map_bb( mod_codes.invert_code(self.constellation.pre_diff_code()))) # unpack the k bit vector into a stream of bits - self.blocks.append(gr.unpack_k_bits_bb( + self.blocks.append(blocks.unpack_k_bits_bb( self.constellation.bits_per_symbol())) # connect to block output check_index = len(self.blocks) diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index a78184dff1..8ddcaac61d 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -68,11 +68,6 @@ <name>Stream Conversions</name> <block>gr_burst_tagger</block> </cat> - <cat> - <name>Misc Conversions</name> - <block>gr_unpack_k_bits_bb</block> - <block>gr_pack_k_bits_bb</block> - </cat> <cat> <name>Synchronizers</name> diff --git a/grc/blocks/gr_pack_k_bits_bb.xml b/grc/blocks/gr_pack_k_bits_bb.xml deleted file mode 100644 index 34e64a5d96..0000000000 --- a/grc/blocks/gr_pack_k_bits_bb.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Pack K Bits -################################################### - --> -<block> - <name>Pack K Bits</name> - <key>gr_pack_k_bits_bb</key> - <import>from gnuradio import gr</import> - <make>gr.pack_k_bits_bb($k)</make> - <param> - <name>K</name> - <key>k</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> - - <doc> - Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros. - </doc> - -</block> diff --git a/grc/blocks/gr_unpack_k_bits_bb.xml b/grc/blocks/gr_unpack_k_bits_bb.xml deleted file mode 100644 index 9917644ab5..0000000000 --- a/grc/blocks/gr_unpack_k_bits_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Unpack K Bits -################################################### - --> -<block> - <name>Unpack K Bits</name> - <key>gr_unpack_k_bits_bb</key> - <import>from gnuradio import gr</import> - <make>gr.unpack_k_bits_bb($k)</make> - <param> - <name>K</name> - <key>k</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> -- cgit v1.2.3 From 25d8f8ddb3fe5493ef2847047c1e70283b0d8af1 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan <johnathan@corganlabs.com> Date: Wed, 27 Feb 2013 13:21:07 -0800 Subject: blocks: added gr::blocks::tuntap_pdu Linux only --- gnuradio-core/src/lib/io/gr_pdu.h | 13 +- .../src/lib/io/gr_pdu_to_tagged_stream.cc | 8 +- .../src/lib/io/gr_tagged_stream_to_pdu.cc | 8 +- gr-blocks/grc/blocks_block_tree.xml | 4 + gr-blocks/grc/blocks_tuntap_pdu.xml | 34 +++++ gr-blocks/include/blocks/CMakeLists.txt | 1 + gr-blocks/include/blocks/tuntap_pdu.h | 53 ++++++++ gr-blocks/lib/CMakeLists.txt | 2 + gr-blocks/lib/ConfigChecks.cmake | 2 +- gr-blocks/lib/stream_pdu_base.cc | 126 +++++++++++++++++++ gr-blocks/lib/stream_pdu_base.h | 60 +++++++++ gr-blocks/lib/tuntap_pdu_impl.cc | 139 +++++++++++++++++++++ gr-blocks/lib/tuntap_pdu_impl.h | 51 ++++++++ gr-blocks/swig/blocks_swig.i | 3 + 14 files changed, 489 insertions(+), 15 deletions(-) create mode 100644 gr-blocks/grc/blocks_tuntap_pdu.xml create mode 100644 gr-blocks/include/blocks/tuntap_pdu.h create mode 100644 gr-blocks/lib/stream_pdu_base.cc create mode 100644 gr-blocks/lib/stream_pdu_base.h create mode 100644 gr-blocks/lib/tuntap_pdu_impl.cc create mode 100644 gr-blocks/lib/tuntap_pdu_impl.h (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/src/lib/io/gr_pdu.h b/gnuradio-core/src/lib/io/gr_pdu.h index a5ae87db7f..53058ccb6c 100644 --- a/gnuradio-core/src/lib/io/gr_pdu.h +++ b/gnuradio-core/src/lib/io/gr_pdu.h @@ -23,17 +23,18 @@ #ifndef GR_PDU_H #define GR_PDU_H +#include <gr_core_api.h> #include <gr_complex.h> #include <gruel/pmt.h> -#define pdu_port_id pmt::mp("pdus") -#define pdu_length_tag pmt::mp("pdu_length") +#define PDU_PORT_ID pmt::mp("pdus") +#define PDU_LENGTH_TAG pmt::mp("pdu_length") enum gr_pdu_vector_type { pdu_byte, pdu_float, pdu_complex }; -size_t gr_pdu_itemsize(gr_pdu_vector_type type); -bool gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v); -pmt::pmt_t gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items); -gr_pdu_vector_type type_from_pmt(pmt::pmt_t vector); +GR_CORE_API size_t gr_pdu_itemsize(gr_pdu_vector_type type); +GR_CORE_API bool gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v); +GR_CORE_API pmt::pmt_t gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items); +GR_CORE_API gr_pdu_vector_type type_from_pmt(pmt::pmt_t vector); #endif diff --git a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc index 5c319dc39d..a702b66a2b 100644 --- a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc +++ b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc @@ -49,7 +49,7 @@ gr_pdu_to_tagged_stream::gr_pdu_to_tagged_stream (gr_pdu_vector_type t) gr_make_io_signature(1, 1, gr_pdu_itemsize(t))), d_vectortype(t), d_itemsize(gr_pdu_itemsize(t)) { - message_port_register_in(pdu_port_id); + message_port_register_in(PDU_PORT_ID); } gr_pdu_to_tagged_stream::~gr_pdu_to_tagged_stream() @@ -77,8 +77,8 @@ gr_pdu_to_tagged_stream::work(int noutput_items, if(noutput_items > 0){ // grab a message if one exists - //pmt::pmt_t msg( delete_head_nowait( pdu_port_id ) ); - pmt::pmt_t msg( delete_head_blocking( pdu_port_id ) ); + //pmt::pmt_t msg( delete_head_nowait( PDU_PORT_ID ) ); + pmt::pmt_t msg( delete_head_blocking( PDU_PORT_ID ) ); if(msg.get() == NULL ){ return nout; } @@ -99,7 +99,7 @@ gr_pdu_to_tagged_stream::work(int noutput_items, uint64_t offset = nitems_written(0) + nout; // add a tag for pdu length - add_item_tag(0, offset, pdu_length_tag, pmt::pmt_from_long( pmt::pmt_length(vect) ), pmt::mp(alias())); + add_item_tag(0, offset, PDU_LENGTH_TAG, pmt::pmt_from_long( pmt::pmt_length(vect) ), pmt::mp(alias())); // if we recieved metadata add it as tags if( !pmt_eq(meta, pmt::PMT_NIL) ){ diff --git a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc index 8211b7672d..1b869edfab 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc @@ -49,7 +49,7 @@ gr_tagged_stream_to_pdu::gr_tagged_stream_to_pdu (gr_pdu_vector_type t) d_vectortype(t), d_itemsize(gr_pdu_itemsize(t)), d_inpdu(false), d_pdu_meta(pmt::PMT_NIL), d_pdu_vector(pmt::PMT_NIL) { - message_port_register_out(pdu_port_id); + message_port_register_out(PDU_PORT_ID); } gr_tagged_stream_to_pdu::~gr_tagged_stream_to_pdu() @@ -70,7 +70,7 @@ gr_tagged_stream_to_pdu::work(int noutput_items, get_tags_in_range(d_tags, 0, abs_N, abs_N+1); bool found_length_tag(false); for(d_tags_itr = d_tags.begin(); (d_tags_itr != d_tags.end()) && (!found_length_tag); d_tags_itr++){ - if( pmt::pmt_equal( (*d_tags_itr).key, pdu_length_tag ) ){ + if( pmt::pmt_equal( (*d_tags_itr).key, PDU_LENGTH_TAG ) ){ if( (*d_tags_itr).offset != abs_N ){ throw std::runtime_error("expected next pdu length tag on a different item..."); } @@ -91,7 +91,7 @@ gr_tagged_stream_to_pdu::work(int noutput_items, // copy any tags in this range into our meta object get_tags_in_range(d_tags, 0, abs_N, abs_N+ncopy); for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++){ - if( ! pmt_equal( (*d_tags_itr).key, pdu_length_tag ) ){ + if( ! pmt_equal( (*d_tags_itr).key, PDU_LENGTH_TAG ) ){ d_pdu_meta = pmt_dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value); } } @@ -127,7 +127,7 @@ void gr_tagged_stream_to_pdu::send_message(){ } pmt::pmt_t msg = pmt::pmt_cons( d_pdu_meta, d_pdu_vector ); - message_port_pub( pdu_port_id, msg ); + message_port_pub( PDU_PORT_ID, msg ); d_pdu_meta = pmt::PMT_NIL; d_pdu_vector = pmt::PMT_NIL; diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml index 6b17078cd2..cd05dd3a87 100644 --- a/gr-blocks/grc/blocks_block_tree.xml +++ b/gr-blocks/grc/blocks_block_tree.xml @@ -99,4 +99,8 @@ <block>blocks_vector_to_stream</block> <block>blocks_vector_to_streams</block> </cat> + <cat> + <name>Networking</name> + <block>blocks_tuntap_pdu</block> + </cat> </cat> diff --git a/gr-blocks/grc/blocks_tuntap_pdu.xml b/gr-blocks/grc/blocks_tuntap_pdu.xml new file mode 100644 index 0000000000..d9a63d4a7f --- /dev/null +++ b/gr-blocks/grc/blocks_tuntap_pdu.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +################################################### +## TUNTAP PDU async message source/sink +################################################### + --> +<block> + <name>TUNTAP PDU</name> + <key>blocks_tuntap_pdu</key> + <import>from gnuradio import blocks</import> + <make>blocks.tuntap_pdu($ifn, $mtu)</make> + <param> + <name>Interface Name</name> + <key>ifn</key> + <value>tun0</value> + <type>string</type> + </param> + <param> + <name>MTU</name> + <key>mtu</key> + <value>10000</value> + <type>int</type> + </param> + <sink> + <name>pdus</name> + <type>message</type> + <optional>1</optional> + </sink> + <source> + <name>pdus</name> + <type>message</type> + <optional>1</optional> + </source> +</block> diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt index a6608696a1..045ebc0c28 100644 --- a/gr-blocks/include/blocks/CMakeLists.txt +++ b/gr-blocks/include/blocks/CMakeLists.txt @@ -136,6 +136,7 @@ install(FILES stream_to_vector.h streams_to_stream.h streams_to_vector.h + tuntap_pdu.h uchar_to_float.h vector_to_stream.h vector_to_streams.h diff --git a/gr-blocks/include/blocks/tuntap_pdu.h b/gr-blocks/include/blocks/tuntap_pdu.h new file mode 100644 index 0000000000..70abb0bd5b --- /dev/null +++ b/gr-blocks/include/blocks/tuntap_pdu.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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_BLOCKS_TUNTAP_PDU_H +#define INCLUDED_BLOCKS_TUNTAP_PDU_H + +#include <blocks/api.h> +#include <gr_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Creates TUNTAP interface and translates traffic to PDUs + * \ingroup net_blk + */ + class BLOCKS_API tuntap_pdu : virtual public gr_block + { + public: + // gr::blocks::tuntap_pdu::sptr + typedef boost::shared_ptr<tuntap_pdu> sptr; + + /*! + * \brief Construct a TUNTAP PDU interface + * \param dev Device name to create + * \param MTU Maximum Transmission Unit size + */ + static sptr make(std::string dev, int MTU=10000); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_TUNTAP_PDU_H */ diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt index 9b076f6964..a62174b44d 100644 --- a/gr-blocks/lib/CMakeLists.txt +++ b/gr-blocks/lib/CMakeLists.txt @@ -171,10 +171,12 @@ list(APPEND gr_blocks_sources short_to_char_impl.cc short_to_float_impl.cc stream_mux_impl.cc + stream_pdu_base.cc stream_to_streams_impl.cc stream_to_vector_impl.cc streams_to_stream_impl.cc streams_to_vector_impl.cc + tuntap_pdu_impl.cc uchar_array_to_float.cc uchar_to_float_impl.cc vector_to_stream_impl.cc diff --git a/gr-blocks/lib/ConfigChecks.cmake b/gr-blocks/lib/ConfigChecks.cmake index 72d6d1d8ab..7f60aed403 100644 --- a/gr-blocks/lib/ConfigChecks.cmake +++ b/gr-blocks/lib/ConfigChecks.cmake @@ -56,7 +56,7 @@ CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H) IF(HAVE_WINDOWS_H) ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK) MESSAGE(STATUS "Adding windows libs to gr blocks libs...") - LIST(APPEND gnuradio_core_libs WS2_32.lib WSock32.lib) + LIST(APPEND blocks_libs WS2_32.lib WSock32.lib) ENDIF(HAVE_WINDOWS_H) ######################################################################## diff --git a/gr-blocks/lib/stream_pdu_base.cc b/gr-blocks/lib/stream_pdu_base.cc new file mode 100644 index 0000000000..3378067f85 --- /dev/null +++ b/gr-blocks/lib/stream_pdu_base.cc @@ -0,0 +1,126 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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 + +#ifdef HAVE_IO_H +#include <io.h> +#endif + +#include <gr_pdu.h> +#include <gr_basic_block.h> +#include "stream_pdu_base.h" +#include <boost/format.hpp> + +static const long timeout_us = 100*1000; //100ms + +namespace gr { + namespace blocks { + + stream_pdu_base::stream_pdu_base(int MTU) + : d_fd(-1), + d_started(false), + d_finished(false) + { + // reserve space for rx buffer + d_rxbuf.resize(MTU,0); + } + + stream_pdu_base::~stream_pdu_base() + { + stop_rxthread(); + } + + void + stream_pdu_base::start_rxthread(gr_basic_block *blk, pmt::pmt_t port) + { + d_blk = blk; + d_port = port; + d_thread = gruel::thread(boost::bind(&stream_pdu_base::run, this)); + d_started = true; + } + + void + stream_pdu_base::stop_rxthread() + { + d_finished = true; + + if (d_started) { + d_thread.interrupt(); + d_thread.join(); + } + } + + void + stream_pdu_base::run() + { + while(!d_finished) { + if (!wait_ready()) + continue; + + const int result = read(d_fd, &d_rxbuf[0], d_rxbuf.size()); + if (result <= 0) + throw std::runtime_error("stream_pdu_base, bad socket read!"); + + pmt::pmt_t vector = pmt::pmt_init_u8vector(result, &d_rxbuf[0]); + pmt::pmt_t pdu = pmt::pmt_cons(pmt::PMT_NIL, vector); + + d_blk->message_port_pub(d_port, pdu); + } + } + + bool + stream_pdu_base::wait_ready() + { + //setup timeval for timeout + timeval tv; + tv.tv_sec = 0; + tv.tv_usec = timeout_us; + + //setup rset for timeout + fd_set rset; + FD_ZERO(&rset); + FD_SET(d_fd, &rset); + + //call select with timeout on receive socket + return ::select(d_fd+1, &rset, NULL, NULL, &tv) > 0; + } + + void + stream_pdu_base::send(pmt::pmt_t msg) + { + pmt::pmt_t vector = pmt::pmt_cdr(msg); + size_t offset(0); + size_t itemsize(::gr_pdu_itemsize(type_from_pmt(vector))); + int len(pmt::pmt_length(vector)*itemsize); + + const int rv = write(d_fd, pmt::pmt_uniform_vector_elements(vector, offset), len); + if (rv != len) { + std::cerr << boost::format("WARNING: gr_stream_pdu_base::send(pdu) write failed! (d_fd=%d, len=%d, rv=%d)") + % d_fd % len % rv << std::endl; + } + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/stream_pdu_base.h b/gr-blocks/lib/stream_pdu_base.h new file mode 100644 index 0000000000..66eaaf0c04 --- /dev/null +++ b/gr-blocks/lib/stream_pdu_base.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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_STREAM_PDU_BASE_H +#define INCLUDED_STREAM_PDU_BASE_H + +#include <gruel/thread.h> +#include <gruel/pmt.h> + +class gr_basic_block; + +namespace gr { + namespace blocks { + + class stream_pdu_base + { + public: + stream_pdu_base(int MTU=10000); + ~stream_pdu_base(); + + protected: + int d_fd; + bool d_started; + bool d_finished; + std::vector<uint8_t> d_rxbuf; + gruel::thread d_thread; + + pmt::pmt_t d_port; + gr_basic_block *d_blk; + + void run(); + void send(pmt::pmt_t msg); + bool wait_ready(); + void start_rxthread(gr_basic_block *blk, pmt::pmt_t rxport); + void stop_rxthread(); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_STREAM_PDU_BASE_H */ diff --git a/gr-blocks/lib/tuntap_pdu_impl.cc b/gr-blocks/lib/tuntap_pdu_impl.cc new file mode 100644 index 0000000000..1970a92b69 --- /dev/null +++ b/gr-blocks/lib/tuntap_pdu_impl.cc @@ -0,0 +1,139 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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 "tuntap_pdu_impl.h" +#include <gr_io_signature.h> +#include <gr_pdu.h> +#include <boost/format.hpp> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#if (defined(linux) || defined(__linux) || defined(__linux__)) +#include <sys/ioctl.h> +#include <arpa/inet.h> +#include <linux/if.h> +#endif + +namespace gr { + namespace blocks { + + tuntap_pdu::sptr + tuntap_pdu::make(std::string dev, int MTU) + { +#if (defined(linux) || defined(__linux) || defined(__linux__)) + return gnuradio::get_initial_sptr(new tuntap_pdu_impl(dev, MTU)); +#else + throw std::runtime_error("tuntap_pdu not implemented on this platform"); +#endif + } + +#if (defined(linux) || defined(__linux) || defined(__linux__)) + tuntap_pdu_impl::tuntap_pdu_impl(std::string dev, int MTU) + : gr_block("tuntap_pdu", + gr_make_io_signature (0, 0, 0), + gr_make_io_signature (0, 0, 0)), + stream_pdu_base(MTU), + d_dev(dev) + { + // make the tuntap + char dev_cstr[1024]; + memset(dev_cstr, 0x00, 1024); + strncpy(dev_cstr, dev.c_str(), std::min(sizeof(dev_cstr), dev.size())); + + d_fd = tun_alloc(dev_cstr); + if (d_fd <= 0) + throw std::runtime_error("gr::tuntap_pdu::make: tun_alloc failed (are you running as root?)"); + + std::cout << boost::format( + "Allocated virtual ethernet interface: %s\n" + "You must now use ifconfig to set its IP address. E.g.,\n" + " $ sudo ifconfig %s 192.168.200.1\n" + "Be sure to use a different address in the same subnet for each machine.\n" + ) % dev % dev << std::endl; + + // set up output message port + message_port_register_out(PDU_PORT_ID); + start_rxthread(this, PDU_PORT_ID); + + // set up input message port + message_port_register_in(PDU_PORT_ID); + set_msg_handler(PDU_PORT_ID, boost::bind(&tuntap_pdu_impl::send, this, _1)); + } + + int + tuntap_pdu_impl::tun_alloc(char *dev, int flags) + { + struct ifreq ifr; + int fd, err; + const char *clonedev = "/dev/net/tun"; + + /* Arguments taken by the function: + * + * char *dev: the name of an interface (or '\0'). MUST have enough + * space to hold the interface name if '\0' is passed + * int flags: interface flags (eg, IFF_TUN etc.) + */ + + /* open the clone device */ + if ((fd = open(clonedev, O_RDWR)) < 0) + return fd; + + /* preparation of the struct ifr, of type "struct ifreq" */ + memset(&ifr, 0, sizeof(ifr)); + + ifr.ifr_flags = flags; /* IFF_TUN or IFF_TAP, plus maybe IFF_NO_PI */ + + /* if a device name was specified, put it in the structure; otherwise, + * the kernel will try to allocate the "next" device of the + * specified type + */ + if (*dev) + strncpy(ifr.ifr_name, dev, IFNAMSIZ); + + /* try to create the device */ + if ((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0) { + close(fd); + return err; + } + + /* if the operation was successful, write back the name of the + * interface to the variable "dev", so the caller can know + * it. Note that the caller MUST reserve space in *dev (see calling + * code below) + */ + strcpy(dev, ifr.ifr_name); + + /* this is the special file descriptor that the caller will use to talk + * with the virtual interface + */ + return fd; + } +#endif + + } /* namespace blocks */ +}/* namespace gr */ diff --git a/gr-blocks/lib/tuntap_pdu_impl.h b/gr-blocks/lib/tuntap_pdu_impl.h new file mode 100644 index 0000000000..396d9d51c8 --- /dev/null +++ b/gr-blocks/lib/tuntap_pdu_impl.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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_BLOCKS_TUNTAP_PDU_IMPL_H +#define INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H + +#include <blocks/tuntap_pdu.h> +#include "stream_pdu_base.h" + +#if (defined(linux) || defined(__linux) || defined(__linux__)) +#include <linux/if_tun.h> +#endif + +namespace gr { + namespace blocks { + + class tuntap_pdu_impl : public tuntap_pdu, public stream_pdu_base + { +#if (defined(linux) || defined(__linux) || defined(__linux__)) + private: + std::string d_dev; + int tun_alloc(char *dev, int flags = IFF_TAP | IFF_NO_PI); + + public: + tuntap_pdu_impl(std::string dev, int MTU); +#endif + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H */ diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i index b229e55638..8e03038673 100644 --- a/gr-blocks/swig/blocks_swig.i +++ b/gr-blocks/swig/blocks_swig.i @@ -119,6 +119,7 @@ #include "blocks/sub_ss.h" #include "blocks/sub_ii.h" #include "blocks/sub_cc.h" +#include "blocks/tuntap_pdu.h" #include "blocks/uchar_to_float.h" #include "blocks/unpacked_to_packed_bb.h" #include "blocks/unpacked_to_packed_ss.h" @@ -219,6 +220,7 @@ %include "blocks/sub_ss.h" %include "blocks/sub_ii.h" %include "blocks/sub_cc.h" +%include "blocks/tuntap_pdu.h" %include "blocks/uchar_to_float.h" %include "blocks/unpacked_to_packed_bb.h" %include "blocks/unpacked_to_packed_ss.h" @@ -318,6 +320,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff); GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss); GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii); GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, tuntap_pdu); GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float); GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb); GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss); -- cgit v1.2.3 From 6e988b777c6788cc7d434b869173ebcdcc2ce5e3 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan <johnathan@corganlabs.com> Date: Wed, 27 Feb 2013 13:50:57 -0800 Subject: core: removed gr_tuntap_pdu Replaced by gr::blocks:tuntap_pdu --- gnuradio-core/src/lib/io/CMakeLists.txt | 1 - gnuradio-core/src/lib/io/gr_tuntap_pdu.cc | 145 ------------------------------ gnuradio-core/src/lib/io/gr_tuntap_pdu.h | 74 --------------- gnuradio-core/src/lib/io/gr_tuntap_pdu.i | 30 ------- gnuradio-core/src/lib/io/io.i | 2 - grc/blocks/block_tree.xml | 1 - grc/blocks/gr_tuntap_pdu.xml | 34 ------- 7 files changed, 287 deletions(-) delete mode 100644 gnuradio-core/src/lib/io/gr_tuntap_pdu.cc delete mode 100644 gnuradio-core/src/lib/io/gr_tuntap_pdu.h delete mode 100644 gnuradio-core/src/lib/io/gr_tuntap_pdu.i delete mode 100644 grc/blocks/gr_tuntap_pdu.xml (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt index 59ca06b5a2..23c019d63b 100644 --- a/gnuradio-core/src/lib/io/CMakeLists.txt +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -105,7 +105,6 @@ set(gr_core_io_triple_threats gr_wavfile_sink gr_tagged_file_sink gr_tagged_stream_to_pdu - gr_tuntap_pdu gr_socket_pdu ) diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc b/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc deleted file mode 100644 index 8dd4b18a10..0000000000 --- a/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc +++ /dev/null @@ -1,145 +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_tuntap_pdu.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> -#include <gr_pdu.h> -#include <boost/format.hpp> - -#if (defined(linux) || defined(__linux) || defined(__linux__)) - -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include <arpa/inet.h> -#include <linux/if.h> - - -// public constructor that returns a shared_ptr - -gr_tuntap_pdu_sptr -gr_make_tuntap_pdu (std::string dev, int MTU) -{ - return gnuradio::get_initial_sptr(new gr_tuntap_pdu(dev, MTU)); -} - -gr_tuntap_pdu::gr_tuntap_pdu (std::string dev, int MTU) - : gr_stream_pdu_base(MTU) -{ - - // make the tuntap - char dev_cstr[1024]; - memset(dev_cstr, 0x00, 1024); - strncpy(dev_cstr, dev.c_str(), std::min(sizeof(dev_cstr), dev.size())); - d_fd = tun_alloc(dev_cstr); - if(d_fd <= 0){ - throw std::runtime_error("TunTap make: tun_alloc failed (are you running as root?)"); - } - - std::cout << boost::format( - "Allocated virtual ethernet interface: %s\n" - "You must now use ifconfig to set its IP address. E.g.,\n" - " $ sudo ifconfig %s 192.168.200.1\n" - "Be sure to use a different address in the same subnet for each machine.\n" - ) % dev % dev << std::endl; - - // set up output message port - message_port_register_out(pmt::mp("pdus")); - start_rxthread(pmt::mp("pdus")); - - // set up input message port - message_port_register_in(pmt::mp("pdus")); - set_msg_handler(pmt::mp("pdus"), boost::bind(&gr_tuntap_pdu::send, this, _1)); -} - - -int gr_tuntap_pdu::tun_alloc(char *dev, int flags) { - struct ifreq ifr; - int fd, err; - const char *clonedev = "/dev/net/tun"; - - /* Arguments taken by the function: - * - * char *dev: the name of an interface (or '\0'). MUST have enough - * space to hold the interface name if '\0' is passed - * int flags: interface flags (eg, IFF_TUN etc.) - */ - - /* open the clone device */ - if( (fd = open(clonedev, O_RDWR)) < 0 ) { - return fd; - } - - /* preparation of the struct ifr, of type "struct ifreq" */ - memset(&ifr, 0, sizeof(ifr)); - - ifr.ifr_flags = flags; /* IFF_TUN or IFF_TAP, plus maybe IFF_NO_PI */ - - if (*dev) { - /* if a device name was specified, put it in the structure; otherwise, - * the kernel will try to allocate the "next" device of the - * specified type */ - strncpy(ifr.ifr_name, dev, IFNAMSIZ); - } - - /* try to create the device */ - if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) { - close(fd); - return err; - } - - /* if the operation was successful, write back the name of the - * interface to the variable "dev", so the caller can know - * it. Note that the caller MUST reserve space in *dev (see calling - * code below) */ - strcpy(dev, ifr.ifr_name); - - /* this is the special file descriptor that the caller will use to talk - * with the virtual interface */ - return fd; -} - -#else //if not linux - -gr_block_sptr -gr_make_tuntap_pdu(std::string dev, int MTU) -{ - gr_block_sptr rv; - throw std::runtime_error("tuntap only implemented on linux"); - return rv; -} - -#endif diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.h b/gnuradio-core/src/lib/io/gr_tuntap_pdu.h deleted file mode 100644 index 18c83f42b2..0000000000 --- a/gnuradio-core/src/lib/io/gr_tuntap_pdu.h +++ /dev/null @@ -1,74 +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_TUNTAP_PDU_H -#define INCLUDED_GR_TUNTAP_PDU_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> -#include <gr_stream_pdu_base.h> - -#if (defined(linux) || defined(__linux) || defined(__linux__)) - -#include <linux/if_tun.h> - -class gr_tuntap_pdu; -typedef boost::shared_ptr<gr_tuntap_pdu> gr_tuntap_pdu_sptr; - -GR_CORE_API gr_tuntap_pdu_sptr gr_make_tuntap_pdu (std::string dev, int MTU=10000); - -/*! - * \brief Gather received items into messages and insert into msgq - * \ingroup sink_blk - */ -class GR_CORE_API gr_tuntap_pdu : public gr_stream_pdu_base -{ - private: - friend GR_CORE_API gr_tuntap_pdu_sptr - gr_make_tuntap_pdu(std::string dev, int MTU); - int tun_alloc(char* dev, int flags = IFF_TAP | IFF_NO_PI); - std::string d_dev; - protected: - gr_tuntap_pdu (std::string dev, int MTU=10000); - - public: - ~gr_tuntap_pdu () {} - -}; - -#else // if not linux - -class gr_tuntap_pdu -{ -private: - gr_tuntap_pdu() {}; -public: - ~gr_tuntap_pdu() {}; -}; - -GR_CORE_API gr_block_sptr gr_make_tuntap_pdu (std::string dev, int MTU=0); - -#endif - -#endif /* INCLUDED_GR_TUNTAP_PDU_H */ diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.i b/gnuradio-core/src/lib/io/gr_tuntap_pdu.i deleted file mode 100644 index 589bbc3853..0000000000 --- a/gnuradio-core/src/lib/io/gr_tuntap_pdu.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,tuntap_pdu); - -%{ -#include <gr_tuntap_pdu.h> -%} - -%include "gr_tuntap_pdu.h" - diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index e2de4eb976..33cc906e92 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -49,7 +49,6 @@ #include <gr_tagged_stream_to_pdu.h> #include <gr_message_debug.h> #include <gr_pdu.h> -#include <gr_tuntap_pdu.h> #include <gr_socket_pdu.h> %} @@ -77,7 +76,6 @@ %include "gr_tagged_stream_to_pdu.i" %include "gr_message_debug.i" %include "gr_pdu.i" -%include "gr_tuntap_pdu.i" %include "gr_socket_pdu.i" diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 8ddcaac61d..4567a65781 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -39,7 +39,6 @@ <block>gr_message_strobe</block> <block>gr_pdu_to_tagged_stream</block> <block>gr_tagged_stream_to_pdu</block> - <block>gr_tuntap_pdu</block> <block>gr_socket_pdu</block> <block>gr_random_pdu</block> </cat> diff --git a/grc/blocks/gr_tuntap_pdu.xml b/grc/blocks/gr_tuntap_pdu.xml deleted file mode 100644 index f169345afa..0000000000 --- a/grc/blocks/gr_tuntap_pdu.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Tuntap PDU Message source/sink -################################################### - --> -<block> - <name>TunTap PDU</name> - <key>gr_tuntap_pdu</key> - <import>from gnuradio import gr</import> - <make>gr.tuntap_pdu($ifn, $mtu)</make> - <param> - <name>Interface Name</name> - <key>ifn</key> - <value>tun0</value> - <type>string</type> - </param> - <param> - <name>MTU</name> - <key>mtu</key> - <value>10000</value> - <type>int</type> - </param> - <sink> - <name>pdus</name> - <type>message</type> - <optional>1</optional> - </sink> - <source> - <name>pdus</name> - <type>message</type> - <optional>1</optional> - </source> -</block> -- cgit v1.2.3 From 5a5338f584297f30e451e43dcb05f331cad51cd4 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Wed, 27 Feb 2013 18:32:31 -0500 Subject: ctrlport: adding option to toggle export of the list of edges on/off. --- gnuradio-core/gnuradio-core.conf | 1 + gnuradio-core/src/lib/runtime/gr_top_block.cc | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/gnuradio-core.conf b/gnuradio-core/gnuradio-core.conf index 3ed9892c73..cf3df4aea7 100644 --- a/gnuradio-core/gnuradio-core.conf +++ b/gnuradio-core/gnuradio-core.conf @@ -12,4 +12,5 @@ export = True [ControlPort] on = False +edges_list = False config = # ${prefix}/etc/gnuradio/ctrlport.conf diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc index e5859768de..c6118bcfdd 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc @@ -138,13 +138,15 @@ gr_top_block::setup_rpc() "items", "Max number of output items", RPC_PRIVLVL_MIN, DISPNULL))); - add_rpc_variable( - rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, std::string>( - alias(), "edge list", - &gr_top_block::edge_list, - pmt::mp(""), pmt::mp(""), pmt::mp(""), - "edges", "List of edges in the graph", - RPC_PRIVLVL_MIN, DISPNULL))); + if(gr_prefs::singleton()->get_bool("ControlPort", "edges_list", false)) { + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, std::string>( + alias(), "edge list", + &gr_top_block::edge_list, + pmt::mp(""), pmt::mp(""), pmt::mp(""), + "edges", "List of edges in the graph", + RPC_PRIVLVL_MIN, DISPNULL))); + } // Setters add_rpc_variable( -- cgit v1.2.3