summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-02-28 14:38:40 -0500
committerTom Rondeau <trondeau@vt.edu>2013-02-28 14:38:40 -0500
commit9f29e51f2945f355b43f3012da43e37dcd95f6b4 (patch)
treebcc71c8975379c107bb6e94da944292a5ee9a03a
parent7afefc484137bf0bed7ab9a7ed86017c117d6a35 (diff)
parent2f55d7dfc33e8d990e44c5bbb7c6d2fbdaddd563 (diff)
Merge branch 'next' into perf_monitor
-rw-r--r--cmake/Modules/GrBoost.cmake2
-rw-r--r--docs/sphinx/source/gr/converter_blk.rst1
-rw-r--r--docs/sphinx/source/gr/index.rst5
-rw-r--r--docs/sphinx/source/gr/level_blk.rst2
-rw-r--r--docs/sphinx/source/gr/misc_blk.rst2
-rw-r--r--gnuradio-core/ctrlport.conf.example25
-rw-r--r--gnuradio-core/gnuradio-core.conf1
-rw-r--r--gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc68
-rw-r--r--gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc8
-rwxr-xr-xgnuradio-core/src/examples/mp-sched/affinity_set.py7
-rwxr-xr-xgnuradio-core/src/examples/network/dial_tone_source.py3
-rwxr-xr-xgnuradio-core/src/examples/tags/test_file_tags.py3
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt8
-rw-r--r--gnuradio-core/src/lib/general/general.i16
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc69
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc107
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.h109
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.cc90
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.h76
-rw-r--r--gnuradio-core/src/lib/general/gr_stretch_ff.cc74
-rw-r--r--gnuradio-core/src/lib/general/gr_stretch_ff.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_stretch_ff.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_threshold_ff.cc67
-rw-r--r--gnuradio-core/src/lib/general/gr_threshold_ff.h59
-rw-r--r--gnuradio-core/src/lib/general/gr_threshold_ff.i39
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.cc110
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.h51
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.i29
-rw-r--r--gnuradio-core/src/lib/general/gr_transcendental.cc153
-rw-r--r--gnuradio-core/src/lib/general/gr_transcendental.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc70
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i34
-rw-r--r--gnuradio-core/src/lib/io/CMakeLists.txt1
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu.h13
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc8
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc8
-rw-r--r--gnuradio-core/src/lib/io/gr_tuntap_pdu.cc145
-rw-r--r--gnuradio-core/src/lib/io/gr_tuntap_pdu.h74
-rw-r--r--gnuradio-core/src/lib/io/gr_tuntap_pdu.i30
-rw-r--r--gnuradio-core/src/lib/io/io.i2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h6
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.cc16
-rw-r--r--gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py683
-rwxr-xr-xgnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor66
-rw-r--r--gr-analog/lib/fastnoise_source_X_impl.cc.t18
-rw-r--r--gr-analog/lib/fastnoise_source_X_impl.h.t4
-rw-r--r--gr-analog/lib/noise_source_X_impl.cc.t16
-rw-r--r--gr-analog/lib/noise_source_X_impl.h.t4
-rw-r--r--gr-analog/python/standard_squelch.py2
-rw-r--r--gr-audio/examples/grc/cvsd_sweep.grc2
-rw-r--r--gr-blocks/examples/metadata/file_metadata_source.grc12
-rw-r--r--gr-blocks/examples/metadata/file_metadata_vector_source.grc12
-rw-r--r--gr-blocks/grc/blocks_block_tree.xml22
-rw-r--r--gr-blocks/grc/blocks_pack_k_bits_bb.xml (renamed from grc/blocks/gr_pack_k_bits_bb.xml)6
-rw-r--r--gr-blocks/grc/blocks_peak_detector2_fb.xml (renamed from grc/blocks/gr_peak_detector2_fb.xml)9
-rw-r--r--gr-blocks/grc/blocks_regenerate_bb.xml32
-rw-r--r--gr-blocks/grc/blocks_stretch_ff.xml34
-rw-r--r--gr-blocks/grc/blocks_threshold_ff.xml (renamed from grc/blocks/gr_threshold_ff.xml)6
-rw-r--r--gr-blocks/grc/blocks_throttle.xml (renamed from grc/blocks/gr_throttle.xml)8
-rw-r--r--gr-blocks/grc/blocks_transcendental.xml (renamed from grc/blocks/gr_transcendental.xml)6
-rw-r--r--gr-blocks/grc/blocks_tuntap_pdu.xml34
-rw-r--r--gr-blocks/grc/blocks_unpack_k_bits_bb.xml (renamed from grc/blocks/gr_unpack_k_bits_bb.xml)6
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt9
-rw-r--r--gr-blocks/include/blocks/pack_k_bits_bb.h (renamed from gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h)57
-rw-r--r--gr-blocks/include/blocks/peak_detector2_fb.h91
-rw-r--r--gr-blocks/include/blocks/regenerate_bb.h80
-rw-r--r--gr-blocks/include/blocks/stretch_ff.h59
-rw-r--r--gr-blocks/include/blocks/threshold_ff.h66
-rw-r--r--gr-blocks/include/blocks/throttle.h62
-rw-r--r--gr-blocks/include/blocks/transcendental.h (renamed from gnuradio-core/src/lib/general/gr_transcendental.h)47
-rw-r--r--gr-blocks/include/blocks/tuntap_pdu.h53
-rw-r--r--gr-blocks/include/blocks/unpack_k_bits_bb.h (renamed from gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h)56
-rw-r--r--gr-blocks/lib/CMakeLists.txt10
-rw-r--r--gr-blocks/lib/ConfigChecks.cmake2
-rw-r--r--gr-blocks/lib/pack_k_bits_bb_impl.cc76
-rw-r--r--gr-blocks/lib/pack_k_bits_bb_impl.h (renamed from gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i)34
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.cc118
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.h64
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.cc103
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.h57
-rw-r--r--gr-blocks/lib/stream_pdu_base.cc126
-rw-r--r--gr-blocks/lib/stream_pdu_base.h60
-rw-r--r--gr-blocks/lib/stretch_ff_impl.cc84
-rw-r--r--gr-blocks/lib/stretch_ff_impl.h53
-rw-r--r--gr-blocks/lib/threshold_ff_impl.cc78
-rw-r--r--gr-blocks/lib/threshold_ff_impl.h57
-rw-r--r--gr-blocks/lib/throttle_impl.cc97
-rw-r--r--gr-blocks/lib/throttle_impl.h54
-rw-r--r--gr-blocks/lib/transcendental_impl.cc150
-rw-r--r--gr-blocks/lib/transcendental_impl.h51
-rw-r--r--gr-blocks/lib/tuntap_pdu_impl.cc139
-rw-r--r--gr-blocks/lib/tuntap_pdu_impl.h (renamed from gnuradio-core/src/lib/general/gr_peak_detector2_fb.i)40
-rw-r--r--gr-blocks/lib/unpack_k_bits_bb_impl.cc77
-rw-r--r--gr-blocks/lib/unpack_k_bits_bb_impl.h (renamed from gnuradio-core/src/lib/general/gr_regenerate_bb.i)36
-rw-r--r--gr-blocks/python/qa_file_metadata.py1
-rwxr-xr-xgr-blocks/python/qa_pack_k_bits.py (renamed from gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py)13
-rw-r--r--gr-blocks/python/qa_peak_detector2.py58
-rwxr-xr-xgr-blocks/python/qa_regenerate.py (renamed from gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py)38
-rwxr-xr-xgr-blocks/python/qa_stream_mux.py2
-rwxr-xr-xgr-blocks/python/qa_stretch.py67
-rw-r--r--gr-blocks/python/qa_threshold.py54
-rwxr-xr-xgr-blocks/python/qa_throttle.py39
-rw-r--r--gr-blocks/python/qa_transcendental.py90
-rwxr-xr-xgr-blocks/python/qa_unpack_k_bits.py (renamed from gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py)8
-rw-r--r--gr-blocks/swig/blocks_swig.i35
-rw-r--r--gr-channels/examples/channel_tone_response.grc8
-rwxr-xr-xgr-digital/examples/berawgn.py2
-rw-r--r--gr-digital/examples/demod/ber_simulation.grc8
-rw-r--r--gr-digital/examples/demod/digital_freq_lock.grc8
-rw-r--r--gr-digital/examples/demod/dpsk_loopback.grc8
-rw-r--r--gr-digital/examples/demod/gfsk_loopback.grc8
-rw-r--r--gr-digital/examples/demod/gmsk_loopback.grc8
-rw-r--r--gr-digital/examples/demod/mpsk_demod.grc10
-rw-r--r--gr-digital/examples/demod/pam_sync.grc8
-rw-r--r--gr-digital/examples/demod/pam_timing.grc8
-rwxr-xr-xgr-digital/examples/narrowband/benchmark_add_channel.py2
-rwxr-xr-xgr-digital/examples/narrowband/rx_voice.py4
-rwxr-xr-xgr-digital/examples/ofdm/benchmark_add_channel.py2
-rw-r--r--gr-digital/python/generic_mod_demod.py14
-rw-r--r--gr-digital/python/ofdm_sync_ml.py2
-rw-r--r--gr-digital/python/ofdm_sync_pn.py4
-rw-r--r--gr-digital/python/ofdm_sync_pnac.py2
-rwxr-xr-xgr-digital/python/qa_constellation.py2
-rwxr-xr-xgr-filter/examples/gr_filtdes_live_upd.py3
-rw-r--r--gr-filter/examples/resampler_demo.grc64
-rwxr-xr-xgr-filter/examples/synth_to_chan.py4
-rw-r--r--gr-filter/lib/fir_filter_XXX_impl.cc.t3
-rw-r--r--gr-howto-write-a-block/apps/howto_square.grc2
-rwxr-xr-xgr-howto-write-a-block/apps/howto_square.py3
-rw-r--r--gr-howto-write-a-block/apps/howto_square_qt.grc12
-rwxr-xr-xgr-howto-write-a-block/apps/howto_square_qt.py11
-rw-r--r--gr-noaa/examples/file_rx_hrpt.grc2
-rw-r--r--gr-qtgui/apps/grc_qt_example.grc8
-rwxr-xr-xgr-qtgui/apps/qt_digital.py3
-rwxr-xr-xgr-qtgui/examples/pyqt_const_c.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_example_c.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_example_f.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_freq_c.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_freq_f.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_time_c.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_time_f.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_time_raster_b.py3
-rwxr-xr-xgr-qtgui/examples/pyqt_time_raster_f.py3
-rwxr-xr-xgr-qtgui/examples/pyqt_waterfall_c.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_waterfall_f.py2
-rw-r--r--gr-qtgui/include/qtgui/time_raster_sink_b.h10
-rw-r--r--gr-qtgui/include/qtgui/time_raster_sink_f.h10
-rw-r--r--gr-qtgui/lib/const_sink_c_impl.cc3
-rw-r--r--gr-qtgui/lib/constellationdisplayform.cc9
-rw-r--r--gr-qtgui/lib/displayform.cc13
-rw-r--r--gr-qtgui/lib/displayform.h3
-rw-r--r--gr-qtgui/lib/freq_sink_c_impl.cc3
-rw-r--r--gr-qtgui/lib/freq_sink_f_impl.cc3
-rw-r--r--gr-qtgui/lib/time_raster_sink_b_impl.cc23
-rw-r--r--gr-qtgui/lib/time_raster_sink_b_impl.h10
-rw-r--r--gr-qtgui/lib/time_raster_sink_c_impl.cc3
-rw-r--r--gr-qtgui/lib/time_raster_sink_f_impl.cc23
-rw-r--r--gr-qtgui/lib/time_raster_sink_f_impl.h10
-rw-r--r--gr-qtgui/lib/time_sink_c_impl.cc3
-rw-r--r--gr-qtgui/lib/time_sink_f_impl.cc3
-rw-r--r--gr-qtgui/lib/waterfall_sink_c_impl.cc3
-rw-r--r--gr-qtgui/lib/waterfall_sink_f_impl.cc3
-rw-r--r--gr-trellis/examples/grc/interference_cancellation.grc8
-rw-r--r--gr-trellis/examples/grc/pccc.grc8
-rw-r--r--gr-trellis/examples/grc/pccc1.grc8
-rw-r--r--gr-trellis/examples/grc/sccc.grc8
-rw-r--r--gr-trellis/examples/grc/sccc1.grc8
-rw-r--r--gr-utils/python/modtool/templates.py2
-rw-r--r--gr-wavelet/CMakeLists.txt1
-rw-r--r--gr-wavelet/lib/CMakeLists.txt2
-rw-r--r--gr-wavelet/python/CMakeLists.txt2
-rwxr-xr-xgr-wavelet/python/qa_classify.py3
-rw-r--r--gr-wavelet/swig/CMakeLists.txt1
-rw-r--r--gr-wxgui/python/fftsink_gl.py4
-rw-r--r--gr-wxgui/python/fftsink_nongl.py4
-rw-r--r--gr-wxgui/python/histosink_gl.py3
-rw-r--r--gr-wxgui/python/numbersink2.py4
-rw-r--r--gr-wxgui/python/scopesink_gl.py2
-rw-r--r--gr-wxgui/python/scopesink_nongl.py3
-rw-r--r--gr-wxgui/python/waterfallsink_gl.py5
-rw-r--r--gr-wxgui/python/waterfallsink_nongl.py4
-rw-r--r--grc/blocks/block_tree.xml12
-rw-r--r--grc/blocks/gr_tuntap_pdu.xml34
-rw-r--r--grc/examples/simple/variable_config.grc8
-rw-r--r--grc/examples/xmlrpc/xmlrpc_server.grc10
-rw-r--r--volk/CMakeLists.txt1
-rw-r--r--volk/cmake/CMakeParseArgumentsCopy.cmake138
-rw-r--r--volk/python/volk_modtool/CMakeLists.txt39
-rw-r--r--volk/python/volk_modtool/README110
-rw-r--r--volk/python/volk_modtool/__init__.py24
-rw-r--r--volk/python/volk_modtool/cfg.py82
-rwxr-xr-xvolk/python/volk_modtool/volk_modtool127
-rw-r--r--volk/python/volk_modtool/volk_modtool_generate.py310
193 files changed, 4119 insertions, 2486 deletions
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake
index 01378df662..d2e91a6f16 100644
--- a/cmake/Modules/GrBoost.cmake
+++ b/cmake/Modules/GrBoost.cmake
@@ -83,7 +83,7 @@ endif(ENABLE_BAD_BOOST)
# YY is the minor version number ('46' for 1.46)
# ZZ is the patcher version number (typically just '00')
set(Boost_NOGO_VERSIONS
- 104600 104700 105200
+ 104600 104601 104700 105200
)
foreach(ver ${Boost_NOGO_VERSIONS})
diff --git a/docs/sphinx/source/gr/converter_blk.rst b/docs/sphinx/source/gr/converter_blk.rst
index 81d159ece0..be643d2cb1 100644
--- a/docs/sphinx/source/gr/converter_blk.rst
+++ b/docs/sphinx/source/gr/converter_blk.rst
@@ -8,4 +8,3 @@ gnuradio.gr: Type Conversions
.. autooldblock:: gnuradio.gr.complex_to_mag
.. autooldblock:: gnuradio.gr.complex_to_mag_squared
.. autooldblock:: gnuradio.gr.complex_to_arg
-.. autooldblock:: gnuradio.gr.unpack_k_bits_bb
diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst
index f4804f1fd0..9cba4089fd 100644
--- a/docs/sphinx/source/gr/index.rst
+++ b/docs/sphinx/source/gr/index.rst
@@ -132,7 +132,6 @@ Type Conversions
gnuradio.gr.complex_to_mag
gnuradio.gr.complex_to_mag_squared
gnuradio.gr.complex_to_arg
- gnuradio.gr.unpack_k_bits_bb
Signal Level Control (AGC)
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -140,8 +139,6 @@ Signal Level Control (AGC)
.. autosummary::
:nosignatures:
- gnuradio.gr.peak_detector2_fb
- gnuradio.gr.regenerate_bb
gnuradio.gr.mute_cc
gnuradio.gr.mute_ff
gnuradio.gr.mute_ii
@@ -174,8 +171,6 @@ Miscellaneous Blocks
gnuradio.gr.kludge_copy
gnuradio.gr.nop
gnuradio.gr.pa_2x2_phase_combiner
- gnuradio.gr.threshold_ff
- gnuradio.gr.throttle
gnuradio.gr.channel_model
Slicing and Dicing Streams
diff --git a/docs/sphinx/source/gr/level_blk.rst b/docs/sphinx/source/gr/level_blk.rst
index 0eacb67230..bfc9801838 100644
--- a/docs/sphinx/source/gr/level_blk.rst
+++ b/docs/sphinx/source/gr/level_blk.rst
@@ -2,8 +2,6 @@ gnuradio.gr: Signal Level Control (AGC)
=======================================
.. autooldblock:: gnuradio.gr.dpll_bb
-.. autooldblock:: gnuradio.gr.peak_detector2_fb
-.. autooldblock:: gnuradio.gr.regenerate_bb
.. autooldblock:: gnuradio.gr.mute_cc
.. autooldblock:: gnuradio.gr.mute_ff
.. autooldblock:: gnuradio.gr.mute_ii
diff --git a/docs/sphinx/source/gr/misc_blk.rst b/docs/sphinx/source/gr/misc_blk.rst
index 4c1a0ee551..a4dcc58a2d 100644
--- a/docs/sphinx/source/gr/misc_blk.rst
+++ b/docs/sphinx/source/gr/misc_blk.rst
@@ -5,6 +5,4 @@ gnuradio.gr: Miscellaneous Blocks
.. autooldblock:: gnuradio.gr.kludge_copy
.. autooldblock:: gnuradio.gr.nop
.. autooldblock:: gnuradio.gr.pa_2x2_phase_combiner
-.. autooldblock:: gnuradio.gr.threshold_ff
-.. autooldblock:: gnuradio.gr.throttle
.. autooldblock:: gnuradio.gr.channel_model
diff --git a/gnuradio-core/ctrlport.conf.example b/gnuradio-core/ctrlport.conf.example
index 7c231eb7c9..51d9e934f2 100644
--- a/gnuradio-core/ctrlport.conf.example
+++ b/gnuradio-core/ctrlport.conf.example
@@ -1,5 +1,30 @@
## Use this to create an endpoint used to export ControlPort.
+##
+## A typical configuation would be to specify using a particular
+## interface (determined from the IP address) and port number:
+##
+## ControlPort.Endpoints=tcp -h 192.168.1.1 -p 9000
+##
+## A similar endpoint without the port number stated will pick a
+## random, free port:
+##
+## ControlPort.Endpoints=tcp -h 192.168.1.1
+##
+## ICE has some wildcard capabilities, as well. The following tells
+## ICE to use all available interfaces:
+##
+## ControlPort.Endpoints=tcp -h *
+##
+## Using 'default' for the host will use what 'hostname' resolves to.
+##
## For more details:
## http://doc.zeroc.com/display/Ice/Proxy+and+Endpoint+Syntax
+## http://www.zeroc.com/doc/Ice-3.2.1/manual/ProxyEndpointRef.51.2.html
# ControlPort.Endpoints = tcp -t 300 -h 127.0.0.1 -p 23456
+
+
+## Set a default hostname (or IP) if no '-h' is used in the Endpoint
+## configuration
+
+#Ice.Default.Host = myhost
diff --git a/gnuradio-core/gnuradio-core.conf b/gnuradio-core/gnuradio-core.conf
index 3ed9892c73..cf3df4aea7 100644
--- a/gnuradio-core/gnuradio-core.conf
+++ b/gnuradio-core/gnuradio-core.conf
@@ -12,4 +12,5 @@ export = True
[ControlPort]
on = False
+edges_list = False
config = # ${prefix}/etc/gnuradio/ctrlport.conf
diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc
index 15452e5399..5287257d77 100644
--- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc
+++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Feb 21 19:08:22 2013</timestamp>
+ <timestamp>Tue Feb 26 14:26:03 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -613,37 +613,6 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
- <param>
- <key>id</key>
- <value>gr_throttle_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>byte</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(623, 64)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>gr_vector_source_x</key>
<param>
<key>id</key>
@@ -748,8 +717,39 @@
<value>0</value>
</param>
</block>
+ <block>
+ <key>blocks_throttle</key>
+ <param>
+ <key>id</key>
+ <value>blocks_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(623, 64)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_psk_mod_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -798,7 +798,7 @@
</connection>
<connection>
<source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc
index 36238e5c18..20e8e7f7db 100644
--- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc
+++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc
@@ -558,10 +558,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -624,7 +624,7 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_psk_mod_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -661,7 +661,7 @@
</connection>
<connection>
<source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gnuradio-core/src/examples/mp-sched/affinity_set.py b/gnuradio-core/src/examples/mp-sched/affinity_set.py
index 6db632e0fa..c1c1a33932 100755
--- a/gnuradio-core/src/examples/mp-sched/affinity_set.py
+++ b/gnuradio-core/src/examples/mp-sched/affinity_set.py
@@ -6,6 +6,7 @@
from gnuradio import eng_notation
from gnuradio import gr
+from gnuradio import blocks
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from optparse import OptionParser
@@ -25,7 +26,7 @@ class affinity_set(gr.top_block):
# Blocks
##################################################
vec_len = 1
- self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*vec_len, samp_rate)
+ self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*vec_len, samp_rate)
self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*vec_len)
self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*vec_len)
self.gr_filt_0 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,])
@@ -37,8 +38,8 @@ class affinity_set(gr.top_block):
##################################################
# Connections
##################################################
- self.connect((self.gr_null_source_0, 0), (self.gr_throttle_0, 0))
- self.connect((self.gr_throttle_0, 0), (self.gr_filt_0, 0))
+ self.connect((self.gr_null_source_0, 0), (self.blocks_throttle_0, 0))
+ self.connect((self.blocks_throttle_0, 0), (self.gr_filt_0, 0))
self.connect((self.gr_filt_0, 0), (self.gr_filt_1, 0))
self.connect((self.gr_filt_1, 0), (self.gr_null_sink_0, 0))
diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py
index a8d85c4c57..d0d3cc7a8d 100755
--- a/gnuradio-core/src/examples/network/dial_tone_source.py
+++ b/gnuradio-core/src/examples/network/dial_tone_source.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr
+from gnuradio import blocks
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import sys
@@ -45,7 +46,7 @@ class dial_tone_source(gr.top_block):
add = blocks.add_ff()
# Throttle needed here to account for the other side's audio card sampling rate
- thr = gr.throttle(gr.sizeof_float, sample_rate)
+ thr = blocks.throttle(gr.sizeof_float, sample_rate)
sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof)
self.connect(src0, (add, 0))
self.connect(src1, (add, 1))
diff --git a/gnuradio-core/src/examples/tags/test_file_tags.py b/gnuradio-core/src/examples/tags/test_file_tags.py
index 135626d2c6..1dfc9e46cd 100755
--- a/gnuradio-core/src/examples/tags/test_file_tags.py
+++ b/gnuradio-core/src/examples/tags/test_file_tags.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr
+from gnuradio import blocks
import sys
try:
@@ -36,7 +37,7 @@ def main():
src = gr.vector_source_s(data, True)
trigger = gr.vector_source_s(trig, True)
- thr = gr.throttle(gr.sizeof_short, 10e3)
+ thr = blocks.throttle(gr.sizeof_short, 10e3)
ann = gr.annotator_alltoall(1000000, gr.sizeof_short)
tagger = gr.burst_tagger(gr.sizeof_short)
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index de75dee7b8..b844cf302c 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -163,21 +163,13 @@ set(gr_core_general_triple_threats
gr_null_sink
gr_null_source
gr_pa_2x2_phase_combiner
- gr_peak_detector2_fb
gr_prefs
gr_random_pdu
- gr_regenerate_bb
gr_remez
gr_skiphead
- gr_stretch_ff
gr_test
- gr_threshold_ff
- gr_throttle
- gr_transcendental
gr_vco_f
gr_vector_map
- gr_unpack_k_bits_bb
- gr_pack_k_bits_bb
gr_annotator_alltoall
gr_annotator_1to1
gr_annotator_raw
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 092582475d..ff4c95631b 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -40,23 +40,15 @@
#include <gr_firdes.h>
#include <gr_random_pdu.h>
#include <gr_fake_channel_coder_pp.h>
-#include <gr_throttle.h>
-#include <gr_transcendental.h>
#include <gr_vco_f.h>
-#include <gr_threshold_ff.h>
-#include <gr_regenerate_bb.h>
#include <gr_pa_2x2_phase_combiner.h>
#include <gr_kludge_copy.h>
#include <gr_prefs.h>
#include <gr_constants.h>
#include <gr_test_types.h>
#include <gr_test.h>
-#include <gr_unpack_k_bits_bb.h>
-#include <gr_pack_k_bits_bb.h>
#include <gr_feval.h>
#include <gr_bin_statistics_f.h>
-#include <gr_peak_detector2_fb.h>
-#include <gr_stretch_ff.h>
#include <gr_copy.h>
#include <complex_vec_test.h>
#include <gr_annotator_alltoall.h>
@@ -86,23 +78,15 @@
%include "gr_firdes.i"
%include "gr_random_pdu.i"
%include "gr_fake_channel_coder_pp.i"
-%include "gr_throttle.i"
-%include "gr_transcendental.i"
%include "gr_vco_f.i"
-%include "gr_threshold_ff.i"
-%include "gr_regenerate_bb.i"
%include "gr_pa_2x2_phase_combiner.i"
%include "gr_kludge_copy.i"
%include "gr_prefs.i"
%include "gr_constants.i"
%include "gr_test_types.h"
%include "gr_test.i"
-%include "gr_unpack_k_bits_bb.i"
-%include "gr_pack_k_bits_bb.i"
%include "gr_feval.i"
%include "gr_bin_statistics_f.i"
-%include "gr_peak_detector2_fb.i"
-%include "gr_stretch_ff.i"
%include "gr_copy.i"
%include "complex_vec_test.i"
%include "gr_annotator_alltoall.i"
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
deleted file mode 100644
index 0ea0c9e388..0000000000
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_pack_k_bits_bb.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <iostream>
-
-gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb(unsigned k)
-{
- return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb(k));
-}
-
-
-gr_pack_k_bits_bb::gr_pack_k_bits_bb (unsigned k)
- : gr_sync_decimator("pack_k_bits_bb",
- gr_make_io_signature (1, 1, sizeof(unsigned char)),
- gr_make_io_signature (1, 1, sizeof(unsigned char)),
- k),
- d_k (k)
-{
- if (d_k == 0)
- throw std::out_of_range("interpolation must be > 0");
-}
-
-gr_pack_k_bits_bb::~gr_pack_k_bits_bb()
-{
-}
-
-int
-gr_pack_k_bits_bb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *)input_items[0];
- unsigned char *out = (unsigned char *)output_items[0];
-
- for(int i = 0; i < noutput_items; i++) {
- out[i] = 0x00;
- for(unsigned int j = 0; j < d_k; j++) {
- out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1);
- }
- }
-
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc
deleted file mode 100644
index a4179a8c2a..0000000000
--- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_peak_detector2_fb.h>
-#include <gr_io_signature.h>
-#include <string.h>
-
-gr_peak_detector2_fb_sptr
-gr_make_peak_detector2_fb (float threshold_factor_rise,
- int look_ahead, float alpha)
-{
- return gnuradio::get_initial_sptr(new gr_peak_detector2_fb (threshold_factor_rise,
- look_ahead, alpha));
-}
-
-gr_peak_detector2_fb::gr_peak_detector2_fb (float threshold_factor_rise,
- int look_ahead, float alpha)
- : gr_sync_block ("peak_detector2_fb",
- gr_make_io_signature (1, 1, sizeof(float)),
- gr_make_io_signature2 (1, 2, sizeof(char), sizeof(float))),
- d_threshold_factor_rise(threshold_factor_rise),
- d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false)
-{
-}
-
-int
-gr_peak_detector2_fb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items) {
- float *iptr = (float *) input_items[0];
- char *optr = (char *) output_items[0];
-
- assert(noutput_items >= 2);
-
- memset(optr, 0, noutput_items*sizeof(char));
-
- for (int i = 0; i < noutput_items; i++) {
-
- if (!d_found) {
- // Have not yet detected presence of peak
- if (iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) {
- d_found = true;
- d_look_ahead_remaining = d_look_ahead;
- d_peak_val = -(float)INFINITY;
- }
- else {
- d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
- }
- }
- else {
- // Detected presence of peak
- if (iptr[i] > d_peak_val) {
- d_peak_val = iptr[i];
- d_peak_ind = i;
- }
- else if (d_look_ahead_remaining <= 0) {
- optr[d_peak_ind] = 1;
- d_found = false;
- d_avg = iptr[i];
- }
-
- // Have not yet located peak, loop and keep searching.
- d_look_ahead_remaining--;
- }
-
- // Every iteration of the loop, write debugging signal out if
- // connected:
- if (output_items.size() == 2) {
- float *sigout = (float *) output_items[1];
- sigout[i] = d_avg;
- }
- } // loop
-
- if (!d_found)
- return noutput_items;
-
- // else if detected presence, keep searching during the next call to work.
- int tmp = d_peak_ind;
- d_peak_ind = 1;
-
- return tmp - 1;
-}
-
-
diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h
deleted file mode 100644
index 665a6b882c..0000000000
--- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_gr_peak_detector2_FB_H
-#define INCLUDED_gr_peak_detector2_FB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-
-class gr_peak_detector2_fb;
-typedef boost::shared_ptr<gr_peak_detector2_fb> gr_peak_detector2_fb_sptr;
-
-GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7,
- int look_ahead = 1000,
- float alpha = 0.001);
-
-/*!
- * \brief Detect the peak of a signal
- * \ingroup level_blk
- *
- * If a peak is detected, this block outputs a 1,
- * or it outputs 0's. A separate debug output may be connected, to
- * view the internal EWMA described below.
- *
- * \param threshold_factor_rise The threshold factor determins when a peak
- * is present. An EWMA average of the signal is calculated and when the
- * value of the signal goes over threshold_factor_rise*average, we
- * call the peak.
- * \param look_ahead The look-ahead value is used when the threshold is
- * found to locate the peak within this range.
- * \param alpha The gain value of a single-pole moving average filter
- */
-
-class GR_CORE_API gr_peak_detector2_fb : public gr_sync_block
-{
- friend GR_CORE_API gr_peak_detector2_fb_sptr
- gr_make_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
-
- gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
-
-private:
- float d_threshold_factor_rise;
- int d_look_ahead;
- int d_look_ahead_remaining;
- int d_peak_ind;
- float d_peak_val;
- float d_alpha;
- float d_avg;
- bool d_found;
-
-public:
-
- /*! \brief Set the threshold factor value for the rise time
- * \param thr new threshold factor
- */
- void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
-
- /*! \brief Set the look-ahead factor
- * \param look new look-ahead factor
- */
- void set_look_ahead(int look) { d_look_ahead = look; }
-
- /*! \brief Set the running average alpha
- * \param alpha new alpha for running average
- */
- void set_alpha(int alpha) { d_alpha = alpha; }
-
- /*! \brief Get the threshold factor value for the rise time
- * \return threshold factor
- */
- float threshold_factor_rise() { return d_threshold_factor_rise; }
-
- /*! \brief Get the look-ahead factor value
- * \return look-ahead factor
- */
- int look_ahead() { return d_look_ahead; }
-
- /*! \brief Get the alpha value of the running average
- * \return alpha
- */
- float alpha() { return d_alpha; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
-
-
diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.cc b/gnuradio-core/src/lib/general/gr_regenerate_bb.cc
deleted file mode 100644
index c96cf247d0..0000000000
--- a/gnuradio-core/src/lib/general/gr_regenerate_bb.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_regenerate_bb.h>
-#include <gr_io_signature.h>
-
-gr_regenerate_bb_sptr
-gr_make_regenerate_bb (int period, unsigned int max_regen)
-{
- return gnuradio::get_initial_sptr(new gr_regenerate_bb (period, max_regen));
-}
-
-gr_regenerate_bb::gr_regenerate_bb (int period, unsigned int max_regen)
- : gr_sync_block ("regenerate_bb",
- gr_make_io_signature (1, 1, sizeof (char)),
- gr_make_io_signature (1, 1, sizeof (char))),
- d_period(period),
- d_countdown(0),
- d_max_regen(max_regen),
- d_regen_count(max_regen)
-{
-}
-
-void gr_regenerate_bb::set_max_regen(unsigned int regen)
-{
- d_max_regen = regen;
- d_countdown = 0;
- d_regen_count = d_max_regen;
-}
-
-void gr_regenerate_bb::set_period(int period)
-{
- d_period = period;
- d_countdown = 0;
- d_regen_count = d_max_regen;
-}
-
-int
-gr_regenerate_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const char *iptr = (const char *) input_items[0];
- char *optr = (char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++){
- optr[i] = 0;
-
- if(d_regen_count < d_max_regen) {
- d_countdown--;
-
- if(d_countdown == 0) {
- optr[i] = 1;
- d_countdown = d_period;
- d_regen_count++;
- }
- }
-
- if(iptr[i] == 1) {
- d_countdown = d_period;
- optr[i] = 1;
- d_regen_count = 0;
- }
-
- }
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.h b/gnuradio-core/src/lib/general/gr_regenerate_bb.h
deleted file mode 100644
index e820db69e8..0000000000
--- a/gnuradio-core/src/lib/general/gr_regenerate_bb.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_REGENERATE_BB_H
-#define INCLUDED_GR_REGENERATE_BB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-
-class gr_regenerate_bb;
-typedef boost::shared_ptr<gr_regenerate_bb> gr_regenerate_bb_sptr;
-
-GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500);
-
-/*!
- * \brief Detect the peak of a signal and repeat every period samples
- * \ingroup level_blk
- *
- * If a peak is detected, this block outputs a 1 repeated every period samples
- * until reset by detection of another 1 on the input or stopped after max_regen
- * regenerations have occurred.
- *
- * Note that if max_regen=(-1)/ULONG_MAX then the regeneration will run forever.
- */
-class GR_CORE_API gr_regenerate_bb : public gr_sync_block
-{
- /*!
- * \brief Make a regenerate block
- * \param period The number of samples between regenerations
- * \param max_regen The maximum number of regenerations to perform; if set to
- * ULONG_MAX, it will regenerate continuously.
- */
- friend GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen);
-
- gr_regenerate_bb (int period, unsigned int max_regen);
-
- private:
- int d_period;
- int d_countdown;
- unsigned int d_max_regen;
- unsigned int d_regen_count;
-
- public:
- /*! \brief Reset the maximum regeneration count; this will reset the current regen.
- */
- void set_max_regen(unsigned int regen);
-
- /*! \brief Reset the period of regenerations; this will reset the current regen.
- */
- void set_period(int period);
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.cc b/gnuradio-core/src/lib/general/gr_stretch_ff.cc
deleted file mode 100644
index e89eadf8b1..0000000000
--- a/gnuradio-core/src/lib/general/gr_stretch_ff.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_stretch_ff.h>
-#include <gr_io_signature.h>
-
-gr_stretch_ff_sptr
-gr_make_stretch_ff(float lo, size_t vlen)
-{
- return gnuradio::get_initial_sptr(new gr_stretch_ff(lo, vlen));
-}
-
-gr_stretch_ff::gr_stretch_ff(float lo, size_t vlen)
- : gr_sync_block("stretch_ff",
- gr_make_io_signature(1, 1, vlen * sizeof(float)),
- gr_make_io_signature(1, 1, vlen * sizeof(float))),
- d_lo(lo), d_vlen(vlen)
-{
-}
-
-int
-gr_stretch_ff::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *in = (const float *) input_items[0];
- float *out = (float *) output_items[0];
-
- for (int count = 0; count < noutput_items; count++) {
- float vmax = in[0] - d_lo;
-
- for (unsigned int i = 1; i < d_vlen; i++) {
- float vtmp = in[i] - d_lo;
- if (vtmp > vmax)
- vmax = vtmp;
- }
-
- if (vmax != 0.0)
- for (unsigned int i = 0; i < d_vlen; i++)
- out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax);
- else
- for (unsigned int i = 0; i < d_vlen; i++)
- out[i] = in[i];
-
- in += d_vlen;
- out += d_vlen;
- }
-
- return noutput_items;
-}
-
diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.h b/gnuradio-core/src/lib/general/gr_stretch_ff.h
deleted file mode 100644
index f592c94a78..0000000000
--- a/gnuradio-core/src/lib/general/gr_stretch_ff.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_STRETCH_FF_H_
-# define INCLUDED_GR_STRETCH_FF_H_
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-
-/*!
- * \brief adjust y-range of an input vector by mapping to range
- * (max-of-input, stipulated-min). Primarily for spectral signature
- * matching by normalizing spectrum dynamic ranges.
- * \ingroup misc_blk
- */
-
-
-class gr_stretch_ff;
-typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr;
-
-GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
-
-class GR_CORE_API gr_stretch_ff : public gr_sync_block
-{
- friend GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
-
- float d_lo; // the constant
- size_t d_vlen;
- gr_stretch_ff(float lo, size_t vlen);
-
- public:
- float lo() const { return d_lo; }
- void set_lo(float lo) { d_lo = lo; }
- size_t vlen() const { return d_vlen; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.i b/gnuradio-core/src/lib/general/gr_stretch_ff.i
deleted file mode 100644
index 81366655eb..0000000000
--- a/gnuradio-core/src/lib/general/gr_stretch_ff.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,stretch_ff);
-
-gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
-
-class gr_stretch_ff : public gr_sync_block
-{
-private:
- gr_stretch_ff(float lo, size_t vlen);
-};
-
diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.cc b/gnuradio-core/src/lib/general/gr_threshold_ff.cc
deleted file mode 100644
index 952613151f..0000000000
--- a/gnuradio-core/src/lib/general/gr_threshold_ff.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// WARNING: this file is machine generated. Edits will be over written
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_threshold_ff.h>
-#include <gr_io_signature.h>
-
-gr_threshold_ff_sptr
-gr_make_threshold_ff (float lo, float hi, float initial_state)
-{
- return gnuradio::get_initial_sptr(new gr_threshold_ff (lo, hi, initial_state));
-}
-
-gr_threshold_ff::gr_threshold_ff (float lo, float hi, float initial_state)
- : gr_sync_block ("threshold_ff",
- gr_make_io_signature (1, 1, sizeof (float)),
- gr_make_io_signature (1, 1, sizeof (float))),
- d_lo (lo), d_hi (hi), d_last_state (initial_state)
-{
-}
-
-int
-gr_threshold_ff::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *in = (const float *) input_items[0];
- float *out = (float *) output_items[0];
-
-
- for(int i=0; i<noutput_items; i++) {
- if (in[i] > d_hi) {
- out[i] = 1.0;
- d_last_state = 1.0;
- } else if (in[i] < d_lo) {
- out[i] = 0.0;
- d_last_state = 0.0;
- } else
- out[i] = d_last_state;
- }
-
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.h b/gnuradio-core/src/lib/general/gr_threshold_ff.h
deleted file mode 100644
index 678f8b1d2d..0000000000
--- a/gnuradio-core/src/lib/general/gr_threshold_ff.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_THRESHOLD_FF_H
-#define INCLUDED_GR_THRESHOLD_FF_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-
-class gr_threshold_ff;
-typedef boost::shared_ptr<gr_threshold_ff> gr_threshold_ff_sptr;
-
-GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0);
-
-/*!
- * \brief Please fix my documentation
- * \ingroup misc_blk
- */
-class GR_CORE_API gr_threshold_ff : public gr_sync_block
-{
- friend GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state);
-
- float d_lo,d_hi; // the constant
- float d_last_state;
- gr_threshold_ff (float lo, float hi, float initial_state);
-
- public:
- float lo () const { return d_lo; }
- void set_lo (float lo) { d_lo = lo; }
- float hi () const { return d_hi; }
- void set_hi (float hi) { d_hi = hi; }
- float last_state () const { return d_last_state; }
- void set_last_state (float last_state) { d_last_state = last_state; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.i b/gnuradio-core/src/lib/general/gr_threshold_ff.i
deleted file mode 100644
index 7584feea8a..0000000000
--- a/gnuradio-core/src/lib/general/gr_threshold_ff.i
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,threshold_ff);
-
-gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0);
-
-class gr_threshold_ff : public gr_sync_block
-{
- private:
- gr_threshold_ff (float lo, float hi, float initial_state);
-
- public:
- float lo () const { return d_lo; }
- void set_lo (float lo) { d_lo = lo; }
- float hi () const { return d_hi; }
- void set_hi (float hi) { d_hi = hi; }
- float last_state () const { return d_last_state; }
- void set_last_state (float last_state) { d_last_state = last_state; }
-};
diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc
deleted file mode 100644
index 1c6c8cf893..0000000000
--- a/gnuradio-core/src/lib/general/gr_throttle.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005-2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_throttle.h>
-#include <gr_io_signature.h>
-#include <cstring>
-#include <boost/thread/thread.hpp>
-
-class gr_throttle_impl : public gr_throttle{
-public:
- gr_throttle_impl(size_t itemsize):
- gr_sync_block("throttle",
- gr_make_io_signature(1, 1, itemsize),
- gr_make_io_signature(1, 1, itemsize)),
- d_itemsize(itemsize)
- {
- /* NOP */
- }
-
- double sample_rate(){
- return d_samps_per_us*1e6;
- }
-
- void set_sample_rate(double rate){
- //changing the sample rate performs a reset of state params
- d_start = boost::get_system_time();
- d_total_samples = 0;
- d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second();
- d_samps_per_us = rate/1e6;
- }
-
- int work (
- int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items
- ){
- //calculate the expected number of samples to have passed through
- boost::system_time now = boost::get_system_time();
- boost::int64_t ticks = (now - d_start).ticks();
- uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks);
-
- //if the expected samples was less, we need to throttle back
- if (d_total_samples > expected_samps){
- boost::this_thread::sleep(boost::posix_time::microseconds(
- long((d_total_samples - expected_samps)/d_samps_per_us)
- ));
- }
-
- //copy all samples output[i] <= input[i]
- const char *in = (const char *) input_items[0];
- char *out = (char *) output_items[0];
- std::memcpy(out, in, noutput_items * d_itemsize);
- d_total_samples += noutput_items;
- return noutput_items;
- }
-
-private:
- boost::system_time d_start;
- size_t d_itemsize;
- uint64_t d_total_samples;
- double d_samps_per_tick, d_samps_per_us;
-
- void setup_rpc(){
-#ifdef GR_CTRLPORT
- d_rpc_vars.push_back(
- rpcbasic_sptr(new rpcbasic_register_get<gr_throttle_impl, double>(
- alias(), "sample_rate", &gr_throttle_impl::sample_rate,
- pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0),
- "Hz", "Sample Rate", RPC_PRIVLVL_MIN,
- DISPTIME | DISPOPTSTRIP)));
- d_rpc_vars.push_back(
- rpcbasic_sptr(new rpcbasic_register_set<gr_throttle_impl, double>(
- alias(), "sample_rate", &gr_throttle_impl::set_sample_rate,
- pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0),
- "Hz", "Sample Rate", RPC_PRIVLVL_MIN,
- DISPTIME | DISPOPTSTRIP)));
-#endif
- }
-};
-
-gr_throttle::sptr
-gr_make_throttle(size_t itemsize, double samples_per_sec)
-{
- gr_throttle::sptr throttle(new gr_throttle_impl(itemsize));
- throttle->set_sample_rate(samples_per_sec);
- return throttle;
-}
diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h
deleted file mode 100644
index 2235ffacf1..0000000000
--- a/gnuradio-core/src/lib/general/gr_throttle.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005-2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_GR_THROTTLE_H
-#define INCLUDED_GR_THROTTLE_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-
-/*!
- * \brief throttle flow of samples such that the average rate does not exceed samples_per_sec.
- * \ingroup misc_blk
- *
- * input: one stream of itemsize; output: one stream of itemsize
- *
- * N.B. this should only be used in GUI apps where there is no other
- * rate limiting block. It is not intended nor effective at precisely
- * controlling the rate of samples. That should be controlled by a
- * source or sink tied to sample clock. E.g., a USRP or audio card.
- */
-class GR_CORE_API gr_throttle : virtual public gr_sync_block
-{
-public:
- typedef boost::shared_ptr<gr_throttle> sptr;
-
- //! Sets the sample rate in samples per second
- virtual double sample_rate() = 0;
- virtual void set_sample_rate(double rate) = 0;
-};
-
-GR_CORE_API gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
-
-#endif /* INCLUDED_GR_THROTTLE_H */
diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i
deleted file mode 100644
index 5ba32de6ed..0000000000
--- a/gnuradio-core/src/lib/general/gr_throttle.i
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005-2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-%{
-#include <gr_throttle.h>
-%}
-
-GR_SWIG_BLOCK_MAGIC(gr,throttle);
-
-%include <gr_throttle.h>
diff --git a/gnuradio-core/src/lib/general/gr_transcendental.cc b/gnuradio-core/src/lib/general/gr_transcendental.cc
deleted file mode 100644
index c1482491ba..0000000000
--- a/gnuradio-core/src/lib/general/gr_transcendental.cc
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gr_transcendental.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <complex> //complex math
-#include <cmath> //real math
-#include <map>
-
-/***********************************************************************
- * work function creation and registration
- **********************************************************************/
-typedef int(*work_fcn_type)(int, gr_vector_const_void_star &, gr_vector_void_star &);
-struct map_val_type{
- work_fcn_type work_fcn;
- size_t io_size;
-};
-typedef std::map<std::string, map_val_type> map_type;
-
-//construct map on first use idiom
-static map_type &get_map(void){
- static map_type map;
- return map;
-}
-
-//static initialization of this object registers a function
-struct gr_transcendental_registrant{
- gr_transcendental_registrant(
- const std::string &key,
- const work_fcn_type &work_fcn,
- const size_t io_size
- ){
- map_val_type val;
- val.work_fcn = work_fcn;
- val.io_size = io_size;
- get_map()[key] = val;
- }
-};
-
-//macro to create a work function and register it
-#define REGISTER_FUNCTION(__fcn__, __type__, __key__) \
- static int __key__ ## _work( \
- int noutput_items, \
- gr_vector_const_void_star &input_items, \
- gr_vector_void_star &output_items \
- ){ \
- const __type__ *in = (const __type__ *) input_items[0]; \
- __type__ *out = (__type__ *) output_items[0]; \
- for (size_t i = 0; i < size_t(noutput_items); i++){ \
- out[i] = std::__fcn__(in[i]); \
- } \
- return noutput_items; \
- } \
- gr_transcendental_registrant __key__ ## _registrant(#__key__, &__key__ ## _work, sizeof(__type__));
-
-//register work functions for real types
-#define REGISTER_REAL_FUNCTIONS(__fcn__) \
- REGISTER_FUNCTION(__fcn__, float, __fcn__ ## _float) \
- REGISTER_FUNCTION(__fcn__, double, __fcn__ ## _double)
-
-//register work functions for complex types
-#define REGISTER_COMPLEX_FUNCTIONS(__fcn__) \
- REGISTER_FUNCTION(__fcn__, std::complex<float>, __fcn__ ## _complex_float) \
- REGISTER_FUNCTION(__fcn__, std::complex<double>, __fcn__ ## _complex_double)
-
-//register both complex and real
-#define REGISTER_FUNCTIONS(__fcn__) \
- REGISTER_REAL_FUNCTIONS(__fcn__) \
- REGISTER_COMPLEX_FUNCTIONS(__fcn__)
-
-//create and register transcendental work functions
-REGISTER_FUNCTIONS(cos)
-REGISTER_FUNCTIONS(sin)
-REGISTER_FUNCTIONS(tan)
-REGISTER_REAL_FUNCTIONS(acos)
-REGISTER_REAL_FUNCTIONS(asin)
-REGISTER_REAL_FUNCTIONS(atan)
-REGISTER_FUNCTIONS(cosh)
-REGISTER_FUNCTIONS(sinh)
-REGISTER_FUNCTIONS(tanh)
-REGISTER_FUNCTIONS(exp)
-REGISTER_FUNCTIONS(log)
-REGISTER_FUNCTIONS(log10)
-REGISTER_FUNCTIONS(sqrt)
-
-/***********************************************************************
- * implementation block simply calls into the function pointer
- **********************************************************************/
-class gr_transcendental_impl : public gr_transcendental{
-public:
- gr_transcendental_impl(
- const work_fcn_type &work_fcn, const size_t io_size
- ):
- gr_sync_block(
- "transcendental",
- gr_make_io_signature(1, 1, io_size),
- gr_make_io_signature(1, 1, io_size)
- ),
- _work_fcn(work_fcn)
- {
- // NOP
- }
-
- int work(
- int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items
- ){
- return _work_fcn(noutput_items, input_items, output_items);
- }
-
-private:
- const work_fcn_type &_work_fcn;
-};
-
-/***********************************************************************
- * factory function to make transcendental block
- **********************************************************************/
-gr_transcendental::sptr gr_make_transcendental(
- const std::string &name,
- const std::string &type
-){
- //search for an entry in the map
- const std::string key = name + "_" + type;
- const bool has_key = get_map().count(key) != 0;
- if (!has_key) throw std::runtime_error(
- "could not find transcendental function for " + key
- );
-
- //make a new block with found work function
- return gr_transcendental::sptr(new gr_transcendental_impl(
- get_map()[key].work_fcn, get_map()[key].io_size
- ));
-}
diff --git a/gnuradio-core/src/lib/general/gr_transcendental.i b/gnuradio-core/src/lib/general/gr_transcendental.i
deleted file mode 100644
index 6acdb10b7e..0000000000
--- a/gnuradio-core/src/lib/general/gr_transcendental.i
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-////////////////////////////////////////////////////////////////////////
-// block headers
-////////////////////////////////////////////////////////////////////////
-%{
-#include <gr_transcendental.h>
-%}
-
-////////////////////////////////////////////////////////////////////////
-// block magic
-////////////////////////////////////////////////////////////////////////
-GR_SWIG_BLOCK_MAGIC(gr,transcendental)
-%include <gr_transcendental.h>
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc
deleted file mode 100644
index 00b88e9724..0000000000
--- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_unpack_k_bits_bb.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <iostream>
-
-gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k)
-{
- return gnuradio::get_initial_sptr(new gr_unpack_k_bits_bb (k));
-}
-
-
-gr_unpack_k_bits_bb::gr_unpack_k_bits_bb (unsigned k)
- : gr_sync_interpolator ("unpack_k_bits_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- k),
- d_k (k)
-{
- if (d_k == 0)
- throw std::out_of_range ("interpolation must be > 0");
-}
-
-gr_unpack_k_bits_bb::~gr_unpack_k_bits_bb ()
-{
-}
-
-int
-gr_unpack_k_bits_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- int n = 0;
- for (unsigned int i = 0; i < noutput_items/d_k; i++){
- unsigned int t = in[i];
- for (int j = d_k - 1; j >= 0; j--)
- out[n++] = (t >> j) & 0x01;
- }
-
- assert(n == noutput_items);
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
deleted file mode 100644
index de0f4b33e7..0000000000
--- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,unpack_k_bits_bb)
-
-gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k) throw(std::exception);
-
-class gr_unpack_k_bits_bb : public gr_sync_interpolator
-{
- private:
- gr_unpack_k_bits_bb (int k);
-
- public:
- ~gr_unpack_k_bits_bb ();
-};
diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt
index 59ca06b5a2..23c019d63b 100644
--- a/gnuradio-core/src/lib/io/CMakeLists.txt
+++ b/gnuradio-core/src/lib/io/CMakeLists.txt
@@ -105,7 +105,6 @@ set(gr_core_io_triple_threats
gr_wavfile_sink
gr_tagged_file_sink
gr_tagged_stream_to_pdu
- gr_tuntap_pdu
gr_socket_pdu
)
diff --git a/gnuradio-core/src/lib/io/gr_pdu.h b/gnuradio-core/src/lib/io/gr_pdu.h
index a5ae87db7f..53058ccb6c 100644
--- a/gnuradio-core/src/lib/io/gr_pdu.h
+++ b/gnuradio-core/src/lib/io/gr_pdu.h
@@ -23,17 +23,18 @@
#ifndef GR_PDU_H
#define GR_PDU_H
+#include <gr_core_api.h>
#include <gr_complex.h>
#include <gruel/pmt.h>
-#define pdu_port_id pmt::mp("pdus")
-#define pdu_length_tag pmt::mp("pdu_length")
+#define PDU_PORT_ID pmt::mp("pdus")
+#define PDU_LENGTH_TAG pmt::mp("pdu_length")
enum gr_pdu_vector_type { pdu_byte, pdu_float, pdu_complex };
-size_t gr_pdu_itemsize(gr_pdu_vector_type type);
-bool gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v);
-pmt::pmt_t gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items);
-gr_pdu_vector_type type_from_pmt(pmt::pmt_t vector);
+GR_CORE_API size_t gr_pdu_itemsize(gr_pdu_vector_type type);
+GR_CORE_API bool gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v);
+GR_CORE_API pmt::pmt_t gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items);
+GR_CORE_API gr_pdu_vector_type type_from_pmt(pmt::pmt_t vector);
#endif
diff --git a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc
index 9354a1366d..79011d8536 100644
--- a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc
+++ b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc
@@ -49,7 +49,7 @@ gr_pdu_to_tagged_stream::gr_pdu_to_tagged_stream (gr_pdu_vector_type t)
gr_make_io_signature(1, 1, gr_pdu_itemsize(t))),
d_vectortype(t), d_itemsize(gr_pdu_itemsize(t))
{
- message_port_register_in(pdu_port_id);
+ message_port_register_in(PDU_PORT_ID);
}
gr_pdu_to_tagged_stream::~gr_pdu_to_tagged_stream()
@@ -77,8 +77,8 @@ gr_pdu_to_tagged_stream::work(int noutput_items,
if(noutput_items > 0){
// grab a message if one exists
- //pmt::pmt_t msg( delete_head_nowait( pdu_port_id ) );
- pmt::pmt_t msg( delete_head_blocking( pdu_port_id ) );
+ //pmt::pmt_t msg( delete_head_nowait( PDU_PORT_ID ) );
+ pmt::pmt_t msg( delete_head_blocking( PDU_PORT_ID ) );
if(msg.get() == NULL ){
return nout;
}
@@ -99,7 +99,7 @@ gr_pdu_to_tagged_stream::work(int noutput_items,
uint64_t offset = nitems_written(0) + nout;
// add a tag for pdu length
- add_item_tag(0, offset, pdu_length_tag, pmt::from_long( pmt::length(vect) ), pmt::mp(alias()));
+ add_item_tag(0, offset, PDU_LENGTH_TAG, pmt::from_long( pmt::length(vect) ), pmt::mp(alias()));
// if we recieved metadata add it as tags
if( !eq(meta, pmt::PMT_NIL) ){
diff --git a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc
index 3493f6a389..7daac6db26 100644
--- a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc
+++ b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc
@@ -49,7 +49,7 @@ gr_tagged_stream_to_pdu::gr_tagged_stream_to_pdu (gr_pdu_vector_type t)
d_vectortype(t), d_itemsize(gr_pdu_itemsize(t)), d_inpdu(false),
d_pdu_meta(pmt::PMT_NIL), d_pdu_vector(pmt::PMT_NIL)
{
- message_port_register_out(pdu_port_id);
+ message_port_register_out(PDU_PORT_ID);
}
gr_tagged_stream_to_pdu::~gr_tagged_stream_to_pdu()
@@ -70,7 +70,7 @@ gr_tagged_stream_to_pdu::work(int noutput_items,
get_tags_in_range(d_tags, 0, abs_N, abs_N+1);
bool found_length_tag(false);
for(d_tags_itr = d_tags.begin(); (d_tags_itr != d_tags.end()) && (!found_length_tag); d_tags_itr++){
- if( pmt::equal( (*d_tags_itr).key, pdu_length_tag ) ){
+ if( pmt::equal( (*d_tags_itr).key, PDU_LENGTH_TAG ) ){
if( (*d_tags_itr).offset != abs_N ){
throw std::runtime_error("expected next pdu length tag on a different item...");
}
@@ -91,7 +91,7 @@ gr_tagged_stream_to_pdu::work(int noutput_items,
// copy any tags in this range into our meta object
get_tags_in_range(d_tags, 0, abs_N, abs_N+ncopy);
for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++){
- if( ! equal( (*d_tags_itr).key, pdu_length_tag ) ){
+ if( ! equal( (*d_tags_itr).key, PDU_LENGTH_TAG ) ){
d_pdu_meta = dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value);
}
}
@@ -127,7 +127,7 @@ void gr_tagged_stream_to_pdu::send_message(){
}
pmt::pmt_t msg = pmt::cons( d_pdu_meta, d_pdu_vector );
- message_port_pub( pdu_port_id, msg );
+ message_port_pub( PDU_PORT_ID, msg );
d_pdu_meta = pmt::PMT_NIL;
d_pdu_vector = pmt::PMT_NIL;
diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc b/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc
deleted file mode 100644
index 8dd4b18a10..0000000000
--- a/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_tuntap_pdu.h>
-#include <gr_io_signature.h>
-#include <cstdio>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdexcept>
-#include <string.h>
-#include <iostream>
-#include <gr_pdu.h>
-#include <boost/format.hpp>
-
-#if (defined(linux) || defined(__linux) || defined(__linux__))
-
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <arpa/inet.h>
-#include <linux/if.h>
-
-
-// public constructor that returns a shared_ptr
-
-gr_tuntap_pdu_sptr
-gr_make_tuntap_pdu (std::string dev, int MTU)
-{
- return gnuradio::get_initial_sptr(new gr_tuntap_pdu(dev, MTU));
-}
-
-gr_tuntap_pdu::gr_tuntap_pdu (std::string dev, int MTU)
- : gr_stream_pdu_base(MTU)
-{
-
- // make the tuntap
- char dev_cstr[1024];
- memset(dev_cstr, 0x00, 1024);
- strncpy(dev_cstr, dev.c_str(), std::min(sizeof(dev_cstr), dev.size()));
- d_fd = tun_alloc(dev_cstr);
- if(d_fd <= 0){
- throw std::runtime_error("TunTap make: tun_alloc failed (are you running as root?)");
- }
-
- std::cout << boost::format(
- "Allocated virtual ethernet interface: %s\n"
- "You must now use ifconfig to set its IP address. E.g.,\n"
- " $ sudo ifconfig %s 192.168.200.1\n"
- "Be sure to use a different address in the same subnet for each machine.\n"
- ) % dev % dev << std::endl;
-
- // set up output message port
- message_port_register_out(pmt::mp("pdus"));
- start_rxthread(pmt::mp("pdus"));
-
- // set up input message port
- message_port_register_in(pmt::mp("pdus"));
- set_msg_handler(pmt::mp("pdus"), boost::bind(&gr_tuntap_pdu::send, this, _1));
-}
-
-
-int gr_tuntap_pdu::tun_alloc(char *dev, int flags) {
- struct ifreq ifr;
- int fd, err;
- const char *clonedev = "/dev/net/tun";
-
- /* Arguments taken by the function:
- *
- * char *dev: the name of an interface (or '\0'). MUST have enough
- * space to hold the interface name if '\0' is passed
- * int flags: interface flags (eg, IFF_TUN etc.)
- */
-
- /* open the clone device */
- if( (fd = open(clonedev, O_RDWR)) < 0 ) {
- return fd;
- }
-
- /* preparation of the struct ifr, of type "struct ifreq" */
- memset(&ifr, 0, sizeof(ifr));
-
- ifr.ifr_flags = flags; /* IFF_TUN or IFF_TAP, plus maybe IFF_NO_PI */
-
- if (*dev) {
- /* if a device name was specified, put it in the structure; otherwise,
- * the kernel will try to allocate the "next" device of the
- * specified type */
- strncpy(ifr.ifr_name, dev, IFNAMSIZ);
- }
-
- /* try to create the device */
- if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) {
- close(fd);
- return err;
- }
-
- /* if the operation was successful, write back the name of the
- * interface to the variable "dev", so the caller can know
- * it. Note that the caller MUST reserve space in *dev (see calling
- * code below) */
- strcpy(dev, ifr.ifr_name);
-
- /* this is the special file descriptor that the caller will use to talk
- * with the virtual interface */
- return fd;
-}
-
-#else //if not linux
-
-gr_block_sptr
-gr_make_tuntap_pdu(std::string dev, int MTU)
-{
- gr_block_sptr rv;
- throw std::runtime_error("tuntap only implemented on linux");
- return rv;
-}
-
-#endif
diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.h b/gnuradio-core/src/lib/io/gr_tuntap_pdu.h
deleted file mode 100644
index 18c83f42b2..0000000000
--- a/gnuradio-core/src/lib/io/gr_tuntap_pdu.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_TUNTAP_PDU_H
-#define INCLUDED_GR_TUNTAP_PDU_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-#include <gr_message.h>
-#include <gr_msg_queue.h>
-#include <gr_stream_pdu_base.h>
-
-#if (defined(linux) || defined(__linux) || defined(__linux__))
-
-#include <linux/if_tun.h>
-
-class gr_tuntap_pdu;
-typedef boost::shared_ptr<gr_tuntap_pdu> gr_tuntap_pdu_sptr;
-
-GR_CORE_API gr_tuntap_pdu_sptr gr_make_tuntap_pdu (std::string dev, int MTU=10000);
-
-/*!
- * \brief Gather received items into messages and insert into msgq
- * \ingroup sink_blk
- */
-class GR_CORE_API gr_tuntap_pdu : public gr_stream_pdu_base
-{
- private:
- friend GR_CORE_API gr_tuntap_pdu_sptr
- gr_make_tuntap_pdu(std::string dev, int MTU);
- int tun_alloc(char* dev, int flags = IFF_TAP | IFF_NO_PI);
- std::string d_dev;
- protected:
- gr_tuntap_pdu (std::string dev, int MTU=10000);
-
- public:
- ~gr_tuntap_pdu () {}
-
-};
-
-#else // if not linux
-
-class gr_tuntap_pdu
-{
-private:
- gr_tuntap_pdu() {};
-public:
- ~gr_tuntap_pdu() {};
-};
-
-GR_CORE_API gr_block_sptr gr_make_tuntap_pdu (std::string dev, int MTU=0);
-
-#endif
-
-#endif /* INCLUDED_GR_TUNTAP_PDU_H */
diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.i b/gnuradio-core/src/lib/io/gr_tuntap_pdu.i
deleted file mode 100644
index 589bbc3853..0000000000
--- a/gnuradio-core/src/lib/io/gr_tuntap_pdu.i
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,tuntap_pdu);
-
-%{
-#include <gr_tuntap_pdu.h>
-%}
-
-%include "gr_tuntap_pdu.h"
-
diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i
index e2de4eb976..33cc906e92 100644
--- a/gnuradio-core/src/lib/io/io.i
+++ b/gnuradio-core/src/lib/io/io.i
@@ -49,7 +49,6 @@
#include <gr_tagged_stream_to_pdu.h>
#include <gr_message_debug.h>
#include <gr_pdu.h>
-#include <gr_tuntap_pdu.h>
#include <gr_socket_pdu.h>
%}
@@ -77,7 +76,6 @@
%include "gr_tagged_stream_to_pdu.i"
%include "gr_message_debug.i"
%include "gr_pdu.i"
-%include "gr_tuntap_pdu.i"
%include "gr_socket_pdu.i"
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index 034f6136d9..acd938080a 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -628,6 +628,12 @@ class GR_CORE_API gr_block : public gr_basic_block {
std::vector<long> d_max_output_buffer;
std::vector<long> d_min_output_buffer;
+ /*! Used by block's setters and work functions to make
+ * setting/resetting of parameters thread-safe.
+ *
+ * Used by calling gruel::scoped_lock l(d_setlock);
+ */
+ gruel::mutex d_setlock;
// These are really only for internal use, but leaving them public avoids
// having to work up an ever-varying list of friend GR_CORE_APIs
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc
index e5859768de..c6118bcfdd 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc
@@ -138,13 +138,15 @@ gr_top_block::setup_rpc()
"items", "Max number of output items",
RPC_PRIVLVL_MIN, DISPNULL)));
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, std::string>(
- alias(), "edge list",
- &gr_top_block::edge_list,
- pmt::mp(""), pmt::mp(""), pmt::mp(""),
- "edges", "List of edges in the graph",
- RPC_PRIVLVL_MIN, DISPNULL)));
+ if(gr_prefs::singleton()->get_bool("ControlPort", "edges_list", false)) {
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, std::string>(
+ alias(), "edge list",
+ &gr_top_block::edge_list,
+ pmt::mp(""), pmt::mp(""), pmt::mp(""),
+ "edges", "List of edges in the graph",
+ RPC_PRIVLVL_MIN, DISPNULL)));
+ }
// Setters
add_rpc_variable(
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
index 27858b575b..f797271970 100644
--- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
+++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,6 +21,7 @@
#
from gnuradio import gr
+from gnuradio import blocks
import sys, time
try:
@@ -31,34 +32,68 @@ except ImportError:
print "Error: Program requires PyQt4 and gr-qtgui."
sys.exit(1)
-class GrDataPlotterC(gr.top_block):
- def __init__(self, name, rate, pmin=None, pmax=None, stripchart=False):
+class GrDataPlotParent(gr.top_block, QtGui.QWidget):
+ # Setup signals
+ plotupdated = QtCore.pyqtSignal(QtGui.QWidget)
+
+ def __init__(self, name, rate, pmin=None, pmax=None):
gr.top_block.__init__(self)
+ QtGui.QWidget.__init__(self, None)
- self._stripchart = stripchart
self._name = name
self._npts = 500
- samp_rate = 1.0
+ self._rate = rate
+ self.knobnames = [name,]
+
+ self.layout = QtGui.QVBoxLayout()
+ self.setLayout(self.layout)
+
+ self.setAcceptDrops(True)
- self._last_data = self._npts*[0,]
- self._data_len = 0
+ def _setup(self, nconnections):
+ self.stop()
+ self.wait()
- self.src = gr.vector_source_c([])
- self.thr = gr.throttle(gr.sizeof_gr_complex, rate)
- self.snk = qtgui.time_sink_c(self._npts, samp_rate,
- self._name, 1)
- self.snk.enable_autoscale(True)
+ if(self.layout.count() > 0):
+ # Remove and disconnect. Making sure no references to snk
+ # remain so that the plot gets deleted.
+ self.layout.removeWidget(self.py_window)
+ self.disconnect(self.thr, (self.snk, 0))
+ self.disconnect(self.src[0], self.thr)
+ for n in xrange(1, self._ncons):
+ self.disconnect(self.src[n], (self.snk,n))
- self.connect(self.src, self.thr, (self.snk, 0))
+ self._ncons = nconnections
+ self._data_len = self._ncons*[0,]
- self.snk.set_line_label(0, "Real")
- self.snk.set_line_label(1, "Imag")
+ self.thr = blocks.throttle(self._datasize, self._rate)
+ self.snk = self.get_qtsink()
+
+ self.connect(self.thr, (self.snk, 0))
+
+ self._last_data = []
+ self.src = []
+ for n in xrange(self._ncons):
+ self.set_line_label(n, self.knobnames[n])
+
+ self._last_data.append(int(self._npts)*[0,])
+ self.src.append(self.get_vecsource())
+
+ if(n == 0):
+ self.connect(self.src[n], self.thr)
+ else:
+ self.connect(self.src[n], (self.snk,n))
self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+ self.layout.addWidget(self.py_window)
+
def __del__(self):
pass
+ def close(self):
+ self.snk.close()
+
def qwidget(self):
return self.py_window
@@ -68,162 +103,172 @@ class GrDataPlotterC(gr.top_block):
def semilogy(self, en=True):
self.snk.enable_semilogy(en)
- def stem(self, en=True):
- self.snk.enable_stem_plot(en)
+ def dragEnterEvent(self, e):
+ e.acceptProposedAction()
+
+ def dropEvent(self, e):
+ if(e.mimeData().hasFormat("text/plain")):
+ data = str(e.mimeData().text())
+
+ #"PlotData:{0}:{1}".format(tag, iscomplex)
+ datalst = data.split(":::")
+ tag = datalst[0]
+ name = datalst[1]
+ cpx = datalst[2] != "0"
+
+ if(tag == "PlotData" and cpx == self._iscomplex):
+ self.knobnames.append(name)
+
+ # create a new qwidget plot with the new data stream.
+ self._setup(len(self.knobnames))
+
+ # emit that this plot has been updated with a new qwidget.
+ self.plotupdated.emit(self)
+
+ e.acceptProposedAction()
+
+ def data_to_complex(self, data):
+ if(self._iscomplex):
+ data_r = data[0::2]
+ data_i = data[1::2]
+ data = [complex(r,i) for r,i in zip(data_r, data_i)]
+ return data
def update(self, data):
# Ask GUI if there has been a change in nsamps
- npts = self.snk.nsamps()
+ npts = self.get_npts()
if(self._npts != npts):
# Adjust buffers to accomodate new settings
- if(npts < self._npts):
- if(self._data_len < npts):
- self._last_data = self._last_data[0:npts]
+ for n in xrange(self._ncons):
+ if(npts < self._npts):
+ if(self._data_len[n] < npts):
+ self._last_data[n] = self._last_data[n][0:npts]
+ else:
+ self._last_data[n] = self._last_data[n][self._data_len[n]-npts:self._data_len[n]]
+ self._data_len[n] = npts
else:
- self._last_data = self._last_data[self._data_len-npts:self._data_len]
- self._data_len = npts
- else:
- self._last_data += (npts - self._npts)*[0,]
+ self._last_data[n] += (npts - self._npts)*[0,]
self._npts = npts
self.snk.reset()
-
+
if(self._stripchart):
# Update the plot data depending on type
- if(type(data) == list):
- data_r = data[0::2]
- data_i = data[1::2]
- data = [complex(r,i) for r,i in zip(data_r, data_i)]
- if(len(data) > self._npts):
- self.src.set_data(data)
- self._last_data = data[-self._npts:]
- else:
- newdata = self._last_data[-(self._npts-len(data)):]
- newdata += data
- self.src.set_data(newdata)
- self._last_data = newdata
-
- else: # single value update
- if(self._data_len < self._npts):
- self._last_data[self._data_len] = data
- self._data_len += 1
- else:
- self._last_data = self._last_data[1:]
- self._last_data.append(data)
- self.src.set_data(self._last_data)
+ for n in xrange(self._ncons):
+ if(type(data[n]) == list):
+ data[n] = self.data_to_complex(data[n])
+ if(len(data[n]) > self._npts):
+ self.src[n].set_data(data[n])
+ self._last_data[n] = data[n][-self._npts:]
+ else:
+ newdata = self._last_data[n][-(self._npts-len(data)):]
+ newdata += data[n]
+ self.src[n].set_data(newdata)
+ self._last_data[n] = newdata
+
+ else: # single value update
+ if(self._iscomplex):
+ data[n] = complex(data[n][0], data[n][1])
+ if(self._data_len[n] < self._npts):
+ self._last_data[n][self._data_len[n]] = data[n]
+ self._data_len[n] += 1
+ else:
+ self._last_data[n] = self._last_data[n][1:]
+ self._last_data[n].append(data[n])
+ self.src[n].set_data(self._last_data[n])
else:
- if(type(data) != list):
- data = [data,]
- self.src.set_data(data)
+ for n in xrange(self._ncons):
+ if(type(data[n]) != list):
+ data[n] = [data[n],]
+ data[n] = self.data_to_complex(data[n])
+ self.src[n].set_data(data[n])
+
+
-class GrDataPlotterF(gr.top_block):
+class GrDataPlotterC(GrDataPlotParent):
def __init__(self, name, rate, pmin=None, pmax=None, stripchart=False):
- gr.top_block.__init__(self)
+ GrDataPlotParent.__init__(self, name, rate, pmin, pmax)
self._stripchart = stripchart
- self._name = name
- self._npts = 500
- samp_rate = 1.0
+ self._datasize = gr.sizeof_gr_complex
+ self._iscomplex = True
- self._last_data = self._npts*[0,]
- self._data_len = 0
+ self._setup(1)
- self.src = gr.vector_source_f([])
- self.thr = gr.throttle(gr.sizeof_float, rate)
- self.snk = qtgui.time_sink_f(self._npts, samp_rate,
- self._name, 1)
- self.snk.enable_autoscale(True)
+ def stem(self, en=True):
+ self.snk.enable_stem_plot(en)
- self.connect(self.src, self.thr, (self.snk, 0))
+ def get_qtsink(self):
+ snk = qtgui.time_sink_c(self._npts, 1.0,
+ self._name, self._ncons)
+ snk.enable_autoscale(True)
+ return snk
- self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+ def get_vecsource(self):
+ return gr.vector_source_c([])
- def __del__(self):
- pass
+ def get_npts(self):
+ self._npts = self.snk.nsamps()
+ return self._npts
- def qwidget(self):
- return self.py_window
+ def set_line_label(self, n, name):
+ self.snk.set_line_label(2*n+0, "Re{" + self.knobnames[n] + "}")
+ self.snk.set_line_label(2*n+1, "Im{" + self.knobnames[n] + "}")
- def name(self):
- return self._name
- def semilogy(self, en=True):
- self.snk.enable_semilogy(en)
+class GrDataPlotterF(GrDataPlotParent):
+ def __init__(self, name, rate, pmin=None, pmax=None, stripchart=False):
+ GrDataPlotParent.__init__(self, name, rate, pmin, pmax)
- def stem(self, en=True):
- self.snk.enable_stem_plot(en)
+ self._stripchart = stripchart
+ self._datasize = gr.sizeof_float
+ self._iscomplex = False
- def update(self, data):
- # Ask GUI if there has been a change in nsamps
- npts = self.snk.nsamps()
- if(self._npts != npts):
+ self._setup(1)
- # Adjust buffers to accomodate new settings
- if(npts < self._npts):
- if(self._data_len < npts):
- self._last_data = self._last_data[0:npts]
- else:
- self._last_data = self._last_data[self._data_len-npts:self._data_len]
- self._data_len = npts
- else:
- self._last_data += (npts - self._npts)*[0,]
- self._npts = npts
- self.snk.reset()
+ def stem(self, en=True):
+ self.snk.enable_stem_plot(en)
- if(self._stripchart):
- # Update the plot data depending on type
- if(type(data) == list):
- if(len(data) > self._npts):
- self.src.set_data(data)
- self._last_data = data[-self._npts:]
- else:
- newdata = self._last_data[-(self._npts-len(data)):]
- newdata += data
- self.src.set_data(newdata)
- self._last_data = newdata
-
- else: # single value update
- if(self._data_len < self._npts):
- self._last_data[self._data_len] = data
- self._data_len += 1
- else:
- self._last_data = self._last_data[1:]
- self._last_data.append(data)
- self.src.set_data(self._last_data)
- else:
- if(type(data) != list):
- data = [data,]
- self.src.set_data(data)
+ def get_qtsink(self):
+ snk = qtgui.time_sink_f(self._npts, 1.0,
+ self._name, self._ncons)
+ snk.enable_autoscale(True)
+ return snk
+
+ def get_vecsource(self):
+ return gr.vector_source_f([])
+
+ def get_npts(self):
+ self._npts = self.snk.nsamps()
+ return self._npts
+
+ def set_line_label(self, n, name):
+ self.snk.set_line_label(n, self.knobnames[n])
-class GrDataPlotterConst(gr.top_block):
- def __init__(self, name, rate, pmin=None, pmax=None):
- gr.top_block.__init__(self)
-
- self._name = name
- self._npts = 500
- samp_rate = 1.0
- self._last_data = self._npts*[0,]
- self._data_len = 0
-
- self.src = gr.vector_source_c([])
- self.thr = gr.throttle(gr.sizeof_gr_complex, rate)
- self.snk = qtgui.const_sink_c(self._npts,
- self._name, 1)
- self.snk.enable_autoscale(True)
+class GrDataPlotterConst(GrDataPlotParent):
+ def __init__(self, name, rate, pmin=None, pmax=None):
+ GrDataPlotParent.__init__(self, name, rate, pmin, pmax)
- self.connect(self.src, self.thr, (self.snk, 0))
+ self._datasize = gr.sizeof_gr_complex
+ self._stripchart = False
+ self._iscomplex = True
- self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+ self._setup(1)
- def __del__(self):
- pass
+ def get_qtsink(self):
+ snk = qtgui.const_sink_c(self._npts,
+ self._name,
+ self._ncons)
+ snk.enable_autoscale(True)
+ return snk
- def qwidget(self):
- return self.py_window
+ def get_vecsource(self):
+ return gr.vector_source_c([])
- def name(self):
- return self._name
+ def get_npts(self):
+ self._npts = self.snk.nsamps()
+ return self._npts
def scatter(self, en=True):
if(en):
@@ -231,327 +276,133 @@ class GrDataPlotterConst(gr.top_block):
else:
self.snk.set_line_style(0, 1)
- def update(self, data):
- # Ask GUI if there has been a change in nsamps
- npts = self.snk.nsamps()
- if(self._npts != npts):
-
- # Adjust buffers to accomodate new settings
- if(npts < self._npts):
- if(self._data_len < npts):
- self._last_data = self._last_data[0:npts]
- else:
- self._last_data = self._last_data[self._data_len-npts:self._data_len]
- self._data_len = npts
- else:
- self._last_data += (npts - self._npts)*[0,]
- self._npts = npts
- self.snk.reset()
-
- # Update the plot data depending on type
- if(type(data) == list):
- data_r = data[0::2]
- data_i = data[1::2]
- data = [complex(r,i) for r,i in zip(data_r, data_i)]
- if(len(data) > self._npts):
- self.src.set_data(data)
- self._last_data = data[-self._npts:]
- else:
- newdata = self._last_data[-(self._npts-len(data)):]
- newdata += data
- self.src.set_data(newdata)
- self._last_data = newdata
-
- else: # single value update
- if(self._data_len < self._npts):
- self._last_data[self._data_len] = data
- self._data_len += 1
- else:
- self._last_data = self._last_data[1:]
- self._last_data.append(data)
- self.src.set_data(self._last_data)
+ def set_line_label(self, n, name):
+ self.snk.set_line_label(n, self.knobnames[n])
-class GrDataPlotterPsdC(gr.top_block):
+class GrDataPlotterPsdC(GrDataPlotParent):
def __init__(self, name, rate, pmin=None, pmax=None):
- gr.top_block.__init__(self)
+ GrDataPlotParent.__init__(self, name, rate, pmin, pmax)
- self._name = name
- self._samp_rate = 1.0
- self._fftsize = 2048
+ self._datasize = gr.sizeof_gr_complex
+ self._stripchart = True
+ self._iscomplex = True
+
+ self._npts = 2048
self._wintype = gr.firdes.WIN_BLACKMAN_hARRIS
self._fc = 0
-
- self._last_data = self._fftsize*[0,]
- self._data_len = 0
- self.src = gr.vector_source_c([])
- self.thr = gr.throttle(gr.sizeof_gr_complex, rate)
- self.snk = qtgui.freq_sink_c(self._fftsize, self._wintype,
- self._fc, self._samp_rate,
- self._name, 1)
- self.snk.enable_autoscale(True)
+ self._setup(1)
- self.connect(self.src, self.thr, (self.snk, 0))
+ def get_qtsink(self):
+ snk = qtgui.freq_sink_c(self._npts, self._wintype,
+ self._fc, 1.0,
+ self._name,
+ self._ncons)
+ snk.enable_autoscale(True)
+ return snk
- self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
-
- def __del__(self):
- pass
+ def get_vecsource(self):
+ return gr.vector_source_c([])
- def qwidget(self):
- return self.py_window
+ def get_npts(self):
+ self._npts = self.snk.fft_size()
+ return self._npts
- def name(self):
- return self._name
+ def set_line_label(self, n, name):
+ self.snk.set_line_label(n, self.knobnames[n])
- def update(self, data):
- # Ask GUI if there has been a change in nsamps
- fftsize = self.snk.fft_size()
- if(self._fftsize != fftsize):
-
- # Adjust buffers to accomodate new settings
- if(fftsize < self._fftsize):
- if(self._data_len < fftsize):
- self._last_data = self._last_data[0:fftsize]
- else:
- self._last_data = self._last_data[self._data_len-fftsize:self._data_len]
- self._data_len = fftsize
- else:
- self._last_data += (fftsize - self._fftsize)*[0,]
- self._fftsize = fftsize
- self.snk.reset()
-
- # Update the plot data depending on type
- if(type(data) == list):
- data_r = data[0::2]
- data_i = data[1::2]
- data = [complex(r,i) for r,i in zip(data_r, data_i)]
- if(len(data) > self._fftsize):
- self.src.set_data(data)
- self._last_data = data[-self._fftsize:]
- else:
- newdata = self._last_data[-(self._fftsize-len(data)):]
- newdata += data
- self.src.set_data(newdata)
- self._last_data = newdata
-
- else: # single value update
- if(self._data_len < self._fftsize):
- self._last_data[self._data_len] = data
- self._data_len += 1
- else:
- self._last_data = self._last_data[1:]
- self._last_data.append(data)
- self.src.set_data(self._last_data)
-class GrDataPlotterPsdF(gr.top_block):
+class GrDataPlotterPsdF(GrDataPlotParent):
def __init__(self, name, rate, pmin=None, pmax=None):
- gr.top_block.__init__(self)
+ GrDataPlotParent.__init__(self, name, rate, pmin, pmax)
- self._name = name
- self._samp_rate = 1.0
- self._fftsize = 2048
+ self._datasize = gr.sizeof_float
+ self._stripchart = True
+ self._iscomplex = False
+
+ self._npts = 2048
self._wintype = gr.firdes.WIN_BLACKMAN_hARRIS
self._fc = 0
-
- self._last_data = self._fftsize*[0,]
- self._data_len = 0
- self.src = gr.vector_source_f([])
- self.thr = gr.throttle(gr.sizeof_float, rate)
- self.snk = qtgui.freq_sink_f(self._fftsize, self._wintype,
- self._fc, self._samp_rate,
- self._name, 1)
- self.snk.enable_autoscale(True)
+ self._setup(1)
- self.connect(self.src, self.thr, (self.snk, 0))
+ def get_qtsink(self):
+ snk = qtgui.freq_sink_f(self._npts, self._wintype,
+ self._fc, 1.0,
+ self._name,
+ self._ncons)
+ snk.enable_autoscale(True)
+ return snk
- self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
-
- def __del__(self):
- pass
+ def get_vecsource(self):
+ return gr.vector_source_f([])
- def qwidget(self):
- return self.py_window
+ def get_npts(self):
+ self._npts = self.snk.fft_size()
+ return self._npts
- def name(self):
- return self._name
+ def set_line_label(self, n, name):
+ self.snk.set_line_label(n, self.knobnames[n])
- def update(self, data):
- # Ask GUI if there has been a change in nsamps
- fftsize = self.snk.fft_size()
- if(self._fftsize != fftsize):
-
- # Adjust buffers to accomodate new settings
- if(fftsize < self._fftsize):
- if(self._data_len < fftsize):
- self._last_data = self._last_data[0:fftsize]
- else:
- self._last_data = self._last_data[self._data_len-fftsize:self._data_len]
- self._data_len = fftsize
- else:
- self._last_data += (fftsize - self._fftsize)*[0,]
- self._fftsize = fftsize
- self.snk.reset()
-
- # Update the plot data depending on type
- if(type(data) == list):
- data_r = data[0::2]
- data_i = data[1::2]
- data = [complex(r,i) for r,i in zip(data_r, data_i)]
- if(len(data) > self._fftsize):
- self.src.set_data(data)
- self._last_data = data[-self._fftsize:]
- else:
- newdata = self._last_data[-(self._fftsize-len(data)):]
- newdata += data
- self.src.set_data(newdata)
- self._last_data = newdata
-
- else: # single value update
- if(self._data_len < self._fftsize):
- self._last_data[self._data_len] = data
- self._data_len += 1
- else:
- self._last_data = self._last_data[1:]
- self._last_data.append(data)
- self.src.set_data(self._last_data)
-
-class GrTimeRasterF(gr.top_block):
+class GrTimeRasterF(GrDataPlotParent):
def __init__(self, name, rate, pmin=None, pmax=None):
- gr.top_block.__init__(self)
-
- self._name = name
- self._npts = 100
- self._rows = 100
- samp_rate = 1.0
-
- self._last_data = self._npts*[0,]
- self._data_len = 0
+ GrDataPlotParent.__init__(self, name, rate, pmin, pmax)
- self.src = gr.vector_source_f([])
- self.thr = gr.throttle(gr.sizeof_float, rate)
- self.snk = qtgui.time_raster_sink_f(samp_rate, self._npts, self._rows,
- [], [], self._name, 1)
+ self._npts = 10
+ self._rows = 40
- self.connect(self.src, self.thr, (self.snk, 0))
+ self._datasize = gr.sizeof_float
+ self._stripchart = False
+ self._iscomplex = False
- self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+ self._setup(1)
- def __del__(self):
- pass
+ def get_qtsink(self):
+ snk = qtgui.time_raster_sink_f(1.0, self._npts, self._rows,
+ [], [], self._name,
+ self._ncons)
+ return snk
- def qwidget(self):
- return self.py_window
+ def get_vecsource(self):
+ return gr.vector_source_f([])
- def name(self):
- return self._name
+ def get_npts(self):
+ self._npts = self.snk.num_cols()
+ return self._npts
- def update(self, data):
- # Ask GUI if there has been a change in nsamps
- npts = int(self.snk.num_cols())
- if(self._npts != npts):
-
- # Adjust buffers to accomodate new settings
- if(npts < self._npts):
- if(self._data_len < npts):
- self._last_data = self._last_data[0:npts]
- else:
- self._last_data = self._last_data[self._data_len-npts:self._data_len]
- self._data_len = npts
- else:
- self._last_data += (npts - self._npts)*[0,]
- self._npts = npts
- self.snk.reset()
-
- # Update the plot data depending on type
- if(type(data) == list):
- if(len(data) > self._npts):
- self.src.set_data(data)
- self._last_data = data[-self._npts:]
- else:
- newdata = self._last_data[-(self._npts-len(data)):]
- newdata += data
- self.src.set_data(newdata)
- self._last_data = newdata
-
- else: # single value update
- if(self._data_len < self._npts):
- self._last_data[self._data_len] = data
- self._data_len += 1
- else:
- self._last_data = self._last_data[1:]
- self._last_data.append(data)
- self.src.set_data(self._last_data)
+ def set_line_label(self, n, name):
+ self.snk.set_line_label(n, self.knobnames[n])
-class GrTimeRasterB(gr.top_block):
+class GrTimeRasterB(GrDataPlotParent):
def __init__(self, name, rate, pmin=None, pmax=None):
- gr.top_block.__init__(self)
-
- self._name = name
- self._npts = 100
- self._rows = 100
- samp_rate = 1.0
+ GrDataPlotParent.__init__(self, name, rate, pmin, pmax)
- self._last_data = self._npts*[0,]
- self._data_len = 0
+ self._npts = 10
+ self._rows = 40
- self.src = gr.vector_source_b([])
- self.thr = gr.throttle(gr.sizeof_char, rate)
- self.snk = qtgui.time_raster_sink_b(samp_rate, self._npts, self._rows,
- [], [], self._name, 1)
+ self._datasize = gr.sizeof_char
+ self._stripchart = False
+ self._iscomplex = False
- self.connect(self.src, self.thr, (self.snk, 0))
+ self._setup(1)
- self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+ def get_qtsink(self):
+ snk = qtgui.time_raster_sink_b(1.0, self._npts, self._rows,
+ [], [], self._name,
+ self._ncons)
+ return snk
- def __del__(self):
- pass
-
- def qwidget(self):
- return self.py_window
-
- def name(self):
- return self._name
+ def get_vecsource(self):
+ return gr.vector_source_b([])
- def update(self, data):
- # Ask GUI if there has been a change in nsamps
- npts = self.snk.num_cols()
- if(self._npts != npts):
+ def get_npts(self):
+ self._npts = self.snk.num_cols()
+ return self._npts
- # Adjust buffers to accomodate new settings
- if(npts < self._npts):
- if(self._data_len < npts):
- self._last_data = self._last_data[0:npts]
- else:
- self._last_data = self._last_data[self._data_len-npts:self._data_len]
- self._data_len = npts
- else:
- self._last_data += (npts - self._npts)*[0,]
- self._npts = npts
- self.snk.reset()
-
- # Update the plot data depending on type
- if(type(data) == list):
- if(len(data) > self._npts):
- self.src.set_data(data)
- self._last_data = data[-self._npts:]
- else:
- newdata = self._last_data[-(self._npts-len(data)):]
- newdata += data
- self.src.set_data(newdata)
- self._last_data = newdata
-
- else: # single value update
- if(self._data_len < self._npts):
- self._last_data[self._data_len] = data
- self._data_len += 1
- else:
- self._last_data = self._last_data[1:]
- self._last_data.append(data)
- self.src.set_data(self._last_data)
+ def set_line_label(self, n, name):
+ self.snk.set_line_label(n, self.knobnames[n])
class GrDataPlotterValueTable:
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
index 60a810b04e..e71cd92ab7 100755
--- a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
+++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@ from gnuradio import gr, ctrlport
from PyQt4 import QtCore,Qt
import PyQt4.QtGui as QtGui
-import sys, time
+import os, sys, time
import Ice
from gnuradio.ctrlport.IceRadioClient import *
@@ -55,7 +55,7 @@ class MAINWindow(QtGui.QMainWindow):
def __init__(self, radio, port, interface):
super(MAINWindow, self).__init__()
- self.updateRate = 2000;
+ self.updateRate = 1000;
self.conns = []
self.plots = []
self.knobprops = []
@@ -83,6 +83,11 @@ class MAINWindow(QtGui.QMainWindow):
icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" )
self.setWindowIcon(icon)
+ # Locally turn off ControlPort export from GR. This prevents
+ # our GR-based plotters from launching their own ControlPort
+ # instance (and possibly causing a port collision if one has
+ # been specified).
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
def setUpdateRate(self,nur):
self.updateRate = int(nur);
@@ -217,17 +222,55 @@ class MAINWindow(QtGui.QMainWindow):
else:
self.newPlotPsdC(tag, uid, title)
+ def startDrag(self, e):
+ drag = QtGui.QDrag(self)
+ mime_data = QtCore.QMimeData()
+
+ tag = str(e.text(0))
+ tree = e.treeWidget().parent()
+ knobprop = self.knobprops[tree.uid][tag]
+ disp = knobprop.display
+ iscomplex = (disp & gr.DISPOPTCPLX) or (disp & gr.DISPXY)
+
+ if(disp != gr.DISPNULL):
+ data = "PlotData:::{0}:::{1}".format(tag, iscomplex)
+ else:
+ data = "OtherData:::{0}:::{1}".format(tag, iscomplex)
+
+ mime_data.setText(data)
+ drag.setMimeData(mime_data)
+
+ drop = drag.start()
+
def createPlot(self, plot, uid, title):
plot.start()
self.plots[uid].append(plot)
- self.mdiArea.addSubWindow(plot.qwidget())
- plot.qwidget().setWindowTitle("{0}: {1}".format(title, plot.name()))
+ self.mdiArea.addSubWindow(plot)
+ plot.setWindowTitle("{0}: {1}".format(title, plot.name()))
self.connect(plot.qwidget(),
QtCore.SIGNAL('destroyed(QObject*)'),
self.destroyPlot)
- plot.qwidget().show()
+ # when the plot is updated via drag-and-drop, we need to be
+ # notified of the new qwidget that's created so we can
+ # properly destroy it.
+ plot.plotupdated.connect(self.plotUpdated)
+
+ plot.show()
+
+ def plotUpdated(self, q):
+ # the plot has been updated with a new qwidget; make sure this
+ # gets dies to the destroyPlot function.
+ for i, plots in enumerate(self.plots):
+ for p in plots:
+ if(p == q):
+ #plots.remove(p)
+ #plots.append(q)
+ self.connect(q.qwidget(),
+ QtCore.SIGNAL('destroyed(QObject*)'),
+ self.destroyPlot)
+ break
def destroyPlot(self, obj):
for plots in self.plots:
@@ -275,7 +318,9 @@ class MAINWindow(QtGui.QMainWindow):
def update(self, knobs, uid):
#sys.stderr.write("KNOB KEYS: {0}\n".format(knobs.keys()))
for plot in self.plots[uid]:
- data = knobs[plot.name()].value
+ data = []
+ for n in plot.knobnames:
+ data.append(knobs[n].value)
plot.update(data)
plot.stop()
plot.wait()
@@ -639,7 +684,7 @@ class MForm(QtGui.QWidget):
self.table.treeWidget.setEditTriggers(QtGui.QAbstractItemView.EditKeyPressed)
self.table.treeWidget.setSortingEnabled(True)
self.table.treeWidget.setDragEnabled(True)
-
+
# add things to layouts
self.horizontalLayout.addWidget(self.table.treeWidget)
@@ -657,6 +702,11 @@ class MForm(QtGui.QWidget):
QtCore.SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'),
self.parent.newSub);
+ # Allow drag/drop event from table item to plotter
+ self.connect(self.table.treeWidget,
+ QtCore.SIGNAL('itemPressed(QTreeWidgetItem*, int)'),
+ self.parent.startDrag)
+
def openMenu(self, pos):
index = self.table.treeWidget.selectedIndexes()
item = self.table.treeWidget.itemFromIndex(index[0])
diff --git a/gr-analog/lib/fastnoise_source_X_impl.cc.t b/gr-analog/lib/fastnoise_source_X_impl.cc.t
index f33e7afa39..25ad8073aa 100644
--- a/gr-analog/lib/fastnoise_source_X_impl.cc.t
+++ b/gr-analog/lib/fastnoise_source_X_impl.cc.t
@@ -57,6 +57,22 @@ namespace gr {
}
void
+ @IMPL_NAME@::set_type(noise_type_t type)
+ {
+ gruel::scoped_lock l(d_setlock);
+ d_type = type;
+ generate();
+ }
+
+ void
+ @IMPL_NAME@::set_amplitude(float ampl)
+ {
+ gruel::scoped_lock l(d_setlock);
+ d_ampl = ampl;
+ generate();
+ }
+
+ void
@IMPL_NAME@::generate()
{
int noutput_items = d_samples.size();
@@ -107,6 +123,8 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ gruel::scoped_lock l(d_setlock);
+
@TYPE@ *out = (@TYPE@*)output_items[0];
for(int i=0; i<noutput_items; i++) {
diff --git a/gr-analog/lib/fastnoise_source_X_impl.h.t b/gr-analog/lib/fastnoise_source_X_impl.h.t
index 7a0f792683..3c5dc106a2 100644
--- a/gr-analog/lib/fastnoise_source_X_impl.h.t
+++ b/gr-analog/lib/fastnoise_source_X_impl.h.t
@@ -43,8 +43,8 @@ namespace gr {
@IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples);
~@IMPL_NAME@();
- void set_type(noise_type_t type) { d_type = type; generate(); }
- void set_amplitude(float ampl) { d_ampl = ampl; generate(); }
+ void set_type(noise_type_t type);
+ void set_amplitude(float ampl);
void generate();
noise_type_t type() const { return d_type; }
diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t
index 35dda9c5d4..40e2517d2e 100644
--- a/gr-analog/lib/noise_source_X_impl.cc.t
+++ b/gr-analog/lib/noise_source_X_impl.cc.t
@@ -54,11 +54,27 @@ namespace gr {
{
}
+ void
+ @IMPL_NAME@::set_type(noise_type_t type)
+ {
+ gruel::scoped_lock l(d_setlock);
+ d_type = type;
+ }
+
+ void
+ @IMPL_NAME@::set_amplitude(float ampl)
+ {
+ gruel::scoped_lock l(d_setlock);
+ d_ampl = ampl;
+ }
+
int
@IMPL_NAME@::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ gruel::scoped_lock l(d_setlock);
+
@TYPE@ *out = (@TYPE@*)output_items[0];
switch(d_type) {
diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_X_impl.h.t
index 8bcc1dfde3..3a0e8d6d7c 100644
--- a/gr-analog/lib/noise_source_X_impl.h.t
+++ b/gr-analog/lib/noise_source_X_impl.h.t
@@ -41,8 +41,8 @@ namespace gr {
@IMPL_NAME@(noise_type_t type, float ampl, long seed = 0);
~@IMPL_NAME@();
- void set_type(noise_type_t type) { d_type = type; }
- void set_amplitude(float ampl) { d_ampl = ampl; }
+ void set_type(noise_type_t type);
+ void set_amplitude(float ampl);
noise_type_t type() const { return d_type; }
float amplitude() const { return d_ampl; }
diff --git a/gr-analog/python/standard_squelch.py b/gr-analog/python/standard_squelch.py
index c1fa406b48..3ed9ebceaa 100644
--- a/gr-analog/python/standard_squelch.py
+++ b/gr-analog/python/standard_squelch.py
@@ -42,7 +42,7 @@ class standard_squelch(gr.hier_block2):
self.sub = blocks.sub_ff();
self.add = blocks.add_ff();
- self.gate = gr.threshold_ff(0.3,0.43,0)
+ self.gate = blocks.threshold_ff(0.3,0.43,0)
self.squelch_lpf = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate))
self.div = blocks.divide_ff()
diff --git a/gr-audio/examples/grc/cvsd_sweep.grc b/gr-audio/examples/grc/cvsd_sweep.grc
index c0cd99ba1e..2fb4c4cc7b 100644
--- a/gr-audio/examples/grc/cvsd_sweep.grc
+++ b/gr-audio/examples/grc/cvsd_sweep.grc
@@ -777,7 +777,7 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
<value>throttle</value>
diff --git a/gr-blocks/examples/metadata/file_metadata_source.grc b/gr-blocks/examples/metadata/file_metadata_source.grc
index 23757881bc..2ce73c029f 100644
--- a/gr-blocks/examples/metadata/file_metadata_source.grc
+++ b/gr-blocks/examples/metadata/file_metadata_source.grc
@@ -244,10 +244,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -318,19 +318,19 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_file_sink_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_tag_debug_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>analog_agc2_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -343,7 +343,7 @@
</connection>
<connection>
<source_block_id>blocks_file_meta_source_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/examples/metadata/file_metadata_vector_source.grc b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
index d52257e06d..2d95d4c947 100644
--- a/gr-blocks/examples/metadata/file_metadata_vector_source.grc
+++ b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
@@ -232,10 +232,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -306,13 +306,13 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_file_sink_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_tag_debug_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -324,14 +324,14 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>blocks_vector_to_stream_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blocks_file_meta_source_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml
index 539a4a30f4..95918ec30d 100644
--- a/gr-blocks/grc/blocks_block_tree.xml
+++ b/gr-blocks/grc/blocks_block_tree.xml
@@ -50,6 +50,7 @@
<block>blocks_integrate_xx</block>
<block>blocks_nlog10_ff</block>
<block>blocks_rms_xx</block>
+ <block>blocks_transcendental</block>
</cat>
<cat>
<name>Boolean Operations (New) </name>
@@ -84,8 +85,6 @@
<cat>
<name>Stream Operations (New) </name>
<block>blocks_delay</block>
- <block>blocks_packed_to_unpacked_xx</block>
- <block>blocks_unpacked_to_packed_xx</block>
<block>blocks_deinterleave</block>
<block>blocks_interleave</block>
<block>blocks_keep_m_in_n</block>
@@ -99,5 +98,24 @@
<block>blocks_vector_to_stream</block>
<block>blocks_vector_to_streams</block>
<block>blocks_stream_to_vector_decimator</block>
+ <block>blocks_peak_detector2_fb</block>
+ <block>blocks_regenerate_bb</block>
+ <block>blocks_stretch_ff</block>
+ <block>blocks_threshold_ff</block>
+ </cat>
+ <cat>
+ <name>Misc Conversions (New) </name>
+ <block>blocks_packed_to_unpacked_xx</block>
+ <block>blocks_unpacked_to_packed_xx</block>
+ <block>blocks_pack_k_bits_bb</block>
+ <block>blocks_unpack_k_bits_bb</block>
+ </cat>
+ <cat>
+ <name>Misc (New) </name>
+ <block>blocks_throttle</block>
+ </cat>
+ <cat>
+ <name>Networking</name>
+ <block>blocks_tuntap_pdu</block>
</cat>
</cat>
diff --git a/grc/blocks/gr_pack_k_bits_bb.xml b/gr-blocks/grc/blocks_pack_k_bits_bb.xml
index 34e64a5d96..5400eb4af9 100644
--- a/grc/blocks/gr_pack_k_bits_bb.xml
+++ b/gr-blocks/grc/blocks_pack_k_bits_bb.xml
@@ -6,9 +6,9 @@
-->
<block>
<name>Pack K Bits</name>
- <key>gr_pack_k_bits_bb</key>
- <import>from gnuradio import gr</import>
- <make>gr.pack_k_bits_bb($k)</make>
+ <key>blocks_pack_k_bits_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.pack_k_bits_bb($k)</make>
<param>
<name>K</name>
<key>k</key>
diff --git a/grc/blocks/gr_peak_detector2_fb.xml b/gr-blocks/grc/blocks_peak_detector2_fb.xml
index 128c6244f7..584e7a1fb3 100644
--- a/grc/blocks/gr_peak_detector2_fb.xml
+++ b/gr-blocks/grc/blocks_peak_detector2_fb.xml
@@ -6,25 +6,28 @@
-->
<block>
<name>Peak Detector2</name>
- <key>gr_peak_detector2_fb</key>
- <import>from gnuradio import gr</import>
- <make>gr.peak_detector2_fb($threshold_factor_rise, $look_ahead, $alpha)</make>
+ <key>blocks_peak_detector2_fb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.peak_detector2_fb($threshold_factor_rise, $look_ahead, $alpha)</make>
<callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
<callback>set_look_ahead($look_ahead)</callback>
<callback>set_alpha($alpha)</callback>
<param>
<name>TH Factor Rise</name>
<key>threshold_factor_rise</key>
+ <value>7</value>
<type>real</type>
</param>
<param>
<name>Look Ahead</name>
<key>look_ahead</key>
+ <value>1000</value>
<type>int</type>
</param>
<param>
<name>Alpha</name>
<key>alpha</key>
+ <value>0.001</value>
<type>real</type>
</param>
<sink>
diff --git a/gr-blocks/grc/blocks_regenerate_bb.xml b/gr-blocks/grc/blocks_regenerate_bb.xml
new file mode 100644
index 0000000000..bbee53387f
--- /dev/null
+++ b/gr-blocks/grc/blocks_regenerate_bb.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Regenerate Block:
+## char in/ char out
+###################################################
+ -->
+<block>
+ <name>Regenerate</name>
+ <key>blocks_regenerate_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.regenerate_bb($period, $max_regen)</make>
+ <param>
+ <name>Period</name>
+ <key>period</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Max Regen Count</name>
+ <key>max_regen</key>
+ <value>500</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_stretch_ff.xml b/gr-blocks/grc/blocks_stretch_ff.xml
new file mode 100644
index 0000000000..00a67602b2
--- /dev/null
+++ b/gr-blocks/grc/blocks_stretch_ff.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stretch Block:
+## float in / float out
+###################################################
+ -->
+<block>
+ <name>Stretch</name>
+ <key>blocks_stretch_ff</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.stretch_ff($lo, $vlen)</make>
+ <param>
+ <name>Low</name>
+ <key>lo</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec. Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_threshold_ff.xml b/gr-blocks/grc/blocks_threshold_ff.xml
index 740ce5794c..0da4157fc8 100644
--- a/grc/blocks/gr_threshold_ff.xml
+++ b/gr-blocks/grc/blocks_threshold_ff.xml
@@ -6,9 +6,9 @@
-->
<block>
<name>Threshold</name>
- <key>gr_threshold_ff</key>
- <import>from gnuradio import gr</import>
- <make>gr.threshold_ff($low, $high, $init)</make>
+ <key>blocks_threshold_ff</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.threshold_ff($low, $high, $init)</make>
<callback>set_hi($high)</callback>
<callback>set_lo($low)</callback>
<param>
diff --git a/grc/blocks/gr_throttle.xml b/gr-blocks/grc/blocks_throttle.xml
index e3a5a2ba19..8293cbde9c 100644
--- a/grc/blocks/gr_throttle.xml
+++ b/gr-blocks/grc/blocks_throttle.xml
@@ -6,11 +6,11 @@
-->
<block>
<name>Throttle</name>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<throttle>1</throttle>
- <import>from gnuradio import gr</import>
- <make>gr.throttle($type.size*$vlen, $samples_per_second)</make>
- <callback>set_sample_rate($samples_per_second)</callback>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.throttle($type.size*$vlen, $samples_per_second)</make>
+ <callback>set_sample_rate($samples_per_second)</callback>
<param>
<name>Type</name>
<key>type</key>
diff --git a/grc/blocks/gr_transcendental.xml b/gr-blocks/grc/blocks_transcendental.xml
index eede447f98..a883a2eefc 100644
--- a/grc/blocks/gr_transcendental.xml
+++ b/gr-blocks/grc/blocks_transcendental.xml
@@ -6,9 +6,9 @@
-->
<block>
<name>Transcendental</name>
- <key>gr_transcendental</key>
- <import>from gnuradio import gr</import>
- <make>gr.transcendental($name, "$type")</make>
+ <key>blocks_transcendental</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.transcendental($name, "$type")</make>
<param>
<name>Type</name>
<key>type</key>
diff --git a/gr-blocks/grc/blocks_tuntap_pdu.xml b/gr-blocks/grc/blocks_tuntap_pdu.xml
new file mode 100644
index 0000000000..d9a63d4a7f
--- /dev/null
+++ b/gr-blocks/grc/blocks_tuntap_pdu.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## TUNTAP PDU async message source/sink
+###################################################
+ -->
+<block>
+ <name>TUNTAP PDU</name>
+ <key>blocks_tuntap_pdu</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.tuntap_pdu($ifn, $mtu)</make>
+ <param>
+ <name>Interface Name</name>
+ <key>ifn</key>
+ <value>tun0</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>MTU</name>
+ <key>mtu</key>
+ <value>10000</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/grc/blocks/gr_unpack_k_bits_bb.xml b/gr-blocks/grc/blocks_unpack_k_bits_bb.xml
index 9917644ab5..90d7493af0 100644
--- a/grc/blocks/gr_unpack_k_bits_bb.xml
+++ b/gr-blocks/grc/blocks_unpack_k_bits_bb.xml
@@ -6,9 +6,9 @@
-->
<block>
<name>Unpack K Bits</name>
- <key>gr_unpack_k_bits_bb</key>
- <import>from gnuradio import gr</import>
- <make>gr.unpack_k_bits_bb($k)</make>
+ <key>blocks_unpack_k_bits_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.unpack_k_bits_bb($k)</make>
<param>
<name>K</name>
<key>k</key>
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
index a6608696a1..48e399d065 100644
--- a/gr-blocks/include/blocks/CMakeLists.txt
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -125,7 +125,10 @@ install(FILES
multiply_const_cc.h
multiply_const_ff.h
nlog10_ff.h
+ pack_k_bits_bb.h
patterned_interleaver.h
+ peak_detector2_fb.h
+ regenerate_bb.h
repeat.h
rms_cf.h
rms_ff.h
@@ -136,7 +139,13 @@ install(FILES
stream_to_vector.h
streams_to_stream.h
streams_to_vector.h
+ stretch_ff.h
+ threshold_ff.h
+ throttle.h
+ transcendental.h
+ tuntap_pdu.h
uchar_to_float.h
+ unpack_k_bits_bb.h
vector_to_stream.h
vector_to_streams.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h b/gr-blocks/include/blocks/pack_k_bits_bb.h
index 8e1508c78b..5bf71c9c3e 100644
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
+++ b/gr-blocks/include/blocks/pack_k_bits_bb.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012-2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,34 +23,31 @@
#ifndef INCLUDED_GR_PACK_K_BITS_BB_H
#define INCLUDED_GR_PACK_K_BITS_BB_H
-#include <gr_core_api.h>
+#include <blocks/api.h>
#include <gr_sync_decimator.h>
-class gr_pack_k_bits_bb;
-typedef boost::shared_ptr<gr_pack_k_bits_bb> gr_pack_k_bits_bb_sptr;
-GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k);
-
-class gr_pack_k_bits_bb;
-
-/*!
- * \brief Converts a stream of bytes with 1 bit in the LSB to a byte with k relevent bits.
- * \ingroup converter_blk
- */
-class GR_CORE_API gr_pack_k_bits_bb : public gr_sync_decimator
-{
- private:
- friend GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k);
-
- gr_pack_k_bits_bb (unsigned k);
-
- unsigned d_k; // number of relevent bits to pack from k input bytes
-
- public:
- ~gr_pack_k_bits_bb ();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Converts a stream of bytes with 1 bit in the LSB to a
+ * byte with k relevent bits.
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API pack_k_bits_bb : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::blocks::pack_k_bits_bb::sptr
+ typedef boost::shared_ptr<pack_k_bits_bb> sptr;
+
+ /*!
+ * \brief Make a pack_k_bits block.
+ * \param k number of bits to be packed.
+ */
+ static sptr make(unsigned k);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PACK_K_BITS_BB_H */
diff --git a/gr-blocks/include/blocks/peak_detector2_fb.h b/gr-blocks/include/blocks/peak_detector2_fb.h
new file mode 100644
index 0000000000..71afc3287b
--- /dev/null
+++ b/gr-blocks/include/blocks/peak_detector2_fb.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Detect the peak of a signal
+ * \ingroup level_blk
+ *
+ * If a peak is detected, this block outputs a 1, or it outputs
+ * 0's. A separate debug output may be connected, to view the
+ * internal EWMA described below.
+ *
+ * \param threshold_factor_rise The threshold factor determins
+ * when a peak is present. An EWMA average of the signal is
+ * calculated and when the value of the signal goes over
+ * threshold_factor_rise*average, we call the peak.
+ * \param look_ahead The look-ahead value is used when the
+ * threshold is found to locate the peak within this range.
+ * \param alpha The gain value of a single-pole moving average filter.
+ */
+ class BLOCKS_API peak_detector2_fb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::peak_detector2_fb::sptr
+ typedef boost::shared_ptr<peak_detector2_fb> sptr;
+
+ static sptr make(float threshold_factor_rise=7,
+ int look_ahead=1000, float alpha=0.001);
+
+ /*! \brief Set the threshold factor value for the rise time
+ * \param thr new threshold factor
+ */
+ virtual void set_threshold_factor_rise(float thr) = 0;
+
+ /*! \brief Set the look-ahead factor
+ * \param look new look-ahead factor
+ */
+ virtual void set_look_ahead(int look) = 0;
+
+ /*! \brief Set the running average alpha
+ * \param alpha new alpha for running average
+ */
+ virtual void set_alpha(int alpha) = 0;
+
+ /*! \brief Get the threshold factor value for the rise time
+ * \return threshold factor
+ */
+ virtual float threshold_factor_rise() = 0;
+
+ /*! \brief Get the look-ahead factor value
+ * \return look-ahead factor
+ */
+ virtual int look_ahead() = 0;
+
+ /*! \brief Get the alpha value of the running average
+ * \return alpha
+ */
+ virtual float alpha() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */
diff --git a/gr-blocks/include/blocks/regenerate_bb.h b/gr-blocks/include/blocks/regenerate_bb.h
new file mode 100644
index 0000000000..3063e70a7f
--- /dev/null
+++ b/gr-blocks/include/blocks/regenerate_bb.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Detect the peak of a signal and repeat every period samples
+ * \ingroup level_blk
+ *
+ * If a peak is detected, this block outputs a 1 repeated every
+ * period samples until reset by detection of another 1 on the
+ * input or stopped after max_regen regenerations have occurred.
+ *
+ * Note that if max_regen=(-1)/ULONG_MAX then the regeneration
+ * will run forever.
+ */
+ class BLOCKS_API regenerate_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::regenerate_bb::sptr
+ typedef boost::shared_ptr<regenerate_bb> sptr;
+
+ /*!
+ * \brief Make a regenerate block
+ * \param period The number of samples between regenerations
+ * \param max_regen The maximum number of regenerations to
+ * perform; if set to ULONG_MAX, it will regenerate
+ * continuously.
+ */
+ static sptr make(int period, unsigned int max_regen=500);
+
+ /*! \brief Reset the maximum regeneration count; this will reset
+ the current regen.
+ */
+ virtual void set_max_regen(unsigned int regen) = 0;
+
+ /*! \brief Reset the period of regenerations; this will reset
+ the current regen.
+ */
+ virtual void set_period(int period) = 0;
+
+ /*! \brief return the maximum regeneration count.
+ */
+ virtual unsigned int max_regen() const = 0;
+
+ /*! \brief return the regeneration period.
+ */
+ virtual int period() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_H */
diff --git a/gr-blocks/include/blocks/stretch_ff.h b/gr-blocks/include/blocks/stretch_ff.h
new file mode 100644
index 0000000000..5f98452a41
--- /dev/null
+++ b/gr-blocks/include/blocks/stretch_ff.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_STRETCH_FF_H
+#define INCLUDED_GR_STRETCH_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief adjust y-range of an input vector by mapping to range
+ * (max-of-input, stipulated-min). Primarily for spectral
+ * signature matching by normalizing spectrum dynamic ranges.
+ * \ingroup misc_blk
+ */
+ class BLOCKS_API stretch_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::stretch_ff::sptr
+ typedef boost::shared_ptr<stretch_ff> sptr;
+
+ /*!
+ * \brief Make a stretch block.
+ * \param lo Set low value for range.
+ * \param vlen vector length of input stream.
+ */
+ static sptr make(float lo, size_t vlen=1);
+
+ virtual float lo() const = 0;
+ virtual void set_lo(float lo) = 0;
+ virtual size_t vlen() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_STRETCH_FF_H */
diff --git a/gr-blocks/include/blocks/threshold_ff.h b/gr-blocks/include/blocks/threshold_ff.h
new file mode 100644
index 0000000000..900e5c5bdb
--- /dev/null
+++ b/gr-blocks/include/blocks/threshold_ff.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THRESHOLD_FF_H
+#define INCLUDED_GR_THRESHOLD_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Output a 1 or zero based on a threshold value.
+ * \ingroup misc_blk
+ *
+ * Test the incoming signal against a threshold. If the signal
+ * excedes the \p hi value, it will output a 1 until the signal
+ * falls below the \p lo value.
+ */
+ class BLOCKS_API threshold_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::threshold_ff::sptr
+ typedef boost::shared_ptr<threshold_ff> sptr;
+
+ /* \brief Create a threadshold block.
+ * \param lo Threshold input signal needs to drop below to
+ * change state to 0.
+ * \param hi Threshold input signal needs to rise above to
+ * change state to 1.
+ * \param initial_state Initial state of the block (0 or 1).
+ */
+ static sptr make(float lo, float hi, float initial_state=0);
+
+ virtual float lo () const = 0;
+ virtual void set_lo (float lo) = 0;
+ virtual float hi () const = 0;
+ virtual void set_hi (float hi) = 0;
+ virtual float last_state () const = 0;
+ virtual void set_last_state (float last_state) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THRESHOLD_FF_H */
diff --git a/gr-blocks/include/blocks/throttle.h b/gr-blocks/include/blocks/throttle.h
new file mode 100644
index 0000000000..20d8037e10
--- /dev/null
+++ b/gr-blocks/include/blocks/throttle.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THROTTLE_H
+#define INCLUDED_GR_THROTTLE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief throttle flow of samples such that the average rate does
+ * not exceed samples_per_sec.
+ * \ingroup misc_blk
+ *
+ * input: one stream of itemsize; output: one stream of itemsize
+ *
+ * N.B. this should only be used in GUI apps where there is no
+ * other rate limiting block. It is not intended nor effective at
+ * precisely controlling the rate of samples. That should be
+ * controlled by a source or sink tied to sample clock. E.g., a
+ * USRP or audio card.
+ */
+ class BLOCKS_API throttle : virtual public gr_sync_block
+ {
+ public:
+ typedef boost::shared_ptr<throttle> sptr;
+
+ static sptr make(size_t itemsize, double samples_per_sec);
+
+ //! Sets the sample rate in samples per second.
+ virtual void set_sample_rate(double rate) = 0;
+
+ //! Get the sample rate in samples per second.
+ virtual double sample_rate() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THROTTLE_H */
diff --git a/gnuradio-core/src/lib/general/gr_transcendental.h b/gr-blocks/include/blocks/transcendental.h
index 9841a53e95..f8a0d5d805 100644
--- a/gnuradio-core/src/lib/general/gr_transcendental.h
+++ b/gr-blocks/include/blocks/transcendental.h
@@ -1,5 +1,6 @@
+/* -*- c++ -*- */
/*
- * Copyright 2011 Free Software Foundation, Inc.
+ * Copyright 2011,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,28 +23,34 @@
#ifndef INCLUDED_GR_TRANSCENDENTAL_H
#define INCLUDED_GR_TRANSCENDENTAL_H
-#include <gr_core_api.h>
+#include <blocks/api.h>
#include <gr_sync_block.h>
#include <string>
-/*!
- * \brief A block that performs various transcendental math operations.
- *
- * Possible function names can be found in the cmath library.
- * IO may be either complex or real, double or single precision.
- *
- * Possible type strings: float, double, complex_float, complex_double
- *
- * output[i] = trans_fcn(input[i])
- */
-class GR_CORE_API gr_transcendental : virtual public gr_sync_block{
-public:
- typedef boost::shared_ptr<gr_transcendental> sptr;
-};
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A block that performs various transcendental math operations.
+ *
+ * Possible function names can be found in the cmath library. IO
+ * may be either complex or real, double or single precision.
+ *
+ * Possible type strings: float, double, complex_float, complex_double
+ *
+ * output[i] = trans_fcn(input[i])
+ */
+ class BLOCKS_API transcendental : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::transcendental::sptr
+ typedef boost::shared_ptr<transcendental> sptr;
+
+ static sptr make(const std::string &name,
+ const std::string &type="float");
+ };
-GR_CORE_API gr_transcendental::sptr gr_make_transcendental(
- const std::string &name,
- const std::string &type = "float"
-);
+ } /* namespace blocks */
+} /* namespace gr */
#endif /* INCLUDED_GR_TRANSCENDENTAL_H */
diff --git a/gr-blocks/include/blocks/tuntap_pdu.h b/gr-blocks/include/blocks/tuntap_pdu.h
new file mode 100644
index 0000000000..70abb0bd5b
--- /dev/null
+++ b/gr-blocks/include/blocks/tuntap_pdu.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_BLOCKS_TUNTAP_PDU_H
+#define INCLUDED_BLOCKS_TUNTAP_PDU_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Creates TUNTAP interface and translates traffic to PDUs
+ * \ingroup net_blk
+ */
+ class BLOCKS_API tuntap_pdu : virtual public gr_block
+ {
+ public:
+ // gr::blocks::tuntap_pdu::sptr
+ typedef boost::shared_ptr<tuntap_pdu> sptr;
+
+ /*!
+ * \brief Construct a TUNTAP PDU interface
+ * \param dev Device name to create
+ * \param MTU Maximum Transmission Unit size
+ */
+ static sptr make(std::string dev, int MTU=10000);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_TUNTAP_PDU_H */
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h b/gr-blocks/include/blocks/unpack_k_bits_bb.h
index c3ea28d3fa..b716ded1d3 100644
--- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h
+++ b/gr-blocks/include/blocks/unpack_k_bits_bb.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,34 +23,30 @@
#ifndef INCLUDED_GR_UNPACK_K_BITS_BB_H
#define INCLUDED_GR_UNPACK_K_BITS_BB_H
-#include <gr_core_api.h>
+#include <blocks/api.h>
#include <gr_sync_interpolator.h>
-class gr_unpack_k_bits_bb;
-typedef boost::shared_ptr<gr_unpack_k_bits_bb> gr_unpack_k_bits_bb_sptr;
-GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k);
-
-class gr_unpack_k_bits_bb;
-
-/*!
- * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB.
- * \ingroup converter_blk
- */
-class GR_CORE_API gr_unpack_k_bits_bb : public gr_sync_interpolator
-{
- private:
- friend GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k);
-
- gr_unpack_k_bits_bb (unsigned k);
-
- unsigned d_k; // number of relevent bits to unpack into k output bytes
-
- public:
- ~gr_unpack_k_bits_bb ();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB.
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API unpack_k_bits_bb : virtual public gr_sync_interpolator
+ {
+ public:
+ // gr::blocks::unpack_k_bits_bb::sptr
+ typedef boost::shared_ptr<unpack_k_bits_bb> sptr;
+
+ /*!
+ * \brief Make an unpack_k_bits block.
+ * \param k number of bits to unpack.
+ */
+ static sptr make(unsigned k);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UNPACK_K_BITS_BB_H */
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 9b076f6964..28158ab593 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -164,19 +164,29 @@ list(APPEND gr_blocks_sources
multiply_const_cc_impl.cc
multiply_const_ff_impl.cc
nlog10_ff_impl.cc
+ pack_k_bits_bb_impl.cc
patterned_interleaver_impl.cc
+ peak_detector2_fb_impl.cc
+ regenerate_bb_impl.cc
repeat_impl.cc
rms_cf_impl.cc
rms_ff_impl.cc
short_to_char_impl.cc
short_to_float_impl.cc
stream_mux_impl.cc
+ stream_pdu_base.cc
stream_to_streams_impl.cc
stream_to_vector_impl.cc
streams_to_stream_impl.cc
streams_to_vector_impl.cc
+ stretch_ff_impl.cc
+ threshold_ff_impl.cc
+ throttle_impl.cc
+ transcendental_impl.cc
+ tuntap_pdu_impl.cc
uchar_array_to_float.cc
uchar_to_float_impl.cc
+ unpack_k_bits_bb_impl.cc
vector_to_stream_impl.cc
vector_to_streams_impl.cc
)
diff --git a/gr-blocks/lib/ConfigChecks.cmake b/gr-blocks/lib/ConfigChecks.cmake
index 72d6d1d8ab..7f60aed403 100644
--- a/gr-blocks/lib/ConfigChecks.cmake
+++ b/gr-blocks/lib/ConfigChecks.cmake
@@ -56,7 +56,7 @@ CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
IF(HAVE_WINDOWS_H)
ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK)
MESSAGE(STATUS "Adding windows libs to gr blocks libs...")
- LIST(APPEND gnuradio_core_libs WS2_32.lib WSock32.lib)
+ LIST(APPEND blocks_libs WS2_32.lib WSock32.lib)
ENDIF(HAVE_WINDOWS_H)
########################################################################
diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.cc b/gr-blocks/lib/pack_k_bits_bb_impl.cc
new file mode 100644
index 0000000000..2a7fcc04cb
--- /dev/null
+++ b/gr-blocks/lib/pack_k_bits_bb_impl.cc
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pack_k_bits_bb_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+namespace gr {
+ namespace blocks {
+
+ pack_k_bits_bb::sptr
+ pack_k_bits_bb::make(unsigned k)
+ {
+ return gnuradio::get_initial_sptr
+ (new pack_k_bits_bb_impl(k));
+ }
+
+ pack_k_bits_bb_impl::pack_k_bits_bb_impl(unsigned k)
+ : gr_sync_decimator("pack_k_bits_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ k),
+ d_k(k)
+ {
+ if(d_k == 0)
+ throw std::out_of_range("interpolation must be > 0");
+ }
+
+ pack_k_bits_bb_impl::~pack_k_bits_bb_impl()
+ {
+ }
+
+ int
+ pack_k_bits_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = 0x00;
+ for(unsigned int j = 0; j < d_k; j++) {
+ out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1);
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i b/gr-blocks/lib/pack_k_bits_bb_impl.h
index 6ae2095ec7..668d438a46 100644
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i
+++ b/gr-blocks/lib/pack_k_bits_bb_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012-2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,15 +20,29 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(gr,pack_k_bits_bb)
+#ifndef INCLUDED_GR_PACK_K_BITS_BB_IMPL_H
+#define INCLUDED_GR_PACK_K_BITS_BB_IMPL_H
-gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (int k) throw(std::exception);
+#include <blocks/pack_k_bits_bb.h>
-class gr_pack_k_bits_bb : public gr_sync_decimator
-{
- private:
- gr_pack_k_bits_bb (int k);
+namespace gr {
+ namespace blocks {
- public:
- ~gr_pack_k_bits_bb ();
-};
+ class pack_k_bits_bb_impl : public pack_k_bits_bb
+ {
+ private:
+ unsigned d_k; // number of relevent bits to pack from k input bytes
+
+ public:
+ pack_k_bits_bb_impl(unsigned k);
+ ~pack_k_bits_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PACK_K_BITS_BB_IMPL_H */
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.cc b/gr-blocks/lib/peak_detector2_fb_impl.cc
new file mode 100644
index 0000000000..0d375c3bad
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.cc
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "peak_detector2_fb_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ peak_detector2_fb::sptr
+ peak_detector2_fb::make(float threshold_factor_rise,
+ int look_ahead, float alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new peak_detector2_fb_impl(threshold_factor_rise,
+ look_ahead, alpha));
+ }
+
+ peak_detector2_fb_impl::peak_detector2_fb_impl(float threshold_factor_rise,
+ int look_ahead, float alpha)
+ : gr_sync_block("peak_detector2_fb",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature2(1, 2, sizeof(char), sizeof(float))),
+ d_threshold_factor_rise(threshold_factor_rise),
+ d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false)
+ {
+ }
+
+ peak_detector2_fb_impl::~peak_detector2_fb_impl()
+ {
+ }
+
+ int
+ peak_detector2_fb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *iptr = (float *)input_items[0];
+ char *optr = (char *)output_items[0];
+
+ assert(noutput_items >= 2);
+
+ memset(optr, 0, noutput_items*sizeof(char));
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(!d_found) {
+ // Have not yet detected presence of peak
+ if(iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) {
+ d_found = true;
+ d_look_ahead_remaining = d_look_ahead;
+ d_peak_val = -(float)INFINITY;
+ }
+ else {
+ d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
+ }
+ }
+ else {
+ // Detected presence of peak
+ if(iptr[i] > d_peak_val) {
+ d_peak_val = iptr[i];
+ d_peak_ind = i;
+ }
+ else if(d_look_ahead_remaining <= 0) {
+ optr[d_peak_ind] = 1;
+ d_found = false;
+ d_avg = iptr[i];
+ }
+
+ // Have not yet located peak, loop and keep searching.
+ d_look_ahead_remaining--;
+ }
+
+ // Every iteration of the loop, write debugging signal out if
+ // connected:
+ if(output_items.size() == 2) {
+ float *sigout = (float *)output_items[1];
+ sigout[i] = d_avg;
+ }
+ } // loop
+
+ if(!d_found)
+ return noutput_items;
+
+ // else if detected presence, keep searching during the next call to work.
+ int tmp = d_peak_ind;
+ d_peak_ind = 1;
+
+ return tmp - 1;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.h b/gr-blocks/lib/peak_detector2_fb_impl.h
new file mode 100644
index 0000000000..f03dd36a8d
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H
+
+#include <blocks/peak_detector2_fb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class peak_detector2_fb_impl : public peak_detector2_fb
+ {
+ private:
+ float d_threshold_factor_rise;
+ int d_look_ahead;
+ int d_look_ahead_remaining;
+ int d_peak_ind;
+ float d_peak_val;
+ float d_alpha;
+ float d_avg;
+ bool d_found;
+
+ public:
+ peak_detector2_fb_impl(float threshold_factor_rise,
+ int look_ahead, float alpha);
+ ~peak_detector2_fb_impl();
+
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
+ void set_look_ahead(int look) { d_look_ahead = look; }
+ void set_alpha(int alpha) { d_alpha = alpha; }
+
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+ int look_ahead() { return d_look_ahead; }
+ float alpha() { return d_alpha; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H */
diff --git a/gr-blocks/lib/regenerate_bb_impl.cc b/gr-blocks/lib/regenerate_bb_impl.cc
new file mode 100644
index 0000000000..4472efb6d4
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.cc
@@ -0,0 +1,103 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "regenerate_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ regenerate_bb::sptr
+ regenerate_bb::make(int period, unsigned int max_regen)
+ {
+ return gnuradio::get_initial_sptr
+ (new regenerate_bb_impl(period, max_regen));
+ }
+
+ regenerate_bb_impl::regenerate_bb_impl(int period, unsigned int max_regen)
+ : gr_sync_block("regenerate_bb",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(char))),
+ d_period(period),
+ d_countdown(0),
+ d_max_regen(max_regen),
+ d_regen_count(max_regen)
+ {
+ }
+
+ regenerate_bb_impl::~regenerate_bb_impl()
+ {
+ }
+
+ void
+ regenerate_bb_impl::set_max_regen(unsigned int regen)
+ {
+ d_max_regen = regen;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ void
+ regenerate_bb_impl::set_period(int period)
+ {
+ d_period = period;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ int
+ regenerate_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *iptr = (const char *)input_items[0];
+ char *optr = (char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ optr[i] = 0;
+
+ if(d_regen_count < d_max_regen) {
+ d_countdown--;
+
+ if(d_countdown == 0) {
+ optr[i] = 1;
+ d_countdown = d_period;
+ d_regen_count++;
+ }
+ }
+
+ if(iptr[i] == 1) {
+ d_countdown = d_period;
+ optr[i] = 1;
+ d_regen_count = 0;
+ }
+
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/regenerate_bb_impl.h b/gr-blocks/lib/regenerate_bb_impl.h
new file mode 100644
index 0000000000..bcfa18391f
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_IMPL_H
+
+#include <blocks/regenerate_bb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class regenerate_bb_impl : public regenerate_bb
+ {
+ private:
+ int d_period;
+ int d_countdown;
+ unsigned int d_max_regen;
+ unsigned int d_regen_count;
+
+ public:
+ regenerate_bb_impl(int period, unsigned int max_regen=500);
+ ~regenerate_bb_impl();
+
+ void set_max_regen(unsigned int regen);
+ void set_period(int period);
+
+ unsigned int max_regen() const { return d_max_regen; };
+ int period() const { return d_period; };
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_IMPL_H */
diff --git a/gr-blocks/lib/stream_pdu_base.cc b/gr-blocks/lib/stream_pdu_base.cc
new file mode 100644
index 0000000000..14e76149a0
--- /dev/null
+++ b/gr-blocks/lib/stream_pdu_base.cc
@@ -0,0 +1,126 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+#include <gr_pdu.h>
+#include <gr_basic_block.h>
+#include "stream_pdu_base.h"
+#include <boost/format.hpp>
+
+static const long timeout_us = 100*1000; //100ms
+
+namespace gr {
+ namespace blocks {
+
+ stream_pdu_base::stream_pdu_base(int MTU)
+ : d_fd(-1),
+ d_started(false),
+ d_finished(false)
+ {
+ // reserve space for rx buffer
+ d_rxbuf.resize(MTU,0);
+ }
+
+ stream_pdu_base::~stream_pdu_base()
+ {
+ stop_rxthread();
+ }
+
+ void
+ stream_pdu_base::start_rxthread(gr_basic_block *blk, pmt::pmt_t port)
+ {
+ d_blk = blk;
+ d_port = port;
+ d_thread = gruel::thread(boost::bind(&stream_pdu_base::run, this));
+ d_started = true;
+ }
+
+ void
+ stream_pdu_base::stop_rxthread()
+ {
+ d_finished = true;
+
+ if (d_started) {
+ d_thread.interrupt();
+ d_thread.join();
+ }
+ }
+
+ void
+ stream_pdu_base::run()
+ {
+ while(!d_finished) {
+ if (!wait_ready())
+ continue;
+
+ const int result = read(d_fd, &d_rxbuf[0], d_rxbuf.size());
+ if (result <= 0)
+ throw std::runtime_error("stream_pdu_base, bad socket read!");
+
+ pmt::pmt_t vector = pmt::init_u8vector(result, &d_rxbuf[0]);
+ pmt::pmt_t pdu = pmt::cons(pmt::PMT_NIL, vector);
+
+ d_blk->message_port_pub(d_port, pdu);
+ }
+ }
+
+ bool
+ stream_pdu_base::wait_ready()
+ {
+ //setup timeval for timeout
+ timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = timeout_us;
+
+ //setup rset for timeout
+ fd_set rset;
+ FD_ZERO(&rset);
+ FD_SET(d_fd, &rset);
+
+ //call select with timeout on receive socket
+ return ::select(d_fd+1, &rset, NULL, NULL, &tv) > 0;
+ }
+
+ void
+ stream_pdu_base::send(pmt::pmt_t msg)
+ {
+ pmt::pmt_t vector = pmt::cdr(msg);
+ size_t offset(0);
+ size_t itemsize(::gr_pdu_itemsize(type_from_pmt(vector)));
+ int len(pmt::length(vector)*itemsize);
+
+ const int rv = write(d_fd, pmt::uniform_vector_elements(vector, offset), len);
+ if (rv != len) {
+ std::cerr << boost::format("WARNING: gr_stream_pdu_base::send(pdu) write failed! (d_fd=%d, len=%d, rv=%d)")
+ % d_fd % len % rv << std::endl;
+ }
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stream_pdu_base.h b/gr-blocks/lib/stream_pdu_base.h
new file mode 100644
index 0000000000..66eaaf0c04
--- /dev/null
+++ b/gr-blocks/lib/stream_pdu_base.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_STREAM_PDU_BASE_H
+#define INCLUDED_STREAM_PDU_BASE_H
+
+#include <gruel/thread.h>
+#include <gruel/pmt.h>
+
+class gr_basic_block;
+
+namespace gr {
+ namespace blocks {
+
+ class stream_pdu_base
+ {
+ public:
+ stream_pdu_base(int MTU=10000);
+ ~stream_pdu_base();
+
+ protected:
+ int d_fd;
+ bool d_started;
+ bool d_finished;
+ std::vector<uint8_t> d_rxbuf;
+ gruel::thread d_thread;
+
+ pmt::pmt_t d_port;
+ gr_basic_block *d_blk;
+
+ void run();
+ void send(pmt::pmt_t msg);
+ bool wait_ready();
+ void start_rxthread(gr_basic_block *blk, pmt::pmt_t rxport);
+ void stop_rxthread();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_STREAM_PDU_BASE_H */
diff --git a/gr-blocks/lib/stretch_ff_impl.cc b/gr-blocks/lib/stretch_ff_impl.cc
new file mode 100644
index 0000000000..90bbc7ee5a
--- /dev/null
+++ b/gr-blocks/lib/stretch_ff_impl.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "stretch_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ stretch_ff::sptr
+ stretch_ff::make(float lo, size_t vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new stretch_ff_impl(lo, vlen));
+ }
+
+ stretch_ff_impl::stretch_ff_impl(float lo, size_t vlen)
+ : gr_sync_block("stretch_ff",
+ gr_make_io_signature(1, 1, vlen * sizeof(float)),
+ gr_make_io_signature(1, 1, vlen * sizeof(float))),
+ d_lo(lo), d_vlen(vlen)
+ {
+ }
+
+ stretch_ff_impl::~stretch_ff_impl()
+ {
+ }
+
+ int
+ stretch_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int count = 0; count < noutput_items; count++) {
+ float vmax = in[0] - d_lo;
+
+ for(unsigned int i = 1; i < d_vlen; i++) {
+ float vtmp = in[i] - d_lo;
+ if(vtmp > vmax)
+ vmax = vtmp;
+ }
+
+ if(vmax != 0.0)
+ for(unsigned int i = 0; i < d_vlen; i++)
+ out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax);
+ else
+ for(unsigned int i = 0; i < d_vlen; i++)
+ out[i] = in[i];
+
+ in += d_vlen;
+ out += d_vlen;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stretch_ff_impl.h b/gr-blocks/lib/stretch_ff_impl.h
new file mode 100644
index 0000000000..af69d835a5
--- /dev/null
+++ b/gr-blocks/lib/stretch_ff_impl.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_STRETCH_FF_IMPL_H
+#define INCLUDED_GR_STRETCH_FF_IMPL_H
+
+#include <blocks/stretch_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class stretch_ff_impl : public stretch_ff
+ {
+ private:
+ float d_lo; // the constant
+ size_t d_vlen;
+
+ public:
+ stretch_ff_impl(float lo, size_t vlen);
+ ~stretch_ff_impl();
+
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ size_t vlen() const { return d_vlen; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_STRETCH_FF_IMPL_H */
diff --git a/gr-blocks/lib/threshold_ff_impl.cc b/gr-blocks/lib/threshold_ff_impl.cc
new file mode 100644
index 0000000000..477f2b1c89
--- /dev/null
+++ b/gr-blocks/lib/threshold_ff_impl.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "threshold_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ threshold_ff::sptr
+ threshold_ff::make(float lo, float hi, float initial_state)
+ {
+ return gnuradio::get_initial_sptr
+ (new threshold_ff_impl(lo, hi, initial_state));
+ }
+
+ threshold_ff_impl::threshold_ff_impl(float lo, float hi,
+ float initial_state)
+ : gr_sync_block("threshold_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_lo(lo), d_hi(hi), d_last_state(initial_state)
+ {
+ }
+
+ threshold_ff_impl::~threshold_ff_impl()
+ {
+ }
+
+ int
+ threshold_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(in[i] > d_hi) {
+ out[i] = 1.0;
+ d_last_state = 1.0;
+ }
+ else if(in[i] < d_lo) {
+ out[i] = 0.0;
+ d_last_state = 0.0;
+ }
+ else
+ out[i] = d_last_state;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/threshold_ff_impl.h b/gr-blocks/lib/threshold_ff_impl.h
new file mode 100644
index 0000000000..41afaa52aa
--- /dev/null
+++ b/gr-blocks/lib/threshold_ff_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THRESHOLD_FF_IMPL_H
+#define INCLUDED_GR_THRESHOLD_FF_IMPL_H
+
+#include <blocks/threshold_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class threshold_ff_impl : public threshold_ff
+ {
+ private:
+ float d_lo, d_hi; // the constant
+ float d_last_state;
+
+ public:
+ threshold_ff_impl(float lo, float hi,
+ float initial_state=0);
+ ~threshold_ff_impl();
+
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ float hi() const { return d_hi; }
+ void set_hi(float hi) { d_hi = hi; }
+ float last_state() const { return d_last_state; }
+ void set_last_state(float last_state) { d_last_state = last_state; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THRESHOLD_FF_IMPL_H */
diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc
new file mode 100644
index 0000000000..49743e3f26
--- /dev/null
+++ b/gr-blocks/lib/throttle_impl.cc
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "throttle_impl.h"
+#include <gr_io_signature.h>
+#include <cstring>
+#include <boost/thread/thread.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ throttle::sptr
+ throttle::make(size_t itemsize, double samples_per_sec)
+ {
+ return gnuradio::get_initial_sptr
+ (new throttle_impl(itemsize, samples_per_sec));
+ }
+
+ throttle_impl::throttle_impl(size_t itemsize,
+ double samples_per_second)
+ : gr_sync_block("throttle",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize)
+ {
+ set_sample_rate(samples_per_second);
+ }
+
+ throttle_impl::~throttle_impl()
+ {
+ }
+
+ void
+ throttle_impl::set_sample_rate(double rate)
+ {
+ //changing the sample rate performs a reset of state params
+ d_start = boost::get_system_time();
+ d_total_samples = 0;
+ d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second();
+ d_samps_per_us = rate/1e6;
+ }
+
+ double
+ throttle_impl::sample_rate() const
+ {
+ return d_samps_per_us * 1e6;
+ }
+
+ int
+ throttle_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ //calculate the expected number of samples to have passed through
+ boost::system_time now = boost::get_system_time();
+ boost::int64_t ticks = (now - d_start).ticks();
+ uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks);
+
+ //if the expected samples was less, we need to throttle back
+ if(d_total_samples > expected_samps) {
+ boost::this_thread::sleep(boost::posix_time::microseconds
+ (long((d_total_samples - expected_samps)/d_samps_per_us)));
+ }
+
+ //copy all samples output[i] <= input[i]
+ const char *in = (const char *)input_items[0];
+ char *out = (char *)output_items[0];
+ std::memcpy(out, in, noutput_items * d_itemsize);
+ d_total_samples += noutput_items;
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/throttle_impl.h b/gr-blocks/lib/throttle_impl.h
new file mode 100644
index 0000000000..86dbef2ac9
--- /dev/null
+++ b/gr-blocks/lib/throttle_impl.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THROTTLE_IMPL_H
+#define INCLUDED_GR_THROTTLE_IMPL_H
+
+#include <blocks/throttle.h>
+
+namespace gr {
+ namespace blocks {
+
+ class throttle_impl : public throttle
+ {
+ private:
+ boost::system_time d_start;
+ size_t d_itemsize;
+ uint64_t d_total_samples;
+ double d_samps_per_tick, d_samps_per_us;
+
+ public:
+ throttle_impl(size_t itemsize, double samples_per_sec);
+ ~throttle_impl();
+
+ void set_sample_rate(double rate);
+ double sample_rate() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THROTTLE_IMPL_H */
diff --git a/gr-blocks/lib/transcendental_impl.cc b/gr-blocks/lib/transcendental_impl.cc
new file mode 100644
index 0000000000..725899ca85
--- /dev/null
+++ b/gr-blocks/lib/transcendental_impl.cc
@@ -0,0 +1,150 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "transcendental_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <complex> //complex math
+#include <cmath> //real math
+#include <map>
+
+namespace gr {
+ namespace blocks {
+
+ /***********************************************************************
+ * work function creation and registration
+ **********************************************************************/
+ struct map_val_type
+ {
+ work_fcn_type work_fcn;
+ size_t io_size;
+ };
+ typedef std::map<std::string, map_val_type> map_type;
+
+ //construct map on first use idiom
+ static map_type &
+ get_map(void)
+ {
+ static map_type map;
+ return map;
+ }
+
+ //static initialization of this object registers a function
+ struct transcendental_registrant
+ {
+ transcendental_registrant(const std::string &key,
+ const work_fcn_type &work_fcn,
+ const size_t io_size)
+ {
+ map_val_type val;
+ val.work_fcn = work_fcn;
+ val.io_size = io_size;
+ get_map()[key] = val;
+ }
+ };
+
+ //macro to create a work function and register it
+#define REGISTER_FUNCTION(__fcn__, __type__, __key__) \
+ static int __key__ ## _work( \
+ int noutput_items, \
+ gr_vector_const_void_star &input_items, \
+ gr_vector_void_star &output_items) \
+ { \
+ const __type__ *in = (const __type__ *) input_items[0]; \
+ __type__ *out = (__type__ *) output_items[0]; \
+ for (size_t i = 0; i < size_t(noutput_items); i++){ \
+ out[i] = std::__fcn__(in[i]); \
+ } \
+ return noutput_items; \
+ } \
+ transcendental_registrant __key__ ## _registrant(#__key__, &__key__ ## _work, sizeof(__type__));
+
+ //register work functions for real types
+#define REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, float, __fcn__ ## _float) \
+ REGISTER_FUNCTION(__fcn__, double, __fcn__ ## _double)
+
+ //register work functions for complex types
+#define REGISTER_COMPLEX_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, std::complex<float>, __fcn__ ## _complex_float) \
+ REGISTER_FUNCTION(__fcn__, std::complex<double>, __fcn__ ## _complex_double)
+
+ //register both complex and real
+#define REGISTER_FUNCTIONS(__fcn__) \
+ REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_COMPLEX_FUNCTIONS(__fcn__)
+
+ //create and register transcendental work functions
+ REGISTER_FUNCTIONS(cos)
+ REGISTER_FUNCTIONS(sin)
+ REGISTER_FUNCTIONS(tan)
+ REGISTER_REAL_FUNCTIONS(acos)
+ REGISTER_REAL_FUNCTIONS(asin)
+ REGISTER_REAL_FUNCTIONS(atan)
+ REGISTER_FUNCTIONS(cosh)
+ REGISTER_FUNCTIONS(sinh)
+ REGISTER_FUNCTIONS(tanh)
+ REGISTER_FUNCTIONS(exp)
+ REGISTER_FUNCTIONS(log)
+ REGISTER_FUNCTIONS(log10)
+ REGISTER_FUNCTIONS(sqrt)
+
+
+ transcendental::sptr
+ transcendental::make(const std::string &name,
+ const std::string &type)
+ {
+ //search for an entry in the map
+ const std::string key = name + "_" + type;
+ const bool has_key = get_map().count(key) != 0;
+ if(!has_key)
+ throw std::runtime_error("could not find transcendental function for " + key);
+
+ //make a new block with found work function
+ return gnuradio::get_initial_sptr
+ (new transcendental_impl(get_map()[key].work_fcn, get_map()[key].io_size));
+ }
+
+ transcendental_impl::transcendental_impl(const work_fcn_type &work_fcn,
+ const size_t io_size)
+ : gr_sync_block("transcendental",
+ gr_make_io_signature(1, 1, io_size),
+ gr_make_io_signature(1, 1, io_size)),
+ _work_fcn(work_fcn)
+ {
+ // NOP
+ }
+
+ transcendental_impl::~transcendental_impl()
+ {
+ }
+
+ int
+ transcendental_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ return _work_fcn(noutput_items, input_items, output_items);
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/transcendental_impl.h b/gr-blocks/lib/transcendental_impl.h
new file mode 100644
index 0000000000..47055551e4
--- /dev/null
+++ b/gr-blocks/lib/transcendental_impl.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_TRANSCENDENTAL_IMPL_H
+#define INCLUDED_GR_TRANSCENDENTAL_IMPL_H
+
+#include <blocks/transcendental.h>
+
+namespace gr {
+ namespace blocks {
+
+ typedef int(*work_fcn_type)(int, gr_vector_const_void_star &, gr_vector_void_star &);
+
+ class transcendental_impl : public transcendental
+ {
+ private:
+ const work_fcn_type &_work_fcn;
+
+ public:
+ transcendental_impl(const work_fcn_type &work_fcn,
+ const size_t io_size);
+ ~transcendental_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TRANSCENDENTAL_IMPL_H */
diff --git a/gr-blocks/lib/tuntap_pdu_impl.cc b/gr-blocks/lib/tuntap_pdu_impl.cc
new file mode 100644
index 0000000000..1970a92b69
--- /dev/null
+++ b/gr-blocks/lib/tuntap_pdu_impl.cc
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tuntap_pdu_impl.h"
+#include <gr_io_signature.h>
+#include <gr_pdu.h>
+#include <boost/format.hpp>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+#include <sys/ioctl.h>
+#include <arpa/inet.h>
+#include <linux/if.h>
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ tuntap_pdu::sptr
+ tuntap_pdu::make(std::string dev, int MTU)
+ {
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+ return gnuradio::get_initial_sptr(new tuntap_pdu_impl(dev, MTU));
+#else
+ throw std::runtime_error("tuntap_pdu not implemented on this platform");
+#endif
+ }
+
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+ tuntap_pdu_impl::tuntap_pdu_impl(std::string dev, int MTU)
+ : gr_block("tuntap_pdu",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (0, 0, 0)),
+ stream_pdu_base(MTU),
+ d_dev(dev)
+ {
+ // make the tuntap
+ char dev_cstr[1024];
+ memset(dev_cstr, 0x00, 1024);
+ strncpy(dev_cstr, dev.c_str(), std::min(sizeof(dev_cstr), dev.size()));
+
+ d_fd = tun_alloc(dev_cstr);
+ if (d_fd <= 0)
+ throw std::runtime_error("gr::tuntap_pdu::make: tun_alloc failed (are you running as root?)");
+
+ std::cout << boost::format(
+ "Allocated virtual ethernet interface: %s\n"
+ "You must now use ifconfig to set its IP address. E.g.,\n"
+ " $ sudo ifconfig %s 192.168.200.1\n"
+ "Be sure to use a different address in the same subnet for each machine.\n"
+ ) % dev % dev << std::endl;
+
+ // set up output message port
+ message_port_register_out(PDU_PORT_ID);
+ start_rxthread(this, PDU_PORT_ID);
+
+ // set up input message port
+ message_port_register_in(PDU_PORT_ID);
+ set_msg_handler(PDU_PORT_ID, boost::bind(&tuntap_pdu_impl::send, this, _1));
+ }
+
+ int
+ tuntap_pdu_impl::tun_alloc(char *dev, int flags)
+ {
+ struct ifreq ifr;
+ int fd, err;
+ const char *clonedev = "/dev/net/tun";
+
+ /* Arguments taken by the function:
+ *
+ * char *dev: the name of an interface (or '\0'). MUST have enough
+ * space to hold the interface name if '\0' is passed
+ * int flags: interface flags (eg, IFF_TUN etc.)
+ */
+
+ /* open the clone device */
+ if ((fd = open(clonedev, O_RDWR)) < 0)
+ return fd;
+
+ /* preparation of the struct ifr, of type "struct ifreq" */
+ memset(&ifr, 0, sizeof(ifr));
+
+ ifr.ifr_flags = flags; /* IFF_TUN or IFF_TAP, plus maybe IFF_NO_PI */
+
+ /* if a device name was specified, put it in the structure; otherwise,
+ * the kernel will try to allocate the "next" device of the
+ * specified type
+ */
+ if (*dev)
+ strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+
+ /* try to create the device */
+ if ((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0) {
+ close(fd);
+ return err;
+ }
+
+ /* if the operation was successful, write back the name of the
+ * interface to the variable "dev", so the caller can know
+ * it. Note that the caller MUST reserve space in *dev (see calling
+ * code below)
+ */
+ strcpy(dev, ifr.ifr_name);
+
+ /* this is the special file descriptor that the caller will use to talk
+ * with the virtual interface
+ */
+ return fd;
+ }
+#endif
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i b/gr-blocks/lib/tuntap_pdu_impl.h
index ec7227e690..396d9d51c8 100644
--- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i
+++ b/gr-blocks/lib/tuntap_pdu_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,26 +20,32 @@
* Boston, MA 02110-1301, USA.
*/
+#ifndef INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H
+#define INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H
-GR_SWIG_BLOCK_MAGIC(gr,peak_detector2_fb)
+#include <blocks/tuntap_pdu.h>
+#include "stream_pdu_base.h"
- gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7,
- int look_ahead = 1000,
- float alpha=0.001);
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+#include <linux/if_tun.h>
+#endif
-class gr_peak_detector2_fb : public gr_sync_block
-{
-private:
- gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
+namespace gr {
+ namespace blocks {
-public:
- void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
- void set_look_ahead(int look) { d_look_ahead = look; }
- void set_alpha(int alpha) { d_avg_alpha = alpha; }
+ class tuntap_pdu_impl : public tuntap_pdu, public stream_pdu_base
+ {
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+ private:
+ std::string d_dev;
+ int tun_alloc(char *dev, int flags = IFF_TAP | IFF_NO_PI);
- float threshold_factor_rise() { return d_threshold_factor_rise; }
- int look_ahead() { return d_look_ahead; }
- float alpha() { return d_avg_alpha; }
-};
+ public:
+ tuntap_pdu_impl(std::string dev, int MTU);
+#endif
+ };
+ } /* namespace blocks */
+} /* namespace gr */
+#endif /* INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H */
diff --git a/gr-blocks/lib/unpack_k_bits_bb_impl.cc b/gr-blocks/lib/unpack_k_bits_bb_impl.cc
new file mode 100644
index 0000000000..367100be84
--- /dev/null
+++ b/gr-blocks/lib/unpack_k_bits_bb_impl.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "unpack_k_bits_bb_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+namespace gr {
+ namespace blocks {
+
+ unpack_k_bits_bb::sptr
+ unpack_k_bits_bb::make(unsigned k)
+ {
+ return gnuradio::get_initial_sptr
+ (new unpack_k_bits_bb_impl(k));
+ }
+
+ unpack_k_bits_bb_impl::unpack_k_bits_bb_impl(unsigned k)
+ : gr_sync_interpolator("unpack_k_bits_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ k),
+ d_k(k)
+ {
+ if(d_k == 0)
+ throw std::out_of_range("interpolation must be > 0");
+ }
+
+ unpack_k_bits_bb_impl::~unpack_k_bits_bb_impl()
+ {
+ }
+
+ int
+ unpack_k_bits_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ int n = 0;
+ for(unsigned int i = 0; i < noutput_items/d_k; i++) {
+ unsigned int t = in[i];
+ for(int j = d_k - 1; j >= 0; j--)
+ out[n++] = (t >> j) & 0x01;
+ }
+
+ assert(n == noutput_items);
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.i b/gr-blocks/lib/unpack_k_bits_bb_impl.h
index 064b0a2789..c72d16ebf8 100644
--- a/gnuradio-core/src/lib/general/gr_regenerate_bb.i
+++ b/gr-blocks/lib/unpack_k_bits_bb_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2006,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,19 +20,29 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(gr,regenerate_bb)
+#ifndef INCLUDED_GR_UNPACK_K_BITS_BB_IMPL_H
+#define INCLUDED_GR_UNPACK_K_BITS_BB_IMPL_H
-gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500);
+#include <blocks/unpack_k_bits_bb.h>
-class gr_regenerate_bb : public gr_sync_block
-{
- private:
- gr_regenerate_bb (int period, unsigned int max_regen);
+namespace gr {
+ namespace blocks {
-public:
- void set_max_regen(unsigned int regen);
+ class unpack_k_bits_bb_impl : public unpack_k_bits_bb
+ {
+ private:
+ unsigned d_k; // number of relevent bits to unpack into k output bytes
- /*! \brief Reset the period of regenerations; this will reset the current regen.
- */
- void set_period(int period);
-};
+ public:
+ unpack_k_bits_bb_impl(unsigned k);
+ ~unpack_k_bits_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UNPACK_K_BITS_BB_IMPL_H */
diff --git a/gr-blocks/python/qa_file_metadata.py b/gr-blocks/python/qa_file_metadata.py
index 69974d6dad..c2319a800e 100644
--- a/gr-blocks/python/qa_file_metadata.py
+++ b/gr-blocks/python/qa_file_metadata.py
@@ -35,6 +35,7 @@ def sig_source_c(samp_rate, freq, amp, N):
class test_file_metadata(gr_unittest.TestCase):
def setUp(self):
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
self.tb = gr.top_block()
def tearDown(self):
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py b/gr-blocks/python/qa_pack_k_bits.py
index 25fc5e9fcc..cd55d2f200 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py
+++ b/gr-blocks/python/qa_pack_k_bits.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2010 Free Software Foundation, Inc.
+# Copyright 2006,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,12 +21,13 @@
#
from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
import random
class test_pack(gr_unittest.TestCase):
def setUp(self):
- self.tb = gr.top_block ()
+ self.tb = gr.top_block()
def tearDown(self):
self.tb = None
@@ -35,7 +36,7 @@ class test_pack(gr_unittest.TestCase):
src_data = (1,0,1,1,0,1,1,0)
expected_results = (1,0,1,1,0,1,1,0)
src = gr.vector_source_b(src_data,False)
- op = gr.pack_k_bits_bb(1)
+ op = blocks.pack_k_bits_bb(1)
dst = gr.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
@@ -45,7 +46,7 @@ class test_pack(gr_unittest.TestCase):
src_data = (1,0,1,1,0,0,0,1)
expected_results = ( 2, 3, 0, 1)
src = gr.vector_source_b(src_data,False)
- op = gr.pack_k_bits_bb(2)
+ op = blocks.pack_k_bits_bb(2)
dst = gr.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
@@ -55,8 +56,8 @@ class test_pack(gr_unittest.TestCase):
def test_003(self):
src_data = expected_results = map(lambda x: random.randint(0,3), range(10));
src = gr.vector_source_b( src_data );
- pack = gr.pack_k_bits_bb(2);
- unpack = gr.unpack_k_bits_bb(2);
+ pack = blocks.pack_k_bits_bb(2);
+ unpack = blocks.unpack_k_bits_bb(2);
snk = gr.vector_sink_b();
self.tb.connect(src,unpack,pack,snk);
self.tb.run()
diff --git a/gr-blocks/python/qa_peak_detector2.py b/gr-blocks/python/qa_peak_detector2.py
new file mode 100644
index 0000000000..4b864e4d70
--- /dev/null
+++ b/gr-blocks/python/qa_peak_detector2.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2010,2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_peak_detector2(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_regen1(self):
+ tb = self.tb
+
+ data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
+
+ expected_result = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+
+ src = gr.vector_source_f(data, False)
+ regen = blocks.peak_detector2_fb()
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run()
+
+ dst_data = dst.data()
+ print dst_data
+
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_peak_detector2, "test_peak_detector2.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py b/gr-blocks/python/qa_regenerate.py
index 5aca03b777..a57eeba2bb 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
+++ b/gr-blocks/python/qa_regenerate.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007,2010 Free Software Foundation, Inc.
+# Copyright 2007,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,17 +21,17 @@
#
from gnuradio import gr, gr_unittest
-import math
+import blocks_swig as blocks
-class test_regenerate (gr_unittest.TestCase):
+class test_regenerate(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_regen1 (self):
+ def test_regen1(self):
tb = self.tb
data = [0, 0, 0,
@@ -44,18 +44,18 @@ class test_regenerate (gr_unittest.TestCase):
src = gr.vector_source_b(data, False)
- regen = gr.regenerate_bb(5, 2)
+ regen = blocks.regenerate_bb(5, 2)
dst = gr.vector_sink_b()
- tb.connect (src, regen)
- tb.connect (regen, dst)
- tb.run ()
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run()
- dst_data = dst.data ()
+ dst_data = dst.data()
- self.assertEqual (expected_result, dst_data)
+ self.assertEqual(expected_result, dst_data)
- def test_regen2 (self):
+ def test_regen2(self):
tb = self.tb
data = 200*[0,]
@@ -74,16 +74,16 @@ class test_regenerate (gr_unittest.TestCase):
expected_result[129] = 1
src = gr.vector_source_b(data, False)
- regen = gr.regenerate_bb(10, 3)
+ regen = blocks.regenerate_bb(10, 3)
dst = gr.vector_sink_b()
- tb.connect (src, regen)
- tb.connect (regen, dst)
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
tb.run ()
- dst_data = dst.data ()
+ dst_data = dst.data()
- self.assertEqual (tuple(expected_result), dst_data)
+ self.assertEqual(tuple(expected_result), dst_data)
if __name__ == '__main__':
diff --git a/gr-blocks/python/qa_stream_mux.py b/gr-blocks/python/qa_stream_mux.py
index f21a9bbbc9..657bd3d63f 100755
--- a/gr-blocks/python/qa_stream_mux.py
+++ b/gr-blocks/python/qa_stream_mux.py
@@ -22,10 +22,12 @@
from gnuradio import gr, gr_unittest
import blocks_swig
+import os
class test_stream_mux (gr_unittest.TestCase):
def setUp (self):
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
self.tb = gr.top_block ()
def tearDown (self):
diff --git a/gr-blocks/python/qa_stretch.py b/gr-blocks/python/qa_stretch.py
new file mode 100755
index 0000000000..078b404dbf
--- /dev/null
+++ b/gr-blocks/python/qa_stretch.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_stretch(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_stretch_01(self):
+ tb = self.tb
+
+ data = 10*[1,]
+ data0 = map(lambda x: x/20.0, data)
+ data1 = map(lambda x: x/10.0, data)
+
+ expected_result0 = 10*[0.05,]
+ expected_result1 = 10*[0.1,]
+
+ src0 = gr.vector_source_f(data0, False)
+ src1 = gr.vector_source_f(data1, False)
+ inter = blocks.streams_to_vector(gr.sizeof_float, 2)
+ op = blocks.stretch_ff(0.1, 2)
+ deinter = blocks.vector_to_streams(gr.sizeof_float, 2)
+ dst0 = gr.vector_sink_f()
+ dst1 = gr.vector_sink_f()
+
+ tb.connect(src0, (inter,0))
+ tb.connect(src1, (inter,1))
+ tb.connect(inter, op)
+ tb.connect(op, deinter)
+ tb.connect((deinter,0), dst0)
+ tb.connect((deinter,1), dst1)
+ tb.run()
+
+ dst0_data = dst0.data()
+ dst1_data = dst1.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result0, dst0_data, 4)
+ self.assertFloatTuplesAlmostEqual(expected_result1, dst1_data, 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_stretch, "test_stretch.xml")
diff --git a/gr-blocks/python/qa_threshold.py b/gr-blocks/python/qa_threshold.py
new file mode 100644
index 0000000000..f91af739ad
--- /dev/null
+++ b/gr-blocks/python/qa_threshold.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_threshold(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ tb = self.tb
+
+ data = [0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2]
+
+ expected_result = (0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1)
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.threshold_ff(1, 1)
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_threshold, "test_threshold.xml")
diff --git a/gr-blocks/python/qa_throttle.py b/gr-blocks/python/qa_throttle.py
new file mode 100755
index 0000000000..5d462f2c9f
--- /dev/null
+++ b/gr-blocks/python/qa_throttle.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_throttle(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ # Test that we can make the block
+ op = blocks.throttle(gr.sizeof_gr_complex, 1)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_throttle, "test_throttle.xml")
diff --git a/gr-blocks/python/qa_transcendental.py b/gr-blocks/python/qa_transcendental.py
new file mode 100644
index 0000000000..8174f79630
--- /dev/null
+++ b/gr-blocks/python/qa_transcendental.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import math
+
+class test_transcendental(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ tb = self.tb
+
+ data = 100*[0,]
+ expected_result = 100*[1,]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("cos", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+ def test_02(self):
+ tb = self.tb
+
+ data = 100*[3,]
+ expected_result = 100*[math.log10(3),]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("log10", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+ def test_03(self):
+ tb = self.tb
+
+ data = 100*[3,]
+ expected_result = 100*[math.tanh(3),]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("tanh", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_transcendental, "test_transcendental.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py b/gr-blocks/python/qa_unpack_k_bits.py
index bb4e7733d4..e038d5a03a 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
+++ b/gr-blocks/python/qa_unpack_k_bits.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2010 Free Software Foundation, Inc.
+# Copyright 2006,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,6 +21,7 @@
#
from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
import random
class test_unpack(gr_unittest.TestCase):
@@ -35,7 +36,7 @@ class test_unpack(gr_unittest.TestCase):
src_data = (1,0,1,1,0,1,1,0)
expected_results = (1,0,1,1,0,1,1,0)
src = gr.vector_source_b(src_data,False)
- op = gr.unpack_k_bits_bb(1)
+ op = blocks.unpack_k_bits_bb(1)
dst = gr.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
@@ -45,13 +46,12 @@ class test_unpack(gr_unittest.TestCase):
src_data = ( 2, 3, 0, 1)
expected_results = (1,0,1,1,0,0,0,1)
src = gr.vector_source_b(src_data,False)
- op = gr.unpack_k_bits_bb(2)
+ op = blocks.unpack_k_bits_bb(2)
dst = gr.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_results, dst.data())
-
if __name__ == '__main__':
gr_unittest.run(test_unpack, "test_unpack.xml")
diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i
index b229e55638..bd57da5348 100644
--- a/gr-blocks/swig/blocks_swig.i
+++ b/gr-blocks/swig/blocks_swig.i
@@ -99,12 +99,15 @@
#include "blocks/not_ss.h"
#include "blocks/not_ii.h"
#include "blocks/patterned_interleaver.h"
+#include "blocks/pack_k_bits_bb.h"
#include "blocks/packed_to_unpacked_bb.h"
#include "blocks/packed_to_unpacked_ss.h"
#include "blocks/packed_to_unpacked_ii.h"
+#include "blocks/peak_detector2_fb.h"
#include "blocks/or_bb.h"
#include "blocks/or_ss.h"
#include "blocks/or_ii.h"
+#include "blocks/regenerate_bb.h"
#include "blocks/repeat.h"
#include "blocks/rms_cf.h"
#include "blocks/rms_ff.h"
@@ -115,11 +118,17 @@
#include "blocks/stream_to_vector.h"
#include "blocks/streams_to_stream.h"
#include "blocks/streams_to_vector.h"
+#include "blocks/stretch_ff.h"
#include "blocks/sub_ff.h"
#include "blocks/sub_ss.h"
#include "blocks/sub_ii.h"
#include "blocks/sub_cc.h"
+#include "blocks/threshold_ff.h"
+#include "blocks/throttle.h"
+#include "blocks/transcendental.h"
+#include "blocks/tuntap_pdu.h"
#include "blocks/uchar_to_float.h"
+#include "blocks/unpack_k_bits_bb.h"
#include "blocks/unpacked_to_packed_bb.h"
#include "blocks/unpacked_to_packed_ss.h"
#include "blocks/unpacked_to_packed_ii.h"
@@ -198,13 +207,16 @@
%include "blocks/not_bb.h"
%include "blocks/not_ss.h"
%include "blocks/not_ii.h"
-%include "blocks/patterned_interleaver.h"
-%include "blocks/packed_to_unpacked_bb.h"
-%include "blocks/packed_to_unpacked_ss.h"
-%include "blocks/packed_to_unpacked_ii.h"
%include "blocks/or_bb.h"
%include "blocks/or_ss.h"
%include "blocks/or_ii.h"
+%include "blocks/pack_k_bits_bb.h"
+%include "blocks/packed_to_unpacked_bb.h"
+%include "blocks/packed_to_unpacked_ss.h"
+%include "blocks/packed_to_unpacked_ii.h"
+%include "blocks/patterned_interleaver.h"
+%include "blocks/peak_detector2_fb.h"
+%include "blocks/regenerate_bb.h"
%include "blocks/repeat.h"
%include "blocks/rms_cf.h"
%include "blocks/rms_ff.h"
@@ -215,11 +227,17 @@
%include "blocks/stream_to_vector.h"
%include "blocks/streams_to_stream.h"
%include "blocks/streams_to_vector.h"
+%include "blocks/stretch_ff.h"
%include "blocks/sub_ff.h"
%include "blocks/sub_ss.h"
%include "blocks/sub_ii.h"
%include "blocks/sub_cc.h"
+%include "blocks/threshold_ff.h"
+%include "blocks/throttle.h"
+%include "blocks/transcendental.h"
+%include "blocks/tuntap_pdu.h"
%include "blocks/uchar_to_float.h"
+%include "blocks/unpack_k_bits_bb.h"
%include "blocks/unpacked_to_packed_bb.h"
%include "blocks/unpacked_to_packed_ss.h"
%include "blocks/unpacked_to_packed_ii.h"
@@ -298,12 +316,15 @@ GR_SWIG_BLOCK_MAGIC2(blocks, not_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, not_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, not_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver);
+GR_SWIG_BLOCK_MAGIC2(blocks, pack_k_bits_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb);
GR_SWIG_BLOCK_MAGIC2(blocks, or_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, repeat);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff);
@@ -314,11 +335,17 @@ GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams);
GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_vector);
GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_stream);
GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_vector);
+GR_SWIG_BLOCK_MAGIC2(blocks, stretch_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, threshold_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, throttle);
+GR_SWIG_BLOCK_MAGIC2(blocks, transcendental);
+GR_SWIG_BLOCK_MAGIC2(blocks, tuntap_pdu);
GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, unpack_k_bits_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii);
diff --git a/gr-channels/examples/channel_tone_response.grc b/gr-channels/examples/channel_tone_response.grc
index bd02f6000a..37e2171eb2 100644
--- a/gr-channels/examples/channel_tone_response.grc
+++ b/gr-channels/examples/channel_tone_response.grc
@@ -216,10 +216,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -748,14 +748,14 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>channels_fading_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py
index b20b17fd39..6f9679d555 100755
--- a/gr-digital/examples/berawgn.py
+++ b/gr-digital/examples/berawgn.py
@@ -77,7 +77,7 @@ class BitErrors(gr.hier_block2):
intdump_decim = int(N_BITS)
self.connect(self,
comp,
- gr.unpack_k_bits_bb(bits_per_byte),
+ blocks.unpack_k_bits_bb(bits_per_byte),
blocks.uchar_to_float(),
blocks.integrate_ff(intdump_decim),
blocks.multiply_const_ff(1.0/N_BITS),
diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc
index 515f7f91f6..b216912a6f 100644
--- a/gr-digital/examples/demod/ber_simulation.grc
+++ b/gr-digital/examples/demod/ber_simulation.grc
@@ -61,10 +61,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle</value>
+ <value>blocks_throttle</value>
</param>
<param>
<key>_enabled</key>
@@ -648,7 +648,7 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle</source_block_id>
+ <source_block_id>blocks_throttle</source_block_id>
<sink_block_id>blks2_error_rate</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -667,7 +667,7 @@
</connection>
<connection>
<source_block_id>random_source_x</source_block_id>
- <sink_block_id>gr_throttle</sink_block_id>
+ <sink_block_id>blocks_throttle</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc
index 7597e1a0fa..965768ece3 100644
--- a/gr-digital/examples/demod/digital_freq_lock.grc
+++ b/gr-digital/examples/demod/digital_freq_lock.grc
@@ -771,10 +771,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -876,12 +876,12 @@
</connection>
<connection>
<source_block_id>digital_psk_mod_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-digital/examples/demod/dpsk_loopback.grc b/gr-digital/examples/demod/dpsk_loopback.grc
index 7a6b2d293f..9befa69b6c 100644
--- a/gr-digital/examples/demod/dpsk_loopback.grc
+++ b/gr-digital/examples/demod/dpsk_loopback.grc
@@ -139,10 +139,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0_0</value>
+ <value>blocks_throttle_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -488,14 +488,14 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0_0</source_block_id>
+ <source_block_id>blocks_throttle_0_0</source_block_id>
<sink_block_id>blks2_packet_encoder_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/gfsk_loopback.grc b/gr-digital/examples/demod/gfsk_loopback.grc
index 51f5ade77a..179a8102f3 100644
--- a/gr-digital/examples/demod/gfsk_loopback.grc
+++ b/gr-digital/examples/demod/gfsk_loopback.grc
@@ -310,10 +310,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0_0</value>
+ <value>blocks_throttle_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -554,7 +554,7 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0_0</source_block_id>
+ <source_block_id>blocks_throttle_0_0</source_block_id>
<sink_block_id>blks2_packet_encoder_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -579,7 +579,7 @@
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/gmsk_loopback.grc b/gr-digital/examples/demod/gmsk_loopback.grc
index c4361fbed8..710070e908 100644
--- a/gr-digital/examples/demod/gmsk_loopback.grc
+++ b/gr-digital/examples/demod/gmsk_loopback.grc
@@ -357,10 +357,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0_0</value>
+ <value>blocks_throttle_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -540,7 +540,7 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0_0</source_block_id>
+ <source_block_id>blocks_throttle_0_0</source_block_id>
<sink_block_id>blks2_packet_encoder_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -571,7 +571,7 @@
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/mpsk_demod.grc b/gr-digital/examples/demod/mpsk_demod.grc
index 61391de545..1045ef5797 100644
--- a/gr-digital/examples/demod/mpsk_demod.grc
+++ b/gr-digital/examples/demod/mpsk_demod.grc
@@ -385,10 +385,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -523,18 +523,18 @@
</connection>
<connection>
<source_block_id>channel_model_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>qtgui_freq_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>qtgui_const_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc
index 3e7f0b3a82..4785482e3f 100644
--- a/gr-digital/examples/demod/pam_sync.grc
+++ b/gr-digital/examples/demod/pam_sync.grc
@@ -1124,10 +1124,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1360,14 +1360,14 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blocks_multiply_const_vxx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc
index 3e437a7ccc..632477821a 100644
--- a/gr-digital/examples/demod/pam_timing.grc
+++ b/gr-digital/examples/demod/pam_timing.grc
@@ -231,10 +231,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1121,7 +1121,7 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_pfb_clock_sync_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -1176,7 +1176,7 @@
</connection>
<connection>
<source_block_id>channels_channel_model_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py
index 05b55e3755..28824dff4b 100755
--- a/gr-digital/examples/narrowband/benchmark_add_channel.py
+++ b/gr-digital/examples/narrowband/benchmark_add_channel.py
@@ -43,7 +43,7 @@ class my_top_block(gr.top_block):
noise_voltage = math.sqrt(noise_power)
self.src = gr.file_source(gr.sizeof_gr_complex, ifile)
- #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate)
+ #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate)
self.channel = filter.channel_model(noise_voltage, frequency_offset,
time_offset, noise_seed=-random.randint(0,100000))
diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py
index b1a1b0782e..a9cb0c0702 100755
--- a/gr-digital/examples/narrowband/rx_voice.py
+++ b/gr-digital/examples/narrowband/rx_voice.py
@@ -82,12 +82,12 @@ class my_top_block(gr.top_block):
self.connect(self.source, self.resampler, self.rxpath)
elif(options.from_file is not None):
- self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, options.bitrate)
self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
self.connect(self.source, self.thr, self.rxpath)
else:
- self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, 1e6)
self.source = gr.null_source(gr.sizeof_gr_complex)
self.connect(self.source, self.thr, self.rxpath)
diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py
index 369087b4c1..0d17efd052 100755
--- a/gr-digital/examples/ofdm/benchmark_add_channel.py
+++ b/gr-digital/examples/ofdm/benchmark_add_channel.py
@@ -45,7 +45,7 @@ class my_top_block(gr.top_block):
frequency_offset = options.frequency_offset / options.fft_length
self.src = gr.file_source(gr.sizeof_gr_complex, ifile)
- #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate)
+ #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate)
self.channel = filter.channel_model(noise_voltage, frequency_offset,
time_offset, noise_seed=-random.randint(0,100000))
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index a5d1d9eb37..bc00646ccc 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -303,7 +303,7 @@ class generic_demod(gr.hier_block2):
mod_codes.invert_code(self._constellation.pre_diff_code()))
# unpack the k bit vector into a stream of bits
- self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol())
+ self.unpack = blocks.unpack_k_bits_bb(self.bits_per_symbol())
if verbose:
self._print_verbage()
@@ -312,14 +312,14 @@ class generic_demod(gr.hier_block2):
self._setup_logging()
# Connect and Initialize base class
- blocks = [self, self.agc, self.freq_recov,
- self.time_recov, self.receiver]
+ self._blocks = [self, self.agc, self.freq_recov,
+ self.time_recov, self.receiver]
if differential:
- blocks.append(self.diffdec)
+ self._blocks.append(self.diffdec)
if self.pre_diff_code:
- blocks.append(self.symbol_mapper)
- blocks += [self.unpack, self]
- self.connect(*blocks)
+ self._blocks.append(self.symbol_mapper)
+ self._blocks += [self.unpack, self]
+ self.connect(*self._blocks)
def samples_per_symbol(self):
return self._samples_per_symbol
diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py
index 895ab767a0..8d81707e30 100644
--- a/gr-digital/python/ofdm_sync_ml.py
+++ b/gr-digital/python/ofdm_sync_ml.py
@@ -135,7 +135,7 @@ class ofdm_sync_ml(gr.hier_block2):
# The output theta of the correlator above is multiplied with this correlation to
# identify the proper peak and remove other products in this cross-correlation
self.threshold_factor = 0.1
- self.slice = gr.threshold_ff(self.threshold_factor, self.threshold_factor, 0)
+ self.slice = blocks.threshold_ff(self.threshold_factor, self.threshold_factor, 0)
self.f2b = blocks.float_to_char()
self.b2f = blocks.char_to_float()
self.mul = blocks.multiply_ff()
diff --git a/gr-digital/python/ofdm_sync_pn.py b/gr-digital/python/ofdm_sync_pn.py
index cddd1b31da..fbf6b6cb07 100644
--- a/gr-digital/python/ofdm_sync_pn.py
+++ b/gr-digital/python/ofdm_sync_pn.py
@@ -86,8 +86,8 @@ class ofdm_sync_pn(gr.hier_block2):
#ML measurements input to sampler block and detect
self.sub1 = blocks.add_const_ff(-1)
- self.pk_detect = gr.peak_detector_fb(0.20, 0.20, 30, 0.001)
- #self.pk_detect = gr.peak_detector2_fb(9)
+ self.pk_detect = blocks.peak_detector_fb(0.20, 0.20, 30, 0.001)
+ #self.pk_detect = blocks.peak_detector2_fb(9)
self.connect(self, self.input)
diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py
index f6627a4aba..7ffe112fb8 100644
--- a/gr-digital/python/ofdm_sync_pnac.py
+++ b/gr-digital/python/ofdm_sync_pnac.py
@@ -91,7 +91,7 @@ class ofdm_sync_pnac(gr.hier_block2):
self.sample_and_hold = gr.sample_and_hold_ff()
#ML measurements input to sampler block and detect
- self.threshold = gr.threshold_ff(0,0,0) # threshold detection might need to be tweaked
+ self.threshold = blocks.threshold_ff(0,0,0) # threshold detection might need to be tweaked
self.peaks = blocksx.float_to_char()
self.connect(self, self.input)
diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py
index 12dbca232f..37112f70a3 100755
--- a/gr-digital/python/qa_constellation.py
+++ b/gr-digital/python/qa_constellation.py
@@ -206,7 +206,7 @@ class mod_demod(gr.hier_block2):
self.blocks.append(digital.map_bb(
mod_codes.invert_code(self.constellation.pre_diff_code())))
# unpack the k bit vector into a stream of bits
- self.blocks.append(gr.unpack_k_bits_bb(
+ self.blocks.append(blocks.unpack_k_bits_bb(
self.constellation.bits_per_symbol()))
# connect to block output
check_index = len(self.blocks)
diff --git a/gr-filter/examples/gr_filtdes_live_upd.py b/gr-filter/examples/gr_filtdes_live_upd.py
index b21e381a46..52985119e0 100755
--- a/gr-filter/examples/gr_filtdes_live_upd.py
+++ b/gr-filter/examples/gr_filtdes_live_upd.py
@@ -22,6 +22,7 @@
from gnuradio.filter import filter_design
from gnuradio import gr, filter
+from gnuradio import blocks
import sys
try:
@@ -70,7 +71,7 @@ class my_top_block(gr.top_block):
src = blocks.add_cc()
channel = channels.channel_model(0.01)
self.filt = filter.fft_filter_ccc(1, self.filt_taps)
- thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts)
self.snk1 = qtgui.freq_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Complex Freq Example", 1)
diff --git a/gr-filter/examples/resampler_demo.grc b/gr-filter/examples/resampler_demo.grc
index 9c19cd7dcc..62ebdd34cd 100644
--- a/gr-filter/examples/resampler_demo.grc
+++ b/gr-filter/examples/resampler_demo.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Sat Nov 10 14:47:16 2012</timestamp>
+ <timestamp>Sun Feb 24 19:43:22 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -236,37 +236,6 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
- <param>
- <key>id</key>
- <value>throttle</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(227, 493)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>pfb_arb_resampler_xxx</key>
<param>
<key>id</key>
@@ -607,6 +576,37 @@
<value>0</value>
</param>
</block>
+ <block>
+ <key>blocks_throttle</key>
+ <param>
+ <key>id</key>
+ <value>throttle</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(227, 492)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
<connection>
<source_block_id>adder</source_block_id>
<sink_block_id>throttle</sink_block_id>
diff --git a/gr-filter/examples/synth_to_chan.py b/gr-filter/examples/synth_to_chan.py
index d1d2406458..5ea4d8ee47 100755
--- a/gr-filter/examples/synth_to_chan.py
+++ b/gr-filter/examples/synth_to_chan.py
@@ -53,7 +53,7 @@ def main():
sigs = list()
fmtx = list()
for fi in freqs:
- s = analog.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1)
+ s = analog.sig_source_f(fs, analog.GR_SIN_WAVE, fi, 1)
fm = analog.nbfm_tx(fs, 4*fs, max_dev=10000, tau=75e-6)
sigs.append(s)
fmtx.append(fm)
@@ -69,7 +69,7 @@ def main():
noise_level = 0.01
head = gr.head(gr.sizeof_gr_complex, N)
- noise = analog.noise_source_c(gr.GR_GAUSSIAN, noise_level)
+ noise = analog.noise_source_c(analog.GR_GAUSSIAN, noise_level)
addnoise = blocks.add_cc()
snk_synth = gr.vector_sink_c()
diff --git a/gr-filter/lib/fir_filter_XXX_impl.cc.t b/gr-filter/lib/fir_filter_XXX_impl.cc.t
index 529c51e2bb..319c267270 100644
--- a/gr-filter/lib/fir_filter_XXX_impl.cc.t
+++ b/gr-filter/lib/fir_filter_XXX_impl.cc.t
@@ -64,6 +64,7 @@ namespace gr {
void
@IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
{
+ gruel::scoped_lock l(d_setlock);
d_fir->set_taps(taps);
d_updated = true;
}
@@ -79,6 +80,8 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ gruel::scoped_lock l(d_setlock);
+
const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
@O_TYPE@ *out = (@O_TYPE@*)output_items[0];
diff --git a/gr-howto-write-a-block/apps/howto_square.grc b/gr-howto-write-a-block/apps/howto_square.grc
index 98f73774e3..1f3324e4eb 100644
--- a/gr-howto-write-a-block/apps/howto_square.grc
+++ b/gr-howto-write-a-block/apps/howto_square.grc
@@ -178,7 +178,7 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
<value>thr</value>
diff --git a/gr-howto-write-a-block/apps/howto_square.py b/gr-howto-write-a-block/apps/howto_square.py
index 0b293b882f..140067b59f 100755
--- a/gr-howto-write-a-block/apps/howto_square.py
+++ b/gr-howto-write-a-block/apps/howto_square.py
@@ -7,6 +7,7 @@
from gnuradio import eng_notation
from gnuradio import gr
+from gnuradio import blocks
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from gnuradio.wxgui import scopesink2
@@ -28,7 +29,7 @@ class howto_square(grc_wxgui.top_block_gui):
##################################################
# Blocks
##################################################
- self.thr = gr.throttle(gr.sizeof_float*1, samp_rate)
+ self.thr = blocks.throttle(gr.sizeof_float*1, samp_rate)
self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1)
self.sqr = howto.square_ff()
self.sink2 = scopesink2.scope_sink_f(
diff --git a/gr-howto-write-a-block/apps/howto_square_qt.grc b/gr-howto-write-a-block/apps/howto_square_qt.grc
index 6281c3a310..c4c72adca0 100644
--- a/gr-howto-write-a-block/apps/howto_square_qt.grc
+++ b/gr-howto-write-a-block/apps/howto_square_qt.grc
@@ -173,10 +173,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -253,19 +253,19 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>howto_square2_ff_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>howto_square_ff_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>qtgui_time_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
@@ -278,7 +278,7 @@
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-howto-write-a-block/apps/howto_square_qt.py b/gr-howto-write-a-block/apps/howto_square_qt.py
index 986f1c7585..3215ea8ab4 100755
--- a/gr-howto-write-a-block/apps/howto_square_qt.py
+++ b/gr-howto-write-a-block/apps/howto_square_qt.py
@@ -7,6 +7,7 @@
from PyQt4 import Qt
from gnuradio import analog
+from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import qtgui
@@ -59,18 +60,18 @@ class howto_square_qt(gr.top_block, Qt.QWidget):
self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
self.howto_square_ff_0 = howto.square_ff()
self.howto_square2_ff_0 = howto.square2_ff()
- self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
+ self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
##################################################
# Connections
##################################################
self.connect((self.howto_square2_ff_0, 0), (self.qtgui_time_sink_x_0, 0))
- self.connect((self.gr_throttle_0, 0), (self.howto_square2_ff_0, 0))
- self.connect((self.gr_throttle_0, 0), (self.howto_square_ff_0, 0))
- self.connect((self.gr_throttle_0, 0), (self.qtgui_time_sink_x_0, 1))
+ self.connect((self.blocks_throttle_0, 0), (self.howto_square2_ff_0, 0))
+ self.connect((self.blocks_throttle_0, 0), (self.howto_square_ff_0, 0))
+ self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 1))
self.connect((self.howto_square_ff_0, 0), (self.qtgui_time_sink_x_0, 2))
- self.connect((self.analog_sig_source_x_0, 0), (self.gr_throttle_0, 0))
+ self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
# QT sink close method reimplementation
def closeEvent(self, event):
diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc
index 664b200a5f..b8a93d56e3 100644
--- a/gr-noaa/examples/file_rx_hrpt.grc
+++ b/gr-noaa/examples/file_rx_hrpt.grc
@@ -438,7 +438,7 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
<value>throttle</value>
diff --git a/gr-qtgui/apps/grc_qt_example.grc b/gr-qtgui/apps/grc_qt_example.grc
index a0c9a0b6ae..320320edcc 100644
--- a/gr-qtgui/apps/grc_qt_example.grc
+++ b/gr-qtgui/apps/grc_qt_example.grc
@@ -249,10 +249,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -434,7 +434,7 @@
</block>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -445,7 +445,7 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py
index d353e0041c..2e8cf2fd66 100755
--- a/gr-qtgui/apps/qt_digital.py
+++ b/gr-qtgui/apps/qt_digital.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr, digital
+from gnuradio import blocks
from gnuradio import eng_notation
import sys
@@ -215,7 +216,7 @@ class my_top_block(gr.top_block):
self.to = 1.0
self.channel = gr.channel_model(noise, self.fo, self.to)
- self.thr = gr.throttle(gr.sizeof_char, self._sample_rate)
+ self.thr = blocks.throttle(gr.sizeof_char, self._sample_rate)
self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
0, self._sample_rate*self.sps,
"Tx", True, True, True, True)
diff --git a/gr-qtgui/examples/pyqt_const_c.py b/gr-qtgui/examples/pyqt_const_c.py
index e26ce0bd90..3a43bf9a92 100755
--- a/gr-qtgui/examples/pyqt_const_c.py
+++ b/gr-qtgui/examples/pyqt_const_c.py
@@ -156,7 +156,7 @@ class my_top_block(gr.top_block):
src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.5, 0)
src = blocks.add_cc()
channel = channels.channel_model(0.001)
- thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts)
self.snk1 = qtgui.const_sink_c(npts, "Constellation Example", 1)
self.connect(src1, (src,0))
diff --git a/gr-qtgui/examples/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py
index ccacc246bf..cb708360f1 100755
--- a/gr-qtgui/examples/pyqt_example_c.py
+++ b/gr-qtgui/examples/pyqt_example_c.py
@@ -160,7 +160,7 @@ class my_top_block(gr.top_block):
src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_cc()
channel = channels.channel_model(0.001)
- thr = gr.throttle(gr.sizeof_gr_complex, 100*fftsize)
+ thr = blocks.throttle(gr.sizeof_gr_complex, 100*fftsize)
self.snk1 = qtgui.sink_c(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Complex Signal Example",
diff --git a/gr-qtgui/examples/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py
index f975bf0d1a..5bd582d1e1 100755
--- a/gr-qtgui/examples/pyqt_example_f.py
+++ b/gr-qtgui/examples/pyqt_example_f.py
@@ -149,7 +149,7 @@ class my_top_block(gr.top_block):
src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0)
src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_ff()
- thr = gr.throttle(gr.sizeof_float, 100*fftsize)
+ thr = blocks.throttle(gr.sizeof_float, 100*fftsize)
noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001)
add = blocks.add_ff()
self.snk1 = qtgui.sink_f(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS,
diff --git a/gr-qtgui/examples/pyqt_freq_c.py b/gr-qtgui/examples/pyqt_freq_c.py
index 5941622130..7632176878 100755
--- a/gr-qtgui/examples/pyqt_freq_c.py
+++ b/gr-qtgui/examples/pyqt_freq_c.py
@@ -160,7 +160,7 @@ class my_top_block(gr.top_block):
src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_cc()
channel = channels.channel_model(0.01)
- thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts)
self.snk1 = qtgui.freq_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Complex Freq Example", 3)
diff --git a/gr-qtgui/examples/pyqt_freq_f.py b/gr-qtgui/examples/pyqt_freq_f.py
index 44d81314a4..668b54d249 100755
--- a/gr-qtgui/examples/pyqt_freq_f.py
+++ b/gr-qtgui/examples/pyqt_freq_f.py
@@ -150,7 +150,7 @@ class my_top_block(gr.top_block):
src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0)
src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_ff()
- thr = gr.throttle(gr.sizeof_float, 100*npts)
+ thr = blocks.throttle(gr.sizeof_float, 100*npts)
self.snk1 = qtgui.freq_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Real freq Example", 3)
diff --git a/gr-qtgui/examples/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py
index 65d62c4167..ae8ebfc257 100755
--- a/gr-qtgui/examples/pyqt_time_c.py
+++ b/gr-qtgui/examples/pyqt_time_c.py
@@ -160,7 +160,7 @@ class my_top_block(gr.top_block):
src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_cc()
channel = channels.channel_model(0.01)
- thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts)
self.snk1 = qtgui.time_sink_c(npts, Rs,
"Complex Time Example", 1)
diff --git a/gr-qtgui/examples/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py
index e64d6fcfde..b733a5a809 100755
--- a/gr-qtgui/examples/pyqt_time_f.py
+++ b/gr-qtgui/examples/pyqt_time_f.py
@@ -149,7 +149,7 @@ class my_top_block(gr.top_block):
src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0)
src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_ff()
- thr = gr.throttle(gr.sizeof_float, 100*npts)
+ thr = blocks.throttle(gr.sizeof_float, 100*npts)
noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001)
add = blocks.add_ff()
self.snk1 = qtgui.time_sink_f(npts, Rs,
diff --git a/gr-qtgui/examples/pyqt_time_raster_b.py b/gr-qtgui/examples/pyqt_time_raster_b.py
index b9db6e1e8e..b29403819d 100755
--- a/gr-qtgui/examples/pyqt_time_raster_b.py
+++ b/gr-qtgui/examples/pyqt_time_raster_b.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr
+from gnuradio import blocks
import sys
try:
@@ -59,7 +60,7 @@ class my_top_block(gr.top_block):
fs = 200
src0 = gr.vector_source_b(data0, True)
src1 = gr.vector_source_b(data1, True)
- thr = gr.throttle(gr.sizeof_char, 50000)
+ thr = blocks.throttle(gr.sizeof_char, 50000)
head = gr.head(gr.sizeof_char, 10000000)
self.snk1 = qtgui.time_raster_sink_b(fs, nrows, ncols, [], [],
"Time Raster Example", 2)
diff --git a/gr-qtgui/examples/pyqt_time_raster_f.py b/gr-qtgui/examples/pyqt_time_raster_f.py
index 0b343e6a6e..957e694b38 100755
--- a/gr-qtgui/examples/pyqt_time_raster_f.py
+++ b/gr-qtgui/examples/pyqt_time_raster_f.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr
+from gnuradio import blocks
import sys
try:
@@ -59,7 +60,7 @@ class my_top_block(gr.top_block):
fs = 200
src0 = gr.vector_source_f(data0, True)
src1 = gr.vector_source_f(data1, True)
- thr = gr.throttle(gr.sizeof_float, 50000)
+ thr = blocks.throttle(gr.sizeof_float, 50000)
hed = gr.head(gr.sizeof_float, 10000000)
self.snk1 = qtgui.time_raster_sink_f(fs, nrows, ncols, [], [],
"Float Time Raster Example", 2)
diff --git a/gr-qtgui/examples/pyqt_waterfall_c.py b/gr-qtgui/examples/pyqt_waterfall_c.py
index 407e8d1bb0..13168e1475 100755
--- a/gr-qtgui/examples/pyqt_waterfall_c.py
+++ b/gr-qtgui/examples/pyqt_waterfall_c.py
@@ -162,7 +162,7 @@ class my_top_block(gr.top_block):
src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_cc()
channel = channels.channel_model(0.01)
- thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts)
filt = filter.fft_filter_ccc(1, taps)
self.snk1 = qtgui.waterfall_sink_c(npts, gr.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
diff --git a/gr-qtgui/examples/pyqt_waterfall_f.py b/gr-qtgui/examples/pyqt_waterfall_f.py
index 8843f19528..f9680c28cf 100755
--- a/gr-qtgui/examples/pyqt_waterfall_f.py
+++ b/gr-qtgui/examples/pyqt_waterfall_f.py
@@ -149,7 +149,7 @@ class my_top_block(gr.top_block):
src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0)
src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_ff()
- thr = gr.throttle(gr.sizeof_float, 100*npts)
+ thr = blocks.throttle(gr.sizeof_float, 100*npts)
self.snk1 = qtgui.waterfall_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Real Waterfall Example", 2)
diff --git a/gr-qtgui/include/qtgui/time_raster_sink_b.h b/gr-qtgui/include/qtgui/time_raster_sink_b.h
index 1f2a2b09e8..132ab9715c 100644
--- a/gr-qtgui/include/qtgui/time_raster_sink_b.h
+++ b/gr-qtgui/include/qtgui/time_raster_sink_b.h
@@ -75,11 +75,11 @@ namespace gr {
virtual void set_update_time(double t) = 0;
virtual void set_title(const std::string &title) = 0;
- virtual void set_line_label(const std::string &lable) = 0;
- virtual void set_line_color(const std::string &color) = 0;
- virtual void set_line_width(int width) = 0;
- virtual void set_line_style(Qt::PenStyle style) = 0;
- virtual void set_line_marker(QwtSymbol::Style marker) = 0;
+ virtual void set_line_label(int which, const std::string &lable) = 0;
+ virtual void set_line_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
virtual void set_line_alpha(int which, double alpha) = 0;
virtual void set_color_map(int which, const int color) = 0;
diff --git a/gr-qtgui/include/qtgui/time_raster_sink_f.h b/gr-qtgui/include/qtgui/time_raster_sink_f.h
index c845dbfa7d..7215373bec 100644
--- a/gr-qtgui/include/qtgui/time_raster_sink_f.h
+++ b/gr-qtgui/include/qtgui/time_raster_sink_f.h
@@ -72,11 +72,11 @@ namespace gr {
virtual void set_update_time(double t) = 0;
virtual void set_title(const std::string &title) = 0;
- virtual void set_line_label(const std::string &lable) = 0;
- virtual void set_line_color(const std::string &color) = 0;
- virtual void set_line_width(int width) = 0;
- virtual void set_line_style(Qt::PenStyle style) = 0;
- virtual void set_line_marker(QwtSymbol::Style marker) = 0;
+ virtual void set_line_label(int which, const std::string &lable) = 0;
+ virtual void set_line_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
virtual void set_line_alpha(int which, double alpha) = 0;
virtual void set_color_map(int which, const int color) = 0;
diff --git a/gr-qtgui/lib/const_sink_c_impl.cc b/gr-qtgui/lib/const_sink_c_impl.cc
index 9b01d1659e..b623dc2175 100644
--- a/gr-qtgui/lib/const_sink_c_impl.cc
+++ b/gr-qtgui/lib/const_sink_c_impl.cc
@@ -75,6 +75,9 @@ namespace gr {
const_sink_c_impl::~const_sink_c_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
// d_main_gui is a qwidget destroyed with its parent
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs_real[i]);
diff --git a/gr-qtgui/lib/constellationdisplayform.cc b/gr-qtgui/lib/constellationdisplayform.cc
index 422e48ea87..e3c65ec41d 100644
--- a/gr-qtgui/lib/constellationdisplayform.cc
+++ b/gr-qtgui/lib/constellationdisplayform.cc
@@ -110,13 +110,8 @@ ConstellationDisplayForm::setXaxis(double min, double max)
void
ConstellationDisplayForm::autoScale(bool en)
{
- if(en) {
- _autoscale_state = true;
- }
- else {
- _autoscale_state = false;
- }
-
+ _autoscale_state = en;
+ _autoscale_act->setChecked(en);
getPlot()->setAutoScale(_autoscale_state);
getPlot()->replot();
}
diff --git a/gr-qtgui/lib/displayform.cc b/gr-qtgui/lib/displayform.cc
index 1f0e27bee6..276539cdde 100644
--- a/gr-qtgui/lib/displayform.cc
+++ b/gr-qtgui/lib/displayform.cc
@@ -28,6 +28,8 @@
DisplayForm::DisplayForm(int nplots, QWidget* parent)
: QWidget(parent), _nplots(nplots), _systemSpecifiedFlag(false)
{
+ _isclosed = false;
+
// Set the initial plot size
resize(QSize(800, 600));
@@ -128,6 +130,8 @@ DisplayForm::DisplayForm(int nplots, QWidget* parent)
DisplayForm::~DisplayForm()
{
+ _isclosed = true;
+
// Qt deletes children when parent is deleted
// Don't worry about deleting Display Plots - they are deleted when parents are deleted
@@ -178,6 +182,12 @@ DisplayForm::Reset()
{
}
+bool
+DisplayForm::isClosed() const
+{
+ return _isclosed;
+}
+
void
DisplayForm::enableMenu(bool en)
{
@@ -185,8 +195,9 @@ DisplayForm::enableMenu(bool en)
}
void
-DisplayForm::closeEvent( QCloseEvent *e )
+DisplayForm::closeEvent(QCloseEvent *e)
{
+ _isclosed = true;
qApp->processEvents();
QWidget::closeEvent(e);
}
diff --git a/gr-qtgui/lib/displayform.h b/gr-qtgui/lib/displayform.h
index 0d105bd83d..31dc757bb6 100644
--- a/gr-qtgui/lib/displayform.h
+++ b/gr-qtgui/lib/displayform.h
@@ -43,6 +43,7 @@ class DisplayForm : public QWidget
virtual DisplayPlot* getPlot() = 0;
void Reset();
+ bool isClosed() const;
void enableMenu(bool en=true);
@@ -91,6 +92,8 @@ signals:
void plotPointSelected(const QPointF p, int type);
protected:
+ bool _isclosed;
+
int _nplots;
QGridLayout *_layout;
diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc
index 3755df0552..b1f9a2b1a1 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.cc
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -86,6 +86,9 @@ namespace gr {
freq_sink_c_impl::~freq_sink_c_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
fft::free(d_magbufs[i]);
diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc
index 807be83948..f357ae10be 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.cc
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -86,6 +86,9 @@ namespace gr {
freq_sink_f_impl::~freq_sink_f_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
fft::free(d_magbufs[i]);
diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.cc b/gr-qtgui/lib/time_raster_sink_b_impl.cc
index 11821a462c..d90661b968 100644
--- a/gr-qtgui/lib/time_raster_sink_b_impl.cc
+++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc
@@ -89,6 +89,9 @@ namespace gr {
time_raster_sink_b_impl::~time_raster_sink_b_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
fft::free(d_tmpflt);
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
@@ -163,33 +166,33 @@ namespace gr {
}
void
- time_raster_sink_b_impl::set_line_label(const std::string &label)
+ time_raster_sink_b_impl::set_line_label(int which, const std::string &label)
{
- d_main_gui->setLineLabel(0, label.c_str());
+ d_main_gui->setLineLabel(which, label.c_str());
}
void
- time_raster_sink_b_impl::set_line_color(const std::string &color)
+ time_raster_sink_b_impl::set_line_color(int which, const std::string &color)
{
- d_main_gui->setLineColor(0, color.c_str());
+ d_main_gui->setLineColor(which, color.c_str());
}
void
- time_raster_sink_b_impl::set_line_width(int width)
+ time_raster_sink_b_impl::set_line_width(int which, int width)
{
- d_main_gui->setLineWidth(0, width);
+ d_main_gui->setLineWidth(which, width);
}
void
- time_raster_sink_b_impl::set_line_style(Qt::PenStyle style)
+ time_raster_sink_b_impl::set_line_style(int which, Qt::PenStyle style)
{
- d_main_gui->setLineStyle(0, style);
+ d_main_gui->setLineStyle(which, style);
}
void
- time_raster_sink_b_impl::set_line_marker(QwtSymbol::Style marker)
+ time_raster_sink_b_impl::set_line_marker(int which, QwtSymbol::Style marker)
{
- d_main_gui->setLineMarker(0, marker);
+ d_main_gui->setLineMarker(which, marker);
}
void
diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.h b/gr-qtgui/lib/time_raster_sink_b_impl.h
index 46f5300cc7..68dfa25aac 100644
--- a/gr-qtgui/lib/time_raster_sink_b_impl.h
+++ b/gr-qtgui/lib/time_raster_sink_b_impl.h
@@ -77,11 +77,11 @@ namespace gr {
void set_update_time(double t);
void set_title(const std::string &title);
- void set_line_label(const std::string &label);
- void set_line_color(const std::string &color);
- void set_line_width(int width);
- void set_line_style(Qt::PenStyle style);
- void set_line_marker(QwtSymbol::Style marker);
+ void set_line_label(int which, const std::string &label);
+ void set_line_color(int which, const std::string &color);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
void set_line_alpha(int which, double alpha);
void set_color_map(int which, const int color);
diff --git a/gr-qtgui/lib/time_raster_sink_c_impl.cc b/gr-qtgui/lib/time_raster_sink_c_impl.cc
index a0b1259157..17098f0d93 100644
--- a/gr-qtgui/lib/time_raster_sink_c_impl.cc
+++ b/gr-qtgui/lib/time_raster_sink_c_impl.cc
@@ -66,6 +66,9 @@ namespace gr {
time_raster_sink_c_impl::~time_raster_sink_c_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
}
diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.cc b/gr-qtgui/lib/time_raster_sink_f_impl.cc
index 5def19f406..39237e2912 100644
--- a/gr-qtgui/lib/time_raster_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc
@@ -87,6 +87,9 @@ namespace gr {
time_raster_sink_f_impl::~time_raster_sink_f_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
fft::free(d_tmpflt);
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
@@ -161,33 +164,33 @@ namespace gr {
}
void
- time_raster_sink_f_impl::set_line_label(const std::string &label)
+ time_raster_sink_f_impl::set_line_label(int which, const std::string &label)
{
- d_main_gui->setLineLabel(0, label.c_str());
+ d_main_gui->setLineLabel(which, label.c_str());
}
void
- time_raster_sink_f_impl::set_line_color(const std::string &color)
+ time_raster_sink_f_impl::set_line_color(int which, const std::string &color)
{
- d_main_gui->setLineColor(0, color.c_str());
+ d_main_gui->setLineColor(which, color.c_str());
}
void
- time_raster_sink_f_impl::set_line_width(int width)
+ time_raster_sink_f_impl::set_line_width(int which, int width)
{
- d_main_gui->setLineWidth(0, width);
+ d_main_gui->setLineWidth(which, width);
}
void
- time_raster_sink_f_impl::set_line_style(Qt::PenStyle style)
+ time_raster_sink_f_impl::set_line_style(int which, Qt::PenStyle style)
{
- d_main_gui->setLineStyle(0, style);
+ d_main_gui->setLineStyle(which, style);
}
void
- time_raster_sink_f_impl::set_line_marker(QwtSymbol::Style marker)
+ time_raster_sink_f_impl::set_line_marker(int which, QwtSymbol::Style marker)
{
- d_main_gui->setLineMarker(0, marker);
+ d_main_gui->setLineMarker(which, marker);
}
void
diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.h b/gr-qtgui/lib/time_raster_sink_f_impl.h
index 922ae6df73..1d7d791202 100644
--- a/gr-qtgui/lib/time_raster_sink_f_impl.h
+++ b/gr-qtgui/lib/time_raster_sink_f_impl.h
@@ -76,11 +76,11 @@ namespace gr {
void set_update_time(double t);
void set_title(const std::string &title);
- void set_line_label(const std::string &label);
- void set_line_color(const std::string &color);
- void set_line_width(int width);
- void set_line_style(Qt::PenStyle style);
- void set_line_marker(QwtSymbol::Style marker);
+ void set_line_label(int which, const std::string &label);
+ void set_line_color(int which, const std::string &color);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
void set_line_alpha(int which, double alpha);
void set_color_map(int which, const int color);
diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc
index 27d7eb3f3e..2edb83fa12 100644
--- a/gr-qtgui/lib/time_sink_c_impl.cc
+++ b/gr-qtgui/lib/time_sink_c_impl.cc
@@ -73,6 +73,9 @@ namespace gr {
time_sink_c_impl::~time_sink_c_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
// d_main_gui is a qwidget destroyed with its parent
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc
index 5bb89c7d59..39a62d3d6b 100644
--- a/gr-qtgui/lib/time_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_sink_f_impl.cc
@@ -73,6 +73,9 @@ namespace gr {
time_sink_f_impl::~time_sink_f_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
// d_main_gui is a qwidget destroyed with its parent
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc b/gr-qtgui/lib/waterfall_sink_c_impl.cc
index 617d6b5442..72908b51b9 100644
--- a/gr-qtgui/lib/waterfall_sink_c_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc
@@ -85,6 +85,9 @@ namespace gr {
waterfall_sink_c_impl::~waterfall_sink_c_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
fft::free(d_magbufs[i]);
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc b/gr-qtgui/lib/waterfall_sink_f_impl.cc
index a17f73a248..bdf1159e5a 100644
--- a/gr-qtgui/lib/waterfall_sink_f_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc
@@ -84,6 +84,9 @@ namespace gr {
waterfall_sink_f_impl::~waterfall_sink_f_impl()
{
+ if(!d_main_gui->isClosed())
+ d_main_gui->close();
+
for(int i = 0; i < d_nconnections; i++) {
fft::free(d_residbufs[i]);
fft::free(d_magbufs[i]);
diff --git a/gr-trellis/examples/grc/interference_cancellation.grc b/gr-trellis/examples/grc/interference_cancellation.grc
index 891426660a..29452311c6 100644
--- a/gr-trellis/examples/grc/interference_cancellation.grc
+++ b/gr-trellis/examples/grc/interference_cancellation.grc
@@ -1507,10 +1507,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -2152,7 +2152,7 @@
</connection>
<connection>
<source_block_id>trellis_encoder_xx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -2163,7 +2163,7 @@
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-trellis/examples/grc/pccc.grc b/gr-trellis/examples/grc/pccc.grc
index a9f65cf856..359cfefc83 100644
--- a/gr-trellis/examples/grc/pccc.grc
+++ b/gr-trellis/examples/grc/pccc.grc
@@ -663,10 +663,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -807,7 +807,7 @@
</connection>
<connection>
<source_block_id>trellis_pccc_encoder_xx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -830,7 +830,7 @@
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-trellis/examples/grc/pccc1.grc b/gr-trellis/examples/grc/pccc1.grc
index 1bc0e189d0..8f58404794 100644
--- a/gr-trellis/examples/grc/pccc1.grc
+++ b/gr-trellis/examples/grc/pccc1.grc
@@ -647,10 +647,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -832,7 +832,7 @@
</connection>
<connection>
<source_block_id>trellis_pccc_encoder_xx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -849,7 +849,7 @@
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-trellis/examples/grc/sccc.grc b/gr-trellis/examples/grc/sccc.grc
index abfbeb8b81..ee532da9fe 100644
--- a/gr-trellis/examples/grc/sccc.grc
+++ b/gr-trellis/examples/grc/sccc.grc
@@ -628,10 +628,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -783,7 +783,7 @@
</connection>
<connection>
<source_block_id>trellis_sccc_encoder_xx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -824,7 +824,7 @@
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-trellis/examples/grc/sccc1.grc b/gr-trellis/examples/grc/sccc1.grc
index 906ca25389..fa6506ba18 100644
--- a/gr-trellis/examples/grc/sccc1.grc
+++ b/gr-trellis/examples/grc/sccc1.grc
@@ -647,10 +647,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -802,7 +802,7 @@
</connection>
<connection>
<source_block_id>trellis_sccc_encoder_xx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -849,7 +849,7 @@
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py
index bfdba19c0f..706017cc21 100644
--- a/gr-utils/python/modtool/templates.py
+++ b/gr-utils/python/modtool/templates.py
@@ -501,7 +501,7 @@ GR_SWIG_BLOCK_MAGIC($modname, $blockname);
#else
%include "${modname}/${blockname}.h"
GR_SWIG_BLOCK_MAGIC2($modname, $blockname);
-#end
+#end if
"""
## Old stuff
diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt
index 8d7ac65f7b..1eb536f9d9 100644
--- a/gr-wavelet/CMakeLists.txt
+++ b/gr-wavelet/CMakeLists.txt
@@ -32,6 +32,7 @@ include(GrComponent)
GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET
Boost_FOUND
ENABLE_GR_CORE
+ ENABLE_GR_BLOCKS
ENABLE_GR_ANALOG
GSL_FOUND
)
diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt
index e49a5433f3..92f1082660 100644
--- a/gr-wavelet/lib/CMakeLists.txt
+++ b/gr-wavelet/lib/CMakeLists.txt
@@ -24,6 +24,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${GR_WAVELET_INCLUDE_DIRS}
+ ${GR_BLOCKS_INCLUDE_DIRS}
${GNURADIO_CORE_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
@@ -47,6 +48,7 @@ list(APPEND gr_wavelet_sources
list(APPEND wavelet_libs
gnuradio-core
+ gnuradio-blocks
${Boost_LIBRARIES}
${WAVELET_LIBRARIES}
${GSL_LIBRARIES}
diff --git a/gr-wavelet/python/CMakeLists.txt b/gr-wavelet/python/CMakeLists.txt
index 9234c62bdb..7f7fd99ecf 100644
--- a/gr-wavelet/python/CMakeLists.txt
+++ b/gr-wavelet/python/CMakeLists.txt
@@ -37,6 +37,8 @@ list(APPEND GR_TEST_PYTHON_DIRS
${CMAKE_BINARY_DIR}/gr-analog/swig
${CMAKE_BINARY_DIR}/gr-wavelet/python
${CMAKE_BINARY_DIR}/gr-wavelet/swig
+ ${CMAKE_BINARY_DIR}/gr-blocks/python
+ ${CMAKE_BINARY_DIR}/gr-blocks/swig
)
list(APPEND GR_TEST_TARGET_DEPS gnuradio-wavelet)
diff --git a/gr-wavelet/python/qa_classify.py b/gr-wavelet/python/qa_classify.py
index 0906761aca..c2972c92f2 100755
--- a/gr-wavelet/python/qa_classify.py
+++ b/gr-wavelet/python/qa_classify.py
@@ -27,6 +27,7 @@ import copy
import math
import wavelet_swig
import analog_swig as analog
+import blocks_swig as blocks
def sqr(x):
return x*x
@@ -88,7 +89,7 @@ class test_classify(gr_unittest.TestCase):
trg_data = copy.deepcopy(src_data)
src = gr.vector_source_f(src_data, False, len(src_data))
- st = gr.stretch_ff(-1.0/5.0, len(src_data))
+ st = blocks.stretch_ff(-1.0/5.0, len(src_data))
dst = gr.vector_sink_f(len(src_data))
self.tb.connect(src, st)
self.tb.connect(st, dst)
diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt
index ea7a24b244..0c78c8936f 100644
--- a/gr-wavelet/swig/CMakeLists.txt
+++ b/gr-wavelet/swig/CMakeLists.txt
@@ -25,6 +25,7 @@ include(GrSwig)
set(GR_SWIG_INCLUDE_DIRS
${GR_WAVELET_INCLUDE_DIRS}
+ ${GR_BLOCKS_INCLUDE_DIRS}
${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
diff --git a/gr-wxgui/python/fftsink_gl.py b/gr-wxgui/python/fftsink_gl.py
index e87b86ec2a..88a5968e2c 100644
--- a/gr-wxgui/python/fftsink_gl.py
+++ b/gr-wxgui/python/fftsink_gl.py
@@ -169,7 +169,7 @@ class test_app_block (stdgui2.std_top_block):
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=100e3,
@@ -183,7 +183,7 @@ class test_app_block (stdgui2.std_top_block):
#src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
src2 = analog.sig_source_f (input_rate, analog.GR_CONST_WAVE, 57.50e3, 1)
- thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ thr2 = blocks.throttle(gr.sizeof_float, input_rate)
sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2,
sample_rate=input_rate, baseband_freq=100e3,
ref_level=0, y_per_div=20, y_divs=10)
diff --git a/gr-wxgui/python/fftsink_nongl.py b/gr-wxgui/python/fftsink_nongl.py
index e9308fd354..d13b296d56 100644
--- a/gr-wxgui/python/fftsink_nongl.py
+++ b/gr-wxgui/python/fftsink_nongl.py
@@ -613,7 +613,7 @@ class test_app_block (stdgui2.std_top_block):
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=100e3,
@@ -624,7 +624,7 @@ class test_app_block (stdgui2.std_top_block):
#src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 100*2e3, 1)
src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 100*5.75e3, 1)
- thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ thr2 = blocks.throttle(gr.sizeof_float, input_rate)
sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2,
sample_rate=input_rate, baseband_freq=100e3,
ref_level=0, y_per_div=20, y_divs=10)
diff --git a/gr-wxgui/python/histosink_gl.py b/gr-wxgui/python/histosink_gl.py
index 8d90204046..6fa7539aa7 100644
--- a/gr-wxgui/python/histosink_gl.py
+++ b/gr-wxgui/python/histosink_gl.py
@@ -26,6 +26,7 @@ import histo_window
import common
from gnuradio import gr
from gnuradio import analog
+from gnuradio import blocks
from pubsub import pubsub
from constants import *
@@ -97,7 +98,7 @@ class test_app_block (stdgui2.std_top_block):
src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
#src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1)
- thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ thr2 = blocks.throttle(gr.sizeof_float, input_rate)
sink2 = histo_sink_f(panel, title="Data", num_bins=31, frame_size=1000)
vbox.Add(sink2.win, 1, wx.EXPAND)
diff --git a/gr-wxgui/python/numbersink2.py b/gr-wxgui/python/numbersink2.py
index 1619b09eb6..395bddbd61 100644
--- a/gr-wxgui/python/numbersink2.py
+++ b/gr-wxgui/python/numbersink2.py
@@ -149,8 +149,8 @@ class test_app_flow_graph(stdgui2.std_top_block):
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- thr1 = gr.throttle(gr.sizeof_float, input_rate)
- thr2 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ thr1 = blocks.throttle(gr.sizeof_float, input_rate)
+ thr2 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
sink1 = number_sink_f(panel, unit='V',label="Real Data", avg_alpha=0.001,
sample_rate=input_rate, minval=-1, maxval=1,
diff --git a/gr-wxgui/python/scopesink_gl.py b/gr-wxgui/python/scopesink_gl.py
index 647ea60983..7d6cd09ec9 100644
--- a/gr-wxgui/python/scopesink_gl.py
+++ b/gr-wxgui/python/scopesink_gl.py
@@ -216,7 +216,7 @@ class test_top_block (stdgui2.std_top_block):
# We add this throttle block so that this demo doesn't suck down
# all the CPU available. You normally wouldn't use it...
- self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate)
scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate,
v_scale=v_scale, t_scale=t_scale)
diff --git a/gr-wxgui/python/scopesink_nongl.py b/gr-wxgui/python/scopesink_nongl.py
index 6351daa723..5f44eeca74 100644
--- a/gr-wxgui/python/scopesink_nongl.py
+++ b/gr-wxgui/python/scopesink_nongl.py
@@ -22,6 +22,7 @@
from gnuradio import gr, gru, eng_notation
from gnuradio import analog
+from gnuradio import blocks
from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
@@ -631,7 +632,7 @@ class test_top_block(stdgui2.std_top_block):
# We add this throttle block so that this demo doesn't suck down
# all the CPU available. You normally wouldn't use it...
- self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate)
scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate,
frame_decim=frame_decim,
diff --git a/gr-wxgui/python/waterfallsink_gl.py b/gr-wxgui/python/waterfallsink_gl.py
index 17900a6e4f..dba50ce551 100644
--- a/gr-wxgui/python/waterfallsink_gl.py
+++ b/gr-wxgui/python/waterfallsink_gl.py
@@ -26,6 +26,7 @@ import waterfall_window
import common
from gnuradio import gr, fft
from gnuradio import analog
+from gnuradio import blocks
from gnuradio.fft import logpwrfft
from pubsub import pubsub
from constants import *
@@ -150,7 +151,7 @@ class test_top_block(stdgui2.std_top_block):
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=100e3)
@@ -159,7 +160,7 @@ class test_top_block(stdgui2.std_top_block):
# generate a real sinusoid
self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000)
- self.thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ self.thr2 = blocks.throttle(gr.sizeof_float, input_rate)
sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=100e3)
self.connect(self.src2, self.thr2, sink2)
diff --git a/gr-wxgui/python/waterfallsink_nongl.py b/gr-wxgui/python/waterfallsink_nongl.py
index 1ff44a88c6..df1534f993 100644
--- a/gr-wxgui/python/waterfallsink_nongl.py
+++ b/gr-wxgui/python/waterfallsink_nongl.py
@@ -407,7 +407,7 @@ class test_top_block (stdgui2.std_top_block):
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=100e3)
@@ -416,7 +416,7 @@ class test_top_block (stdgui2.std_top_block):
# generate a real sinusoid
self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000)
- self.thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ self.thr2 = blocks.throttle(gr.sizeof_float, input_rate)
sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=100e3)
self.connect(self.src2, self.thr2, sink2)
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index d9b5eb80d8..4567a65781 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -39,14 +39,11 @@
<block>gr_message_strobe</block>
<block>gr_pdu_to_tagged_stream</block>
<block>gr_tagged_stream_to_pdu</block>
- <block>gr_tuntap_pdu</block>
<block>gr_socket_pdu</block>
<block>gr_random_pdu</block>
</cat>
<cat>
<name>Operators</name>
- <block>gr_transcendental</block>
-
<block>gr_max_xx</block>
<block>gr_argmax_xx</block>
@@ -71,11 +68,6 @@
<block>gr_burst_tagger</block>
</cat>
<cat>
- <name>Misc Conversions</name>
- <block>gr_unpack_k_bits_bb</block>
- <block>gr_pack_k_bits_bb</block>
- </cat>
- <cat>
<name>Synchronizers</name>
<block>gr_mpsk_sync_cc</block>
@@ -86,11 +78,9 @@
<cat>
<name>Level Controls</name>
<block>gr_peak_detector_xb</block>
- <block>gr_peak_detector2_fb</block>
<block>gr_sample_and_hold_xx</block>
<block>gr_mute_xx</block>
- <block>gr_threshold_ff</block>
</cat>
<cat>
<name>Filters</name>
@@ -123,8 +113,6 @@
<block>note</block>
<block>import</block>
- <block>gr_throttle</block>
-
<block>blks2_selector</block>
<block>blks2_valve</block>
<block>blks2_error_rate</block>
diff --git a/grc/blocks/gr_tuntap_pdu.xml b/grc/blocks/gr_tuntap_pdu.xml
deleted file mode 100644
index f169345afa..0000000000
--- a/grc/blocks/gr_tuntap_pdu.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Tuntap PDU Message source/sink
-###################################################
- -->
-<block>
- <name>TunTap PDU</name>
- <key>gr_tuntap_pdu</key>
- <import>from gnuradio import gr</import>
- <make>gr.tuntap_pdu($ifn, $mtu)</make>
- <param>
- <name>Interface Name</name>
- <key>ifn</key>
- <value>tun0</value>
- <type>string</type>
- </param>
- <param>
- <name>MTU</name>
- <key>mtu</key>
- <value>10000</value>
- <type>int</type>
- </param>
- <sink>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/grc/examples/simple/variable_config.grc b/grc/examples/simple/variable_config.grc
index fc0d2fea6b..0b50b1e5bb 100644
--- a/grc/examples/simple/variable_config.grc
+++ b/grc/examples/simple/variable_config.grc
@@ -273,10 +273,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -347,14 +347,14 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>wxgui_fftsink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/grc/examples/xmlrpc/xmlrpc_server.grc b/grc/examples/xmlrpc/xmlrpc_server.grc
index ea70ded720..7497117f28 100644
--- a/grc/examples/xmlrpc/xmlrpc_server.grc
+++ b/grc/examples/xmlrpc/xmlrpc_server.grc
@@ -346,10 +346,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle</value>
+ <value>blocks_throttle</value>
</param>
<param>
<key>_enabled</key>
@@ -420,20 +420,20 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle</source_block_id>
+ <source_block_id>blocks_throttle</source_block_id>
<sink_block_id>wxgui_scopesink2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle</source_block_id>
+ <source_block_id>blocks_throttle</source_block_id>
<sink_block_id>wxgui_fftsink2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle</sink_block_id>
+ <sink_block_id>blocks_throttle</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/volk/CMakeLists.txt b/volk/CMakeLists.txt
index 506c828c17..a04c2adefd 100644
--- a/volk/CMakeLists.txt
+++ b/volk/CMakeLists.txt
@@ -141,6 +141,7 @@ add_subdirectory(lib)
# And the utility apps
########################################################################
add_subdirectory(apps)
+add_subdirectory(python/volk_modtool)
########################################################################
# Print summary
diff --git a/volk/cmake/CMakeParseArgumentsCopy.cmake b/volk/cmake/CMakeParseArgumentsCopy.cmake
new file mode 100644
index 0000000000..7ce4c49ae5
--- /dev/null
+++ b/volk/cmake/CMakeParseArgumentsCopy.cmake
@@ -0,0 +1,138 @@
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
+# parsing the arguments given to that macro or function.
+# It processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e. keywords which can be used when calling the macro without any value
+# following, like e.g. the OPTIONAL keyword of the install() command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g. DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this macro
+# which can be followed by more than one value, like e.g. the TARGETS or
+# FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.
+# These variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
+# your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments as the
+# real install() command:
+#
+# function(MY_INSTALL)
+# set(options OPTIONAL FAST)
+# set(oneValueArgs DESTINATION RENAME)
+# set(multiValueArgs TARGETS CONFIGURATIONS)
+# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+# ...
+#
+# Assume my_install() has been called like this:
+# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+# After the cmake_parse_arguments() call the macro will have set the following
+# variables:
+# MY_INSTALL_OPTIONAL = TRUE
+# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+# MY_INSTALL_DESTINATION = "bin"
+# MY_INSTALL_RENAME = "" (was not used)
+# MY_INSTALL_TARGETS = "foo;bar"
+# MY_INSTALL_CONFIGURATIONS = "" (was not used)
+# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+# You can the continue and process these variables.
+#
+# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
+# another recognized keyword follows, this is interpreted as the beginning of
+# the new option.
+# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
+# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+ # first set all result variables to empty/FALSE
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+ set(${prefix}_${arg_name})
+ endforeach(arg_name)
+
+ foreach(option ${_optionNames})
+ set(${prefix}_${option} FALSE)
+ endforeach(option)
+
+ set(${prefix}_UNPARSED_ARGUMENTS)
+
+ set(insideValues FALSE)
+ set(currentArgName)
+
+ # now iterate over all arguments and fill the result variables
+ foreach(currentArg ${ARGN})
+ list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+
+ if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
+ if(insideValues)
+ if("${insideValues}" STREQUAL "SINGLE")
+ set(${prefix}_${currentArgName} ${currentArg})
+ set(insideValues FALSE)
+ elseif("${insideValues}" STREQUAL "MULTI")
+ list(APPEND ${prefix}_${currentArgName} ${currentArg})
+ endif()
+ else(insideValues)
+ list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+ endif(insideValues)
+ else()
+ if(NOT ${optionIndex} EQUAL -1)
+ set(${prefix}_${currentArg} TRUE)
+ set(insideValues FALSE)
+ elseif(NOT ${singleArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "SINGLE")
+ elseif(NOT ${multiArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "MULTI")
+ endif()
+ endif()
+
+ endforeach(currentArg)
+
+ # propagate the result variables to the caller:
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+ set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
+ endforeach(arg_name)
+ set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
diff --git a/volk/python/volk_modtool/CMakeLists.txt b/volk/python/volk_modtool/CMakeLists.txt
new file mode 100644
index 0000000000..6fb87f2668
--- /dev/null
+++ b/volk/python/volk_modtool/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# Install python files and apps
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ cfg.py
+ volk_modtool_generate.py
+ DESTINATION ${GR_PYTHON_DIR}/volk_modtool
+ COMPONENT "volk"
+)
+
+GR_PYTHON_INSTALL(
+ PROGRAMS
+ volk_modtool
+ DESTINATION ${GR_RUNTIME_DIR}
+ COMPONENT "volk"
+)
diff --git a/volk/python/volk_modtool/README b/volk/python/volk_modtool/README
new file mode 100644
index 0000000000..2532e1a86a
--- /dev/null
+++ b/volk/python/volk_modtool/README
@@ -0,0 +1,110 @@
+The volk_modtool tool is installed along with VOLK as a way of helping
+to construct, add to, and interogate the VOLK library or companion
+libraries.
+
+volk_modtool is installed into $prefix/bin.
+
+VOLK modtool enables creating standalone (out-of-tree) VOLK modules
+and provides a few tools for sharing VOLK kernels between VOLK
+modules. If you need to design or work with VOLK kernels away from
+the canonical VOLK library, this is the tool. If you need to tailor
+your own VOLK library for whatever reason, this is the tool.
+
+The canonical VOLK library installs a volk.h and a libvolk.so. Your
+own library will install volk_$name.h and libvolk_$name.so. Ya Gronk?
+Good.
+
+There isn't a substantial difference between the canonical VOLK
+module and any other VOLK module. They're all peers. Any module
+created via VOLK modtool will come complete with a default
+volk_modtool.cfg file associating the module with the base from which
+it came, its distinctive $name and its destination (or path). These
+values (created from user input if VOLK modtool runs without a
+user-supplied config file or a default config file) serve as default
+values for some VOLK modtool actions. It's more or less intended for
+the user to change directories to the top level of a created VOLK
+module and then run volk_modtool to take advantage of the values
+stored in the default volk_modtool.cfg file.
+
+Apart from creating new VOLK modules, VOLK modtool allows you to list
+the names of kernels in other modules, list the names of kernels in
+the current module, add kernels from another module into the current
+module, and remove kernels from the current module. When moving
+kernels between modules, VOLK modtool does its best to keep the qa
+and profiling code for those kernels intact. If the base has a test
+or a profiling call for some kernel, those calls will follow the
+kernel when VOLK modtool adds that kernel. If QA or profiling
+requires a puppet kernel, the puppet kernel will follow the original
+kernel when VOLK modtool adds that original kernel. VOLK modtool
+respects puppets.
+
+======================================================================
+
+Installing a new VOLK Library:
+
+Run the command "volk_modtool -i". This will ask you three questions:
+
+ name: // the name to give your VOLK library: volk_<name>
+ destination: // directory new source tree is built under -- must exists.
+ // It will create <directory>/volk_<name>
+ base: // the directory containing the original VOLK source code
+
+This will build a new skeleton directory in the destination provided
+with the name volk_<name>. It will contain the necessary structure to
+build:
+
+ mkdir build
+ cd build
+ cmake -DCMAKE_INSTALL_PREFIX=/opt/volk ../
+ make
+ sudo make install
+
+Right now, the library is empty and contains no kernels. Kernels can
+be added from another VOLK library using the '-a' option. If not
+specified, the kernel will be extracted from the base VOLK
+directory. Using the '-b' allows us to specify another VOLK library to
+use for this purpose.
+
+ volk_modtool -a -n 32fc_x2_conjugate_dot_prod_32fc
+
+This will put the code for the new kernel into
+<destination>/volk_<name>/kernels/volk_<name>/
+
+Other kernels must be added by hand. See the following webpages for
+more information about creating VOLK kernels:
+ http://gnuradio.org/doc/doxygen/volk_guide.html
+ http://gnuradio.org/redmine/projects/gnuradio/wiki/Volk
+
+
+======================================================================
+
+OPTIONS
+
+Options for Adding and Removing Kernels:
+ -a, --add_kernel
+ Add kernel from existing VOLK module. Uses the base VOLK module
+ unless -b is used. Use -n to specify the kernel name.
+ Requires: -n.
+ Optional: -b
+
+ -A, --add_all_kernels
+ Add all kernels from existing VOLK module. Uses the base VOLK
+ module unless -b is used.
+ Optional: -b
+
+ -x, --remove_kernel
+ Remove kernel from module.
+ Required: -n.
+ Optional: -b
+
+Options for Listing Kernels:
+ -l, --list
+ Lists all kernels available in the base VOLK module.
+
+ -k, --kernels
+ Lists all kernels in this VOLK module.
+
+ -r, --remote-list
+ Lists all kernels in another VOLK module that is specified
+ using the -b option.
+
diff --git a/volk/python/volk_modtool/__init__.py b/volk/python/volk_modtool/__init__.py
new file mode 100644
index 0000000000..6ddf48da05
--- /dev/null
+++ b/volk/python/volk_modtool/__init__.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from cfg import volk_modtool_config
+from volk_modtool_generate import volk_modtool
diff --git a/volk/python/volk_modtool/cfg.py b/volk/python/volk_modtool/cfg.py
new file mode 100644
index 0000000000..c5cfb919c0
--- /dev/null
+++ b/volk/python/volk_modtool/cfg.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+import ConfigParser
+import sys
+import os
+import exceptions
+import re
+
+
+class volk_modtool_config:
+ def verify(self):
+ for i in self.verification:
+ self.verify_section(i)
+
+ def verify_section(self, section):
+ stuff = self.cfg.items(section[0])
+ for i in range(len(section[1])):
+ if not eval(re.sub('\$' + str(i), stuff[i][1], section[1][i])):
+ raise exceptions.IOError('bad configuration... key:%s, val:%s'%(stuff[i][0], stuff[i][1]))
+
+ def __init__(self, cfg=None):
+ self.config_name = 'config'
+ self.config_defaults = ['name', 'destination', 'base']
+ self.config_defaults_verify = ['re.match(\'[a-zA-Z0-9]+$\', \'$0\')',
+ 'os.path.exists(\'$1\')', 'os.path.exists(\'$2\')']
+ self.verification = [(self.config_name, self.config_defaults_verify)]
+ default = os.path.join(os.getcwd(), 'volk_modtool.cfg')
+ icfg = ConfigParser.RawConfigParser()
+ if cfg:
+ icfg.read(cfg)
+ elif os.path.exists(default):
+ icfg.read(default)
+ else:
+ print "Initializing config file..."
+ icfg.add_section(self.config_name)
+ for kn in self.config_defaults:
+ rv = raw_input("%s: "%(kn))
+ icfg.set(self.config_name, kn, rv)
+ self.cfg = icfg
+ self.verify()
+
+
+ def read_map(self, name, inp):
+ if self.cfg.has_section(name):
+ self.cfg.remove_section(name)
+ self.cfg.add_section(name)
+ for i in inp:
+ self.cfg.set(name, i, inp[i])
+
+ def get_map(self, name):
+ retval = {}
+ stuff = self.cfg.items(name)
+ for i in stuff:
+ retval[i[0]] = i[1]
+ return retval
+
+
+
+
+
+
+
diff --git a/volk/python/volk_modtool/volk_modtool b/volk/python/volk_modtool/volk_modtool
new file mode 100755
index 0000000000..fbacc7139b
--- /dev/null
+++ b/volk/python/volk_modtool/volk_modtool
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from volk_modtool import volk_modtool, volk_modtool_config
+from optparse import OptionParser, OptionGroup
+
+import exceptions
+import os
+
+if __name__ == '__main__':
+ parser = OptionParser();
+ actions = OptionGroup(parser, 'Actions');
+ actions.add_option('-i', '--install', action='store_true',
+ help='Create a new volk module.')
+ parser.add_option('-b', '--base_path', action='store', default=None,
+ help='Base path for action. By default, volk_modtool.cfg loads this value.')
+ parser.add_option('-n', '--kernel_name', action='store', default=None,
+ help='Kernel name for action. No default')
+ parser.add_option('-c', '--config', action='store', dest='config_file', default=None,
+ help='Config file for volk_modtool. By default, volk_modtool.cfg in the local directory will be used/created.')
+ actions.add_option('-a', '--add_kernel', action='store_true',
+ help='Add kernel from existing volk module. Requires: -n. Optional: -b')
+ actions.add_option('-A', '--add_all_kernels', action='store_true',
+ help='Add all kernels from existing volk module. Optional: -b')
+ actions.add_option('-x', '--remove_kernel', action='store_true',
+ help='Remove kernel from module. Required: -n. Optional: -b')
+ actions.add_option('-l', '--list', action='store_true',
+ help='List all kernels in the base.')
+ actions.add_option('-k', '--kernels', action='store_true',
+ help='List all kernels in the module.')
+ actions.add_option('-r', '--remote_list', action='store_true',
+ help='List all available kernels in remote volk module. Requires: -b.')
+ actions.add_option('-m', '--moo', action='store_true',
+ help='Have you mooed today?')
+ parser.add_option_group(actions)
+
+ (options, args) = parser.parse_args();
+
+ if options.moo:
+ print " (__) "
+ print " (oo) "
+ print " /------\/ "
+ print " / | || "
+ print " * /\---/\ "
+ print " ~~ ~~ "
+
+ else:
+ my_cfg = volk_modtool_config(options.config_file);
+
+ my_modtool = volk_modtool(my_cfg.get_map(my_cfg.config_name));
+
+
+ if options.install:
+ my_modtool.make_module_skeleton();
+ my_modtool.write_default_cfg(my_cfg.cfg);
+
+
+ if options.add_kernel:
+ if not options.kernel_name:
+ raise exceptions.IOError("This action requires the -n option.");
+ else:
+ name = options.kernel_name;
+ if options.base_path:
+ base = options.base_path;
+ else:
+ base = my_cfg.cfg.get(my_cfg.config_name, 'base');
+ my_modtool.import_kernel(name, base);
+
+ if options.remove_kernel:
+ if not options.kernel_name:
+ raise exceptions.IOError("This action requires the -n option.");
+ else:
+ name = options.kernel_name;
+ my_modtool.remove_kernel(name);
+
+ if options.add_all_kernels:
+
+ if options.base_path:
+ base = options.base_path;
+ else:
+ base = my_cfg.cfg.get(my_cfg.config_name, 'base');
+ kernelset = my_modtool.get_current_kernels(base);
+ for i in kernelset:
+ my_modtool.import_kernel(i, base);
+
+ if options.remote_list:
+ if not options.base_path:
+ raise exceptions.IOError("This action requires the -b option. Try -l or -k for listing kernels in the base or the module.")
+ else:
+ base = options.base_path;
+ kernelset = my_modtool.get_current_kernels(base);
+ for i in kernelset:
+ print i;
+
+ if options.list:
+ kernelset = my_modtool.get_current_kernels();
+ for i in kernelset:
+ print i;
+
+ if options.kernels:
+ dest = my_cfg.cfg.get(my_cfg.config_name, 'destination');
+ name = my_cfg.cfg.get(my_cfg.config_name, 'name');
+ base = os.path.join(dest, 'volk_' + name);
+ kernelset = my_modtool.get_current_kernels(base);
+ for i in kernelset:
+ print i;
+
+
diff --git a/volk/python/volk_modtool/volk_modtool_generate.py b/volk/python/volk_modtool/volk_modtool_generate.py
new file mode 100644
index 0000000000..2e10e7b00c
--- /dev/null
+++ b/volk/python/volk_modtool/volk_modtool_generate.py
@@ -0,0 +1,310 @@
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+import os
+import sys
+import re
+import glob
+import shutil
+import exceptions
+from sets import Set
+
+class volk_modtool:
+ def __init__(self, cfg):
+ self.volk = re.compile('volk');
+ self.remove_after_underscore = re.compile("_.*");
+ self.volk_run_tests = re.compile('^\s*VOLK_RUN_TESTS.*\n', re.MULTILINE);
+ self.volk_profile = re.compile('^\s*(VOLK_PROFILE|VOLK_PUPPET_PROFILE).*\n', re.MULTILINE);
+ self.my_dict = cfg;
+ self.lastline = re.compile('\s*char path\[1024\];.*');
+ self.badassert = re.compile('^\s*assert\(toked\[0\] == "volk_.*\n', re.MULTILINE);
+ self.goodassert = ' assert(toked[0] == "volk");\n'
+ self.baderase = re.compile('^\s*toked.erase\(toked.begin\(\)\);.*\n', re.MULTILINE);
+ self.gooderase = ' toked.erase(toked.begin());\n toked.erase(toked.begin());\n';
+
+ def get_basename(self, base=None):
+ if not base:
+ base = self.my_dict['base']
+ candidate = base.split('/')[-1];
+ if len(candidate.split('_')) == 1:
+ return '';
+ else:
+ return candidate.split('_')[-1];
+
+ def get_current_kernels(self, base=None):
+ if not base:
+ base = self.my_dict['base']
+ name = self.get_basename();
+ else:
+ name = self.get_basename(base);
+ if name == '':
+ hdr_files = glob.glob(os.path.join(base, "kernels/volk/*.h"));
+ begins = re.compile("(?<=volk_).*")
+ else:
+ hdr_files = glob.glob(os.path.join(base, "kernels/volk_" + name + "/*.h"));
+ begins = re.compile("(?<=volk_" + name + "_).*")
+
+ datatypes = [];
+ functions = [];
+
+
+ for line in hdr_files:
+
+ subline = re.search(".*\.h.*", os.path.basename(line))
+ if subline:
+ subsubline = begins.search(subline.group(0));
+ if subsubline:
+ dtype = self.remove_after_underscore.sub("", subsubline.group(0));
+ subdtype = re.search("[0-9]+[A-z]+", dtype);
+ if subdtype:
+ datatypes.append(subdtype.group(0));
+
+
+ datatypes = set(datatypes);
+
+ for line in hdr_files:
+ for dt in datatypes:
+ if dt in line:
+ #subline = re.search("(?<=volk_)" + dt + ".*(?=\.h)", line);
+ subline = re.search(begins.pattern[:-2] + dt + ".*(?=\.h)", line);
+ if subline:
+ functions.append(subline.group(0));
+
+ return set(functions);
+
+ def make_module_skeleton(self):
+
+ dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'])
+ if os.path.exists(dest):
+ shutil.rmtree(dest)
+
+ if not os.path.exists(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'kernels/volk_' + self.my_dict['name'])):
+ os.makedirs(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'kernels/volk_' + self.my_dict['name']))
+
+ current_kernel_names = self.get_current_kernels();
+
+ for root, dirnames, filenames in os.walk(self.my_dict['base']):
+ for name in filenames:
+ t_table = map(lambda a: re.search(a, name), current_kernel_names);
+ t_table = set(t_table);
+ if t_table == set([None]):
+ infile = os.path.join(root, name);
+ instring = open(infile, 'r').read();
+ outstring = re.sub(self.volk, 'volk_' + self.my_dict['name'], instring);
+ newname = re.sub(self.volk, 'volk_' + self.my_dict['name'], name);
+ relpath = os.path.relpath(infile, self.my_dict['base']);
+ newrelpath = re.sub(self.volk, 'volk_' + self.my_dict['name'], relpath);
+ dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], os.path.dirname(newrelpath), newname);
+
+ if not os.path.exists(os.path.dirname(dest)):
+ os.makedirs(os.path.dirname(dest))
+ open(dest, 'w+').write(outstring);
+
+
+ infile = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc');
+ instring = open(infile, 'r').read();
+ outstring = re.sub(self.volk_run_tests, '', instring);
+ open(infile, 'w+').write(outstring);
+
+ infile = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'apps/volk_' + self.my_dict['name'] + '_profile.cc');
+ instring = open(infile, 'r').read();
+ outstring = re.sub(self.volk_profile, '', instring);
+ open(infile, 'w+').write(outstring);
+
+ infile = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/qa_utils.cc');
+ instring = open(infile, 'r').read();
+ outstring = re.sub(self.badassert, self.goodassert, instring);
+ outstring = re.sub(self.baderase, self.gooderase, outstring);
+ open(infile, 'w+').write(outstring);
+
+ def write_default_cfg(self, cfg):
+ outfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'volk_modtool.cfg'), 'wb');
+ cfg.write(outfile);
+ outfile.close();
+
+
+ def convert_kernel(self, oldvolk, name, base, inpath, top):
+ infile = os.path.join(inpath, 'kernels/' + top[:-1] + '/' + top + name + '.h');
+ instring = open(infile, 'r').read();
+ outstring = re.sub(oldvolk, 'volk_' + self.my_dict['name'], instring);
+ newname = 'volk_' + self.my_dict['name'] + '_' + name + '.h';
+ relpath = os.path.relpath(infile, base);
+ newrelpath = re.sub(oldvolk, 'volk_' + self.my_dict['name'], relpath);
+ dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], os.path.dirname(newrelpath), newname);
+
+
+
+ if not os.path.exists(os.path.dirname(dest)):
+ os.makedirs(os.path.dirname(dest))
+ open(dest, 'w+').write(outstring);
+
+ def remove_kernel(self, name):
+ basename = self.my_dict['name'];
+ if len(basename) > 0:
+ top = 'volk_' + basename + '_';
+ else:
+ top = 'volk_'
+ base = os.path.join(self.my_dict['destination'], top[:-1]) ;
+
+ if not name in self.get_current_kernels():
+
+ raise exceptions.IOError("Requested kernel %s is not in module %s"%(name,base));
+
+
+
+ inpath = os.path.abspath(base);
+
+
+ kernel = re.compile(name)
+ search_kernels = Set([kernel])
+ profile = re.compile('^\s*VOLK_PROFILE')
+ puppet = re.compile('^\s*VOLK_PUPPET')
+ src_dest = os.path.join(inpath, 'apps/', top[:-1] + '_profile.cc');
+ infile = open(src_dest);
+ otherlines = infile.readlines();
+ open(src_dest, 'w+').write('');
+
+ for otherline in otherlines:
+ write_okay = True;
+ if kernel.search(otherline):
+ write_okay = False;
+ if puppet.match(otherline):
+ args = re.search("(?<=VOLK_PUPPET_PROFILE).*", otherline)
+ m_func = args.group(0).split(',')[0];
+ func = re.search('(?<=' + top + ').*', m_func);
+ search_kernels.add(re.compile(func.group(0)));
+ if write_okay:
+ open(src_dest, 'a').write(otherline);
+
+
+ src_dest = os.path.join(inpath, 'lib/testqa.cc')
+ infile = open(src_dest);
+ otherlines = infile.readlines();
+ open(src_dest, 'w+').write('');
+
+ for otherline in otherlines:
+ write_okay = True;
+
+ for kernel in search_kernels:
+ if kernel.search(otherline):
+ write_okay = False;
+
+ if write_okay:
+ open(src_dest, 'a').write(otherline);
+
+ for kernel in search_kernels:
+ infile = os.path.join(inpath, 'kernels/' + top[:-1] + '/' + top + kernel.pattern + '.h');
+ print "Removing kernel %s"%(kernel.pattern)
+ if os.path.exists(infile):
+ os.remove(infile);
+
+ def import_kernel(self, name, base):
+ if not (base):
+ base = self.my_dict['base'];
+ basename = self.getbasename();
+ else:
+ basename = self.get_basename(base);
+ if not name in self.get_current_kernels(base):
+ raise exceptions.IOError("Requested kernel %s is not in module %s"%(name,base));
+
+ inpath = os.path.abspath(base);
+ if len(basename) > 0:
+ top = 'volk_' + basename + '_';
+ else:
+ top = 'volk_'
+ oldvolk = re.compile(top[:-1]);
+
+ self.convert_kernel(oldvolk, name, base, inpath, top);
+
+ kernel = re.compile(name)
+ search_kernels = Set([kernel])
+
+ profile = re.compile('^\s*VOLK_PROFILE')
+ puppet = re.compile('^\s*VOLK_PUPPET')
+ infile = open(os.path.join(inpath, 'apps/', oldvolk.pattern + '_profile.cc'));
+ otherinfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'apps/volk_' + self.my_dict['name'] + '_profile.cc'));
+ dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'apps/volk_' + self.my_dict['name'] + '_profile.cc');
+ lines = infile.readlines();
+ otherlines = otherinfile.readlines();
+ open(dest, 'w+').write('');
+ insert = False;
+ inserted = False
+ for otherline in otherlines:
+
+ if self.lastline.match(otherline):
+ insert = True;
+ if insert and not inserted:
+ inserted = True;
+ for line in lines:
+ if kernel.search(line):
+ if profile.match(line):
+ outline = re.sub(oldvolk, 'volk_' + self.my_dict['name'], line);
+ open(dest, 'a').write(outline);
+ elif puppet.match(line):
+ outline = re.sub(oldvolk, 'volk_' + self.my_dict['name'], line);
+ open(dest, 'a').write(outline);
+ args = re.search("(?<=VOLK_PUPPET_PROFILE).*", line)
+ m_func = args.group(0).split(',')[0];
+ func = re.search('(?<=' + top + ').*', m_func);
+ search_kernels.add(re.compile(func.group(0)));
+ self.convert_kernel(oldvolk, func.group(0), base, inpath, top);
+ write_okay = True;
+ for kernel in search_kernels:
+ if kernel.search(otherline):
+ write_okay = False
+ if write_okay:
+ open(dest, 'a').write(otherline);
+
+ for kernel in search_kernels:
+ print "Adding kernel %s from module %s"%(kernel.pattern,base)
+
+ infile = open(os.path.join(inpath, 'lib/testqa.cc'));
+ otherinfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc'));
+ dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc');
+ lines = infile.readlines();
+ otherlines = otherinfile.readlines();
+ open(dest, 'w+').write('');
+ inserted = False;
+ insert = False
+ for otherline in otherlines:
+
+ if (re.match('\s*', otherline) == None or re.match('\s*#.*', otherline) == None):
+
+ insert = True;
+ if insert and not inserted:
+ inserted = True;
+ for line in lines:
+ for kernel in search_kernels:
+ if kernel.search(line):
+ if self.volk_run_tests.match(line):
+ outline = re.sub(oldvolk, 'volk_' + self.my_dict['name'], line);
+ open(dest, 'a').write(outline);
+ write_okay = True;
+ for kernel in search_kernels:
+ if kernel.search(otherline):
+ write_okay = False
+ if write_okay:
+ open(dest, 'a').write(otherline);
+
+
+
+
+