diff options
-rw-r--r-- | gnuradio-core/src/examples/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general.i | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_burst_tagger.cc | 109 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_burst_tagger.h | 64 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_burst_tagger.i | 35 | ||||
-rwxr-xr-x | gr-analog/examples/tags/uhd_burst_detector.py | 2 | ||||
-rw-r--r-- | gr-blocks/examples/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-blocks/examples/tags/CMakeLists.txt (renamed from gnuradio-core/src/examples/tags/CMakeLists.txt) | 2 | ||||
-rwxr-xr-x | gr-blocks/examples/tags/test_file_tags.py (renamed from gnuradio-core/src/examples/tags/test_file_tags.py) | 2 | ||||
-rw-r--r-- | gr-blocks/lib/burst_tagger_impl.cc | 10 | ||||
-rw-r--r-- | gr-blocks/python/qa_burst_tagger.py | 8 | ||||
-rw-r--r-- | grc/blocks/block_tree.xml | 4 | ||||
-rw-r--r-- | grc/blocks/gr_burst_tagger.xml | 87 |
14 files changed, 13 insertions, 315 deletions
diff --git a/gnuradio-core/src/examples/CMakeLists.txt b/gnuradio-core/src/examples/CMakeLists.txt index 5a0df064d6..532c658083 100644 --- a/gnuradio-core/src/examples/CMakeLists.txt +++ b/gnuradio-core/src/examples/CMakeLists.txt @@ -19,7 +19,6 @@ add_subdirectory(mp-sched) add_subdirectory(network) -add_subdirectory(tags) add_subdirectory(volk_benchmark) if(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index f9e12cfdcf..bbc6a7612b 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -164,7 +164,6 @@ set(gr_core_general_triple_threats gr_annotator_alltoall gr_annotator_1to1 gr_annotator_raw - gr_burst_tagger ) if(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index f824d9aba0..f7f7942577 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -49,7 +49,6 @@ #include <gr_annotator_alltoall.h> #include <gr_annotator_1to1.h> #include <gr_annotator_raw.h> -#include <gr_burst_tagger.h> #include <gr_vector_map.h> %} @@ -80,7 +79,6 @@ %include "gr_annotator_alltoall.i" %include "gr_annotator_1to1.i" %include "gr_annotator_raw.i" -%include "gr_burst_tagger.i" %include "gr_vector_map.i" %include "gr_block_gateway.i" diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc deleted file mode 100644 index 72924109bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.cc +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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_burst_tagger.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_burst_tagger_sptr -gr_make_burst_tagger(size_t itemsize) -{ - return gnuradio::get_initial_sptr(new gr_burst_tagger(itemsize)); -} - -gr_burst_tagger::gr_burst_tagger(size_t itemsize) - : gr_sync_block ("burst_tagger", - gr_make_io_signature2 (2, 2, itemsize, sizeof(short)), - gr_make_io_signature (1, 1, itemsize)), - d_itemsize(itemsize), d_state(false) -{ - std::stringstream str; - str << name() << unique_id(); - - d_true_key = pmt::string_to_symbol("burst"); - d_true_value = pmt::PMT_T; - - d_false_key = pmt::string_to_symbol("burst"); - d_false_value = pmt::PMT_F; - - d_id = pmt::string_to_symbol(str.str()); -} - -void -gr_burst_tagger::set_true_tag (const std::string &key, bool value) -{ - d_true_key = pmt::string_to_symbol(key); - if(value == true) { - d_true_value = pmt::PMT_T; - } - else { - d_true_value = pmt::PMT_F; - } -} - -void -gr_burst_tagger::set_false_tag (const std::string &key, bool value) -{ - d_false_key = pmt::string_to_symbol(key); - if(value == true) { - d_false_value = pmt::PMT_T; - } - else { - d_false_value = pmt::PMT_F; - } -} - -gr_burst_tagger::~gr_burst_tagger() -{ -} - -int -gr_burst_tagger::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *signal = (const char*)input_items[0]; - const short *trigger = (const short*)input_items[1]; - char *out = (char*)output_items[0]; - - memcpy(out, signal, noutput_items * d_itemsize); - - for(int i = 0; i < noutput_items; i++) { - if(trigger[i] > 0) { - if(d_state == false) { - d_state = true; - add_item_tag(0, nitems_written(0)+i, d_true_key, d_true_value, d_id); - } - } - else { - if(d_state == true) { - d_state = false; - add_item_tag(0, nitems_written(0)+i, d_false_key, d_false_value, d_id); - } - } - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h deleted file mode 100644 index 9a7898b043..0000000000 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -#ifndef INCLUDED_GR_BURST_TAGGER_H -#define INCLUDED_GR_BURST_TAGGER_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_burst_tagger; -typedef boost::shared_ptr<gr_burst_tagger> gr_burst_tagger_sptr; - -GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); - -/*! - * \brief output[i] = input[i] - * \ingroup misc_blk - * - */ -class GR_CORE_API gr_burst_tagger : public gr_sync_block -{ - size_t d_itemsize; - bool d_state; - pmt::pmt_t d_true_key; - pmt::pmt_t d_true_value; - - pmt::pmt_t d_false_key; - pmt::pmt_t d_false_value; - - pmt::pmt_t d_id; - - friend GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); - gr_burst_tagger(size_t itemsize); - - public: - ~gr_burst_tagger(); - void set_true_tag (const std::string &key, bool value); - void set_false_tag (const std::string &key, bool value); - - 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_burst_tagger.i b/gnuradio-core/src/lib/general/gr_burst_tagger.i deleted file mode 100644 index a5511e48ad..0000000000 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,burst_tagger) - -gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); - -class gr_burst_tagger : public gr_sync_block -{ - private: - gr_burst_tagger(size_t itemsize); - - public: - void set_true_tag(const std::string &key, bool value); - void set_false_tag(const std::string &key, bool value); -}; diff --git a/gr-analog/examples/tags/uhd_burst_detector.py b/gr-analog/examples/tags/uhd_burst_detector.py index 4bcf5a77cc..6ebaef91fa 100755 --- a/gr-analog/examples/tags/uhd_burst_detector.py +++ b/gr-analog/examples/tags/uhd_burst_detector.py @@ -51,7 +51,7 @@ class uhd_burst_detector(gr.top_block): taps = firdes.low_pass_2(1, 1, 0.4, 0.1, 60) self.chanfilt = filter.fir_filter_ccc(10, taps) - self.tagger = gr.burst_tagger(gr.sizeof_gr_complex) + self.tagger = blocks.burst_tagger(gr.sizeof_gr_complex) # Dummy signaler to collect a burst on known periods data = 1000*[0,] + 1000*[1,] diff --git a/gr-blocks/examples/CMakeLists.txt b/gr-blocks/examples/CMakeLists.txt index 79535daa05..0f9db57b63 100644 --- a/gr-blocks/examples/CMakeLists.txt +++ b/gr-blocks/examples/CMakeLists.txt @@ -18,3 +18,4 @@ # Boston, MA 02110-1301, USA. add_subdirectory(metadata) +add_subdirectory(tags) diff --git a/gnuradio-core/src/examples/tags/CMakeLists.txt b/gr-blocks/examples/tags/CMakeLists.txt index 8975fd03aa..142b5cde6c 100644 --- a/gnuradio-core/src/examples/tags/CMakeLists.txt +++ b/gr-blocks/examples/tags/CMakeLists.txt @@ -22,6 +22,6 @@ include(GrPython) GR_PYTHON_INSTALL(PROGRAMS test_file_tags.py DESTINATION ${GR_PKG_DATA_DIR}/examples/tags - COMPONENT "core_python" + COMPONENT "blocks_python" ) diff --git a/gnuradio-core/src/examples/tags/test_file_tags.py b/gr-blocks/examples/tags/test_file_tags.py index 1dfc9e46cd..1493864bd4 100755 --- a/gnuradio-core/src/examples/tags/test_file_tags.py +++ b/gr-blocks/examples/tags/test_file_tags.py @@ -39,7 +39,7 @@ def main(): thr = blocks.throttle(gr.sizeof_short, 10e3) ann = gr.annotator_alltoall(1000000, gr.sizeof_short) - tagger = gr.burst_tagger(gr.sizeof_short) + tagger = blocks..burst_tagger(gr.sizeof_short) fsnk = gr.tagged_file_sink(gr.sizeof_short, 1) diff --git a/gr-blocks/lib/burst_tagger_impl.cc b/gr-blocks/lib/burst_tagger_impl.cc index 5d0691bde6..31c535290d 100644 --- a/gr-blocks/lib/burst_tagger_impl.cc +++ b/gr-blocks/lib/burst_tagger_impl.cc @@ -47,13 +47,13 @@ namespace gr { std::stringstream str; str << name() << unique_id(); - d_true_key = pmt::pmt_string_to_symbol("burst"); + d_true_key = pmt::string_to_symbol("burst"); d_true_value = pmt::PMT_T; - d_false_key = pmt::pmt_string_to_symbol("burst"); + d_false_key = pmt::string_to_symbol("burst"); d_false_value = pmt::PMT_F; - d_id = pmt::pmt_string_to_symbol(str.str()); + d_id = pmt::string_to_symbol(str.str()); } burst_tagger_impl::~burst_tagger_impl() @@ -63,7 +63,7 @@ namespace gr { void burst_tagger_impl::set_true_tag(const std::string &key, bool value) { - d_true_key = pmt::pmt_string_to_symbol(key); + d_true_key = pmt::string_to_symbol(key); if(value == true) { d_true_value = pmt::PMT_T; } @@ -75,7 +75,7 @@ namespace gr { void burst_tagger_impl::set_false_tag (const std::string &key, bool value) { - d_false_key = pmt::pmt_string_to_symbol(key); + d_false_key = pmt::string_to_symbol(key); if(value == true) { d_false_value = pmt::PMT_T; } diff --git a/gr-blocks/python/qa_burst_tagger.py b/gr-blocks/python/qa_burst_tagger.py index 5e249cb8b9..dfe9ec6429 100644 --- a/gr-blocks/python/qa_burst_tagger.py +++ b/gr-blocks/python/qa_burst_tagger.py @@ -51,10 +51,10 @@ class test_burst_tagger(gr_unittest.TestCase): self.assertEqual(6, x[2].offset) self.assertEqual(8, x[3].offset) - self.assertEqual(True, pmt.pmt_to_bool(x[0].value)) - self.assertEqual(False, pmt.pmt_to_bool(x[1].value)) - self.assertEqual(True, pmt.pmt_to_bool(x[2].value)) - self.assertEqual(False, pmt.pmt_to_bool(x[3].value)) + self.assertEqual(True, pmt.to_bool(x[0].value)) + self.assertEqual(False, pmt.to_bool(x[1].value)) + self.assertEqual(True, pmt.to_bool(x[2].value)) + self.assertEqual(False, pmt.to_bool(x[3].value)) if __name__ == '__main__': gr_unittest.run(test_burst_tagger, "test_burst_tagger.xml") diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index e4c059500a..7d1f0be9d6 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -35,10 +35,6 @@ <block>gr_endian_swap</block> </cat> <cat> - <name>Stream Conversions</name> - <block>gr_burst_tagger</block> - </cat> - <cat> <name>Synchronizers</name> <block>gr_mpsk_sync_cc</block> diff --git a/grc/blocks/gr_burst_tagger.xml b/grc/blocks/gr_burst_tagger.xml deleted file mode 100644 index 58c909999a..0000000000 --- a/grc/blocks/gr_burst_tagger.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Burst tagger: -## all types, 1 output, 2 input: stream & trigger (short) -################################################### - --> -<block> - <name>Burst Tagger</name> - <key>gr_burst_tagger</key> - <import>from gnuradio import gr</import> - <make>gr.burst_tagger($type.size) -self.$(id).set_true_tag($true_key,$true_value) -self.$(id).set_false_tag($false_key,$false_value) - </make> - <callback>set_true_tag($true_key,$true_value)</callback> - <callback>set_false_tag($false_key,$false_value)</callback> - <param> - <name>Stream 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>True KeyID</name> - <key>true_key</key> - <value>burst</value> - <type>string</type> - </param> - <param> - <name>True Value</name> - <key>true_value</key> - <value>True</value> - <type>bool</type> - </param> - <param> - <name>False KeyID</name> - <key>false_key</key> - <value>burst</value> - <type>string</type> - </param> - <param> - <name>False Value</name> - <key>false_value</key> - <value>False</value> - <type>bool</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - <vlen>1</vlen> - </sink> - <sink> - <name>trigger</name> - <type>short</type> - <vlen>1</vlen> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>1</vlen> - </source> -</block> |