blob: e31cf92e6dd4adf4f4043c4a93a509229d971de1 [file] [log] [blame]
Piotr Krysik8d7b64d2017-11-08 14:34:02 +01001"""
2Embedded Python Blocks:
3
4Each this file is saved, GRC will instantiate the first class it finds to get
5ports and parameters of your block. The arguments to __init__ will be the
6parameters. All of them are required to have default values!
7"""
8import numpy as np
9from gnuradio import gr
10import pmt
11
12class burst_to_fn_time(gr.basic_block):
13 def __init__(self): # only default arguments here
14 gr.basic_block.__init__(
15 self,
16 name='Burst to fn_time',
17 in_sig=[],
18 out_sig=[]
19 )
20 self.message_port_register_in(pmt.intern("bursts_in"))
21 self.message_port_register_out(pmt.intern("fn_time_out"))
22 self.set_msg_handler(pmt.intern("bursts_in"), self.convert)
23
24 def convert(self, msg):
25 fn_time = pmt.dict_ref(pmt.car(msg),pmt.intern("fn_time"),pmt.PMT_NIL)
26 fn_time_msg = pmt.dict_add(pmt.make_dict(), pmt.intern("fn_time"), fn_time)
27 if pmt.to_python(fn_time) is not None:
28 self.message_port_pub(pmt.intern("fn_time_out"), fn_time_msg)