summaryrefslogtreecommitdiff
path: root/gr-blocks
diff options
context:
space:
mode:
Diffstat (limited to 'gr-blocks')
-rw-r--r--gr-blocks/examples/CMakeLists.txt1
-rw-r--r--gr-blocks/examples/tags/CMakeLists.txt27
-rwxr-xr-xgr-blocks/examples/tags/test_file_tags.py56
-rw-r--r--gr-blocks/lib/burst_tagger_impl.cc10
-rw-r--r--gr-blocks/python/qa_burst_tagger.py8
5 files changed, 93 insertions, 9 deletions
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/gr-blocks/examples/tags/CMakeLists.txt b/gr-blocks/examples/tags/CMakeLists.txt
new file mode 100644
index 0000000000..142b5cde6c
--- /dev/null
+++ b/gr-blocks/examples/tags/CMakeLists.txt
@@ -0,0 +1,27 @@
+# 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(GrPython)
+
+GR_PYTHON_INSTALL(PROGRAMS
+ test_file_tags.py
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/tags
+ COMPONENT "blocks_python"
+)
+
diff --git a/gr-blocks/examples/tags/test_file_tags.py b/gr-blocks/examples/tags/test_file_tags.py
new file mode 100755
index 0000000000..1493864bd4
--- /dev/null
+++ b/gr-blocks/examples/tags/test_file_tags.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr
+from gnuradio import blocks
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+def main():
+ data = scipy.arange(0, 32000, 1).tolist()
+ trig = 100*[0,] + 100*[1,]
+
+ src = gr.vector_source_s(data, True)
+ trigger = gr.vector_source_s(trig, True)
+
+ thr = blocks.throttle(gr.sizeof_short, 10e3)
+ ann = gr.annotator_alltoall(1000000, gr.sizeof_short)
+ tagger = blocks..burst_tagger(gr.sizeof_short)
+
+ fsnk = gr.tagged_file_sink(gr.sizeof_short, 1)
+
+ tb = gr.top_block()
+ tb.connect(src, thr, (tagger, 0))
+ tb.connect(trigger, (tagger, 1))
+ tb.connect(tagger, fsnk)
+
+ tb.run()
+
+if __name__ == "__main__":
+ main()
+
+
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")