# Check The output of a block & input captured frames to GNURadio

**URL:** <https://www.ruby-forum.com/t/check-the-output-of-a-block-input-captured-frames-to-gnuradio/240125>\
**Category:** GNU Radio\
**Created:** [March 28, 2014, 11:07pm UTC](https://www.ruby-forum.com/t/check-the-output-of-a-block-input-captured-frames-to-gnuradio/240125 "2014-03-28T23:07:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [March 28, 2014, 11:07pm UTC](https://www.ruby-forum.com/t/check-the-output-of-a-block-input-captured-frames-to-gnuradio/240125/1 "2014-03-28T23:07:35Z")

</div>

I want to make a test and see the output , I put 3 blocks , vector  
source ,  
throttle and vector sink . I edited the “vector” parameter in vector  
source  
block to (6,6). All 3 blocks have a type “byte”. I generated the flow  
graph.  
I moved to the directory of grc file , I wrote in terminal  
vim top\_block.py  
then I write to the end of file : " print  
tb.blocks\_vector\_sink\_x\_0.data()"  
and saved the changes . Then I execute the python file by writing in  
terminal :  
./top\_block.py  
But the output takes too long time and doesn’t appear ! what is the  
problem  
?  
and is there any other method to see the output ???As I am a beginner  
and  
someone told me this method.  
I tried this for example 10 times but every time it takes too long and  
doesn’t appear , only one time it appears!

Another question :  
If I have captured some frames using wireshark (from twinkle softphone),  
and I saved them .I want to make them an input to ofdm transmitter .  
How  
to make them an input?

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Sara\_ChSSrif](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ba0ec/32.png) [@Sara\_ChSSrif](https://www.ruby-forum.com/u/Sara_ChSSrif)\
**Post date:** [March 29, 2014, 12:52am UTC](https://www.ruby-forum.com/t/check-the-output-of-a-block-input-captured-frames-to-gnuradio/240125/2 "2014-03-29T00:52:43Z")

</div>

I found that “tb.wait()” is written in the file so it takes too long  
time .  
Now after I erased tb.wait() .. the output on terminal is —\> ( ) .. I  
don’t know why ?? Here is what is written in top\_block.py

#!/usr/bin/env python  
##################################################

# Gnuradio Python Flow Graph

# Title: Top Block

# Generated: Sat Mar 29 01:47:01 2014

##################################################

from gnuradio import blocks  
from gnuradio import eng\_notation  
from gnuradio import gr  
from gnuradio.eng\_option import eng\_option  
from gnuradio.filter import firdes  
from grc\_gnuradio import wxgui as grc\_wxgui  
from optparse import OptionParser  
import wx

class top\_block(grc\_wxgui.top\_block\_gui):

```
def __init__ (self):
    grc_wxgui.top_block_gui. __init__ (self, title="Top Block")
    _icon_path = 

```

“/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png”  
self.SetIcon(wx.Icon(\_icon\_path, wx.BITMAP\_TYPE\_ANY))

```
    ##################################################
    # Variables
    ##################################################
    self.samp_rate = samp_rate = 32000

    ##################################################
    # Blocks
    ##################################################
    self.blocks_vector_source_x_0 = blocks.vector_source_b((6, 6),

```

True, 1, )  
self.blocks\_vector\_sink\_x\_0 = blocks.vector\_sink\_b(1)  
self.blocks\_throttle\_0 = blocks.throttle(gr.sizeof\_char\*1,  
samp\_rate,True)

```
    ##################################################
    # Connections
    ##################################################
    self.connect((self.blocks_vector_source_x_0, 0),

```

(self.blocks\_throttle\_0, 0))  
self.connect((self.blocks\_throttle\_0, 0),  
(self.blocks\_vector\_sink\_x\_0, 0))

4,1 Top

# QT sink close method reimplementation

```
def get_samp_rate(self):
    return self.samp_rate

def set_samp_rate(self, samp_rate):
    self.samp_rate = samp_rate
    self.blocks_throttle_0.set_sample_rate(self.samp_rate)

```

if **name** == ‘ **main** ’:  
import ctypes  
import sys  
if sys.platform.startswith(‘linux’):  
try:  
x11 = ctypes.cdll.LoadLibrary(‘libX11.so’)  
x11.XInitThreads()  
except:  
print “Warning: failed to XInitThreads()”  
parser = OptionParser(option\_class=eng\_option, usage=“%prog:  
[options]”)  
(options, args) = parser.parse\_args()  
tb = top\_block()  
tb.Start(True)  
print tb.blocks\_vector\_sink\_x\_0.data()

2014-03-29 0:06 GMT+02:00 Sara C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Sara\_ChSSrif](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ba0ec/32.png) [@Sara\_ChSSrif](https://www.ruby-forum.com/u/Sara_ChSSrif)\
**Post date:** [March 29, 2014, 9:25am UTC](https://www.ruby-forum.com/t/check-the-output-of-a-block-input-captured-frames-to-gnuradio/240125/3 "2014-03-29T09:25:33Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Don’t erase stuff because it takes time…  
tb.wait() is necessary to let the top block wait for all the work to  
finish.  
GNU Radio flowgraphs will run until a) a block signals that it’s done,  
or b) the flow graph is stopped.  
I think you want to use the “a)” approach. Add a Head block into your  
flowgraph:

> **[GNU Radio Manual and C++ API Reference: gr::blocks::head Class Reference](https://www.gnuradio.org/doc/doxygen/classgr_1_1blocks_1_1head.html)**

Your flow graph will then terminate after a specified number of  
samples has passed the head block.

So what your program does is  
tb.start()  
tb.wait()  
outpput=sink.data()

Greetings,  
Marcus

On 29.03.2014 00:51, Sara C. wrote:

> self.SetIcon(wx.Icon(\_icon\_path, wx.BITMAP\_TYPE\_ANY))  
> samp\_rate,True)
> 
> (options, args) = parser.parse\_args() tb = top\_block()
> 
> > of grc file , I wrote in terminal vim top\_block.py then I write  
> > an input to ofdm transmitter . How to make them an input?

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1  
Comment: Using GnuPG with Thunderbird - [http://www.enigmail.net/](http://www.enigmail.net/)

iQEcBAEBAgAGBQJTNoMgAAoJEBQ6EdjyzlHtL0AH/iStidlKCfhombUBd6bHbS8t  
4M8cPCIYcIecYKRdavevc+lvqSKviNuzehhhBLrOQHRgCP7XFh63Tf+newFH0bWa  
O8LQx+xssVdQDPTtbBUzjDLnszJium94YrPsqXp4re+qZR341UEkf7s7UzHzWxff  
CnRdzH1oiUgJ1C7oeHS3PzKu9JUEjAznhXnf99X5wysA4CRf5W5LHfHqnKL0z0Z7  
EMEOrQ7vquGV6Ky6T10NxxqiTPEzw3HOgpoM6PfXSPNcfoZ+THBVdTNVStR6Em5Q  
yYrDFUgGU123VoebQYtEBQxIpBjoYvwyrK3O3v/tZEMn/WSpHTiEh7REV9slA5I=  
=abZB  
-----END PGP SIGNATURE-----
