discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] New python block gr_modtool - When no inputs/outputs,


From: Jorge Gallo
Subject: [Discuss-gnuradio] New python block gr_modtool - When no inputs/outputs, which parent should I use?
Date: Tue, 24 Feb 2015 10:36:14 +0100

Hello,

I tried to implement a python block which generates tuning commands every 5 seconds.
     Python block: 0 inputs, 0 outputs, 1 out_msg port which must be declared in the constructor.

I used gr_modtool. I got some trouble that I think can be easily solved.


New python block:

#!/usr/bin/env python
import numpy
from gnuradio import gr
import time

class generador_NN(SOMETHING_1):
    def __init__(self):
        SOMETHING_1.__init__(SOMETHING_2)
    self.message_port_register_out(pmt.intern("ppm"))


    def general_work(self):
    while True:
        time.sleep(5)
        self.message_port_pub(pmt.intern("ppm"), pmt.to_pmt("freq", float(915e6)))
        time.sleep(5)
        self.message_port_pub(pmt.intern("ppm"), pmt.to_pmt("freq", float(916e6)))


My trouble comes where the "SOMETHING" is:

SOMETHING_1: gr.sync_block, gr.basic_block, gr.noblock ¿?
When using gr_mod tool, which kind of block must specify? If I use sync or basic it complaints there are missing input/outputs. On the other hand if I write noblock there is no message_port_register_out method available.
How can I solve that?


SOMETHING_2: Depends which kind of block is the parent. Since there is no input/output it must be empty (self). Correct?

Many thanks,
Jorge

reply via email to

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