5 changed files with 1 additions and 110 deletions
@ -1,38 +0,0 @@ |
|||||||
<?xml version="1.0"?> |
|
||||||
<block> |
|
||||||
<name>Multi RDS Printer</name> |
|
||||||
<key>multirds_multi_rds_printer</key> |
|
||||||
<category>[multirds]</category> |
|
||||||
<import>import multirds</import> |
|
||||||
<make>multirds.multi_rds_printer($print_freq,$nPorts)</make> |
|
||||||
<!-- Make one 'param' node for every Parameter you want settable from the GUI. |
|
||||||
Sub-nodes: |
|
||||||
* name |
|
||||||
* key (makes the value accessible as $keyname, e.g. in the make node) |
|
||||||
* type --> |
|
||||||
<param> |
|
||||||
<name>Print Frequency</name> |
|
||||||
<key>print_freq</key> |
|
||||||
<value>10</value> |
|
||||||
<type>int</type> |
|
||||||
</param> |
|
||||||
|
|
||||||
<!-- Make one 'sink' node per input. Sub-nodes: |
|
||||||
* name (an identifier for the GUI) |
|
||||||
* type |
|
||||||
* vlen |
|
||||||
* optional (set to 1 for optional inputs) --> |
|
||||||
<param> |
|
||||||
<name>Number of Ports</name> |
|
||||||
<key>nPorts</key> |
|
||||||
<value>2</value> |
|
||||||
<type>int</type> |
|
||||||
<hide>part</hide> |
|
||||||
</param> |
|
||||||
<sink> |
|
||||||
<name>in</name> |
|
||||||
<type>message</type> |
|
||||||
<nports>$nPorts</nports> |
|
||||||
<!--<optional>1</optional>--> |
|
||||||
</sink> |
|
||||||
</block> |
|
||||||
@ -1,69 +0,0 @@ |
|||||||
#!/usr/bin/env python |
|
||||||
# -*- coding: utf-8 -*- |
|
||||||
# |
|
||||||
# Copyright 2016 <+YOU OR YOUR COMPANY+>. |
|
||||||
# |
|
||||||
# This is free software; you can redistribute it and/or modify |
|
||||||
# it under the terms of the GNU General Public License as published by |
|
||||||
# the Free Software Foundation; either version 3, or (at your option) |
|
||||||
# any later version. |
|
||||||
# |
|
||||||
# This software is distributed in the hope that it will be useful, |
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
# GNU General Public License for more details. |
|
||||||
# |
|
||||||
# You should have received a copy of the GNU General Public License |
|
||||||
# along with this software; see the file COPYING. If not, write to |
|
||||||
# the Free Software Foundation, Inc., 51 Franklin Street, |
|
||||||
# Boston, MA 02110-1301, USA. |
|
||||||
# |
|
||||||
|
|
||||||
import numpy,pmt,functools |
|
||||||
from gnuradio import gr |
|
||||||
|
|
||||||
class multi_rds_printer(gr.sync_block): |
|
||||||
""" |
|
||||||
docstring for block multi_rds_printer |
|
||||||
""" |
|
||||||
def __init__(self, print_freq,nPorts): |
|
||||||
gr.sync_block.__init__(self, |
|
||||||
name="multi_rds_printer", |
|
||||||
in_sig=None, |
|
||||||
out_sig=None) |
|
||||||
self.PS="station name" |
|
||||||
self.RT="radio text" |
|
||||||
self.PI="C0FE" |
|
||||||
self.stations = {} |
|
||||||
self.print_freq = print_freq |
|
||||||
self.print_count=print_freq |
|
||||||
for i in range(0,nPorts): |
|
||||||
self.message_port_register_in(pmt.intern('in%d'%i)) |
|
||||||
self.set_msg_handler(pmt.intern('in%d'%i), functools.partial(self.handle_msg, port=i)) |
|
||||||
def handle_msg(self, msg, port): |
|
||||||
t = pmt.to_long(pmt.tuple_ref(msg, 0)) |
|
||||||
m = pmt.symbol_to_string(pmt.tuple_ref(msg, 1)) |
|
||||||
#code.interact(local=locals()) |
|
||||||
if(t==0): |
|
||||||
self.PI=m |
|
||||||
self.stations[str(port)+"PI"]=m |
|
||||||
elif(t==1): |
|
||||||
self.PS=m |
|
||||||
self.stations[str(port)+"PS"]=m |
|
||||||
elif(t==4): |
|
||||||
self.RT=m |
|
||||||
self.stations[str(port)+"RT"]=m |
|
||||||
self.print_count -= 1 |
|
||||||
#print(self.stations) |
|
||||||
if (self.print_count==0): |
|
||||||
self.print_count=self.print_freq |
|
||||||
print("########## stations ###########") |
|
||||||
for key in sorted(self.stations): |
|
||||||
print("%s: %s" % (key, self.stations[key])) |
|
||||||
# def work(self, input_items, output_items): |
|
||||||
# in0 = input_items[0] |
|
||||||
# out = output_items[0] |
|
||||||
# # <+signal processing here+> |
|
||||||
# out[:] = in0 |
|
||||||
# return len(output_items[0]) |
|
||||||
|
|
||||||
Loading…
Reference in new issue