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