python - Is it possible to access work function's variable in __init__ of a GNU Radio block? -
in following gnu radio processing block, can't figure out who/what passes value of input_items
work
function in first place. possible pass value __init__
function instead?
i have file xyz.py :
class xyz(gr.sync_block): """ docstring block add_python """ def __init__(self, parent, title, order): gr.sync_block.__init__(self, name="xyz", in_sig=[numpy.float32,numpy.float32], out_sig=none) ................ ................ //i want access value of input_items here ............... ............... def work(self, input_items, output_items): ................
the __init__
function called once "initialize" new instance of class. has nothing moving data through flowgraph, besides setting input , output types block can connected.
so, in top_block
, might have:
proc = xyz() # xyz's __init__ called here self.connect(source, proc, sink) # still no input_items, connected flowgraph
and later on, run flowgraph:
tb = top_block() tb.run() # 'input_items' passed 'work' of each block in succession
when run flowgraph, gnu radio scheduler takes number of samples source block , puts them in buffer. passes buffer work
function of next block in flowgraph, along "empty" buffer output items.
so work
function of each block called automatically scheduler when there data process. __init__
can not have access of parameters work
, because input_items
has not been passed work
@ time __init__
called.
Comments
Post a Comment