diff options
author | Josh Blum | 2011-03-14 16:57:13 -0700 |
---|---|---|
committer | Josh Blum | 2011-03-14 16:57:13 -0700 |
commit | 4d5096c8b084c5832256dc2cd8bb617ee93d94a4 (patch) | |
tree | cd0ca60a18f6e1201b1f911f20851defa9d2421b /grc/blocks/variable_function_probe.xml | |
parent | 7df5b10ddcd64309a5c299f662a4cd62a7d175ab (diff) | |
parent | fcebe220ba4690a4c339daa3d0909aad7776e631 (diff) | |
download | gnuradio-4d5096c8b084c5832256dc2cd8bb617ee93d94a4.tar.gz gnuradio-4d5096c8b084c5832256dc2cd8bb617ee93d94a4.tar.bz2 gnuradio-4d5096c8b084c5832256dc2cd8bb617ee93d94a4.zip |
Merge branch 'wip/qtgui/grc' into mergeme/qtgui/grc
Conflicts:
grc/grc_gnuradio/Makefile.am
Diffstat (limited to 'grc/blocks/variable_function_probe.xml')
-rw-r--r-- | grc/blocks/variable_function_probe.xml | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/grc/blocks/variable_function_probe.xml b/grc/blocks/variable_function_probe.xml new file mode 100644 index 000000000..269966c70 --- /dev/null +++ b/grc/blocks/variable_function_probe.xml @@ -0,0 +1,70 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Variable function probe +################################################### + --> +<block> + <name>Function Probe</name> + <key>variable_function_probe</key> + <import>import time</import> + <import>import threading</import> + <var_make>self.$(id) = $(id) = $value</var_make> + <make>#slurp +def _$(id)_probe(): + while True: + val = self.$(block_id()).$(function_name())($(function_args())) + try: self.set_$(id)(val) + except AttributeError, e: pass + time.sleep(1.0/($poll_rate)) +_$(id)_thread = threading.Thread(target=_$(id)_probe) +_$(id)_thread.daemon = True +_$(id)_thread.start()</make> + <callback>self.set_$(id)($value)</callback> + <param> + <name>Value</name> + <key>value</key> + <value>0</value> + <type>raw</type> + </param> + <param> + <name>Block ID</name> + <key>block_id</key> + <value>my_block_0</value> + <type>string</type> + </param> + <param> + <name>Function Name</name> + <key>function_name</key> + <value>get_number</value> + <type>string</type> + </param> + <param> + <name>Function Args</name> + <key>function_args</key> + <value></value> + <type>string</type> + <hide>#if $function_args() then 'none' else 'part'#</hide> + </param> + <param> + <name>Poll Rate (Hz)</name> + <key>poll_rate</key> + <value>10</value> + <type>real</type> + </param> + <doc> +Periodically probe a function and set its value to this variable. + +Set the values for block ID, function name, and function args appropriately: \ +Block ID should be the ID of another block in this flow graph. \ +Function name should be the name of a class method on that block. \ +Function args are the parameters passed into that function. \ +For a function with no arguments, leave function args blank. \ +When passing a string for the function arguments, quote the string literal: '"arg"'. + +The values will used literally, and generated into the following form: +self.block_id.function_name(function_args) + +To poll a stream for a level, use this with the probe signal block. + </doc> +</block> |