Changeset 9776
- Timestamp:
- 10/10/08 22:59:23
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/trunk/grc/data/platforms/python/blocks/variable_sink.xml
r9772 r9776 8 8 <name>Variable Sink</name> 9 9 <key>variable_sink</key> 10 <import>from grc_gnuradio import blks2 as grc_blks2</import> 11 <make>grc_blks2.queue_sink_$(type.fcn)($vlen) 12 grc_blks2.queue_sink_thread(self.$id, self.set_$(variable))</make> 10 <import>from gnuradio import gr</import> 11 <import>import threading</import> 12 <import>import time</import> 13 <make>gr.vector_sink_$(type.fcn)() 14 def _$(id)_run(): 15 while True: 16 time.sleep(1.0/$samp_rate) 17 data = self.$(id).data() 18 #if $vlen.eval == 0 19 if data: 20 self.set_$(variable.eval)(data[-1]) 21 self.$(id).clear() 22 #else 23 if len(data) >= $vlen: 24 self.set_$(variable.eval)(data[-($vlen):]) 25 self.$(id).clear() 26 #end if 27 threading.Thread(target=_$(id)_run).start()</make> 13 28 <param> 14 29 <name>Type</name> … … 45 60 <key>variable</key> 46 61 <value></value> 47 <type>raw</type> 62 <type>string</type> 63 </param> 64 <param> 65 <name>Sample Rate</name> 66 <key>samp_rate</key> 67 <value>10</value> 68 <type>real</type> 48 69 </param> 49 70 <param> 50 71 <name>Vec Length</name> 51 72 <key>vlen</key> 52 <value> 1</value>73 <value>0</value> 53 74 <type>int</type> 54 75 </param> 55 <check>$vlen > 0</check>76 <check>$vlen >= 0</check> 56 77 <sink> 57 78 <name>in</name> 58 79 <type>$type</type> 59 <vlen>$vlen</vlen>60 80 </sink> 61 81 <doc> 62 Read samples from the input stream and write each sample to the variable.82 Read samples at from the input stream and write each sample to the variable. 63 83 64 84 The variable must be the id of an existing variable block. 85 86 When the vector length is 0, the variable will be set to numbers. \ 87 When the vector length is > 0, the variable will be set to vectors. 65 88 </doc> 66 89 </block> gnuradio/trunk/grc/src/grc_gnuradio/blks2/Makefile.am
r9741 r9776 29 29 packet.py \ 30 30 probe.py \ 31 queue.py \32 31 selector.py
