1

I have an input to a Threshold block, which I have verified is working with a QT GUI number sink.

QT GUI number sink

I want to print the output of the Threshold block to console, preferably using the Message Debug block.

However, the output of the Threshold block is a float stream, which doesn't match the input of the Message Debug block.

Is there a way to convert a float stream into message, or am I going down the wrong hole?

My general aim is: when the input exceeds a certain threshold, print to console. Another program will monitor the console and when there is a print out, this triggers another action. I'm also not sure how to output ONLY when the threshold is exceeded, but one problem at a time.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
Faith
  • 37
  • 9
  • what do you want to do with these numbers after printing? (I'm pretty sure that yes, you're going down the wrong hole). – Marcus Müller Aug 08 '18 at 10:19
  • My general aim is: when the input exceeds a certain threshold, print to console. Another program will monitor the console and when there is a print out, this triggers another action. I'm also not sure how to output ONLY when the threshold is exceeded, but one problem at a time. – Faith Aug 08 '18 at 18:32
  • Yeah, that's a problem: there's no guarantee about nothing else writing to standard output in GNU Radio. So, don't rely on that! There's an easier solution, though – Marcus Müller Aug 08 '18 at 18:48

1 Answers1

1

I'm also not sure how to output ONLY when the threshold is exceeded, but one problem at a time.

Yes, but that problem is a blocker: Std output is a shared thing across all things in the GNU Radio process, so you can't generally guarantee exclusivity.

Let's not go down that route!

Instead, use something designed for exactly for this kind of things decades ago in UNIX!

Named pipes. These are FIFOs that you can handle like files.

So, use a file source to write to a FIFO, and pipe that FIFO into your other program.

It's really simple:

  • mkfifo /path/to/where/you/want/to/named/pipe
  • add a file sink that writes to /path/to/where/you/want/to/named/pipe
  • either make your other software open that /path/to/where/you/want/to/named/pipe, or do something like other_program < /path/to/where/you/want/to/named/pipe (that actually makes the standard (==console-equivalent) input of your other program what you write to that file sink)
Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
  • Thank you so much!!!! Also, would like to add running od -f /.../pipe outputs the file sink content properly. – Faith Aug 08 '18 at 20:11
  • and automatically, there is only output when the threshold is exceeded. – Faith Aug 08 '18 at 20:21