diff options
Diffstat (limited to 'gnuradio-core/src/lib')
27 files changed, 0 insertions, 1616 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 12e0bf0346..de1ad59092 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -174,7 +174,6 @@ set(gr_core_general_triple_threats gr_annotator_raw gr_burst_tagger gr_tag_debug - gr_message_strobe ) if(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 04d524ee5c..030dce92a2 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -56,7 +56,6 @@ #include <gr_burst_tagger.h> #include <gr_vector_map.h> #include <gr_tag_debug.h> -#include <gr_message_strobe.h> %} %include "gri_control_loop.i" @@ -94,7 +93,6 @@ %include "gr_vector_map.i" %include "gr_tag_debug.i" %include "gr_block_gateway.i" -%include "gr_message_strobe.i" #ifdef GR_CTRLPORT diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.cc b/gnuradio-core/src/lib/general/gr_message_strobe.cc deleted file mode 100644 index 6a9f807d18..0000000000 --- a/gnuradio-core/src/lib/general/gr_message_strobe.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_strobe.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <iostream> - -// public constructor that returns a shared_ptr - -gr_message_strobe_sptr -gr_make_message_strobe (pmt::pmt_t msg, float period_ms) -{ - return gnuradio::get_initial_sptr(new gr_message_strobe(msg, period_ms)); -} - -gr_message_strobe::gr_message_strobe (pmt::pmt_t msg, float period_ms) - : gr_block("message_strobe", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), - d_finished(false), - d_period_ms(period_ms), - d_msg(msg) -{ - message_port_register_out(pmt::mp("strobe")); - d_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&gr_message_strobe::run, this))); - - message_port_register_in(pmt::mp("set_msg")); - set_msg_handler(pmt::mp("set_msg"), boost::bind(&gr_message_strobe::set_msg, this, _1)); -} - -gr_message_strobe::~gr_message_strobe() -{ - d_finished = true; - d_thread->interrupt(); - d_thread->join(); -} - -void gr_message_strobe::run(){ - while(!d_finished) { - boost::this_thread::sleep(boost::posix_time::milliseconds(d_period_ms)); - if(d_finished){ return; } - - message_port_pub( pmt::mp("strobe"), d_msg ); - } -} diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.h b/gnuradio-core/src/lib/general/gr_message_strobe.h deleted file mode 100644 index 89046ffc05..0000000000 --- a/gnuradio-core/src/lib/general/gr_message_strobe.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_STROBE_H -#define INCLUDED_GR_MESSAGE_STROBE_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_strobe; -typedef boost::shared_ptr<gr_message_strobe> gr_message_strobe_sptr; - -GR_CORE_API gr_message_strobe_sptr gr_make_message_strobe (pmt::pmt_t msg, float period_ms); - -/*! - * \brief Send message at defined interval - * \ingroup msg_blk - */ -class GR_CORE_API gr_message_strobe : public gr_block -{ - private: - friend GR_CORE_API gr_message_strobe_sptr - gr_make_message_strobe(pmt::pmt_t msg, float period_ms); - - boost::shared_ptr<boost::thread> d_thread; - bool d_finished; - float d_period_ms; - pmt::pmt_t d_msg; - - void run(); - - protected: - gr_message_strobe (pmt::pmt_t msg, float period_ms); - - public: - ~gr_message_strobe (); - - void set_msg(pmt::pmt_t msg){ d_msg = msg; } -}; - -#endif /* INCLUDED_GR_MESSAGE_STROBE_H */ diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.i b/gnuradio-core/src/lib/general/gr_message_strobe.i deleted file mode 100644 index 490aa8e8a1..0000000000 --- a/gnuradio-core/src/lib/general/gr_message_strobe.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_strobe); - -%{ -#include <gr_message_strobe.h> -%} - -%include "gr_message_strobe.h" - diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index b3852973e3..45834ced5f 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -85,10 +85,6 @@ expand_h_cc_i(gr_vector_source_X b s i f c) expand_h_cc_i(gr_vector_insert_X b) expand_h_cc_i(gr_vector_sink_X b s i f c) -expand_h_cc_i(gr_moving_average_XX ss ii ff cc) - -expand_h_cc_i(gr_peak_detector_XX fb ib sb) - add_custom_target(gengen_generated DEPENDS ${generated_gengen_includes} ${generated_gengen_swigs} diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 4d9c56dc00..68913f9a75 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -37,15 +37,6 @@ ss_roots = [ # regular blocks reg_signatures = ['ss', 'ii', 'ff', 'cc'] -reg_roots = [ - 'gr_moving_average_XX', - ] - -# other blocks -others = ( - ('gr_peak_detector_XX', ('fb','ib','sb')), - ) - def expand_h_cc_i (root, sig): # root looks like 'gr_vector_sink_X' @@ -62,15 +53,6 @@ def generate (): for r in ss_roots: for s in ss_signatures: expand_h_cc_i (r, s) - for r in reg_roots : - for s in reg_signatures: - expand_h_cc_i (r, s) - - for root, sigs in others: - for s in sigs: - expand_h_cc_i (root, s) - - if __name__ == '__main__': generate () diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t deleted file mode 100644 index ddee30bd77..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter) -{ - return gnuradio::get_initial_sptr (new @NAME@ (length, scale, max_iter)); -} - -@NAME@::@NAME@ (int length, @O_TYPE@ scale, int max_iter) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_length(length), - d_scale(scale), - d_max_iter(max_iter), - d_new_length(length), - d_new_scale(scale), - d_updated(false) -{ - set_history(length); -} - -@NAME@::~@NAME@ () -{ -} - -void -@NAME@::set_length_and_scale(int length, @O_TYPE@ scale) -{ - d_new_length = length; - d_new_scale = scale; - d_updated = true; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - if (d_updated) { - d_length = d_new_length; - d_scale = d_new_scale; - set_history(d_length); - d_updated = false; - return 0; // history requirements might have changed - } - - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - @I_TYPE@ sum = 0; - int num_iter = (noutput_items>d_max_iter) ? d_max_iter : noutput_items; - for (int i = 0; i < d_length-1 ; i++) { - sum += in[i]; - } - - for (int i = 0; i < num_iter; i++) { - sum += in[i+d_length-1]; - out[i] = sum * d_scale; - sum -= in[i]; - } - - return num_iter; -} diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t deleted file mode 100644 index 37678abe13..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; - -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096); - -/*! - * \brief output is the moving sum of the last N samples, scaled by the scale factor - * \ingroup filter_blk - * - * max_iter limits how long we go without flushing the accumulator - * This is necessary to avoid numerical instability for float and complex. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ -private: - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@(int length, @O_TYPE@ scale, int max_iter); - - @NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096); - - int d_length; - @O_TYPE@ d_scale; - int d_max_iter; - - int d_new_length; - @O_TYPE@ d_new_scale; - bool d_updated; - -public: - ~@NAME@ (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int length() const { return d_new_length; } - @O_TYPE@ scale() const { return d_new_scale; } - - void set_length_and_scale(int length, @O_TYPE@ scale); -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t deleted file mode 100644 index 6e3b9ca9bc..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter=4096); - -class @NAME@ : public gr_sync_block -{ -private: - @NAME@ (); - - public: - int length() const; - @O_TYPE@ scale() const; - void set_length_and_scale(int length, @O_TYPE@ scale); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t deleted file mode 100644 index 54af3c0cd4..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <string.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha) -{ - return gnuradio::get_initial_sptr (new @NAME@ (threshold_factor_rise, - threshold_factor_fall, - look_ahead, alpha)); -} - -@NAME@::@NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (char))), - d_threshold_factor_rise(threshold_factor_rise), - d_threshold_factor_fall(threshold_factor_fall), - d_look_ahead(look_ahead), d_avg_alpha(alpha), d_avg(0), d_found(0) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; - char *optr = (char *) output_items[0]; - - memset(optr, 0, noutput_items*sizeof(char)); - - @I_TYPE@ peak_val = -(@I_TYPE@)INFINITY; - int peak_ind = 0; - unsigned char state = 0; - int i = 0; - - //printf("noutput_items %d\n",noutput_items); - while(i < noutput_items) { - if(state == 0) { // below threshold - if(iptr[i] > d_avg*d_threshold_factor_rise) { - state = 1; - } - else { - d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg; - i++; - } - } - else if(state == 1) { // above threshold, have not found peak - //printf("Entered State 1: %f i: %d noutput_items: %d\n", iptr[i], i, noutput_items); - if(iptr[i] > peak_val) { - peak_val = iptr[i]; - peak_ind = i; - d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg; - i++; - } - else if (iptr[i] > d_avg*d_threshold_factor_fall) { - d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg; - i++; - } - else { - optr[peak_ind] = 1; - state = 0; - peak_val = -(@I_TYPE@)INFINITY; - //printf("Leaving State 1: Peak: %f Peak Ind: %d i: %d noutput_items: %d\n", - //peak_val, peak_ind, i, noutput_items); - } - } - } - - if(state == 0) { - //printf("Leave in State 0, produced %d\n",noutput_items); - return noutput_items; - } - else { // only return up to passing the threshold - //printf("Leave in State 1, only produced %d of %d\n",peak_ind,noutput_items); - return peak_ind+1; - } -} diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t deleted file mode 100644 index 3e05594fbd..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25, - float threshold_factor_fall = 0.40, - int look_ahead = 10, - float alpha = 0.001); - -/*! - * \brief Detect the peak of a signal - * \ingroup level_blk - * - * If a peak is detected, this block outputs a 1, - * or it outputs 0's. - * - * \param threshold_factor_rise The threshold factor determins when a peak - * has started. An average of the signal is calculated and when the - * value of the signal goes over threshold_factor_rise*average, we - * start looking for a peak. - * \param threshold_factor_fall The threshold factor determins when a peak - * has ended. An average of the signal is calculated and when the - * value of the signal goes bellow threshold_factor_fall*average, we - * stop looking for a peak. - * \param look_ahead The look-ahead value is used when the threshold is - * found to look if there another peak within this step range. - * If there is a larger value, we set that as the peak and look ahead - * again. This is continued until the highest point is found with - * This look-ahead range. - * \param alpha The gain value of a moving average filter - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha); - - @NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha); - - private: - float d_threshold_factor_rise; - float d_threshold_factor_fall; - int d_look_ahead; - float d_avg_alpha; - float d_avg; - unsigned char d_found; - - public: - - /*! \brief Set the threshold factor value for the rise time - * \param thr new threshold factor - */ - void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; } - - /*! \brief Set the threshold factor value for the fall time - * \param thr new threshold factor - */ - void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; } - - /*! \brief Set the look-ahead factor - * \param look new look-ahead factor - */ - void set_look_ahead(int look) { d_look_ahead = look; } - - /*! \brief Set the running average alpha - * \param alpha new alpha for running average - */ - void set_alpha(int alpha) { d_avg_alpha = alpha; } - - /*! \brief Get the threshold factor value for the rise time - * \return threshold factor - */ - float threshold_factor_rise() { return d_threshold_factor_rise; } - - /*! \brief Get the threshold factor value for the fall time - * \return threshold factor - */ - float threshold_factor_fall() { return d_threshold_factor_fall; } - - /*! \brief Get the look-ahead factor value - * \return look-ahead factor - */ - int look_ahead() { return d_look_ahead; } - - /*! \brief Get the alpha value of the running average - * \return alpha - */ - float alpha() { return d_avg_alpha; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t deleted file mode 100644 index 212ce0c946..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25, - float threshold_factor_fall = 0.40, - int look_ahead = 10, - float alpha=0.001); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (float threshold_factor_rise, - float threshold_factor_fall, - int look_ahead, float alpha); - - public: - void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; } - void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; } - void set_look_ahead(int look) { d_look_ahead = look; } - void set_alpha(int alpha) { d_avg_alpha = alpha; } - - float threshold_factor_rise() { return d_threshold_factor_rise; } - float threshold_factor_fall() { return d_threshold_factor_fall; } - int look_ahead() { return d_look_ahead; } - float alpha() { return d_avg_alpha; } -}; diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt index 7368283dab..dc0ffe62b1 100644 --- a/gnuradio-core/src/lib/io/CMakeLists.txt +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -85,10 +85,6 @@ set(gr_core_io_triple_threats gr_file_source gr_file_descriptor_sink gr_file_descriptor_source - gr_message_debug - gr_message_sink - gr_message_source - gr_message_burst_source microtune_xxxx_eval_board microtune_4702_eval_board microtune_4937_eval_board diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.cc b/gnuradio-core/src/lib/io/gr_message_burst_source.cc deleted file mode 100644 index 968df6ec38..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_burst_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <gr_tags.h> - -// public constructor that returns a shared_ptr - -gr_message_burst_source_sptr -gr_make_message_burst_source(size_t itemsize, int msgq_limit) -{ - return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq_limit)); -} - -// public constructor that takes existing message queue -gr_message_burst_source_sptr -gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq) -{ - return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq)); -} - -gr_message_burst_source::gr_message_burst_source (size_t itemsize, int msgq_limit) - : gr_sync_block("message_burst_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false) -{ - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); -} - -gr_message_burst_source::gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq) - : gr_sync_block("message_burst_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false) -{ - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); -} - -gr_message_burst_source::~gr_message_burst_source() -{ -} - -int -gr_message_burst_source::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - int nn = 0; - - uint64_t abs_sample_count = nitems_written(0); - - while (nn < noutput_items){ - if (d_msg){ - // - // Consume whatever we can from the current message - // - - int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if (d_msg_offset == d_msg->length()){ - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - //tag end of burst - add_item_tag(0, //stream ID - abs_sample_count+nn-1, //sample number - pmt::string_to_symbol("tx_eob"), - pmt::from_bool(1), - d_me //block src id - ); - } - } - else { - // - // No current message - // - if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got - break; - } - - if (d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - //tag start of burst - add_item_tag(0, //stream ID - abs_sample_count+nn, //sample number - pmt::string_to_symbol("tx_sob"), - pmt::from_bool(1), - d_me //block src id - ); - - - if ((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - } - - return nn; -} diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.h b/gnuradio-core/src/lib/io/gr_message_burst_source.h deleted file mode 100644 index 63e2201139..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_H -#define INCLUDED_GR_MESSAGE_BURST_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_burst_source; -typedef boost::shared_ptr<gr_message_burst_source> gr_message_burst_source_sptr; - -GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0); -GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - -/*! - * \brief Turn received messages into a stream and tag them for UHD to send. - * \ingroup source_blk - */ -class GR_CORE_API gr_message_burst_source : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - pmt::pmt_t d_me; - - friend GR_CORE_API gr_message_burst_source_sptr - gr_make_message_burst_source(size_t itemsize, int msgq_limit); - friend GR_CORE_API gr_message_burst_source_sptr - gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq); - - protected: - gr_message_burst_source (size_t itemsize, int msgq_limit); - gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_burst_source (); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_gr_message_burst_source_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.i b/gnuradio-core/src/lib/io/gr_message_burst_source.i deleted file mode 100644 index f7ad840c22..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.i +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_burst_source); - -gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0); -gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - -class gr_message_burst_source : public gr_sync_block -{ - protected: - gr_message_burst_source (size_t itemsize, int msgq_limit); - gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_burst_source (); - - gr_msg_queue_sptr msgq() const; -}; diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc deleted file mode 100644 index 07c0af1e34..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_debug.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <iostream> - -// public constructor that returns a shared_ptr - -gr_message_debug_sptr -gr_make_message_debug () -{ - return gnuradio::get_initial_sptr(new gr_message_debug()); -} - -void -gr_message_debug::print(pmt::pmt_t msg) -{ - std::cout << "******* MESSAGE DEBUG PRINT ********\n"; - pmt::print(msg); - std::cout << "************************************\n"; -} - -void -gr_message_debug::store(pmt::pmt_t msg) -{ - gruel::scoped_lock guard(d_mutex); - d_messages.push_back(msg); -} - -void -gr_message_debug::print_pdu(pmt::pmt_t pdu) -{ - pmt::pmt_t meta = pmt::car(pdu); - pmt::pmt_t vector = pmt::cdr(pdu); - - std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n"; - pmt::print(meta); - size_t len = pmt::length(vector); - std::cout << "pdu_length = " << len << std::endl; - std::cout << "contents = " << std::endl; - size_t offset(0); - const uint8_t* d = (const uint8_t*) uniform_vector_elements(vector, offset); - for(size_t i=0; i<len; i+=16){ - printf("%04x: ", ((unsigned int)i)); - for(size_t j=i; j<std::min(i+16,len); j++){ - printf("%02x ",d[j] ); - } - - std::cout << std::endl; - } - - std::cout << "***********************************\n"; -} - -int -gr_message_debug::num_messages() -{ - return (int)d_messages.size(); -} - -pmt::pmt_t -gr_message_debug::get_message(int i) -{ - gruel::scoped_lock guard(d_mutex); - - if((size_t)i >= d_messages.size()) { - throw std::runtime_error("gr_message_debug: index for message out of bounds.\n"); - } - - return d_messages[i]; -} - -gr_message_debug::gr_message_debug() - : gr_block("message_debug", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)) -{ - message_port_register_in(pmt::mp("print")); - set_msg_handler(pmt::mp("print"), boost::bind(&gr_message_debug::print, this, _1)); - - message_port_register_in(pmt::mp("store")); - set_msg_handler(pmt::mp("store"), boost::bind(&gr_message_debug::store, this, _1)); - - message_port_register_in(pmt::mp("print_pdu")); - set_msg_handler(pmt::mp("print_pdu"), boost::bind(&gr_message_debug::print_pdu, this, _1)); -} - -gr_message_debug::~gr_message_debug() -{ -} diff --git a/gnuradio-core/src/lib/io/gr_message_debug.h b/gnuradio-core/src/lib/io/gr_message_debug.h deleted file mode 100644 index f1374e8062..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_DEBUG_H -#define INCLUDED_GR_MESSAGE_DEBUG_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> -#include <gruel/thread.h> - -class gr_message_debug; -typedef boost::shared_ptr<gr_message_debug> gr_message_debug_sptr; - -GR_CORE_API gr_message_debug_sptr gr_make_message_debug(); - -/*! - * \brief Print received messages to stdout - * \ingroup sink_blk - */ -class GR_CORE_API gr_message_debug : public gr_block -{ - private: - friend GR_CORE_API gr_message_debug_sptr - gr_make_message_debug(); - - /*! - * \brief Messages received in this port are printed to stdout. - * - * This port receives messages from the scheduler's message handling - * mechanism and prints it to stdout. This message handler function - * is only meant to be used by the scheduler to handle messages - * posted to port 'print'. - * - * \param msg A pmt message passed from the scheduler's message handling. - */ - void print(pmt::pmt_t msg); - - /*! - * \brief PDU formatted messages received in this port are printed to stdout. - * - * This port receives messages from the scheduler's message handling - * mechanism and prints it to stdout. This message handler function - * is only meant to be used by the scheduler to handle messages - * posted to port 'print'. - * - * \param pdu A PDU message passed from the scheduler's message handling. - */ - void print_pdu(pmt::pmt_t pdu); - - /*! - * \brief Messages received in this port are stored in a vector. - * - * This port receives messages from the scheduler's message handling - * mechanism and stores it in a vector. Messages can be retrieved - * later using the 'get_message' function. This message handler - * function is only meant to be used by the scheduler to handle - * messages posted to port 'store'. - * - * \param msg A pmt message passed from the scheduler's message handling. - */ - void store(pmt::pmt_t msg); - - gruel::mutex d_mutex; - std::vector<pmt::pmt_t> d_messages; - - protected: - gr_message_debug (); - - public: - ~gr_message_debug (); - - /*! - * \brief Reports the number of messages received by this block. - */ - int num_messages(); - - /*! - * \brief Get a message (as a PMT) from the message vector at index \p i. - * - * Messages passed to the 'store' port will be stored in a - * vector. This function retrieves those messages by index. They are - * index in order of when they were received (all messages are just - * pushed onto the back of a vector). This is mostly useful in - * debugging message passing graphs and in QA code. - * - * \param i The index in the vector for the message to retrieve. - * - * \return a message at index \p i as a pmt_t. - */ - pmt::pmt_t get_message(int i); -}; - -#endif /* INCLUDED_GR_MESSAGE_DEBUG_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_debug.i b/gnuradio-core/src/lib/io/gr_message_debug.i deleted file mode 100644 index 65d3bfc4aa..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_debug.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_debug); - -%{ -#include <gr_message_debug.h> -%} - -%include "gr_message_debug.h" - diff --git a/gnuradio-core/src/lib/io/gr_message_sink.cc b/gnuradio-core/src/lib/io/gr_message_sink.cc deleted file mode 100644 index ae0b5c7649..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_sink.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - - -// public constructor that returns a shared_ptr - -gr_message_sink_sptr -gr_make_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block) -{ - return gnuradio::get_initial_sptr(new gr_message_sink(itemsize, msgq, dont_block)); -} - -gr_message_sink::gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block) - : gr_sync_block("message_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), - d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block) -{ -} - -gr_message_sink::~gr_message_sink() -{ -} - -int -gr_message_sink::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - - // if we'd block, drop the data on the floor and say everything is OK - if (d_dont_block && d_msgq->full_p()) - return noutput_items; - - // build a message to hold whatever we've got - gr_message_sptr msg = gr_make_message(0, // msg type - d_itemsize, // arg1 for other end - noutput_items, // arg2 for other end (redundant) - noutput_items * d_itemsize); // len of msg - memcpy(msg->msg(), in, noutput_items * d_itemsize); - - d_msgq->handle(msg); // send it - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/io/gr_message_sink.h b/gnuradio-core/src/lib/io/gr_message_sink.h deleted file mode 100644 index 84005694a1..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SINK_H -#define INCLUDED_GR_MESSAGE_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_sink; -typedef boost::shared_ptr<gr_message_sink> gr_message_sink_sptr; - -GR_CORE_API gr_message_sink_sptr gr_make_message_sink (size_t itemsize, - gr_msg_queue_sptr msgq, - bool dont_block); - -/*! - * \brief Gather received items into messages and insert into msgq - * \ingroup sink_blk - */ -class GR_CORE_API gr_message_sink : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - bool d_dont_block; - - friend GR_CORE_API gr_message_sink_sptr - gr_make_message_sink(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - protected: - gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - public: - ~gr_message_sink (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MESSAGE_SINK_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_sink.i b/gnuradio-core/src/lib/io/gr_message_sink.i deleted file mode 100644 index 8415cbd66d..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_sink.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_sink); - -gr_message_sink_sptr gr_make_message_sink (size_t itemsize, - gr_msg_queue_sptr msgq, - bool dont_block); - -class gr_message_sink : public gr_sync_block -{ - protected: - gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); - - public: - ~gr_message_sink (); -}; diff --git a/gnuradio-core/src/lib/io/gr_message_source.cc b/gnuradio-core/src/lib/io/gr_message_source.cc deleted file mode 100644 index fb3da89a8b..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_message_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - - -// public constructor that returns a shared_ptr - -gr_message_source_sptr -gr_make_message_source(size_t itemsize, int msgq_limit) -{ - return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq_limit)); -} - -// public constructor that takes existing message queue -gr_message_source_sptr -gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq) -{ - return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq)); -} - -gr_message_source::gr_message_source (size_t itemsize, int msgq_limit) - : gr_sync_block("message_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false) -{ -} - -gr_message_source::gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq) - : gr_sync_block("message_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false) -{ -} - -gr_message_source::~gr_message_source() -{ -} - -int -gr_message_source::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - int nn = 0; - - while (nn < noutput_items){ - if (d_msg){ - // - // Consume whatever we can from the current message - // - int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if (d_msg_offset == d_msg->length()){ - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - } - } - else { - // - // No current message - // - if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got - break; - } - - if (d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - - if ((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - } - - return nn; -} diff --git a/gnuradio-core/src/lib/io/gr_message_source.h b/gnuradio-core/src/lib/io/gr_message_source.h deleted file mode 100644 index c510d1775f..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SOURCE_H -#define INCLUDED_GR_MESSAGE_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_message_source; -typedef boost::shared_ptr<gr_message_source> gr_message_source_sptr; - -GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); -GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - -/*! - * \brief Turn received messages into a stream - * \ingroup source_blk - */ -class GR_CORE_API gr_message_source : public gr_sync_block -{ - private: - size_t d_itemsize; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - friend GR_CORE_API gr_message_source_sptr - gr_make_message_source(size_t itemsize, int msgq_limit); - friend GR_CORE_API gr_message_source_sptr - gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq); - - protected: - gr_message_source (size_t itemsize, int msgq_limit); - gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_source (); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MESSAGE_SOURCE_H */ diff --git a/gnuradio-core/src/lib/io/gr_message_source.i b/gnuradio-core/src/lib/io/gr_message_source.i deleted file mode 100644 index 9ee9157e8c..0000000000 --- a/gnuradio-core/src/lib/io/gr_message_source.i +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,message_source); - -gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); -gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - -class gr_message_source : public gr_sync_block -{ - protected: - gr_message_source (size_t itemsize, int msgq_limit); - gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq); - - public: - ~gr_message_source (); - - gr_msg_queue_sptr msgq() const; -}; diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index 01a174903d..be2ce99374 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -37,15 +37,11 @@ #include <gr_oscope_sink_x.h> #include <gr_oscope_sink_f.h> #include <ppio.h> -#include <gr_message_source.h> -#include <gr_message_burst_source.h> -#include <gr_message_sink.h> #include <gr_udp_sink.h> #include <gr_udp_source.h> #include <gr_wavfile_sink.h> #include <gr_wavfile_source.h> #include <gr_tagged_file_sink.h> -#include <gr_message_debug.h> %} %include "gr_file_sink_base.i" @@ -60,14 +56,10 @@ %include "sdr_1000.i" %include "gr_oscope_sink.i" %include "ppio.i" -%include "gr_message_source.i" -%include "gr_message_burst_source.i" -%include "gr_message_sink.i" %include "gr_udp_sink.i" %include "gr_udp_source.i" %include "gr_wavfile_sink.i" %include "gr_wavfile_source.i" %include "gr_tagged_file_sink.i" -%include "gr_message_debug.i" |