summaryrefslogtreecommitdiff
path: root/gr-blocks/grc
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2015-04-05 16:20:18 -0400
committerTom Rondeau <tom@trondeau.com>2015-04-05 16:20:18 -0400
commit81929b6cc8258ca022fabe6013ddc043452cd21c (patch)
tree80131912327c3327b8c6f882bd17d82c64812e03 /gr-blocks/grc
parentfa2abde0a0c9c1430ca1c4bb470ddb35e18c0ee2 (diff)
blocks: adding a variable tag_object to help build tags.
Edit boxes to set the tag's offset, key, value, and source id to make it easier to create and use tags in a flwograph. the gr-blocks example vector_source_with_tags.grc has been updated to use this.
Diffstat (limited to 'gr-blocks/grc')
-rw-r--r--gr-blocks/grc/blocks_block_tree.xml4
-rw-r--r--gr-blocks/grc/blocks_tag_object.xml55
2 files changed, 59 insertions, 0 deletions
diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml
index 383ec876e4..cc7b4b8c6f 100644
--- a/gr-blocks/grc/blocks_block_tree.xml
+++ b/gr-blocks/grc/blocks_block_tree.xml
@@ -221,4 +221,8 @@
<block>blocks_vco_f</block>
<block>blocks_vco_c</block>
</cat>
+ <cat>
+ <name>Variables</name>
+ <block>variable_tag_object</block>
+ </cat>
</cat>
diff --git a/gr-blocks/grc/blocks_tag_object.xml b/gr-blocks/grc/blocks_tag_object.xml
new file mode 100644
index 0000000000..f5813d3fbc
--- /dev/null
+++ b/gr-blocks/grc/blocks_tag_object.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Tag Object: creates a tag
+###################################################
+ -->
+<block>
+ <name>Tag Object</name>
+ <key>variable_tag_object</key>
+ <var_make>self.$(id) = $(id) = gr.tag_utils.python_to_tag(($offset, $key, $value, $src))</var_make>
+ <make></make>
+
+ <param>
+ <name>Offset</name>
+ <key>offset</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Key</name>
+ <key>key</key>
+ <value>pmt.intern("key")</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>Value</name>
+ <key>value</key>
+ <value>pmt.intern("value")</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>Source ID</name>
+ <key>src</key>
+ <value>pmt.intern("src")</value>
+ <type>raw</type>
+ </param>
+
+ <doc>
+ This block creates a tag object. While tags are based on an
+ absolute offset, this is based on a relative offset that must be
+ appropriately translated by the block using it. For example, this
+ is used by the vector_source blocks, which will treat a 0 offset
+ in the tag as the first item in the stream when the vector starts
+ or repeats.
+
+ The tag objects are created using the python_to_tag Python
+ function to make it easy to generate a tag_t in Python. The call
+ looks like:
+
+ gr.tag_utils.python_to_tag(($offset, $key, $value, $src))
+ </doc>
+</block>