Hi everyone,

I've got a problem with messages and message queues. The problem is
simply that I just cannot figure out how to use them. I tried the
simple program that is attached to this email (test.py), and the
result is in test.log. If anybody has the time to take a quick look at
the code and point me in the right direction, I would be very
thankful!

Regards,

--
Trond Danielsen
#!/usr/bin/env python

from gnuradio import gr

class testing(gr.top_block):
    def __init__(self):
        gr.top_block.__init__(self, "testing")

        self.src = gr.vector_source_f( range(200), False )

        self.mq = gr.msg_queue()
        self.sink = gr.message_sink(gr.sizeof_float, self.mq, False)
        self.connect( self.src, self.sink )

def main():
    top_block = testing()
    runtime = gr.runtime(top_block)

    try:
        runtime.start()

        print "queue"
        print top_block.mq.count()

        msg = top_block.mq.delete_head()
        print "msg"
        print msg.type()
        print msg.arg1()
        print msg.arg2()
        print msg.length()

        runtime.wait()
    except KeyboardInterrupt:
        pass

if __name__ == "__main__":
    main()

# vim: ai ts=4 sts=4 et sw=4

connecting: vector_source_f(1):0 -> message_sink(2):0
Setting runtime on 0x6923a0 to 0x6918c0
start: entered
flattening testing
Flattening edge vector_source_f(1):0->message_sink(2):0
Validating block: message_sink(2)
Validating block: vector_source_f(1)
Creating block detail for message_sink(2)
Creating block detail for vector_source_f(1)
Allocating new buffer for output 0
Setting input 0 from edge vector_source_f(1):0->message_sink(2):0
start_threads: entered
start_threads: starting 0x6d26f0
queue
0
msg
0
4.0
200.0
800
wait: entered
wait: joining thread 0x6d26f0
wait: join returned
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to