[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Question about hier block
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] Question about hier block |
Date: |
Fri, 26 Mar 2010 14:07:19 -0700 |
User-agent: |
Mutt/1.5.20 (2009-08-17) |
On Fri, Mar 26, 2010 at 05:23:34PM +0100, Axel Belliard wrote:
> Hi
>
> I'm trying to make a very simple hier block. ( see the code below). When I
> execute my top block i get no error, but the data seems to never enter the
> hier block ( the print-line prints : "()"). What am I doing wrong?
You're printing from the constructor, before the graph has been run.
>
>
> ####my hier block#########
> from gnuradio import gr
> class Trameur(gr.hier_block2):
> def __init__(self):
> gr.hier_block2.__init__(self, "Trameur",gr.io_signature(1, 1,
> gr.sizeof_char),gr.io_signature(1, 1, gr.sizeof_char))
>
>
> #####input####
> self.in_data = gr.vector_sink_b()
> self.connect(self ,self.in_data)
> self.src_data = self.in_data.data()
> print self.src_data
>
> #######output###########"
> self.out_data = gr.vector_source_b (self.src_data)
> self.connect(self.out_data , self)
>
> #####################My top block############################
>
>
> from gnuradio import gr
> from Trameur_stanag import Trameur
> class top(gr.top_block):
> def __init__(self):
> gr.top_block.__init__(self)
>
> self.src_data =
> (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
>
> self.in_data = gr.vector_source_b(self.src_data)
> self.tramage = Trameur ()
> self.sink2=gr.vector_sink()
>
> self.connect( self.in_data, self.tramage)
> self.connect(self.tramage, self.sink2)
>
> if __name__ == '__main__':
> try:
> tb = top()
> tb.run()
> except KeyboardInterrupt:
> pass