Hi Rich,

sounds like a job for gr-eventstream[1] to only put in info when some
event occured (i.e. when a message was sent to the eventstream block),
and maybe gr-msgtools to convert the change in variable value from a "QT
GUI Pushbutton" to a message, and a self-written (might be simple enough
to do in Python) block that has a message input and a message output
and, upon change, sends a event-stream-event-compatible message to the
event stream source, containing the contents of the file.  Then you'd
write a mux and be done.

To be completely honest, though it's a bit like re-inventing
gr-eventstream, I'd probably just use the aforementioned pushbutton,
convert its pushbutton variable change to a message using gr-msgtools'
Variable To Message block to convert that to a variable, and write a
quick C++ or python block that has a "passthrough" stream input, a
"interject" message input, and a stream output. Whenever there's a
"pressed" message, it would disrupt its normal activity of passing
through the input, and change into a state of inserting samples from a
file, till the complete file is read completely. Sounds like not-so-much
code.

Note that message handling happens asynchronous, ie. only *in between*
calls to work. So, always consider that handling a message of this sorts
has a worst-case latency of f_sample * size_of_output buffer + Python/Qt
overhead. Luckily, you can restrict the output buffer size, or you could
even intentionally never produce too many samples at once.

Best regards,

Marcus

[1]
https://oshearesearch.com/index.php/2015/03/15/burst-transmission-in-gnu-radio-sample-streams-with-eventstream/


On 25.07.2016 20:28, Richard Bell wrote:
> Hello,
>
> I need to let the user select which input stream to transmit by
> pushing a button on the GUI. By default, the transmitter transmits
> random data until the user clicks the button, at which point a file is
> transmitted.
>
> It is important that the entire file be transmitted, from the
> beginning. This means that the file data stream can't be dropped to
> the floor until the user clicks the button, it must apply back
> pressure from the selector block to the file source block until the
> user presses the button.
>
> The selector block uses a null sink for each stream that isn't
> connected to the output, so I loose the ability to send the file from
> the beginning. In addition, the selector is causing the flowgraph to
> close with return code -11 and no other message.
>
> Does someone have an idea of how I could do this using GRC?
>
> Thank you,
> Rich
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to