I am trying to understand how the message source works
and how I can use it from within my python code.
So I wrote a simple script with a message source and a null sink.
I wanted the following behavior:
every time I press a button on my keybord to send a constant message in
the queue and verify that the queue size has increased.
Here is the piece of code that I have so far…
What I don’t know how to do is to enqueue a message every time
I press a button.
Can someone point to the right direction as to how this event driven
behavior is implemented.
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_option import eng_option
from optparse import OptionParser
def __init__(self): gr.flow_graph.__init__(self) packet = 'abcdefghijklmnopqrstuwxy' #multiple of
src0 = gr.message_source(gr.sizeof_float,10) dst = gr.null_sink (gr.sizeof_float) self.connect (src0, dst) # Now I want every time I press a button to run the following
# so that I add the same msg in the message queue