Message Pair to Var: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(add detail)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This block converts an input message pair to the value of a gnuradio variable.
<p>This block converts an input message pair to the value of a gnuradio variable.</p>
<code>Added in 3.9</code>


== Parameters ==
== Parameters ==
Line 9: Line 10:
== Messages ==
== Messages ==


Input message pairs are of the form (<name> . <value>). More information can be found in [[Polymorphic_Types_(PMTs)#Pairs|PMT Pairs]].
Input message pairs are of the form (<name> . <value>). For this block, <name> is ignored. The variable to be set is specified as a block parameter. More information on PMTs in general can be found in [[Polymorphic_Types_(PMTs)#Pairs|PMT Pairs]].


== Example Flowgraph ==
== Example Flowgraph ==
Line 23: Line 24:
== Source Files ==
== Source Files ==


; C++ files
; Python file
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/python/blocks/msg_pair_to_var.py msg_pair_to_var.py]
 
; Header files
: [https://github.com/gnuradio/gnuradio TODO]
 
; Public header files
: [https://github.com/gnuradio/gnuradio TODO]


; Block definition
; Block definition
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/grc/blocks_msg_pair_to_var.block.yml blocks_msg_pair_to_var.block.yml]


[[Category:Block Docs]]
[[Category:Block Docs]]

Latest revision as of 08:38, 1 September 2025

This block converts an input message pair to the value of a gnuradio variable.

Added in 3.9

Parameters

(R): Run-time adjustable

Variable
Name of the variable to be set. type: string; default: 'freq'

Messages

Input message pairs are of the form (<name> . <value>). For this block, <name> is ignored. The variable to be set is specified as a block parameter. More information on PMTs in general can be found in PMT Pairs.

Example Flowgraph

In this flowgraph, the input message has the name 'value' and the value of 1 or 0. The Message Pair to Var Block Variable has the value "pressed", so it sets the variable "pressed" to 1. The QT_GUI_Label displays the value of "pressed".

Msg pair to var fg.png

Example Output

Msg pair to var out.png

Source Files

Python file
msg_pair_to_var.py
Block definition
blocks_msg_pair_to_var.block.yml