Browse Source

gr_modtool mv max_freq station_search

gr_modtool mv sync_decim symbol_combiner

renamed blocks
dev
Clemens Richter 8 years ago
parent
commit
fb5fa7e215
  1. 4
      grc/CMakeLists.txt
  2. 6
      grc/multirds_station_search.xml
  3. 6
      grc/multirds_symbol_combiner.xml
  4. 2
      include/multirds/CMakeLists.txt
  5. 16
      include/multirds/symbol_combiner.h
  6. 2
      lib/CMakeLists.txt
  7. 20
      lib/symbol_combiner_impl.cc
  8. 14
      lib/symbol_combiner_impl.h
  9. 2
      python/CMakeLists.txt
  10. 219
      python/RDS-decoder-instanciation.grc
  11. 2
      python/__init__.py
  12. 6
      python/station_search.py
  13. 105
      python/top_block.py
  14. 6
      swig/multirds_swig.i

4
grc/CMakeLists.txt

@ -20,11 +20,11 @@ install(FILES
multirds_rds_table_qt.xml
multirds_rds_parser_table_qt.xml
multirds_rds_decoder.xml
multirds_max_freq.xml
multirds_station_search.xml
multirds_stream_selector.xml
multirds_vector_cutter.xml
multirds_decoder_compare.xml
multirds_sync_decim.xml
multirds_symbol_combiner.xml
multirds_rds_decoder_redsea.xml
multirds_qtgui_range.xml
multirds_variable_setter.xml

6
grc/multirds_max_freq.xml → grc/multirds_station_search.xml

@ -1,10 +1,10 @@
<?xml version="1.0"?>
<block>
<name>max_freq</name>
<key>multirds_max_freq</key>
<name>station_search</name>
<key>multirds_station_search</key>
<category>[multirds]</category>
<import>import multirds</import>
<make>multirds.max_freq($fft_len, $num_decoders, $center_freq, $samp_rate,$round_to,$debug)</make>
<make>multirds.station_search($fft_len, $num_decoders, $center_freq, $samp_rate,$round_to,$debug)</make>
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
Sub-nodes:
* name

6
grc/multirds_sync_decim.xml → grc/multirds_symbol_combiner.xml

@ -1,10 +1,10 @@
<?xml version="1.0"?>
<block>
<name>sync_decim</name>
<key>multirds_sync_decim</key>
<name>symbol_combiner</name>
<key>multirds_symbol_combiner</key>
<category>[multirds]</category>
<import>import multirds</import>
<make>multirds.sync_decim($threshold, $min_diff, $log)</make>
<make>multirds.symbol_combiner($threshold, $min_diff, $log)</make>
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
Sub-nodes:
* name

2
include/multirds/CMakeLists.txt

@ -23,7 +23,7 @@
install(FILES
api.h
rds_decoder.h
sync_decim.h
symbol_combiner.h
rds_decoder_redsea.h
stream_router.h DESTINATION include/multirds
)

16
include/multirds/sync_decim.h → include/multirds/symbol_combiner.h

@ -19,8 +19,8 @@
*/
#ifndef INCLUDED_MULTIRDS_SYNC_DECIM_H
#define INCLUDED_MULTIRDS_SYNC_DECIM_H
#ifndef INCLUDED_MULTIRDS_SYMBOL_COMBINER_H
#define INCLUDED_MULTIRDS_SYMBOL_COMBINER_H
#include <multirds/api.h>
#include <gnuradio/sync_decimator.h>
@ -33,17 +33,17 @@ namespace gr {
* \ingroup multirds
*
*/
class MULTIRDS_API sync_decim : virtual public gr::sync_decimator
class MULTIRDS_API symbol_combiner : virtual public gr::sync_decimator
{
public:
typedef boost::shared_ptr<sync_decim> sptr;
typedef boost::shared_ptr<symbol_combiner> sptr;
/*!
* \brief Return a shared_ptr to a new instance of multirds::sync_decim.
* \brief Return a shared_ptr to a new instance of multirds::symbol_combiner.
*
* To avoid accidental use of raw pointers, multirds::sync_decim's
* To avoid accidental use of raw pointers, multirds::symbol_combiner's
* constructor is in a private implementation
* class. multirds::sync_decim::make is the public interface for
* class. multirds::symbol_combiner::make is the public interface for
* creating new instances.
*/
static sptr make(float threshold,float min_diff,bool log);
@ -52,5 +52,5 @@ namespace gr {
} // namespace multirds
} // namespace gr
#endif /* INCLUDED_MULTIRDS_SYNC_DECIM_H */
#endif /* INCLUDED_MULTIRDS_SYMBOL_COMBINER_H */

2
lib/CMakeLists.txt

@ -26,7 +26,7 @@ include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
list(APPEND multirds_sources
rds_decoder_impl.cc
sync_decim_impl.cc
symbol_combiner_impl.cc
rds_decoder_redsea_impl.cc
stream_router_impl.cc )

20
lib/sync_decim_impl.cc → lib/symbol_combiner_impl.cc

@ -23,7 +23,7 @@
#endif
#include <gnuradio/io_signature.h>
#include "sync_decim_impl.h"
#include "symbol_combiner_impl.h"
#define DECIM 2
#define lout log && std::cout
//#define SYNC_COUNTER_MAX 5//higher value -> slower sync, less cpu load
@ -32,18 +32,18 @@
namespace gr {
namespace multirds {
sync_decim::sptr
sync_decim::make(float threshold,float min_diff,bool log)
symbol_combiner::sptr
symbol_combiner::make(float threshold,float min_diff,bool log)
{
return gnuradio::get_initial_sptr
(new sync_decim_impl(threshold, min_diff, log));
(new symbol_combiner_impl(threshold, min_diff, log));
}
/*
* The private constructor
*/
sync_decim_impl::sync_decim_impl(float threshold,float min_diff,bool log)
: gr::sync_decimator("sync_decim",
symbol_combiner_impl::symbol_combiner_impl(float threshold,float min_diff,bool log)
: gr::sync_decimator("symbol_combiner",
gr::io_signature::make(1, 1, sizeof(float)),
gr::io_signature::make(1, 1, sizeof(float)), DECIM),
threshold(threshold),
@ -52,7 +52,7 @@ namespace gr {
{
message_port_register_in(pmt::mp("ctrl"));
set_msg_handler(pmt::mp("ctrl"), boost::bind(&sync_decim_impl::parse_ctrl_msg, this, _1));
set_msg_handler(pmt::mp("ctrl"), boost::bind(&symbol_combiner_impl::parse_ctrl_msg, this, _1));
message_port_register_out(pmt::mp("ctrl"));
//init persistant vars
last_input=0;
@ -64,11 +64,11 @@ namespace gr {
/*
* Our virtual destructor.
*/
sync_decim_impl::~sync_decim_impl()
symbol_combiner_impl::~symbol_combiner_impl()
{
}
void sync_decim_impl::parse_ctrl_msg(pmt::pmt_t pdu) {
void symbol_combiner_impl::parse_ctrl_msg(pmt::pmt_t pdu) {
if(!pmt::is_pair(pdu)) {
lout << "wrong input message (not a PDU)" << std::endl;
return;
@ -90,7 +90,7 @@ namespace gr {
int
sync_decim_impl::work(int noutput_items,
symbol_combiner_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{

14
lib/sync_decim_impl.h → lib/symbol_combiner_impl.h

@ -18,22 +18,22 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_MULTIRDS_SYNC_DECIM_IMPL_H
#define INCLUDED_MULTIRDS_SYNC_DECIM_IMPL_H
#ifndef INCLUDED_MULTIRDS_SYMBOL_COMBINER_IMPL_H
#define INCLUDED_MULTIRDS_SYMBOL_COMBINER_IMPL_H
#include <multirds/sync_decim.h>
#include <multirds/symbol_combiner.h>
namespace gr {
namespace multirds {
class sync_decim_impl : public sync_decim
class symbol_combiner_impl : public symbol_combiner
{
private:
// Nothing to declare in this block.
public:
sync_decim_impl(float threshold,float min_diff,bool log);
~sync_decim_impl();
symbol_combiner_impl(float threshold,float min_diff,bool log);
~symbol_combiner_impl();
// Where all the action really happens
int work(int noutput_items,
@ -54,5 +54,5 @@ namespace gr {
} // namespace multirds
} // namespace gr
#endif /* INCLUDED_MULTIRDS_SYNC_DECIM_IMPL_H */
#endif /* INCLUDED_MULTIRDS_SYMBOL_COMBINER_IMPL_H */

2
python/CMakeLists.txt

@ -33,7 +33,7 @@ GR_PYTHON_INSTALL(
__init__.py
rds_table_qt.py
rds_parser_table_qt.py
max_freq.py
station_search.py
chart.py
stream_selector.py
vector_cutter.py

219
python/RDS-decoder-instanciation.grc

@ -0,0 +1,219 @@
<?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.11'?>
<flow_graph>
<timestamp>Thu Jun 8 13:29:17 2017</timestamp>
<block>
<key>options</key>
<param>
<key>author</key>
<value></value>
</param>
<param>
<key>window_size</key>
<value></value>
</param>
<param>
<key>category</key>
<value>[GRC Hier Blocks]</value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>description</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(8, 8)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>generate_options</key>
<value>qt_gui</value>
</param>
<param>
<key>hier_block_src_path</key>
<value>.:</value>
</param>
<param>
<key>id</key>
<value>top_block</value>
</param>
<param>
<key>max_nouts</key>
<value>0</value>
</param>
<param>
<key>qt_qss_theme</key>
<value></value>
</param>
<param>
<key>realtime_scheduling</key>
<value></value>
</param>
<param>
<key>run_command</key>
<value>{python} -u {filename}</value>
</param>
<param>
<key>run_options</key>
<value>prompt</value>
</param>
<param>
<key>run</key>
<value>True</value>
</param>
<param>
<key>thread_safe_setters</key>
<value></value>
</param>
<param>
<key>title</key>
<value></value>
</param>
</block>
<block>
<key>variable</key>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(8, 160)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>samp_rate</value>
</param>
<param>
<key>value</key>
<value>32000</value>
</param>
</block>
<block>
<key>blocks_null_source</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>bus_conns</key>
<value>[[0,],]</value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(471, 191)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>blocks_null_source_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>num_outputs</key>
<value>1</value>
</param>
<param>
<key>type</key>
<value>byte</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>multirds_rds_decoder_redsea</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>debug</key>
<value>True</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(662, 111)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>multirds_rds_decoder_redsea_0</value>
</param>
<param>
<key>log</key>
<value>False</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
</block>
<connection>
<source_block_id>blocks_null_source_0</source_block_id>
<sink_block_id>multirds_rds_decoder_redsea_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
</flow_graph>

2
python/__init__.py

@ -35,7 +35,7 @@ except ImportError:
from rds_table_qt import rds_table_qt
from rds_parser_table_qt import rds_parser_table_qt
from max_freq import max_freq
from station_search import station_search
from chart import Chart
from stream_selector import stream_selector

6
python/max_freq.py → python/station_search.py

@ -23,13 +23,13 @@ import numpy as np
from gnuradio import gr
import code,math,pmt,time,threading
class max_freq(gr.sync_block):
class station_search(gr.sync_block):
"""
docstring for block max_freq
docstring for block station_search
"""
def __init__(self, fft_len=1024,num_decoders=4,center_freq=0,samp_rate=0,round_to=100e3,debug=False):
gr.sync_block.__init__(self,
name="max_freq",
name="station_search",
in_sig=[(np.float32,fft_len)],
out_sig=None)
self.fft_len=fft_len

105
python/top_block.py

@ -0,0 +1,105 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Thu Jun 8 13:38:58 2017
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
from PyQt4 import Qt
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import multirds
import sys
from gnuradio import qtgui
class top_block(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self, "Top Block")
Qt.QWidget.__init__(self)
self.setWindowTitle("Top Block")
qtgui.util.check_set_qss()
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
self.settings = Qt.QSettings("GNU Radio", "top_block")
self.restoreGeometry(self.settings.value("geometry").toByteArray())
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 32000
##################################################
# Blocks
##################################################
self.multirds_rds_decoder_redsea_0 = multirds.rds_decoder_redsea(False, True)
self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*1)
##################################################
# Connections
##################################################
self.connect((self.blocks_null_source_0, 0), (self.multirds_rds_decoder_redsea_0, 0))
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "top_block")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
def main(top_block_cls=top_block, options=None):
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
tb.start()
tb.show()
def quitting():
tb.stop()
tb.wait()
qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
qapp.exec_()
if __name__ == '__main__':
main()

6
swig/multirds_swig.i

@ -9,7 +9,7 @@
%{
#include "multirds/rds_decoder.h"
#include "multirds/sync_decim.h"
#include "multirds/symbol_combiner.h"
#include "multirds/rds_decoder_redsea.h"
#include "multirds/stream_router.h"
%}
@ -17,8 +17,8 @@
%include "multirds/rds_decoder.h"
GR_SWIG_BLOCK_MAGIC2(multirds, rds_decoder);
%include "multirds/sync_decim.h"
GR_SWIG_BLOCK_MAGIC2(multirds, sync_decim);
%include "multirds/symbol_combiner.h"
GR_SWIG_BLOCK_MAGIC2(multirds, symbol_combiner);
%include "multirds/rds_decoder_redsea.h"
GR_SWIG_BLOCK_MAGIC2(multirds, rds_decoder_redsea);
%include "multirds/stream_router.h"

Loading…
Cancel
Save