Python Block Message Passing: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:


== Starting the Message Passing Flowgraph ==
== Starting the Message Passing Flowgraph ==
The following flowgraph will demonstrate how to:
* Add message sending and receiving ports to Python blocks
* Transmit messages
* Receive and handle messages
* Adapt block behavior in the ''work()'' function based on a received messages


== PMT ==
== PMT ==

Revision as of 15:55, 24 January 2022

Template:TutorialNavigation


The previous tutorial, Creating Your First Block, demonstrates how to create a Python block using the Embedded Python Block. The next tutorial, Low Pass Filter Example, demonstrates how to use filtering blocks in GNU Radio.

Message Overview

Messages are an asynchronous way to send information between blocks. Messages are good at conveying control data, maintaining a consistent state across blocks and providing some forms of non-data feedback to blocks in a flowgraph.

Messages have a couple unique properties:

  • There is no sample-clock based guarantee when messages will arrive
  • Messages are not associated with a specific sample like a tag
  • Message input and output ports do not have to be connected in GRC
  • Message ports use the Polymorphic Type (PMT)

Message ports are denoted by a grey color and their connections are distinguished by dashed lines:

MessageBlockExample.png

Starting the Message Passing Flowgraph

The following flowgraph will demonstrate how to:

  • Add message sending and receiving ports to Python blocks
  • Transmit messages
  • Receive and handle messages
  • Adapt block behavior in the work() function based on a received messages

PMT

describe basic PMT types

link against other PMT pages

Creating a Message Output Port

  • saving code 'compiles' the python and error messages are displayed the EPB window



  • message ports do not have to be connected like stream/vector ports






The next tutorial, Low Pass Filter Example, demonstrates how to use filtering blocks in GNU Radio.