diff options
Diffstat (limited to 'grc/blocks/variable_function_probe.xml')
-rw-r--r-- | grc/blocks/variable_function_probe.xml | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/grc/blocks/variable_function_probe.xml b/grc/blocks/variable_function_probe.xml deleted file mode 100644 index 47c11b29fe..0000000000 --- a/grc/blocks/variable_function_probe.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?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> -def _$(id)_probe(): - while True: - #set $obj = 'self' + ('.' + $block_id() if $block_id() else '') - val = $(obj).$(function_name())($(function_args())) - try: - self.set_$(id)(val) - except AttributeError: - 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>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> - <param> - <name>Initial Value</name> - <key>value</key> - <value>0</value> - <type>raw</type> - <hide>part</hide> - </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. \ -An empty Block ID references the flow graph itself. \ -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) -or, if the Block ID is empty, - self.function_name(function_args) - -To poll a stream for a level, use this with the probe signal block. - </doc> -</block> |