commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9776 - in gnuradio/trunk/grc: data/platforms/python/b


From: jblum
Subject: [Commit-gnuradio] r9776 - in gnuradio/trunk/grc: data/platforms/python/blocks src/grc_gnuradio/blks2
Date: Fri, 10 Oct 2008 22:59:24 -0600 (MDT)

Author: jblum
Date: 2008-10-10 22:59:23 -0600 (Fri, 10 Oct 2008)
New Revision: 9776

Removed:
   gnuradio/trunk/grc/src/grc_gnuradio/blks2/queue.py
Modified:
   gnuradio/trunk/grc/data/platforms/python/blocks/variable_sink.xml
   gnuradio/trunk/grc/src/grc_gnuradio/blks2/Makefile.am
Log:
use vector sink inside variable sink

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/variable_sink.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/variable_sink.xml   
2008-10-11 03:45:09 UTC (rev 9775)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/variable_sink.xml   
2008-10-11 04:59:23 UTC (rev 9776)
@@ -7,9 +7,24 @@
 <block>
        <name>Variable Sink</name>
        <key>variable_sink</key>
-       <import>from grc_gnuradio import blks2 as grc_blks2</import>
-       <make>grc_blks2.queue_sink_$(type.fcn)($vlen)
-grc_blks2.queue_sink_thread(self.$id, self.set_$(variable))</make>
+       <import>from gnuradio import gr</import>
+       <import>import threading</import>
+       <import>import time</import>
+       <make>gr.vector_sink_$(type.fcn)()
+def _$(id)_run():
+       while True:
+               time.sleep(1.0/$samp_rate)
+               data = self.$(id).data()
+#if $vlen.eval == 0
+               if data:
+                       self.set_$(variable.eval)(data[-1])
+                       self.$(id).clear()
+#else
+               if len(data) &gt;= $vlen:
+                       self.set_$(variable.eval)(data[-($vlen):])
+                       self.$(id).clear()
+#end if
+threading.Thread(target=_$(id)_run).start()</make>
        <param>
                <name>Type</name>
                <key>type</key>
@@ -44,23 +59,31 @@
                <name>Variable</name>
                <key>variable</key>
                <value></value>
-               <type>raw</type>
+               <type>string</type>
        </param>
        <param>
+               <name>Sample Rate</name>
+               <key>samp_rate</key>
+               <value>10</value>
+               <type>real</type>
+       </param>
+       <param>
                <name>Vec Length</name>
                <key>vlen</key>
-               <value>1</value>
+               <value>0</value>
                <type>int</type>
        </param>
-       <check>$vlen &gt; 0</check>
+       <check>$vlen &gt;= 0</check>
        <sink>
                <name>in</name>
                <type>$type</type>
-               <vlen>$vlen</vlen>
        </sink>
        <doc>
-Read samples from the input stream and write each sample to the variable.
+Read samples at from the input stream and write each sample to the variable.
 
 The variable must be the id of an existing variable block.
+
+When the vector length is 0, the variable will be set to numbers. \
+When the vector length is > 0, the variable will be set to vectors.
        </doc>
 </block>

Modified: gnuradio/trunk/grc/src/grc_gnuradio/blks2/Makefile.am
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/blks2/Makefile.am       2008-10-11 
03:45:09 UTC (rev 9775)
+++ gnuradio/trunk/grc/src/grc_gnuradio/blks2/Makefile.am       2008-10-11 
04:59:23 UTC (rev 9776)
@@ -28,5 +28,4 @@
        error_rate.py \
        packet.py \
        probe.py \
-       queue.py \
        selector.py

Deleted: gnuradio/trunk/grc/src/grc_gnuradio/blks2/queue.py





reply via email to

[Prev in Thread] Current Thread [Next in Thread]