UPD: Works great!
----------
class blk(gr.basic_block):
     def __init__(self):
         gr.sync_block.__init__(
             self,
             name='Message Pair Multiplexer',
             in_sig=None,
             out_sig=None
         )
         self.message_port_register_in(pmt.intern('msg_in'))
         self.set_msg_handler(pmt.intern('msg_in'), self.handle_msg)
         self.variables = [
             'amp',
             'freq',
             'test',
             'whatever',
         ]
         for var in self.variables:
             self.message_port_register_out(pmt.intern(var))
     def handle_msg(self, msg):
         # i rewrote this line from memory so might have messed up whoops
         if pmt.serialize_str(pmt.car(msg)) in self.variables:
             self.message_port_pub(pmt.car(msg), msg)
     def work(self, input_items, output_items):
         pass
----------
Sometimes the clearest answers come up while writing the question out. I 
hope this post will help other beginners like me in the future.
No comments:
Post a Comment