Search code examples
gnuradiognuradio-companion

Detect a keypress in GNURadio


How would I detect a keypress inside of GNURadio, or even more specifically how would I change a variable if a key is down or up?

[Edit] Example: A push to talk on a SDR driven HAM radio station thats using GNUradio, so when I press 'V' (on my keyboard) I transmit, this could be done by changing the value of a variable, which is used in a selector to select between a null source and an audio source


Solution

  • It depends on the event that you are waiting for. For example if your variable can take one of two values and you just use QT pushbutton to toggle between them, then you may list these two values in some variable and use pushbutton as an index to it, this flowgraph demonstrates how to toggle signal source frequency using a pushbutton. https://drive.google.com/open?id=1PXb9755C4iGBOYHwXZytHH-TnmmELPpg

    But if your event is waited from another process, then I recommend you to use zmq to do RPC, or even xmlrpc(client/server). you can find a very good example of how to use zmq in /usr/local/share/gnuradio/examples/zeromq.

    I hope this helps.