summaryrefslogtreecommitdiff
path: root/gr-blocks
diff options
context:
space:
mode:
authorBen Reynwar <ben@reynwar.net>2013-04-02 23:04:08 -0700
committerBen Reynwar <ben@reynwar.net>2013-04-02 23:04:08 -0700
commitc6dbde23b256a41b3d92cb4ad6b63287095d53c7 (patch)
tree71db12ea2e1667770c22568dcdf5e0857d5f1e59 /gr-blocks
parent22b70d0889ef3c51e27a31ee18d153093a55cbb8 (diff)
parent98758cbfa9a2aff714952d19e773bc370dfa2185 (diff)
Merged next into uninstalled import branch.
Diffstat (limited to 'gr-blocks')
-rw-r--r--gr-blocks/CMakeLists.txt6
-rw-r--r--gr-blocks/examples/CMakeLists.txt4
-rw-r--r--gr-blocks/examples/ctrlport/CMakeLists.txt25
-rw-r--r--gr-blocks/examples/ctrlport/comparing_resamplers.grc390
-rw-r--r--gr-blocks/examples/ctrlport/pfb_sync_test-qt.grc854
-rw-r--r--gr-blocks/examples/ctrlport/pfb_sync_test.grc668
-rw-r--r--gr-blocks/examples/metadata/file_metadata_sink.grc204
-rw-r--r--gr-blocks/examples/metadata/file_metadata_source.grc6
-rw-r--r--gr-blocks/examples/metadata/file_metadata_vector_sink.grc14
-rw-r--r--gr-blocks/examples/metadata/file_metadata_vector_source.grc6
-rw-r--r--gr-blocks/examples/msg_passing/strobe.grc176
-rwxr-xr-xgr-blocks/examples/tags/test_file_tags.py12
-rw-r--r--gr-blocks/gnuradio-blocks.pc.in2
-rw-r--r--gr-blocks/grc/CMakeLists.txt13
-rw-r--r--gr-blocks/grc/blocks_block_tree.xml22
-rw-r--r--gr-blocks/grc/blocks_complex_to_real.xml8
-rw-r--r--gr-blocks/grc/blocks_copy.xml75
-rw-r--r--gr-blocks/grc/blocks_ctrlport_performance.xml50
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe2_c.xml66
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe_c.xml56
-rw-r--r--gr-blocks/grc/blocks_ctrlport_viewer.xml50
-rw-r--r--gr-blocks/grc/blocks_deinterleave.xml10
-rw-r--r--gr-blocks/grc/blocks_endian_swap.xml41
-rw-r--r--gr-blocks/grc/blocks_file_descriptor_sink.xml59
-rw-r--r--gr-blocks/grc/blocks_file_descriptor_source.xml73
-rw-r--r--gr-blocks/grc/blocks_file_sink.xml78
-rw-r--r--gr-blocks/grc/blocks_head.xml65
-rw-r--r--gr-blocks/grc/blocks_message_strobe.xml2
-rw-r--r--gr-blocks/grc/blocks_nop.xml68
-rw-r--r--gr-blocks/grc/blocks_null_sink.xml54
-rw-r--r--gr-blocks/grc/blocks_null_source.xml54
-rw-r--r--gr-blocks/grc/blocks_plateau_detector_fb.xml26
-rw-r--r--gr-blocks/grc/blocks_probe_rate.xml66
-rw-r--r--gr-blocks/grc/blocks_probe_signal_vx.xml2
-rw-r--r--gr-blocks/grc/blocks_random_pdu.xml2
-rw-r--r--gr-blocks/grc/blocks_repack_bits_bb.xml46
-rw-r--r--gr-blocks/grc/blocks_skiphead.xml65
-rw-r--r--gr-blocks/grc/blocks_tagged_file_sink.xml60
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_mux.xml65
-rw-r--r--gr-blocks/grc/blocks_udp_sink.xml77
-rw-r--r--gr-blocks/grc/blocks_udp_source.xml79
-rw-r--r--gr-blocks/grc/blocks_vco_f.xml35
-rw-r--r--gr-blocks/grc/blocks_vector_insert_x.xml80
-rw-r--r--gr-blocks/grc/blocks_vector_sink_x.xml54
-rw-r--r--gr-blocks/grc/blocks_vector_source_x.xml85
-rw-r--r--gr-blocks/grc/blocks_wavfile_sink.xml43
-rw-r--r--gr-blocks/grc/blocks_wavfile_source.xml44
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt50
-rw-r--r--gr-blocks/include/blocks/annotator_1to1.h60
-rw-r--r--gr-blocks/include/blocks/annotator_alltoall.h61
-rw-r--r--gr-blocks/include/blocks/annotator_raw.h57
-rw-r--r--gr-blocks/include/blocks/api.h2
-rw-r--r--gr-blocks/include/blocks/check_lfsr_32k_s.h56
-rw-r--r--gr-blocks/include/blocks/control_loop.h234
-rw-r--r--gr-blocks/include/blocks/copy.h54
-rw-r--r--gr-blocks/include/blocks/ctrlport_probe2_c.h64
-rw-r--r--gr-blocks/include/blocks/ctrlport_probe_c.h62
-rw-r--r--gr-blocks/include/blocks/endian_swap.h50
-rw-r--r--gr-blocks/include/blocks/file_descriptor_sink.h54
-rw-r--r--gr-blocks/include/blocks/file_descriptor_source.h61
-rw-r--r--gr-blocks/include/blocks/file_sink.h55
-rw-r--r--gr-blocks/include/blocks/file_sink_base.h80
-rw-r--r--gr-blocks/include/blocks/head.h55
-rw-r--r--gr-blocks/include/blocks/lfsr_15_1_0.h69
-rw-r--r--gr-blocks/include/blocks/lfsr_32k.h90
-rw-r--r--gr-blocks/include/blocks/lfsr_32k_source_s.h55
-rw-r--r--gr-blocks/include/blocks/message_sink.h5
-rw-r--r--gr-blocks/include/blocks/message_source.h2
-rw-r--r--gr-blocks/include/blocks/mute_XX.h.t4
-rw-r--r--gr-blocks/include/blocks/nop.h59
-rw-r--r--gr-blocks/include/blocks/null_sink.h55
-rw-r--r--gr-blocks/include/blocks/null_source.h53
-rw-r--r--gr-blocks/include/blocks/pdu.h4
-rw-r--r--gr-blocks/include/blocks/peak_detector_XX.h.t2
-rw-r--r--gr-blocks/include/blocks/plateau_detector_fb.h71
-rw-r--r--gr-blocks/include/blocks/probe_rate.h60
-rw-r--r--gr-blocks/include/blocks/repack_bits_bb.h65
-rw-r--r--gr-blocks/include/blocks/rotator.h63
-rw-r--r--gr-blocks/include/blocks/skiphead.h53
-rw-r--r--gr-blocks/include/blocks/tagged_file_sink.h65
-rw-r--r--gr-blocks/include/blocks/tagged_stream_mux.h61
-rw-r--r--gr-blocks/include/blocks/udp_sink.h81
-rw-r--r--gr-blocks/include/blocks/udp_source.h84
-rw-r--r--gr-blocks/include/blocks/vco_f.h57
-rw-r--r--gr-blocks/include/blocks/vector_insert_X.h.t54
-rw-r--r--gr-blocks/include/blocks/vector_map.h71
-rw-r--r--gr-blocks/include/blocks/vector_sink_X.h.t54
-rw-r--r--gr-blocks/include/blocks/vector_source_X.h.t56
-rw-r--r--gr-blocks/include/blocks/wavfile.h101
-rw-r--r--gr-blocks/include/blocks/wavfile_sink.h87
-rw-r--r--gr-blocks/include/blocks/wavfile_source.h70
-rw-r--r--gr-blocks/lib/CMakeLists.txt89
-rw-r--r--gr-blocks/lib/annotator_1to1_impl.cc113
-rw-r--r--gr-blocks/lib/annotator_1to1_impl.h56
-rw-r--r--gr-blocks/lib/annotator_alltoall_impl.cc117
-rw-r--r--gr-blocks/lib/annotator_alltoall_impl.h56
-rw-r--r--gr-blocks/lib/annotator_raw_impl.cc113
-rw-r--r--gr-blocks/lib/annotator_raw_impl.h54
-rw-r--r--gr-blocks/lib/check_lfsr_32k_s_impl.cc179
-rw-r--r--gr-blocks/lib/check_lfsr_32k_s_impl.h94
-rw-r--r--gr-blocks/lib/control_loop.cc214
-rw-r--r--gr-blocks/lib/copy_impl.cc91
-rw-r--r--gr-blocks/lib/copy_impl.h56
-rw-r--r--gr-blocks/lib/ctrlport_probe2_c_impl.cc163
-rw-r--r--gr-blocks/lib/ctrlport_probe2_c_impl.h67
-rw-r--r--gr-blocks/lib/ctrlport_probe_c_impl.cc101
-rw-r--r--gr-blocks/lib/ctrlport_probe_c_impl.h60
-rw-r--r--gr-blocks/lib/delay_impl.cc4
-rw-r--r--gr-blocks/lib/delay_impl.h4
-rw-r--r--gr-blocks/lib/endian_swap_impl.cc110
-rw-r--r--gr-blocks/lib/endian_swap_impl.h48
-rw-r--r--gr-blocks/lib/file_descriptor_sink_impl.cc94
-rw-r--r--gr-blocks/lib/file_descriptor_sink_impl.h49
-rw-r--r--gr-blocks/lib/file_descriptor_source_impl.cc156
-rw-r--r--gr-blocks/lib/file_descriptor_source_impl.h58
-rw-r--r--gr-blocks/lib/file_meta_sink_impl.cc6
-rw-r--r--gr-blocks/lib/file_meta_sink_impl.h4
-rw-r--r--gr-blocks/lib/file_meta_source_impl.cc8
-rw-r--r--gr-blocks/lib/file_meta_source_impl.h6
-rw-r--r--gr-blocks/lib/file_sink_base.cc131
-rw-r--r--gr-blocks/lib/file_sink_impl.cc90
-rw-r--r--gr-blocks/lib/file_sink_impl.h48
-rw-r--r--gr-blocks/lib/file_source_impl.cc10
-rw-r--r--gr-blocks/lib/head_impl.cc75
-rw-r--r--gr-blocks/lib/head_impl.h52
-rw-r--r--gr-blocks/lib/lfsr_32k_source_s_impl.cc79
-rw-r--r--gr-blocks/lib/lfsr_32k_source_s_impl.h52
-rw-r--r--gr-blocks/lib/message_debug_impl.cc4
-rw-r--r--gr-blocks/lib/message_debug_impl.h6
-rw-r--r--gr-blocks/lib/message_sink_impl.cc79
-rw-r--r--gr-blocks/lib/message_sink_impl.h6
-rw-r--r--gr-blocks/lib/message_source_impl.cc100
-rw-r--r--gr-blocks/lib/message_source_impl.h6
-rw-r--r--gr-blocks/lib/nop_impl.cc100
-rw-r--r--gr-blocks/lib/nop_impl.h60
-rw-r--r--gr-blocks/lib/null_sink_impl.cc60
-rw-r--r--gr-blocks/lib/null_sink_impl.h45
-rw-r--r--gr-blocks/lib/null_source_impl.cc63
-rw-r--r--gr-blocks/lib/null_source_impl.h45
-rw-r--r--gr-blocks/lib/pdu.cc2
-rw-r--r--gr-blocks/lib/plateau_detector_fb_impl.cc83
-rw-r--r--gr-blocks/lib/plateau_detector_fb_impl.h50
-rw-r--r--gr-blocks/lib/probe_rate_impl.cc119
-rw-r--r--gr-blocks/lib/probe_rate_impl.h63
-rw-r--r--gr-blocks/lib/qa_block_tags.cc450
-rw-r--r--gr-blocks/lib/qa_block_tags.h50
-rw-r--r--gr-blocks/lib/qa_blocks.cc41
-rw-r--r--gr-blocks/lib/qa_blocks.h38
-rw-r--r--gr-blocks/lib/qa_gr_block.cc89
-rw-r--r--gr-blocks/lib/qa_gr_block.h48
-rw-r--r--gr-blocks/lib/qa_gr_flowgraph.cc245
-rw-r--r--gr-blocks/lib/qa_gr_flowgraph.h75
-rw-r--r--gr-blocks/lib/qa_gr_hier_block2.cc55
-rw-r--r--gr-blocks/lib/qa_gr_hier_block2.h42
-rw-r--r--gr-blocks/lib/qa_gr_hier_block2_derived.cc87
-rw-r--r--gr-blocks/lib/qa_gr_hier_block2_derived.h41
-rw-r--r--gr-blocks/lib/qa_gr_top_block.cc285
-rw-r--r--gr-blocks/lib/qa_gr_top_block.h66
-rw-r--r--gr-blocks/lib/qa_rotator.cc75
-rw-r--r--gr-blocks/lib/qa_rotator.h39
-rw-r--r--gr-blocks/lib/qa_set_msg_handler.cc78
-rw-r--r--gr-blocks/lib/qa_set_msg_handler.h43
-rw-r--r--gr-blocks/lib/repack_bits_bb_impl.cc123
-rw-r--r--gr-blocks/lib/repack_bits_bb_impl.h58
-rw-r--r--gr-blocks/lib/sine_table.h1025
-rw-r--r--gr-blocks/lib/skiphead_impl.cc93
-rw-r--r--gr-blocks/lib/skiphead_impl.h50
-rw-r--r--gr-blocks/lib/socket_pdu_impl.cc2
-rw-r--r--gr-blocks/lib/stream_pdu_base.cc2
-rw-r--r--gr-blocks/lib/stream_pdu_base.h6
-rw-r--r--gr-blocks/lib/tag_debug_impl.cc6
-rw-r--r--gr-blocks/lib/tag_debug_impl.h4
-rw-r--r--gr-blocks/lib/tagged_file_sink_impl.cc235
-rw-r--r--gr-blocks/lib/tagged_file_sink_impl.h61
-rw-r--r--gr-blocks/lib/tagged_stream_mux_impl.cc93
-rw-r--r--gr-blocks/lib/tagged_stream_mux_impl.h54
-rw-r--r--gr-blocks/lib/tagged_stream_to_pdu_impl.cc4
-rw-r--r--gr-blocks/lib/tcp_connection.h2
-rw-r--r--gr-blocks/lib/test_gr_blocks.cc47
-rw-r--r--gr-blocks/lib/udp_sink_impl.cc148
-rw-r--r--gr-blocks/lib/udp_sink_impl.h65
-rw-r--r--gr-blocks/lib/udp_source_impl.cc215
-rw-r--r--gr-blocks/lib/udp_source_impl.h84
-rw-r--r--gr-blocks/lib/vco_f_impl.cc68
-rw-r--r--gr-blocks/lib/vco_f_impl.h53
-rw-r--r--gr-blocks/lib/vector_insert_X_impl.cc.t109
-rw-r--r--gr-blocks/lib/vector_insert_X_impl.h.t58
-rw-r--r--gr-blocks/lib/vector_map_impl.cc127
-rw-r--r--gr-blocks/lib/vector_map_impl.h55
-rw-r--r--gr-blocks/lib/vector_sink_X_impl.cc.t83
-rw-r--r--gr-blocks/lib/vector_sink_X_impl.h.t56
-rw-r--r--gr-blocks/lib/vector_source_X_impl.cc.t144
-rw-r--r--gr-blocks/lib/vector_source_X_impl.h.t62
-rw-r--r--gr-blocks/lib/wavfile.cc258
-rw-r--r--gr-blocks/lib/wavfile_sink_impl.cc293
-rw-r--r--gr-blocks/lib/wavfile_sink_impl.h94
-rw-r--r--gr-blocks/lib/wavfile_source_impl.cc174
-rw-r--r--gr-blocks/lib/wavfile_source_impl.h70
-rw-r--r--gr-blocks/python/blocks/CMakeLists.txt10
-rw-r--r--gr-blocks/python/blocks/parse_file_metadata.py7
-rwxr-xr-xgr-blocks/python/blocks/qa_add_mult_div_sub.py18
-rwxr-xr-xgr-blocks/python/blocks/qa_add_mult_v.py34
-rw-r--r--gr-blocks/python/blocks/qa_argmax.py10
-rwxr-xr-xgr-blocks/python/blocks/qa_bin_statistics.py8
-rwxr-xr-xgr-blocks/python/blocks/qa_boolean_operators.py26
-rw-r--r--gr-blocks/python/blocks/qa_burst_tagger.py5
-rw-r--r--gr-blocks/python/blocks/qa_conjugate.py6
-rwxr-xr-xgr-blocks/python/blocks/qa_delay.py8
-rw-r--r--gr-blocks/python/blocks/qa_file_metadata.py14
-rwxr-xr-xgr-blocks/python/blocks/qa_integrate.py20
-rwxr-xr-xgr-blocks/python/blocks/qa_interleave.py24
-rwxr-xr-xgr-blocks/python/blocks/qa_keep_m_in_n.py10
-rwxr-xr-xgr-blocks/python/blocks/qa_keep_one_in_n.py6
-rwxr-xr-xgr-blocks/python/blocks/qa_max.py8
-rwxr-xr-xgr-blocks/python/blocks/qa_message.py8
-rw-r--r--gr-blocks/python/blocks/qa_moving_average.py8
-rw-r--r--gr-blocks/python/blocks/qa_multiply_conjugate.py8
-rwxr-xr-xgr-blocks/python/blocks/qa_mute.py12
-rwxr-xr-xgr-blocks/python/blocks/qa_nlog10.py6
-rwxr-xr-xgr-blocks/python/blocks/qa_pack_k_bits.py12
-rwxr-xr-xgr-blocks/python/blocks/qa_packed_to_unpacked.py76
-rwxr-xr-xgr-blocks/python/blocks/qa_patterned_interleaver.py12
-rwxr-xr-xgr-blocks/python/blocks/qa_pdu.py2
-rw-r--r--gr-blocks/python/blocks/qa_peak_detector.py12
-rw-r--r--gr-blocks/python/blocks/qa_peak_detector2.py4
-rwxr-xr-xgr-blocks/python/blocks/qa_pipe_fittings.py18
-rw-r--r--gr-blocks/python/blocks/qa_probe_signal.py4
-rwxr-xr-xgr-blocks/python/blocks/qa_regenerate.py8
-rwxr-xr-xgr-blocks/python/blocks/qa_repeat.py8
-rw-r--r--gr-blocks/python/blocks/qa_rms.py12
-rw-r--r--gr-blocks/python/blocks/qa_sample_and_hold.py6
-rwxr-xr-xgr-blocks/python/blocks/qa_stream_mux.py14
-rwxr-xr-xgr-blocks/python/blocks/qa_stretch.py8
-rwxr-xr-xgr-blocks/python/blocks/qa_tag_debug.py2
-rw-r--r--gr-blocks/python/blocks/qa_threshold.py4
-rw-r--r--gr-blocks/python/blocks/qa_transcendental.py12
-rwxr-xr-xgr-blocks/python/blocks/qa_type_conversions.py114
-rwxr-xr-xgr-blocks/python/blocks/qa_unpack_k_bits.py8
-rw-r--r--gr-blocks/python/qa_affinity.py50
-rw-r--r--gr-blocks/python/qa_block_gateway.py256
-rwxr-xr-xgr-blocks/python/qa_copy.py58
-rwxr-xr-xgr-blocks/python/qa_cpp_py_binding.py174
-rwxr-xr-xgr-blocks/python/qa_cpp_py_binding_set.py152
-rw-r--r--gr-blocks/python/qa_endian_swap.py66
-rw-r--r--gr-blocks/python/qa_file_source_sink.py94
-rwxr-xr-xgr-blocks/python/qa_head.py47
-rwxr-xr-xgr-blocks/python/qa_hier_block2.py398
-rw-r--r--gr-blocks/python/qa_message_tags.py27
-rw-r--r--gr-blocks/python/qa_null_sink_source.py46
-rwxr-xr-xgr-blocks/python/qa_plateau_detector_fb.py46
-rw-r--r--gr-blocks/python/qa_python_message_passing.py123
-rwxr-xr-xgr-blocks/python/qa_repack_bits_bb.py127
-rwxr-xr-xgr-blocks/python/qa_skiphead.py103
-rw-r--r--gr-blocks/python/qa_tag_file_sink.py72
-rwxr-xr-xgr-blocks/python/qa_tagged_stream_mux.py111
-rw-r--r--gr-blocks/python/qa_udp_source_sink.py122
-rw-r--r--gr-blocks/python/qa_vco.py59
-rwxr-xr-xgr-blocks/python/qa_vector_insert.py59
-rw-r--r--gr-blocks/python/qa_vector_map.py104
-rwxr-xr-xgr-blocks/python/qa_vector_sink_source.py66
-rwxr-xr-xgr-blocks/python/qa_wavfile.py69
-rw-r--r--gr-blocks/python/test_16bit_1chunk.wavbin0 -> 52 bytes
-rw-r--r--gr-blocks/swig/CMakeLists.txt11
-rw-r--r--gr-blocks/swig/blocks_swig.i154
-rw-r--r--gr-blocks/tests/CMakeLists.txt55
-rw-r--r--gr-blocks/tests/benchmark_nco.cc225
-rw-r--r--gr-blocks/tests/benchmark_vco.cc172
-rw-r--r--gr-blocks/tests/nco_results48
268 files changed, 19222 insertions, 636 deletions
diff --git a/gr-blocks/CMakeLists.txt b/gr-blocks/CMakeLists.txt
index 8a639c8084..fdaf40a7bd 100644
--- a/gr-blocks/CMakeLists.txt
+++ b/gr-blocks/CMakeLists.txt
@@ -28,12 +28,13 @@ include(GrBoost)
include(GrComponent)
GR_REGISTER_COMPONENT("gr-blocks" ENABLE_GR_BLOCKS
Boost_FOUND
- ENABLE_GR_CORE
+ ENABLE_GNURADIO_RUNTIME
)
GR_SET_GLOBAL(GR_BLOCKS_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/lib
${CMAKE_CURRENT_BINARY_DIR}/include
)
@@ -81,6 +82,9 @@ CPACK_COMPONENT("blocks_swig"
########################################################################
add_subdirectory(include/blocks)
add_subdirectory(lib)
+#if(ENABLE_TESTING)
+# add_subdirectory(tests)
+#endif(ENABLE_TESTING)
if(ENABLE_PYTHON)
add_subdirectory(python/blocks)
add_subdirectory(swig)
diff --git a/gr-blocks/examples/CMakeLists.txt b/gr-blocks/examples/CMakeLists.txt
index 0f9db57b63..c9829661b6 100644
--- a/gr-blocks/examples/CMakeLists.txt
+++ b/gr-blocks/examples/CMakeLists.txt
@@ -19,3 +19,7 @@
add_subdirectory(metadata)
add_subdirectory(tags)
+
+if(ENABLE_GR_CTRLPORT)
+add_subdirectory(ctrlport)
+endif(ENABLE_GR_CTRLPORT)
diff --git a/gr-blocks/examples/ctrlport/CMakeLists.txt b/gr-blocks/examples/ctrlport/CMakeLists.txt
new file mode 100644
index 0000000000..47ef4c225e
--- /dev/null
+++ b/gr-blocks/examples/ctrlport/CMakeLists.txt
@@ -0,0 +1,25 @@
+# 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(PROGRAMS
+ DESTINATION ${GR_PKG_CTRLPORT_EXAMPLES_DIR}
+ COMPONENT "core_python"
+)
diff --git a/gr-blocks/examples/ctrlport/comparing_resamplers.grc b/gr-blocks/examples/ctrlport/comparing_resamplers.grc
new file mode 100644
index 0000000000..7b90a2066c
--- /dev/null
+++ b/gr-blocks/examples/ctrlport/comparing_resamplers.grc
@@ -0,0 +1,390 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Fri Mar 15 11:01:13 2013</timestamp>
+ <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>complex</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>(191, 125)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_ctrlport_probe2_c</key>
+ <param>
+ <key>id</key>
+ <value>probe_arc_resamp</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>arb_resampler</value>
+ </param>
+ <param>
+ <key>desc</key>
+ <value>PFB Arbitrary Resampler</value>
+ </param>
+ <param>
+ <key>len</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(9, 296)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>resamp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1.25</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(272, 9)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>pfb_arb_resampler_xxx</key>
+ <param>
+ <key>id</key>
+ <value>pfb_arb_resampler_xxx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>ccf</value>
+ </param>
+ <param>
+ <key>rrate</key>
+ <value>resamp_rate</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value></value>
+ </param>
+ <param>
+ <key>nfilts</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>atten</key>
+ <value>60</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(305, 280)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_ctrlport_probe2_c</key>
+ <param>
+ <key>id</key>
+ <value>probe_frac_interp</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>fractional_interp</value>
+ </param>
+ <param>
+ <key>desc</key>
+ <value>Fractional Interpolator</value>
+ </param>
+ <param>
+ <key>len</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 204)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>fractional_interpolator_xx</key>
+ <param>
+ <key>id</key>
+ <value>fractional_interpolator_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>phase_shift</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>interp_ratio</key>
+ <value>1.0/resamp_rate</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(354, 212)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>30e6</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(181, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>analog_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>analog.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>samp_rate/10</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(11, 93)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>channels_channel_model</key>
+ <param>
+ <key>id</key>
+ <value>channels_channel_model_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>noise_voltage</key>
+ <value>0.1</value>
+ </param>
+ <param>
+ <key>freq_offset</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>epsilon</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>[1,]</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(382, 93)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>comparing_resamplers</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>570,390</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>no_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>analog_sig_source_x_0</source_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>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>channels_channel_model_0</source_block_id>
+ <sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>channels_channel_model_0</source_block_id>
+ <sink_block_id>fractional_interpolator_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
+ <sink_block_id>probe_arc_resamp</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fractional_interpolator_xx_0</source_block_id>
+ <sink_block_id>probe_frac_interp</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/examples/ctrlport/pfb_sync_test-qt.grc b/gr-blocks/examples/ctrlport/pfb_sync_test-qt.grc
new file mode 100644
index 0000000000..c28ed6d71a
--- /dev/null
+++ b/gr-blocks/examples/ctrlport/pfb_sync_test-qt.grc
@@ -0,0 +1,854 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Sun Mar 17 21:00:28 2013</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>pfb_sync_test_qt</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280,1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(105, 126)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>300000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(14, 124)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>import</key>
+ <param>
+ <key>id</key>
+ <value>import_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>import</key>
+ <value>import random, math, cmath</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(14, 77)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_packed_to_unpacked_xx</key>
+ <param>
+ <key>id</key>
+ <value>blocks_packed_to_unpacked_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>bits_per_chunk</key>
+ <value>8</value>
+ </param>
+ <param>
+ <key>endianness</key>
+ <value>gr.GR_MSB_FIRST</value>
+ </param>
+ <param>
+ <key>num_ports</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(419, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <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>(436, 97)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_psk_mod</key>
+ <param>
+ <key>id</key>
+ <value>digital_psk_mod_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>constellation_points</key>
+ <value>4</value>
+ </param>
+ <param>
+ <key>mod_code</key>
+ <value>"gray"</value>
+ </param>
+ <param>
+ <key>differential</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>samples_per_symbol</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>excess_bw</key>
+ <value>0.35</value>
+ </param>
+ <param>
+ <key>verbose</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>log</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(627, 65)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_pfb_clock_sync_xxx</key>
+ <param>
+ <key>id</key>
+ <value>digital_pfb_clock_sync_xxx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>ccf</value>
+ </param>
+ <param>
+ <key>sps</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>loop_bw</key>
+ <value>2*3.14/100.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, nfilts,1.0/sps, 0.35, int(22*sps*nfilts))</value>
+ </param>
+ <param>
+ <key>filter_size</key>
+ <value>nfilts</value>
+ </param>
+ <param>
+ <key>init_phase</key>
+ <value>nfilts/2</value>
+ </param>
+ <param>
+ <key>max_dev</key>
+ <value>1.5</value>
+ </param>
+ <param>
+ <key>osps</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(339, 195)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>nfilts</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(74, 390)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>amps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>[1]</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(7, 390)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>graymap</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>[[3,1,0,2]]</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(7, 326)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_const_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_const_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>-2</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>xmin</key>
+ <value>-2</value>
+ </param>
+ <param>
+ <key>xmax</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>update_time</key>
+ <value>0.10</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(752, 196)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>channels_channel_model</key>
+ <param>
+ <key>id</key>
+ <value>channels_channel_model_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>noise_voltage</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>freq_offset</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>epsilon</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>cmath.exp(1j*phase)</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(68, 211)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_ctrlport_probe2_c</key>
+ <param>
+ <key>id</key>
+ <value>received_probe2</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>received</value>
+ </param>
+ <param>
+ <key>desc</key>
+ <value>Constellation Points</value>
+ </param>
+ <param>
+ <key>len</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(195, 519)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>phase</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Phase</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.5</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(266, 344)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_ctrlport_probe2_c</key>
+ <param>
+ <key>id</key>
+ <value>time_probe2</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>time locked</value>
+ </param>
+ <param>
+ <key>desc</key>
+ <value>Constellation Points</value>
+ </param>
+ <param>
+ <key>len</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(447, 440)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Noise</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.050</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0.0001</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(7, 455)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_costas_loop_cc</key>
+ <param>
+ <key>id</key>
+ <value>digital_costas_loop_cc_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>w</key>
+ <value>6.28/100.0</value>
+ </param>
+ <param>
+ <key>order</key>
+ <value>4</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(610, 279)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_null_sink</key>
+ <param>
+ <key>id</key>
+ <value>blocks_null_sink_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(859, 279)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_ctrlport_probe2_c</key>
+ <param>
+ <key>id</key>
+ <value>phase_probe2</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>phase locked</value>
+ </param>
+ <param>
+ <key>desc</key>
+ <value>Constellation Points</value>
+ </param>
+ <param>
+ <key>len</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(681, 379)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_vector_source_x</key>
+ <param>
+ <key>id</key>
+ <value>blocks_vector_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>vector</key>
+ <value>(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50)</value>
+ </param>
+ <param>
+ <key>tags</key>
+ <value>[]</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(190, 71)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_ctrlport_monitor</key>
+ <param>
+ <key>id</key>
+ <value>blocks_ctrlport_monitor_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>en</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(193, 7)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <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>
+ </connection>
+ <connection>
+ <source_block_id>digital_pfb_clock_sync_xxx_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>
+ </connection>
+ <connection>
+ <source_block_id>digital_costas_loop_cc_0</source_block_id>
+ <sink_block_id>qtgui_const_sink_x_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>1</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>digital_costas_loop_cc_0</source_block_id>
+ <sink_block_id>blocks_null_sink_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>channels_channel_model_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>
+ </connection>
+ <connection>
+ <source_block_id>digital_psk_mod_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>digital_costas_loop_cc_0</source_block_id>
+ <sink_block_id>phase_probe2</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_packed_to_unpacked_xx_0</source_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>blocks_vector_source_x_0</source_block_id>
+ <sink_block_id>blocks_packed_to_unpacked_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>channels_channel_model_0</source_block_id>
+ <sink_block_id>received_probe2</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
+ <sink_block_id>time_probe2</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
+ <sink_block_id>digital_costas_loop_cc_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/examples/ctrlport/pfb_sync_test.grc b/gr-blocks/examples/ctrlport/pfb_sync_test.grc
new file mode 100644
index 0000000000..06692aad46
--- /dev/null
+++ b/gr-blocks/examples/ctrlport/pfb_sync_test.grc
@@ -0,0 +1,668 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Sun Mar 17 21:01:36 2013</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>pfb_sync_test</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>import</key>
+ <param>
+ <key>id</key>
+ <value>import_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>import</key>
+ <value>import random, math, cmath</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(14, 77)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>300000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(14, 124)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>graymap</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>[[3,1,0,2]]</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(32, 387)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>amps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>[1]</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(32, 451)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>nfilts</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(99, 451)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_costas_loop_cc</key>
+ <param>
+ <key>id</key>
+ <value>digital_costas_loop_cc_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>w</key>
+ <value>6.28/100.0</value>
+ </param>
+ <param>
+ <key>order</key>
+ <value>4</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(626, 223)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(105, 126)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_null_sink</key>
+ <param>
+ <key>id</key>
+ <value>blocks_null_sink_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(964, 200)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.05</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0.00000001</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(281, 406)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>phase</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(167, 405)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_pfb_clock_sync_xxx</key>
+ <param>
+ <key>id</key>
+ <value>digital_pfb_clock_sync_xxx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>ccf</value>
+ </param>
+ <param>
+ <key>sps</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>loop_bw</key>
+ <value>2*3.14/100.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, nfilts,1.0/sps, 0.35, int(22*sps*nfilts))</value>
+ </param>
+ <param>
+ <key>filter_size</key>
+ <value>nfilts</value>
+ </param>
+ <param>
+ <key>init_phase</key>
+ <value>nfilts/2</value>
+ </param>
+ <param>
+ <key>max_dev</key>
+ <value>1.5</value>
+ </param>
+ <param>
+ <key>osps</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(322, 231)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_psk_mod</key>
+ <param>
+ <key>id</key>
+ <value>digital_psk_mod_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>constellation_points</key>
+ <value>4</value>
+ </param>
+ <param>
+ <key>mod_code</key>
+ <value>"gray"</value>
+ </param>
+ <param>
+ <key>differential</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>samples_per_symbol</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>excess_bw</key>
+ <value>0.35</value>
+ </param>
+ <param>
+ <key>verbose</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>log</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(846, 32)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>channels_channel_model</key>
+ <param>
+ <key>id</key>
+ <value>channels_channel_model_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>noise_voltage</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>freq_offset</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>epsilon</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>cmath.exp(1j*phase)</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(73, 247)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_file_source</key>
+ <param>
+ <key>id</key>
+ <value>blocks_file_source_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>file</key>
+ <value>/dev/urandom</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(229, 56)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <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>
+ <block>
+ <key>blocks_packed_to_unpacked_xx</key>
+ <param>
+ <key>id</key>
+ <value>blocks_packed_to_unpacked_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>bits_per_chunk</key>
+ <value>8</value>
+ </param>
+ <param>
+ <key>endianness</key>
+ <value>gr.GR_MSB_FIRST</value>
+ </param>
+ <param>
+ <key>num_ports</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(415, 56)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_ctrlport_monitor</key>
+ <param>
+ <key>id</key>
+ <value>blocks_ctrlport_monitor_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>en</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(229, 7)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <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>
+ </connection>
+ <connection>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
+ <sink_block_id>digital_costas_loop_cc_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>digital_costas_loop_cc_0</source_block_id>
+ <sink_block_id>blocks_null_sink_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>channels_channel_model_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>
+ </connection>
+ <connection>
+ <source_block_id>digital_psk_mod_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_file_source_0</source_block_id>
+ <sink_block_id>blocks_packed_to_unpacked_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/examples/metadata/file_metadata_sink.grc b/gr-blocks/examples/metadata/file_metadata_sink.grc
index 198b0725f9..4cda1eba39 100644
--- a/gr-blocks/examples/metadata/file_metadata_sink.grc
+++ b/gr-blocks/examples/metadata/file_metadata_sink.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Fri Dec 14 17:09:06 2012</timestamp>
+ <timestamp>Sun Mar 17 20:44:09 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -61,42 +61,77 @@
</param>
</block>
<block>
- <key>gr_sig_source_x</key>
+ <key>variable_qtgui_range</key>
<param>
<key>id</key>
- <value>gr_sig_source_x_0</value>
+ <value>qt_samp_rate</value>
</param>
<param>
<key>_enabled</key>
- <value>False</value>
+ <value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>label</key>
+ <value></value>
</param>
<param>
- <key>samp_rate</key>
+ <key>value</key>
<value>samp_rate</value>
</param>
<param>
- <key>waveform</key>
- <value>gr.GR_COS_WAVE</value>
+ <key>start</key>
+ <value>200000</value>
</param>
<param>
- <key>freq</key>
- <value>1000</value>
+ <key>stop</key>
+ <value>5000000</value>
</param>
<param>
- <key>amp</key>
- <value>1</value>
+ <key>step</key>
+ <value>200000</value>
</param>
<param>
- <key>offset</key>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(330, 259)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>200000</value>
+ </param>
<param>
<key>_coordinate</key>
- <value>(57, 140)</value>
+ <value>(208, 11)</value>
</param>
<param>
<key>_rotation</key>
@@ -104,54 +139,54 @@
</param>
</block>
<block>
- <key>variable_qtgui_range</key>
+ <key>blocks_file_meta_sink</key>
<param>
<key>id</key>
- <value>qt_samp_rate</value>
+ <value>blocks_file_meta_sink_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value></value>
+ <key>file</key>
+ <value>/tmp/metadat_file.out</value>
</param>
<param>
- <key>value</key>
- <value>samp_rate</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>start</key>
- <value>200000</value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>stop</key>
- <value>5000000</value>
+ <key>rel_rate</key>
+ <value>1</value>
</param>
<param>
- <key>step</key>
- <value>200000</value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
- <key>widget</key>
- <value>counter_slider</value>
+ <key>max_seg_size</key>
+ <value>1000000</value>
</param>
<param>
- <key>orient</key>
- <value>Qt.Horizontal</value>
+ <key>extra_dict</key>
+ <value>""</value>
</param>
<param>
- <key>min_len</key>
- <value>200</value>
+ <key>detached</key>
+ <value>True</value>
</param>
<param>
- <key>gui_hint</key>
- <value></value>
+ <key>unbuffered</key>
+ <value>False</value>
</param>
<param>
<key>_coordinate</key>
- <value>(330, 259)</value>
+ <value>(569, 124)</value>
</param>
<param>
<key>_rotation</key>
@@ -159,22 +194,30 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>blocks_head</key>
<param>
<key>id</key>
- <value>samp_rate</value>
+ <value>blocks_head_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>200000</value>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>num_items</key>
+ <value>20000000</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(208, 11)</value>
+ <value>(309, 172)</value>
</param>
<param>
<key>_rotation</key>
@@ -189,7 +232,7 @@
</param>
<param>
<key>_enabled</key>
- <value>True</value>
+ <value>False</value>
</param>
<param>
<key>type</key>
@@ -845,10 +888,10 @@
</param>
</block>
<block>
- <key>gr_head</key>
+ <key>analog_sig_source_x</key>
<param>
<key>id</key>
- <value>gr_head_0</value>
+ <value>analog_sig_source_x_0</value>
</param>
<param>
<key>_enabled</key>
@@ -859,71 +902,28 @@
<value>complex</value>
</param>
<param>
- <key>num_items</key>
- <value>20000000</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(309, 172)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>blocks_file_meta_sink</key>
- <param>
- <key>id</key>
- <value>blocks_file_meta_sink_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>file</key>
- <value>/tmp/metadat_file.out</value>
- </param>
- <param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
<key>samp_rate</key>
<value>samp_rate</value>
</param>
<param>
- <key>rel_rate</key>
- <value>1</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>max_seg_size</key>
- <value>1000000</value>
+ <key>waveform</key>
+ <value>analog.GR_COS_WAVE</value>
</param>
<param>
- <key>extra_dict</key>
- <value>""</value>
+ <key>freq</key>
+ <value>1000</value>
</param>
<param>
- <key>detached</key>
- <value>True</value>
+ <key>amp</key>
+ <value>1</value>
</param>
<param>
- <key>unbuffered</key>
- <value>False</value>
+ <key>offset</key>
+ <value>0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(569, 124)</value>
+ <value>(48, 115)</value>
</param>
<param>
<key>_rotation</key>
@@ -931,20 +931,20 @@
</param>
</block>
<connection>
- <source_block_id>gr_sig_source_x_0</source_block_id>
- <sink_block_id>gr_head_0</sink_block_id>
+ <source_block_id>uhd_usrp_source_0</source_block_id>
+ <sink_block_id>blocks_head_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>uhd_usrp_source_0</source_block_id>
- <sink_block_id>gr_head_0</sink_block_id>
+ <source_block_id>blocks_head_0</source_block_id>
+ <sink_block_id>blocks_file_meta_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_head_0</source_block_id>
- <sink_block_id>blocks_file_meta_sink_0</sink_block_id>
+ <source_block_id>analog_sig_source_x_0</source_block_id>
+ <sink_block_id>blocks_head_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/examples/metadata/file_metadata_source.grc b/gr-blocks/examples/metadata/file_metadata_source.grc
index f45c151d3f..5d0a0417a8 100644
--- a/gr-blocks/examples/metadata/file_metadata_source.grc
+++ b/gr-blocks/examples/metadata/file_metadata_source.grc
@@ -209,10 +209,10 @@
</param>
</block>
<block>
- <key>gr_file_sink</key>
+ <key>blocks_file_sink</key>
<param>
<key>id</key>
- <value>gr_file_sink_1</value>
+ <value>blocks_file_sink_1</value>
</param>
<param>
<key>_enabled</key>
@@ -319,7 +319,7 @@
</block>
<connection>
<source_block_id>blocks_throttle_0</source_block_id>
- <sink_block_id>gr_file_sink_1</sink_block_id>
+ <sink_block_id>blocks_file_sink_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/examples/metadata/file_metadata_vector_sink.grc b/gr-blocks/examples/metadata/file_metadata_vector_sink.grc
index 05b7cbc922..ebc4812e56 100644
--- a/gr-blocks/examples/metadata/file_metadata_vector_sink.grc
+++ b/gr-blocks/examples/metadata/file_metadata_vector_sink.grc
@@ -84,10 +84,10 @@
</param>
</block>
<block>
- <key>gr_vector_source_x</key>
+ <key>blocks_vector_source_x</key>
<param>
<key>id</key>
- <value>gr_vector_source_x_0</value>
+ <value>blocks_vector_source_x_0</value>
</param>
<param>
<key>_enabled</key>
@@ -119,10 +119,10 @@
</param>
</block>
<block>
- <key>gr_head</key>
+ <key>blocks_head</key>
<param>
<key>id</key>
- <value>gr_head_0</value>
+ <value>blocks_head_0</value>
</param>
<param>
<key>_enabled</key>
@@ -205,13 +205,13 @@
</param>
</block>
<connection>
- <source_block_id>gr_vector_source_x_0</source_block_id>
- <sink_block_id>gr_head_0</sink_block_id>
+ <source_block_id>blocks_vector_source_x_0</source_block_id>
+ <sink_block_id>blocks_head_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_head_0</source_block_id>
+ <source_block_id>blocks_head_0</source_block_id>
<sink_block_id>blocks_file_meta_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-blocks/examples/metadata/file_metadata_vector_source.grc b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
index 584a033c2d..3c2dda9ded 100644
--- a/gr-blocks/examples/metadata/file_metadata_vector_source.grc
+++ b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
@@ -84,10 +84,10 @@
</param>
</block>
<block>
- <key>gr_file_sink</key>
+ <key>blocks_file_sink</key>
<param>
<key>id</key>
- <value>gr_file_sink_1</value>
+ <value>blocks_file_sink_1</value>
</param>
<param>
<key>_enabled</key>
@@ -307,7 +307,7 @@
</block>
<connection>
<source_block_id>blocks_throttle_0</source_block_id>
- <sink_block_id>gr_file_sink_1</sink_block_id>
+ <sink_block_id>blocks_file_sink_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/examples/msg_passing/strobe.grc b/gr-blocks/examples/msg_passing/strobe.grc
index d9d4ce43cb..e5001a4262 100644
--- a/gr-blocks/examples/msg_passing/strobe.grc
+++ b/gr-blocks/examples/msg_passing/strobe.grc
@@ -1,46 +1,59 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Dec 6 11:33:08 2012</timestamp>
+ <timestamp>Sun Mar 17 20:42:59 2013</timestamp>
<block>
- <key>variable</key>
+ <key>options</key>
<param>
<key>id</key>
- <value>samp_rate</value>
+ <value>strobe</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>32000</value>
+ <key>title</key>
+ <value></value>
</param>
<param>
- <key>_coordinate</key>
- <value>(10, 170)</value>
+ <key>author</key>
+ <value></value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>description</key>
+ <value></value>
</param>
- </block>
- <block>
- <key>gr_pdu_to_tagged_stream</key>
<param>
- <key>id</key>
- <value>gr_pdu_to_tagged_stream_0</value>
+ <key>window_size</key>
+ <value>1280, 1024</value>
</param>
<param>
- <key>_enabled</key>
+ <key>generate_options</key>
+ <value>no_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>byte</value>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(443, 89)</value>
+ <value>(10, 10)</value>
</param>
<param>
<key>_rotation</key>
@@ -48,18 +61,22 @@
</param>
</block>
<block>
- <key>blocks_message_debug</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>blocks_message_debug_0</value>
+ <value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
<key>_coordinate</key>
- <value>(1049, 176)</value>
+ <value>(10, 170)</value>
</param>
<param>
<key>_rotation</key>
@@ -67,22 +84,18 @@
</param>
</block>
<block>
- <key>gr_tagged_stream_to_pdu</key>
+ <key>blocks_message_debug</key>
<param>
<key>id</key>
- <value>gr_tagged_stream_to_pdu_0</value>
+ <value>blocks_message_debug_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>byte</value>
- </param>
- <param>
<key>_coordinate</key>
- <value>(870, 89)</value>
+ <value>(1049, 176)</value>
</param>
<param>
<key>_rotation</key>
@@ -90,10 +103,10 @@
</param>
</block>
<block>
- <key>gr_kludge_copy</key>
+ <key>blocks_pdu_to_tagged_stream</key>
<param>
<key>id</key>
- <value>gr_kludge_copy_0</value>
+ <value>blocks_pdu_to_tagged_stream_0</value>
</param>
<param>
<key>_enabled</key>
@@ -104,16 +117,8 @@
<value>byte</value>
</param>
<param>
- <key>num_ports</key>
- <value>1</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
<key>_coordinate</key>
- <value>(686, 89)</value>
+ <value>(388, 85)</value>
</param>
<param>
<key>_rotation</key>
@@ -124,7 +129,7 @@
<key>blocks_message_strobe</key>
<param>
<key>id</key>
- <value>blocks_message_strobe_0</value>
+ <value>blocks_message_strobe_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -132,15 +137,15 @@
</param>
<param>
<key>msg</key>
- <value>pmt.intern("TEST")</value>
+ <value>pmt.cons( pmt.PMT_NIL, pmt.make_u8vector(512,0) )</value>
</param>
<param>
<key>period</key>
- <value>1000</value>
+ <value>750</value>
</param>
<param>
<key>_coordinate</key>
- <value>(423, 177)</value>
+ <value>(95, 95)</value>
</param>
<param>
<key>_rotation</key>
@@ -148,26 +153,30 @@
</param>
</block>
<block>
- <key>blocks_message_strobe</key>
+ <key>blocks_copy</key>
<param>
<key>id</key>
- <value>blocks_message_strobe_0_0</value>
+ <value>blocks_copy_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>msg</key>
- <value>pmt.cons( pmt.PMT_NIL, pmt.make_u8vector(512,0) )</value>
+ <key>type</key>
+ <value>byte</value>
</param>
<param>
- <key>period</key>
- <value>750</value>
+ <key>enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(99, 85)</value>
+ <value>(629, 81)</value>
</param>
<param>
<key>_rotation</key>
@@ -175,58 +184,49 @@
</param>
</block>
<block>
- <key>options</key>
+ <key>blocks_tagged_stream_to_pdu</key>
<param>
<key>id</key>
- <value>strobe</value>
+ <value>blocks_tagged_stream_to_pdu_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>title</key>
- <value></value>
- </param>
- <param>
- <key>author</key>
- <value></value>
- </param>
- <param>
- <key>description</key>
- <value></value>
- </param>
- <param>
- <key>window_size</key>
- <value>1280, 1024</value>
+ <key>type</key>
+ <value>byte</value>
</param>
<param>
- <key>generate_options</key>
- <value>no_gui</value>
+ <key>_coordinate</key>
+ <value>(837, 47)</value>
</param>
<param>
- <key>category</key>
- <value>Custom</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>blocks_message_strobe</key>
<param>
- <key>run_options</key>
- <value>prompt</value>
+ <key>id</key>
+ <value>blocks_message_strobe_0</value>
</param>
<param>
- <key>run</key>
+ <key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>max_nouts</key>
- <value>0</value>
+ <key>msg</key>
+ <value>pmt.intern("TEST")</value>
</param>
<param>
- <key>realtime_scheduling</key>
- <value></value>
+ <key>period</key>
+ <value>1000</value>
</param>
<param>
<key>_coordinate</key>
- <value>(10, 10)</value>
+ <value>(423, 164)</value>
</param>
<param>
<key>_rotation</key>
@@ -234,32 +234,32 @@
</param>
</block>
<connection>
- <source_block_id>blocks_message_strobe_0_0</source_block_id>
- <sink_block_id>gr_pdu_to_tagged_stream_0</sink_block_id>
+ <source_block_id>blocks_message_strobe_0</source_block_id>
+ <sink_block_id>blocks_message_debug_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blocks_message_strobe_0</source_block_id>
- <sink_block_id>blocks_message_debug_0</sink_block_id>
+ <source_block_id>blocks_message_strobe_0_0</source_block_id>
+ <sink_block_id>blocks_pdu_to_tagged_stream_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_tagged_stream_to_pdu_0</source_block_id>
+ <source_block_id>blocks_tagged_stream_to_pdu_0</source_block_id>
<sink_block_id>blocks_message_debug_0</sink_block_id>
<source_key>0</source_key>
- <sink_key>0</sink_key>
+ <sink_key>2</sink_key>
</connection>
<connection>
- <source_block_id>gr_kludge_copy_0</source_block_id>
- <sink_block_id>gr_tagged_stream_to_pdu_0</sink_block_id>
+ <source_block_id>blocks_copy_0</source_block_id>
+ <sink_block_id>blocks_tagged_stream_to_pdu_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_pdu_to_tagged_stream_0</source_block_id>
- <sink_block_id>gr_kludge_copy_0</sink_block_id>
+ <source_block_id>blocks_pdu_to_tagged_stream_0</source_block_id>
+ <sink_block_id>blocks_copy_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/examples/tags/test_file_tags.py b/gr-blocks/examples/tags/test_file_tags.py
index 1493864bd4..cc11cf594e 100755
--- a/gr-blocks/examples/tags/test_file_tags.py
+++ b/gr-blocks/examples/tags/test_file_tags.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -34,14 +34,14 @@ def main():
data = scipy.arange(0, 32000, 1).tolist()
trig = 100*[0,] + 100*[1,]
- src = gr.vector_source_s(data, True)
- trigger = gr.vector_source_s(trig, True)
+ src = blocks.vector_source_s(data, True)
+ trigger = blocks.vector_source_s(trig, True)
thr = blocks.throttle(gr.sizeof_short, 10e3)
- ann = gr.annotator_alltoall(1000000, gr.sizeof_short)
- tagger = blocks..burst_tagger(gr.sizeof_short)
+ ann = blocks.annotator_alltoall(1000000, gr.sizeof_short)
+ tagger = blocks.burst_tagger(gr.sizeof_short)
- fsnk = gr.tagged_file_sink(gr.sizeof_short, 1)
+ fsnk = blocks.tagged_file_sink(gr.sizeof_short, 1)
tb = gr.top_block()
tb.connect(src, thr, (tagger, 0))
diff --git a/gr-blocks/gnuradio-blocks.pc.in b/gr-blocks/gnuradio-blocks.pc.in
index c24564157e..5e6dea231e 100644
--- a/gr-blocks/gnuradio-blocks.pc.in
+++ b/gr-blocks/gnuradio-blocks.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: gnuradio-blocks
Description: GNU Radio basic block library
-Requires: gnuradio-core
+Requires: gnuradio-runtime
Version: @LIBVER@
Libs: -L${libdir} -lgnuradio-blocks
Cflags: -I${includedir}
diff --git a/gr-blocks/grc/CMakeLists.txt b/gr-blocks/grc/CMakeLists.txt
index ed66d9e3b2..9d38e3dcd8 100644
--- a/gr-blocks/grc/CMakeLists.txt
+++ b/gr-blocks/grc/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012-2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -19,4 +19,15 @@
########################################################################
file(GLOB xml_files "*.xml")
+
+# Force out the controlport GRC blocks if we've disabled it.
+if(NOT ENABLE_GR_CTRLPORT)
+ list(REMOVE_ITEM xml_files
+ ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_viewer.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/blocks_ctrlport_performance.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe_c.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe2_c.xml
+ )
+endif(NOT ENABLE_GR_CTRLPORT)
+
install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "blocks_python")
diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml
index 6ab4398194..0cd4ac434f 100644
--- a/gr-blocks/grc/blocks_block_tree.xml
+++ b/gr-blocks/grc/blocks_block_tree.xml
@@ -31,18 +31,30 @@
<cat>
<name>Sources (New)</name>
<block>blocks_file_source</block>
+ <block>blocks_file_descriptor_source</block>
<block>blocks_file_meta_source</block>
<block>blocks_pdu_to_tagged_stream</block>
<block>blocks_random_pdu</block>
<block>blocks_message_source</block>
<block>blocks_message_burst_source</block>
+ <block>blocks_udp_source</block>
+ <block>blocks_wavfile_source</block>
+ <block>blocks_vector_source_x</block>
+ <block>blocks_null_source</block>
</cat>
<cat>
<name>Sinks (New)</name>
+ <block>blocks_file_sink</block>
+ <block>blocks_file_descriptor_sink</block>
<block>blocks_file_meta_sink</block>
<block>blocks_tagged_stream_to_pdu</block>
<block>blocks_tag_debug</block>
<block>blocks_message_sink</block>
+ <block>blocks_tagged_file_sink</block>
+ <block>blocks_udp_sink</block>
+ <block>blocks_wavfile_sink</block>
+ <block>blocks_vector_sink_x</block>
+ <block>blocks_null_sink</block>
</cat>
<cat>
<name>Math Operations (New) </name>
@@ -60,6 +72,7 @@
<block>blocks_transcendental</block>
<block>blocks_argmax_xx</block>
<block>blocks_max_xx</block>
+ <block>blocks_vco_f</block>
</cat>
<cat>
<name>Boolean Operations (New) </name>
@@ -88,6 +101,7 @@
<block>blocks_int_to_float</block>
<block>blocks_interleaved_short_to_complex</block>
<block>blocks_short_to_char</block>
+ <block>blocks_repack_bits_bb</block>
<block>blocks_short_to_float</block>
<block>blocks_uchar_to_float</block>
</cat>
@@ -109,10 +123,13 @@
<block>blocks_stream_to_vector_decimator</block>
<block>blocks_peak_detector_xb</block>
<block>blocks_peak_detector2_fb</block>
+ <block>blocks_plateau_detector_fb</block>
<block>blocks_regenerate_bb</block>
<block>blocks_stretch_ff</block>
<block>blocks_threshold_ff</block>
<block>blocks_burst_tagger</block>
+ <block>blocks_endian_swap</block>
+ <block>blocks_vector_insert_x</block>
</cat>
<cat>
<name>Misc Conversions (New) </name>
@@ -124,6 +141,11 @@
<cat>
<name>Misc (New) </name>
<block>blocks_throttle</block>
+ <block>blocks_probe_rate</block>
+ <block>blocks_head</block>
+ <block>blocks_skiphead</block>
+ <block>blocks_copy</block>
+ <block>blocks_nop</block>
</cat>
<cat>
<name>Networking</name>
diff --git a/gr-blocks/grc/blocks_complex_to_real.xml b/gr-blocks/grc/blocks_complex_to_real.xml
index 0fe77dc1c5..6737f1da36 100644
--- a/gr-blocks/grc/blocks_complex_to_real.xml
+++ b/gr-blocks/grc/blocks_complex_to_real.xml
@@ -24,13 +24,7 @@
</sink>
<source>
<name>re</name>
- <type>real</type>
+ <type>float</type>
<vlen>$vlen</vlen>
</source>
- <source>
- <name>im</name>
- <type>real</type>
- <vlen>$vlen</vlen>
- <optional>1</optional>
- </source>
</block>
diff --git a/gr-blocks/grc/blocks_copy.xml b/gr-blocks/grc/blocks_copy.xml
new file mode 100644
index 0000000000..55c4b343d3
--- /dev/null
+++ b/gr-blocks/grc/blocks_copy.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Copy
+###################################################
+ -->
+<block>
+ <name>Copy</name>
+ <key>blocks_copy</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.copy($type.size*$vlen)
+self.$(id).set_enabled($enabled)</make>
+ <callback>set_enabled($enabled)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Enabled</name>
+ <key>enabled</key>
+ <value>True</value>
+ <type>bool</type>
+ <option>
+ <name>Enabled</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Disabled</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_ctrlport_performance.xml b/gr-blocks/grc/blocks_ctrlport_performance.xml
new file mode 100644
index 0000000000..20b57025db
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_performance.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<block>
+ <name>CtrlPort Performance Monitor</name>
+ <key>blocks_ctrlport_monitor_performance</key>
+ <category>Control Port</category>
+ <import>from gnuradio.ctrlport.monitor import *</import>
+ <make>not $en or monitor("gr-perf-monitorx")</make>
+ <param>
+ <name>Enabled</name>
+ <key>en</key>
+ <value></value>
+ <type>enum</type>
+ <option>
+ <name>True</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>False</name>
+ <key>False</key>
+ </option>
+ </param>
+
+ <doc>
+ Place this in a graph to launch a QtPy GR CtrlPort Performance Monitor app.
+ </doc>
+
+</block>
+
diff --git a/gr-blocks/grc/blocks_ctrlport_probe2_c.xml b/gr-blocks/grc/blocks_ctrlport_probe2_c.xml
new file mode 100644
index 0000000000..34f6dc0f50
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_probe2_c.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<block>
+ <name>Ctrlport Complex Probe (fixed len)</name>
+ <key>blocks_ctrlport_probe2_c</key>
+ <category>Control Port</category>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.ctrlport_probe2_c($name, $desc, $len)</make>
+ <callback>set_length($len)</callback>
+
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>constellation</value>
+ <type>string</type>
+ </param>
+
+ <param>
+ <name>Description</name>
+ <key>desc</key>
+ <value>Constellation Points</value>
+ <type>string</type>
+ </param>
+
+ <param>
+ <name>Length</name>
+ <key>len</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+
+
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+
+ <doc>
+ Place this in a graph to export complex values to a GRCP port probe.
+
+ * Version 2 allows you to specify a length in samples that you wish to get every probe
+ </doc>
+
+</block>
+
diff --git a/gr-blocks/grc/blocks_ctrlport_probe_c.xml b/gr-blocks/grc/blocks_ctrlport_probe_c.xml
new file mode 100644
index 0000000000..3b17823931
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_probe_c.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<block>
+ <name>Ctrlport Complex Probe</name>
+ <key>blocks_ctrlport_probe_c</key>
+ <category>Control Port</category>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.ctrlport_probe_c($name, $desc)</make>
+
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>constellation</value>
+ <type>string</type>
+ </param>
+
+ <param>
+ <name>Description</name>
+ <key>desc</key>
+ <value>Constellation Points</value>
+ <type>string</type>
+ </param>
+
+
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+
+ <doc>
+ Place this in a graph to export complex values to a GRCP port probe.
+ </doc>
+
+</block>
+
diff --git a/gr-blocks/grc/blocks_ctrlport_viewer.xml b/gr-blocks/grc/blocks_ctrlport_viewer.xml
new file mode 100644
index 0000000000..99abd6d4bd
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_viewer.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<block>
+ <name>CtrlPort Monitor</name>
+ <key>blocks_ctrlport_monitor</key>
+ <category>Control Port</category>
+ <import>from gnuradio.ctrlport.monitor import *</import>
+ <make>not $en or monitor()</make>
+ <param>
+ <name>Enabled</name>
+ <key>en</key>
+ <value></value>
+ <type>enum</type>
+ <option>
+ <name>True</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>False</name>
+ <key>False</key>
+ </option>
+ </param>
+
+ <doc>
+ Place this in a graph to launch a QtPy GR CtrlPort Monitor app.
+ </doc>
+
+</block>
+
diff --git a/gr-blocks/grc/blocks_deinterleave.xml b/gr-blocks/grc/blocks_deinterleave.xml
index 1030913241..e3970bd326 100644
--- a/gr-blocks/grc/blocks_deinterleave.xml
+++ b/gr-blocks/grc/blocks_deinterleave.xml
@@ -16,27 +16,27 @@
<option>
<name>Complex</name>
<key>complex</key>
- <opt>size:blocks.sizeof_blocks_complex</opt>
+ <opt>size:gr.sizeof_gr_complex</opt>
</option>
<option>
<name>Float</name>
<key>float</key>
- <opt>size:blocks.sizeof_float</opt>
+ <opt>size:gr.sizeof_float</opt>
</option>
<option>
<name>Int</name>
<key>int</key>
- <opt>size:blocks.sizeof_int</opt>
+ <opt>size:gr.sizeof_int</opt>
</option>
<option>
<name>Short</name>
<key>short</key>
- <opt>size:blocks.sizeof_short</opt>
+ <opt>size:gr.sizeof_short</opt>
</option>
<option>
<name>Byte</name>
<key>byte</key>
- <opt>size:blocks.sizeof_char</opt>
+ <opt>size:gr.sizeof_char</opt>
</option>
</param>
<param>
diff --git a/gr-blocks/grc/blocks_endian_swap.xml b/gr-blocks/grc/blocks_endian_swap.xml
new file mode 100644
index 0000000000..5fea420664
--- /dev/null
+++ b/gr-blocks/grc/blocks_endian_swap.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Add Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Endian Swap</name>
+ <key>blocks_endian_swap</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.endian_swap($type.size)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:8</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>s32</key>
+ <opt>size:4</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>s16</key>
+ <opt>size:2</opt>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_file_descriptor_sink.xml b/gr-blocks/grc/blocks_file_descriptor_sink.xml
new file mode 100644
index 0000000000..211d86dfd3
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_descriptor_sink.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Sink
+###################################################
+ -->
+<block>
+ <name>File Descriptor Sink</name>
+ <key>blocks_file_descriptor_sink</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.file_descriptor_sink($type.size*$vlen, $fd)</make>
+ <param>
+ <name>File Descriptor</name>
+ <key>fd</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_file_descriptor_source.xml b/gr-blocks/grc/blocks_file_descriptor_source.xml
new file mode 100644
index 0000000000..b29335c3af
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_descriptor_source.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Source
+###################################################
+ -->
+<block>
+ <name>File Descriptor Source</name>
+ <key>blocks_file_descriptor_source</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.file_descriptor_source($type.size*$vlen, $fd, $repeat)</make>
+ <param>
+ <name>File Descriptor</name>
+ <key>fd</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_file_sink.xml b/gr-blocks/grc/blocks_file_sink.xml
new file mode 100644
index 0000000000..75ef86a6b8
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_sink.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Sink
+###################################################
+ -->
+<block>
+ <name>File Sink</name>
+ <key>blocks_file_sink</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.file_sink($type.size*$vlen, $file)
+self.$(id).set_unbuffered($unbuffered)</make>
+ <callback>set_unbuffered($unbuffered)</callback>
+ <callback>open($file)</callback>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_save</type>
+ </param>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Unbuffered</name>
+ <key>unbuffered</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param>
+
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_head.xml b/gr-blocks/grc/blocks_head.xml
new file mode 100644
index 0000000000..8b6e67820c
--- /dev/null
+++ b/gr-blocks/grc/blocks_head.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Head
+###################################################
+ -->
+<block>
+ <name>Head</name>
+ <key>blocks_head</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.head($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_message_strobe.xml b/gr-blocks/grc/blocks_message_strobe.xml
index 25c98cd01c..8cd39a8bf2 100644
--- a/gr-blocks/grc/blocks_message_strobe.xml
+++ b/gr-blocks/grc/blocks_message_strobe.xml
@@ -8,7 +8,7 @@
<name>Message Strobe</name>
<key>blocks_message_strobe</key>
<import>from gnuradio import blocks</import>
- <import>from gruel import pmt</import>
+ <import>import pmt</import>
<make>blocks.message_strobe($msg, $period)</make>
<param>
<name>Message PMT</name>
diff --git a/gr-blocks/grc/blocks_nop.xml b/gr-blocks/grc/blocks_nop.xml
new file mode 100644
index 0000000000..d38c23839d
--- /dev/null
+++ b/gr-blocks/grc/blocks_nop.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Nop
+###################################################
+ -->
+<block>
+ <name>Nop</name>
+ <key>blocks_nop</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.nop($type.size*$vlen)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_null_sink.xml b/gr-blocks/grc/blocks_null_sink.xml
new file mode 100644
index 0000000000..2ae20e619a
--- /dev/null
+++ b/gr-blocks/grc/blocks_null_sink.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Null Sink
+###################################################
+ -->
+<block>
+ <name>Null Sink</name>
+ <key>blocks_null_sink</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.null_sink($type.size*$vlen)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_null_source.xml b/gr-blocks/grc/blocks_null_source.xml
new file mode 100644
index 0000000000..01d3905cab
--- /dev/null
+++ b/gr-blocks/grc/blocks_null_source.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Null Source
+###################################################
+ -->
+<block>
+ <name>Null Source</name>
+ <key>blocks_null_source</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.null_source($type.size*$vlen)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_plateau_detector_fb.xml b/gr-blocks/grc/blocks_plateau_detector_fb.xml
new file mode 100644
index 0000000000..90f67a4cf5
--- /dev/null
+++ b/gr-blocks/grc/blocks_plateau_detector_fb.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<block>
+ <name>Plateau Detector</name>
+ <key>blocks_plateau_detector_fb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.plateau_detector_fb($max_len, $threshold)</make>
+ <param>
+ <name>Max. plateau length</name>
+ <key>max_len</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Threshold</name>
+ <key>threshold</key>
+ <value>0.9</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_probe_rate.xml b/gr-blocks/grc/blocks_probe_rate.xml
new file mode 100644
index 0000000000..08df23e0d2
--- /dev/null
+++ b/gr-blocks/grc/blocks_probe_rate.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Probe Rate
+###################################################
+ -->
+<block>
+ <name>Probe Rate</name>
+ <key>blocks_probe_rate</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.probe_rate($type.size*$vlen, $mintime, $alpha)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Min Update Time (ms)</name>
+ <key>mintime</key>
+ <value>500.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Update Alpha</name>
+ <key>alpha</key>
+ <value>0.15</value>
+ <type>real</type>
+ </param>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_probe_signal_vx.xml b/gr-blocks/grc/blocks_probe_signal_vx.xml
index f8836f05c2..f4e945ab0d 100644
--- a/gr-blocks/grc/blocks_probe_signal_vx.xml
+++ b/gr-blocks/grc/blocks_probe_signal_vx.xml
@@ -45,9 +45,11 @@
<value>1</value>
<type>int</type>
</param>
+ <check>$vlen &gt; 0</check>
<sink>
<name>in</name>
<type>$type</type>
+ <vlen>$vlen</vlen>
</sink>
<doc>
Available functions to probe: level()
diff --git a/gr-blocks/grc/blocks_random_pdu.xml b/gr-blocks/grc/blocks_random_pdu.xml
index 640e14de8a..83e3e65fd6 100644
--- a/gr-blocks/grc/blocks_random_pdu.xml
+++ b/gr-blocks/grc/blocks_random_pdu.xml
@@ -8,7 +8,7 @@
<name>Random PDU Generator</name>
<key>blocks_random_pdu</key>
<import>from gnuradio import blocks</import>
- <import>from gruel import pmt</import>
+ <import>import pmt</import>
<make>blocks.random_pdu($minsize, $maxsize)</make>
<param>
<name>Min Bytes</name>
diff --git a/gr-blocks/grc/blocks_repack_bits_bb.xml b/gr-blocks/grc/blocks_repack_bits_bb.xml
new file mode 100644
index 0000000000..4ad5ec631b
--- /dev/null
+++ b/gr-blocks/grc/blocks_repack_bits_bb.xml
@@ -0,0 +1,46 @@
+<block>
+ <name>Repack Bits</name>
+ <key>blocks_repack_bits_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.repack_bits_bb($k, $l, $len_tag_key, $align_output)</make>
+ <param>
+ <name>Bits per input byte</name>
+ <key>k</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Bits per output byte</name>
+ <key>l</key>
+ <value>8</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Length Tag Key</name>
+ <key>len_tag_key</key>
+ <value>""</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Packet Alignment</name>
+ <key>align_output</key>
+ <value>False</value>
+ <type>enum</type>
+ <option>
+ <name>Output</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Input</name>
+ <key>False</key>
+ </option>
+ </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_skiphead.xml b/gr-blocks/grc/blocks_skiphead.xml
new file mode 100644
index 0000000000..7d90862830
--- /dev/null
+++ b/gr-blocks/grc/blocks_skiphead.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Skip Head
+###################################################
+ -->
+<block>
+ <name>Skip Head</name>
+ <key>blocks_skiphead</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.skiphead($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_tagged_file_sink.xml b/gr-blocks/grc/blocks_tagged_file_sink.xml
new file mode 100644
index 0000000000..a849c48c9a
--- /dev/null
+++ b/gr-blocks/grc/blocks_tagged_file_sink.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Tagged File Sink
+###################################################
+ -->
+<block>
+ <name>Tagged File Sink</name>
+ <key>blocks_tagged_file_sink</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.tagged_file_sink($type.size*$vlen, $samp_rate)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_tagged_stream_mux.xml b/gr-blocks/grc/blocks_tagged_stream_mux.xml
new file mode 100644
index 0000000000..40d98a3346
--- /dev/null
+++ b/gr-blocks/grc/blocks_tagged_stream_mux.xml
@@ -0,0 +1,65 @@
+<block>
+ <name>Tagged Stream Mux</name>
+ <key>blocks_tagged_stream_mux</key>
+ <category>Stream Operations</category>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.tagged_stream_mux($type.size*$vlen, $lengthtagname)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Number of inputs</name>
+ <key>ninputs</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Length tag names</name>
+ <key>lengthtagname</key>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Vector Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$ninputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
+
diff --git a/gr-blocks/grc/blocks_udp_sink.xml b/gr-blocks/grc/blocks_udp_sink.xml
new file mode 100644
index 0000000000..a001b2f1bb
--- /dev/null
+++ b/gr-blocks/grc/blocks_udp_sink.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##UDP Sink
+###################################################
+ -->
+<block>
+ <name>UDP Sink</name>
+ <key>blocks_udp_sink</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.udp_sink($type.size*$vlen, $ipaddr, $port, $psize, $eof)</make>
+ <callback>set_mtu($mtu)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Destination IP Address</name>
+ <key>ipaddr</key>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Destination Port</name>
+ <key>port</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Payload Size</name>
+ <key>psize</key>
+ <value>1472</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Send Null Pkt as EOF</name>
+ <key>eof</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_udp_source.xml b/gr-blocks/grc/blocks_udp_source.xml
new file mode 100644
index 0000000000..bca1dff8b8
--- /dev/null
+++ b/gr-blocks/grc/blocks_udp_source.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##UDP Source
+###################################################
+ -->
+<block>
+ <name>UDP Source</name>
+ <key>blocks_udp_source</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.udp_source($type.size*$vlen, $ipaddr, $port, $psize, $eof)</make>
+ <callback>set_mtu($mtu)</callback>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>IP Address</name>
+ <key>ipaddr</key>
+ <value>127.0.0.1</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Port</name>
+ <key>port</key>
+ <value>1234</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Payload Size</name>
+ <key>psize</key>
+ <value>1472</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Null Pkt is EOF</name>
+ <key>eof</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_vco_f.xml b/gr-blocks/grc/blocks_vco_f.xml
new file mode 100644
index 0000000000..77a3ba0bd4
--- /dev/null
+++ b/gr-blocks/grc/blocks_vco_f.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##VCO
+###################################################
+ -->
+<block>
+ <name>VCO</name>
+ <key>blocks_vco_f</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.vco_f($samp_rate, $sensitivity, $amplitude)</make>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sensitivity</name>
+ <key>sensitivity</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Amplitude</name>
+ <key>amplitude</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_vector_insert_x.xml b/gr-blocks/grc/blocks_vector_insert_x.xml
new file mode 100644
index 0000000000..2bc7ada2e6
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_insert_x.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector Source
+###################################################
+ -->
+<block>
+ <name>Vector Insert</name>
+ <key>blocks_vector_insert_x</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.vector_insert_$(type.fcn)($vector, $period, $offset)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ <opt>vec_type:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ <opt>vec_type:real_vector</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vector</name>
+ <key>vector</key>
+ <value>0, 0, 0</value>
+ <type>$type.vec_type</type>
+ </param>
+ <param>
+ <name>Periodicity</name>
+ <key>period</key>
+ <value>100</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Offset</name>
+ <key>offset</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+
+ <doc>
+ Periodicity, the length of the periodicity at which the vector should be inserted at the output.
+ (i.e. one vector for every N output items)
+
+ Offset sepcifies where in the cycle period we should begin at.
+ </doc>
+</block>
diff --git a/gr-blocks/grc/blocks_vector_sink_x.xml b/gr-blocks/grc/blocks_vector_sink_x.xml
new file mode 100644
index 0000000000..7f51731975
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_sink_x.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector sink
+###################################################
+ -->
+<block>
+ <name>Vector Sink</name>
+ <key>blocks_vector_sink_x</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.vector_sink_$(type.fcn)($vlen)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_vector_source_x.xml b/gr-blocks/grc/blocks_vector_source_x.xml
new file mode 100644
index 0000000000..6de3f5b184
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_source_x.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector Source
+###################################################
+ -->
+<block>
+ <name>Vector Source</name>
+ <key>blocks_vector_source_x</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.vector_source_$(type.fcn)($vector, $repeat, $vlen, $tags)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ <opt>vec_type:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ <opt>vec_type:real_vector</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vector</name>
+ <key>vector</key>
+ <value>(0, 0, 0)</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Tags</name>
+ <key>tags</key>
+ <value>[]</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_wavfile_sink.xml b/gr-blocks/grc/blocks_wavfile_sink.xml
new file mode 100644
index 0000000000..8e81d8d202
--- /dev/null
+++ b/gr-blocks/grc/blocks_wavfile_sink.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Wav File Sink
+###################################################
+ -->
+<block>
+ <name>Wav File Sink</name>
+ <key>blocks_wavfile_sink</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.wavfile_sink($file, $nchan, $samp_rate, $bits_per_sample)</make>
+ <callback>open($file)</callback>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_save</type>
+ </param>
+ <param>
+ <name>N Channels</name>
+ <key>nchan</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Bits per Sample</name>
+ <key>bits_per_sample</key>
+ <value>8</value>
+ <type>int</type>
+ </param>
+ <check>1 &lt;= $nchan</check>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <nports>$nchan</nports>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_wavfile_source.xml b/gr-blocks/grc/blocks_wavfile_source.xml
new file mode 100644
index 0000000000..deb48472a4
--- /dev/null
+++ b/gr-blocks/grc/blocks_wavfile_source.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Wav File Source
+###################################################
+ -->
+<block>
+ <name>Wav File Source</name>
+ <key>blocks_wavfile_source</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.wavfile_source($file, $repeat)</make>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_open</type>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>N Channels</name>
+ <key>nchan</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>1 &lt;= $nchan</check>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <nports>$nchan</nports>
+ </source>
+</block>
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
index 24451903d0..14346f9c15 100644
--- a/gr-blocks/include/blocks/CMakeLists.txt
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -26,7 +26,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
#!${PYTHON_EXECUTABLE}
import sys, os, re
-sys.path.append('${GR_CORE_PYTHONPATH}')
+sys.path.append('${GR_RUNTIME_PYTHONPATH}')
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
@@ -65,8 +65,8 @@ endmacro(expand_h)
# Invoke macro to generate various sources
########################################################################
expand_h(add_XX ss ii cc)
-expand_h(add_const_XX ss ii ff cc)
-expand_h(add_const_vXX ss ii ff cc)
+expand_h(add_const_XX bb ss ii ff cc)
+expand_h(add_const_vXX bb ss ii ff cc)
expand_h(and_XX bb ss ii)
expand_h(and_const_XX bb ss ii)
expand_h(argmax_XX fs is ss)
@@ -88,6 +88,9 @@ expand_h(sub_XX ss ii ff cc)
expand_h(xor_XX bb ss ii)
expand_h(packed_to_unpacked_XX bb ss ii)
expand_h(unpacked_to_packed_XX bb ss ii)
+expand_h(vector_insert_X b s i f c)
+expand_h(vector_sink_X b s i f c)
+expand_h(vector_source_X b s i f c)
add_custom_target(blocks_generated_includes DEPENDS
${generated_includes}
@@ -99,13 +102,23 @@ add_custom_target(blocks_generated_includes DEPENDS
install(FILES
${generated_includes}
api.h
+ control_loop.h
count_bits.h
+ file_sink_base.h
+ lfsr_15_1_0.h
+ lfsr_32k.h
log2_const.h
+ rotator.h
+ wavfile.h
add_ff.h
+ annotator_1to1.h
+ annotator_alltoall.h
+ annotator_raw.h
bin_statistics_f.h
burst_tagger.h
char_to_float.h
char_to_short.h
+ check_lfsr_32k_s.h
complex_to_interleaved_short.h
complex_to_float.h
complex_to_imag.h
@@ -114,8 +127,13 @@ install(FILES
complex_to_mag_squared.h
complex_to_arg.h
conjugate_cc.h
+ copy.h
deinterleave.h
delay.h
+ endian_swap.h
+ file_descriptor_sink.h
+ file_descriptor_source.h
+ file_sink.h
file_source.h
file_meta_sink.h
file_meta_source.h
@@ -124,11 +142,13 @@ install(FILES
float_to_int.h
float_to_short.h
float_to_uchar.h
+ head.h
int_to_float.h
interleave.h
interleaved_short_to_complex.h
keep_m_in_n.h
keep_one_in_n.h
+ lfsr_32k_source_s.h
message_debug.h
message_sink.h
message_source.h
@@ -140,18 +160,25 @@ install(FILES
multiply_const_cc.h
multiply_const_ff.h
nlog10_ff.h
+ nop.h
+ null_sink.h
+ null_source.h
pack_k_bits_bb.h
patterned_interleaver.h
pdu.h
pdu_to_tagged_stream.h
peak_detector2_fb.h
random_pdu.h
+ plateau_detector_fb.h
+ probe_rate.h
regenerate_bb.h
+ repack_bits_bb.h
repeat.h
rms_cf.h
rms_ff.h
short_to_char.h
short_to_float.h
+ skiphead.h
socket_pdu.h
stream_mux.h
stream_to_streams.h
@@ -160,15 +187,32 @@ install(FILES
streams_to_vector.h
stretch_ff.h
tag_debug.h
+ tagged_file_sink.h
+ tagged_stream_mux.h
tagged_stream_to_pdu.h
threshold_ff.h
throttle.h
transcendental.h
tuntap_pdu.h
uchar_to_float.h
+ udp_sink.h
+ udp_source.h
unpack_k_bits_bb.h
+ vco_f.h
+ vector_map.h
vector_to_stream.h
vector_to_streams.h
+ wavfile_sink.h
+ wavfile_source.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
COMPONENT "blocks_devel"
)
+
+if(ENABLE_GR_CTRLPORT)
+install(FILES
+ ctrlport_probe_c.h
+ ctrlport_probe2_c.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
+ COMPONENT "blocks_devel"
+)
+endif(ENABLE_GR_CTRLPORT)
diff --git a/gr-blocks/include/blocks/annotator_1to1.h b/gr-blocks/include/blocks/annotator_1to1.h
new file mode 100644
index 0000000000..6cc8db6eef
--- /dev/null
+++ b/gr-blocks/include/blocks/annotator_1to1.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H
+#define INCLUDED_GR_ANNOTATOR_1TO1_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000
+ * items it sees. The tags contain the name and ID of the
+ * instantiated block, use "seq" as a key, and have a counter that
+ * increments by 1 for every tag produced that is used as the
+ * tag's value. The tags are propagated using the 1-to-1 policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These
+ * tags can be recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+ class BLOCKS_API annotator_1to1 : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::annotator_1to1::sptr
+ typedef boost::shared_ptr<annotator_1to1> sptr;
+
+ static sptr make(int when, size_t sizeof_stream_item);
+
+ virtual std::vector<gr_tag_t> data() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ANNOTATOR_1TO1_H */
diff --git a/gr-blocks/include/blocks/annotator_alltoall.h b/gr-blocks/include/blocks/annotator_alltoall.h
new file mode 100644
index 0000000000..558aea69ca
--- /dev/null
+++ b/gr-blocks/include/blocks/annotator_alltoall.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000
+ * items it sees. The tags contain the name and ID of the
+ * instantiated block, use "seq" as a key, and have a counter that
+ * increments by 1 for every tag produced that is used as the
+ * tag's value. The tags are propagated using the all-to-all
+ * policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These
+ * tags can be recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+ class BLOCKS_API annotator_alltoall : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::annotator_alltoall::sptr
+ typedef boost::shared_ptr<annotator_alltoall> sptr;
+
+ static sptr make(int when, size_t sizeof_stream_item);
+
+ virtual std::vector<gr_tag_t> data() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ANNOTATOR_ALLTOALL_H */
diff --git a/gr-blocks/include/blocks/annotator_raw.h b/gr-blocks/include/blocks/annotator_raw.h
new file mode 100644
index 0000000000..ae273c2a46
--- /dev/null
+++ b/gr-blocks/include/blocks/annotator_raw.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_RAW_H
+#define INCLUDED_GR_ANNOTATOR_RAW_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <gr_tags.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief raw stream annotator testing block.
+ *
+ * This block creates arbitrary tags to be sent downstream blocks
+ * to be sent are set manually via accessor methods and are sent
+ * only once.
+ *
+ * This block is intended for testing of tag related blocks
+ */
+ class BLOCKS_API annotator_raw : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::annotator_raw::sptr
+ typedef boost::shared_ptr<annotator_raw> sptr;
+
+ static sptr make(size_t sizeof_stream_item);
+
+ // insert a tag to be added
+ virtual void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ANNOTATOR_RAW_H */
diff --git a/gr-blocks/include/blocks/api.h b/gr-blocks/include/blocks/api.h
index 45fbc0d216..d77bdbdd5b 100644
--- a/gr-blocks/include/blocks/api.h
+++ b/gr-blocks/include/blocks/api.h
@@ -22,7 +22,7 @@
#ifndef INCLUDED_BLOCKS_API_H
#define INCLUDED_BLOCKS_API_H
-#include <gruel/attributes.h>
+#include <attributes.h>
#ifdef gnuradio_blocks_EXPORTS
# define BLOCKS_API __GR_ATTR_EXPORT
diff --git a/gr-blocks/include/blocks/check_lfsr_32k_s.h b/gr-blocks/include/blocks/check_lfsr_32k_s.h
new file mode 100644
index 0000000000..4eba436e80
--- /dev/null
+++ b/gr-blocks/include/blocks/check_lfsr_32k_s.h
@@ -0,0 +1,56 @@
+/* -*- 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_CHECK_LFSR_32K_S_H
+#define INCLUDED_GR_CHECK_LFSR_32K_S_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief sink that checks if its input stream consists of a lfsr_32k sequence.
+ * \ingroup sink_blk
+ *
+ * This sink is typically used along with
+ * gr::blocks::lfsr_32k_source_s to test the USRP using its
+ * digital loopback mode.
+ */
+ class BLOCKS_API check_lfsr_32k_s : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::check_lfsr_32k_s::sptr
+ typedef boost::shared_ptr<check_lfsr_32k_s> sptr;
+
+ static sptr make();
+
+ virtual long ntotal () const = 0;
+ virtual long nright () const = 0;
+ virtual long runlength () const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_CHECK_LFSR_32K_S_H */
diff --git a/gr-blocks/include/blocks/control_loop.h b/gr-blocks/include/blocks/control_loop.h
new file mode 100644
index 0000000000..7c09f5915b
--- /dev/null
+++ b/gr-blocks/include/blocks/control_loop.h
@@ -0,0 +1,234 @@
+/* -*- 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 GR_BLOCKS_CONTROL_LOOP
+#define GR_BLOCKS_CONTROL_LOOP
+
+#include <blocks/api.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API control_loop
+ {
+ protected:
+ float d_phase, d_freq;
+ float d_max_freq, d_min_freq;
+ float d_damping, d_loop_bw;
+ float d_alpha, d_beta;
+
+ public:
+ control_loop(void) {}
+ control_loop(float loop_bw, float max_freq, float min_freq);
+ virtual ~control_loop();
+
+ /*! \brief update the system gains from the loop bandwidth and damping factor
+ *
+ * This function updates the system gains based on the loop
+ * bandwidth and damping factor of the system. These two
+ * factors can be set separately through their own set
+ * functions.
+ */
+ void update_gains();
+
+ /*! \brief Advance the control loop based on the current gain
+ * settings and the inputted error signal.
+ */
+ void advance_loop(float error);
+
+ /*! \brief Keep the phase between -2pi and 2pi
+ *
+ * This function keeps the phase between -2pi and 2pi. If the
+ * phase is greater than 2pi by d, it wraps around to be -2pi+d;
+ * similarly if it is less than -2pi by d, it wraps around to
+ * 2pi-d.
+ *
+ * This function should be called after advance_loop to keep the
+ * phase in a good operating region. It is set as a separate
+ * method in case another way is desired as this is fairly
+ * heavy-handed.
+ */
+ void phase_wrap();
+
+ /*! \brief Keep the frequency between d_min_freq and d_max_freq
+ *
+ * This function keeps the frequency between d_min_freq and
+ * d_max_freq. If the frequency is greater than d_max_freq, it
+ * is set to d_max_freq. If the frequency is less than
+ * d_min_freq, it is set to d_min_freq.
+ *
+ * This function should be called after advance_loop to keep the
+ * frequency in the specified region. It is set as a separate
+ * method in case another way is desired as this is fairly
+ * heavy-handed.
+ */
+ void frequency_limit();
+
+ /*******************************************************************
+ * SET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Set the loop bandwidth
+ *
+ * Set the loop filter's bandwidth to \p bw. This should be
+ * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be
+ * a positive number.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param bw (float) new bandwidth
+ */
+ virtual void set_loop_bandwidth(float bw);
+
+ /*!
+ * \brief Set the loop damping factor
+ *
+ * Set the loop filter's damping factor to \p df. The damping
+ * factor should be sqrt(2)/2.0 for critically damped systems.
+ * Set it to anything else only if you know what you are
+ * doing. It must be a number between 0 and 1.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param df (float) new damping factor
+ */
+ void set_damping_factor(float df);
+
+ /*!
+ * \brief Set the loop gain alpha
+ *
+ * Set's the loop filter's alpha gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param alpha (float) new alpha gain
+ *
+ */
+ void set_alpha(float alpha);
+
+ /*!
+ * \brief Set the loop gain beta
+ *
+ * Set's the loop filter's beta gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param beta (float) new beta gain
+ */
+ void set_beta(float beta);
+
+ /*!
+ * \brief Set the control loop's frequency.
+ *
+ * Set's the control loop's frequency. While this is normally
+ * updated by the inner loop of the algorithm, it could be
+ * useful to manually initialize, set, or reset this under
+ * certain circumstances.
+ *
+ * \param freq (float) new frequency
+ */
+ void set_frequency(float freq);
+
+ /*!
+ * \brief Set the control loop's phase.
+ *
+ * Set's the control loop's phase. While this is normally
+ * updated by the inner loop of the algorithm, it could be
+ * useful to manually initialize, set, or reset this under
+ * certain circumstances.
+ *
+ * \param phase (float) new phase
+ */
+ void set_phase(float phase);
+
+ /*!
+ * \brief Set the control loop's maximum frequency.
+ *
+ * Set the maximum frequency the control loop can track.
+ *
+ * \param freq (float) new max frequency
+ */
+ void set_max_freq(float freq);
+
+ /*!
+ * \brief Set the control loop's minimum frequency.
+ *
+ * Set the minimum frequency the control loop can track.
+ *
+ * \param freq (float) new min frequency
+ */
+ void set_min_freq(float freq);
+
+ /*******************************************************************
+ * GET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Returns the loop bandwidth
+ */
+ float get_loop_bandwidth() const;
+
+ /*!
+ * \brief Returns the loop damping factor
+ */
+ float get_damping_factor() const;
+
+ /*!
+ * \brief Returns the loop gain alpha
+ */
+ float get_alpha() const;
+
+ /*!
+ * \brief Returns the loop gain beta
+ */
+ float get_beta() const;
+
+ /*!
+ * \brief Get the control loop's frequency estimate
+ */
+ float get_frequency() const;
+
+ /*!
+ * \brief Get the control loop's phase estimate
+ */
+ float get_phase() const;
+
+ /*!
+ * \brief Get the control loop's maximum frequency.
+ */
+ float get_max_freq() const;
+
+ /*!
+ * \brief Get the control loop's minimum frequency.
+ */
+ float get_min_freq() const;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* GR_BLOCKS_CONTROL_LOOP */
diff --git a/gr-blocks/include/blocks/copy.h b/gr-blocks/include/blocks/copy.h
new file mode 100644
index 0000000000..5ed0ea0e92
--- /dev/null
+++ b/gr-blocks/include/blocks/copy.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,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_COPY_H
+#define INCLUDED_GR_COPY_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output[i] = input[i]
+ * \ingroup misc_blk
+ *
+ * When enabled (default), this block copies its input to its
+ * output. When disabled, this block drops its input on the floor.
+ */
+ class BLOCKS_API copy : virtual public gr_block
+ {
+ public:
+ // gr::blocks::copy::sptr
+ typedef boost::shared_ptr<copy> sptr;
+
+ static sptr make(size_t itemsize);
+
+ virtual void set_enabled(bool enable) = 0;
+ virtual bool enabled() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_COPY_H */
diff --git a/gr-blocks/include/blocks/ctrlport_probe2_c.h b/gr-blocks/include/blocks/ctrlport_probe2_c.h
new file mode 100644
index 0000000000..9a6034fcca
--- /dev/null
+++ b/gr-blocks/include/blocks/ctrlport_probe2_c.h
@@ -0,0 +1,64 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_CTRLPORT_PROBE2_C_H
+#define INCLUDED_CTRLPORT_PROBE2_C_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A ControlPort probe to export vectors of signals.
+ *
+ * This block acts as a sink in the flowgraph but also exports
+ * vectors of complex samples over ControlPort. This block holds
+ * the latest \p len number of complex samples so that every query
+ * by a ControlPort client will get the same length vector.
+ */
+ class BLOCKS_API ctrlport_probe2_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::ctrlport_probe2_c::sptr
+ typedef boost::shared_ptr<ctrlport_probe2_c> sptr;
+
+ /*!
+ * \brief Make a ControlPort probe block.
+ * \param id A string ID to name the probe over ControlPort.
+ * \param desc A string describing the probe.
+ * \param len Number of samples to transmit.
+ */
+ static sptr make(const std::string &id, const std::string &desc, int len);
+
+ virtual std::vector<gr_complex> get() = 0;
+
+ virtual void set_length(int len) = 0;
+ virtual int length() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_CTRLPORT_PROBE2_C_H */
+
diff --git a/gr-blocks/include/blocks/ctrlport_probe_c.h b/gr-blocks/include/blocks/ctrlport_probe_c.h
new file mode 100644
index 0000000000..92fe8c5600
--- /dev/null
+++ b/gr-blocks/include/blocks/ctrlport_probe_c.h
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_CTRLPORT_PROBE_C_H
+#define INCLUDED_CTRLPORT_PROBE_C_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <rpcregisterhelpers.h>
+#include <boost/thread/shared_mutex.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A ControlPort probe to export vectors of signals.
+ *
+ * This block acts as a sink in the flowgraph but also exports
+ * vectors of complex samples over ControlPort. This block simply
+ * sends the current vector held in the work function when the
+ * queried by a ControlPort client.
+ */
+ class BLOCKS_API ctrlport_probe_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::ctrlport_probe_c::sptr
+ typedef boost::shared_ptr<ctrlport_probe_c> sptr;
+
+ /*!
+ * \brief Make a ControlPort probe block.
+ * \param id A string ID to name the probe over ControlPort.
+ * \param desc A string describing the probe.
+ */
+ static sptr make(const std::string &id, const std::string &desc);
+
+ virtual std::vector<gr_complex> get() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_H */
+
diff --git a/gr-blocks/include/blocks/endian_swap.h b/gr-blocks/include/blocks/endian_swap.h
new file mode 100644
index 0000000000..4b5a76218e
--- /dev/null
+++ b/gr-blocks/include/blocks/endian_swap.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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_ENDIAN_SWAP_H
+#define INCLUDED_GR_ENDIAN_SWAP_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of items into thier byte swapped version
+ *
+ * \param item_size_bytes number of bytes per item, 1=no-op,
+ * 2=uint16_t, 4=uint32_t, 8=uint64_t
+ */
+ class BLOCKS_API endian_swap : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::endian_swap::sptr
+ typedef boost::shared_ptr<endian_swap> sptr;
+
+ static sptr make(size_t item_size_bytes=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ENDIAN_SWAP_H */
diff --git a/gr-blocks/include/blocks/file_descriptor_sink.h b/gr-blocks/include/blocks/file_descriptor_sink.h
new file mode 100644
index 0000000000..df59e24c0a
--- /dev/null
+++ b/gr-blocks/include/blocks/file_descriptor_sink.h
@@ -0,0 +1,54 @@
+/* -*- 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_FILE_DESCRIPTOR_SINK_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to file descriptor.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API file_descriptor_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::file_descriptor_sink::sptr
+ typedef boost::shared_ptr<file_descriptor_sink> sptr;
+
+ /*!
+ * Build a file descriptor sink block.
+ *
+ * \param itemsize item size of the incoming data stream.
+ * \param fd file descriptor (as an integer).
+ */
+ static sptr make(size_t itemsize, int fd);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SINK_H */
diff --git a/gr-blocks/include/blocks/file_descriptor_source.h b/gr-blocks/include/blocks/file_descriptor_source.h
new file mode 100644
index 0000000000..ff4f14792b
--- /dev/null
+++ b/gr-blocks/include/blocks/file_descriptor_source.h
@@ -0,0 +1,61 @@
+/* -*- 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_FILE_DESCRIPTOR_SOURCE_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read stream from file descriptor.
+ * \ingroup source_blk
+ */
+ class BLOCKS_API file_descriptor_source : virtual public gr_sync_block
+ {
+ protected:
+ virtual int read_items(char *buf, int nitems) = 0;
+ virtual int handle_residue(char *buf, int nbytes_read) = 0;
+ virtual void flush_residue() = 0;
+
+ public:
+ // gr::blocks::file_descriptor_source::sptr
+ typedef boost::shared_ptr<file_descriptor_source> sptr;
+
+ /*!
+ * Build a file descriptor source block.
+ *
+ * \param itemsize item size of the incoming data stream.
+ * \param fd file descriptor (as an integer).
+ * \param repeat repeat the data stream continuously.
+ */
+ static sptr make(size_t itemsize, int fd, bool repeat);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H */
diff --git a/gr-blocks/include/blocks/file_sink.h b/gr-blocks/include/blocks/file_sink.h
new file mode 100644
index 0000000000..08c2adf1f7
--- /dev/null
+++ b/gr-blocks/include/blocks/file_sink.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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_FILE_SINK_H
+#define INCLUDED_GR_FILE_SINK_H
+
+#include <blocks/api.h>
+#include <blocks/file_sink_base.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to file.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API file_sink : virtual public gr_sync_block,
+ virtual public file_sink_base
+ {
+ public:
+ // gr::blocks::file_sink::sptr
+ typedef boost::shared_ptr<file_sink> sptr;
+
+ /*!
+ * \brief Make a file sink.
+ * \param itemsize size of the input data items.
+ * \param filename name of the file to open and write output to.
+ */
+ static sptr make(size_t itemsize, const char *filename);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_SINK_H */
diff --git a/gr-blocks/include/blocks/file_sink_base.h b/gr-blocks/include/blocks/file_sink_base.h
new file mode 100644
index 0000000000..3eeb0e63da
--- /dev/null
+++ b/gr-blocks/include/blocks/file_sink_base.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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_FILE_SINK_BASE_H
+#define INCLUDED_GR_FILE_SINK_BASE_H
+
+#include <blocks/api.h>
+#include <boost/thread.hpp>
+#include <cstdio>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Common base class for file sinks
+ */
+ class BLOCKS_API file_sink_base
+ {
+ protected:
+ FILE *d_fp; // current FILE pointer
+ FILE *d_new_fp; // new FILE pointer
+ bool d_updated; // is there a new FILE pointer?
+ bool d_is_binary;
+ boost::mutex d_mutex;
+ bool d_unbuffered;
+
+ protected:
+ file_sink_base(const char *filename, bool is_binary);
+
+ public:
+ file_sink_base() {}
+ ~file_sink_base();
+
+ /*!
+ * \brief Open filename and begin output to it.
+ */
+ bool open(const char *filename);
+
+ /*!
+ * \brief Close current output file.
+ *
+ * Closes current output file and ignores any output until
+ * open is called to connect to another file.
+ */
+ void close();
+
+ /*!
+ * \brief if we've had an update, do it now.
+ */
+ void do_update();
+
+ /*!
+ * \brief turn on unbuffered writes for slower outputs
+ */
+ void set_unbuffered(bool unbuffered);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_SINK_BASE_H */
diff --git a/gr-blocks/include/blocks/head.h b/gr-blocks/include/blocks/head.h
new file mode 100644
index 0000000000..cc7d3808e5
--- /dev/null
+++ b/gr-blocks/include/blocks/head.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_HEAD_H
+#define INCLUDED_GR_HEAD_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief copies the first N items to the output then signals done
+ * \ingroup slicedice_blk
+ *
+ * Useful for building test cases
+ */
+ class BLOCKS_API head : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::head::sptr
+ typedef boost::shared_ptr<head> sptr;
+
+ static sptr make(size_t sizeof_stream_item,
+ uint64_t nitems);
+
+ virtual void reset() = 0;
+ virtual void set_length(int nitems) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_HEAD_H */
diff --git a/gr-blocks/include/blocks/lfsr_15_1_0.h b/gr-blocks/include/blocks/lfsr_15_1_0.h
new file mode 100644
index 0000000000..a79ed62eb8
--- /dev/null
+++ b/gr-blocks/include/blocks/lfsr_15_1_0.h
@@ -0,0 +1,69 @@
+/* -*- 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_GRI_LFSR_15_1_0_H
+#define INCLUDED_GRI_LFSR_15_1_0_H
+
+#include <blocks/api.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1
+ * \ingroup misc
+ *
+ * Generates a maximal length pseudo-random sequence of length
+ * 2^15 - 1 bits.
+ */
+ class BLOCKS_API lfsr_15_1_0
+ {
+ private:
+ unsigned long d_sr; // shift register
+
+ public:
+ lfsr_15_1_0() { reset(); }
+
+ void reset() { d_sr = 0x7fff; }
+
+ int next_bit()
+ {
+ d_sr = ((((d_sr >> 1) ^ d_sr) & 0x1) << 14) | (d_sr >> 1);
+ return d_sr & 0x1;
+ }
+
+ int next_byte ()
+ {
+ int v = 0;
+ for(int i = 0; i < 8; i++) {
+ v >>= 1;
+ if(next_bit ())
+ v |= 0x80;
+ }
+ return v;
+ }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GRI_LFSR_15_1_0_H */
diff --git a/gr-blocks/include/blocks/lfsr_32k.h b/gr-blocks/include/blocks/lfsr_32k.h
new file mode 100644
index 0000000000..7e70f6512b
--- /dev/null
+++ b/gr-blocks/include/blocks/lfsr_32k.h
@@ -0,0 +1,90 @@
+/* -*- 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_GRI_LFSR_32k_H
+#define INCLUDED_GRI_LFSR_32k_H
+
+#include <blocks/api.h>
+#include <blocks/lfsr_15_1_0.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief generate pseudo-random sequence of length 32768 bits.
+ * \ingroup misc
+ *
+ * This is based on gri_lfsr_15_1_0 with an extra 0 added at the
+ * end of the sequence.
+ */
+ class BLOCKS_API lfsr_32k
+ {
+ private:
+ lfsr_15_1_0 d_lfsr;
+ unsigned int d_count;
+
+ public:
+ lfsr_32k() { reset (); }
+
+ void reset()
+ {
+ d_lfsr.reset();
+ d_count = 0;
+ }
+
+ int next_bit()
+ {
+ if(d_count == 32767) {
+ d_count = 0;
+ return 0;
+ }
+ d_count++;
+ return d_lfsr.next_bit();
+ }
+
+ int next_byte()
+ {
+ int v = 0;
+ for(int i = 0; i < 8; i++) {
+ v >>= 1;
+ if(next_bit ())
+ v |= 0x80;
+ }
+ return v;
+ }
+
+ int next_short()
+ {
+ int v = 0;
+ for(int i = 0; i < 16; i++) {
+ v >>= 1;
+ if(next_bit ())
+ v |= 0x8000;
+ }
+ return v;
+ }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GRI_LFSR_32k_H */
diff --git a/gr-blocks/include/blocks/lfsr_32k_source_s.h b/gr-blocks/include/blocks/lfsr_32k_source_s.h
new file mode 100644
index 0000000000..c24cc31b29
--- /dev/null
+++ b/gr-blocks/include/blocks/lfsr_32k_source_s.h
@@ -0,0 +1,55 @@
+/* -*- 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_LFSR_32K_SOURCE_S_H
+#define INCLUDED_GR_LFSR_32K_SOURCE_S_H
+
+#include <blocks/api.h>
+#include <blocks/lfsr_32k.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts)
+ * \ingroup source_blk
+ *
+ * This source is typically used along with gr::blocks::check_lfsr_32k_s to
+ * test the USRP using its digital loopback mode.
+ */
+ class BLOCKS_API lfsr_32k_source_s : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::lfsr_32k_source_s::sptr
+ typedef boost::shared_ptr<lfsr_32k_source_s> sptr;
+
+ /*!
+ * \brief Make a LFSR 32k source block.
+ */
+ static sptr make();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_LFSR_32K_SOURCE_S_H */
diff --git a/gr-blocks/include/blocks/message_sink.h b/gr-blocks/include/blocks/message_sink.h
index 5d14836dd4..5d3084d02d 100644
--- a/gr-blocks/include/blocks/message_sink.h
+++ b/gr-blocks/include/blocks/message_sink.h
@@ -40,7 +40,10 @@ namespace gr {
// gr::blocks::message_sink::sptr
typedef boost::shared_ptr<message_sink> sptr;
- static sptr make (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block,
+ const std::string& lengthtagname);
+
};
} /* namespace blocks */
diff --git a/gr-blocks/include/blocks/message_source.h b/gr-blocks/include/blocks/message_source.h
index 5b55191880..cf4bafc22b 100644
--- a/gr-blocks/include/blocks/message_source.h
+++ b/gr-blocks/include/blocks/message_source.h
@@ -42,6 +42,8 @@ namespace gr {
static sptr make(size_t itemsize, int msgq_limit=0);
static sptr make(size_t itemsize, gr_msg_queue_sptr msgq);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq,
+ const std::string& lengthtagname);
virtual gr_msg_queue_sptr msgq() const = 0;
};
diff --git a/gr-blocks/include/blocks/mute_XX.h.t b/gr-blocks/include/blocks/mute_XX.h.t
index 3033248c4e..2b1c8b9a4d 100644
--- a/gr-blocks/include/blocks/mute_XX.h.t
+++ b/gr-blocks/include/blocks/mute_XX.h.t
@@ -41,10 +41,10 @@ namespace gr {
// gr::blocks::@NAME@::sptr
typedef boost::shared_ptr<@NAME@> sptr;
- static sptr make(bool mute);
+ static sptr make(bool mute=false);
virtual bool mute() const = 0;
- virtual void set_mute(bool mute) = 0;
+ virtual void set_mute(bool mute=false) = 0;
};
} /* namespace blocks */
diff --git a/gr-blocks/include/blocks/nop.h b/gr-blocks/include/blocks/nop.h
new file mode 100644
index 0000000000..a75adad621
--- /dev/null
+++ b/gr-blocks/include/blocks/nop.h
@@ -0,0 +1,59 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NOP_H
+#define INCLUDED_GR_NOP_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Does nothing. Used for testing only.
+ * \ingroup misc_blk
+ */
+ class BLOCKS_API nop : virtual public gr_block
+ {
+ public:
+ // gr::blocks::nop::sptr
+ typedef boost::shared_ptr<nop> sptr;
+
+ /*!
+ * Build a nop block.
+ *
+ * \param sizeof_stream_item size of the stream items in bytes.
+ */
+ static sptr make(size_t sizeof_stream_item);
+
+ virtual int nmsgs_received() const = 0;
+
+ virtual int ctrlport_test() const = 0;
+ virtual void set_ctrlport_test(int x) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_NOP_H */
diff --git a/gr-blocks/include/blocks/null_sink.h b/gr-blocks/include/blocks/null_sink.h
new file mode 100644
index 0000000000..c13a7552c6
--- /dev/null
+++ b/gr-blocks/include/blocks/null_sink.h
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NULL_SINK_H
+#define INCLUDED_GR_NULL_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Bit bucket. Use as a termination point when a sink is
+ * required and we don't want to do anything real.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API null_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::null_sink::sptr
+ typedef boost::shared_ptr<null_sink> sptr;
+
+ /*!
+ * Build a null sink block.
+ *
+ * \param sizeof_stream_item size of the stream items in bytes.
+ */
+ static sptr make(size_t sizeof_stream_item);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_NULL_SINK_H */
diff --git a/gr-blocks/include/blocks/null_source.h b/gr-blocks/include/blocks/null_source.h
new file mode 100644
index 0000000000..904a0c1ba3
--- /dev/null
+++ b/gr-blocks/include/blocks/null_source.h
@@ -0,0 +1,53 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NULL_SOURCE_H
+#define INCLUDED_GR_NULL_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A source of zeros used mainly for testing.
+ * \ingroup source_blk
+ */
+ class BLOCKS_API null_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::null_source::sptr
+ typedef boost::shared_ptr<null_source> sptr;
+
+ /*!
+ * Build a null source block.
+ *
+ * \param sizeof_stream_item size of the stream items in bytes.
+ */
+ static sptr make(size_t sizeof_stream_item);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_NULL_SOURCE_H */
diff --git a/gr-blocks/include/blocks/pdu.h b/gr-blocks/include/blocks/pdu.h
index de0999c574..8890c5cb17 100644
--- a/gr-blocks/include/blocks/pdu.h
+++ b/gr-blocks/include/blocks/pdu.h
@@ -25,7 +25,7 @@
#include <blocks/api.h>
#include <gr_complex.h>
-#include <gruel/pmt.h>
+#include <pmt/pmt.h>
#define PDU_PORT_ID pmt::mp("pdus")
#define PDU_LENGTH_TAG pmt::mp("pdu_length")
@@ -38,7 +38,7 @@ namespace gr {
BLOCKS_API size_t itemsize(vector_type type);
BLOCKS_API bool type_matches(vector_type type, pmt::pmt_t v);
- BLOCKS_API pmt::pmt_t make_vector(vector_type type, const uint8_t* buf, size_t items);
+ BLOCKS_API pmt::pmt_t make_pdu_vector(vector_type type, const uint8_t* buf, size_t items);
BLOCKS_API vector_type type_from_pmt(pmt::pmt_t vector);
} /* namespace pdu */
diff --git a/gr-blocks/include/blocks/peak_detector_XX.h.t b/gr-blocks/include/blocks/peak_detector_XX.h.t
index 1c8ba0652f..fead53d208 100644
--- a/gr-blocks/include/blocks/peak_detector_XX.h.t
+++ b/gr-blocks/include/blocks/peak_detector_XX.h.t
@@ -38,7 +38,7 @@ namespace gr {
* If a peak is detected, this block outputs a 1,
* or it outputs 0's.
*/
- class GR_CORE_API @NAME@ : virtual public gr_sync_block
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
{
public:
// gr::blocks::@NAME@::sptr
diff --git a/gr-blocks/include/blocks/plateau_detector_fb.h b/gr-blocks/include/blocks/plateau_detector_fb.h
new file mode 100644
index 0000000000..041f9c1baf
--- /dev/null
+++ b/gr-blocks/include/blocks/plateau_detector_fb.h
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H
+#define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Detects a plateau and marks the middle.
+ *
+ * Detect a plateau of a-priori known height. Input is a stream of floats,
+ * the output is a stream of bytes. Whenever a plateau is detected, the
+ * middle of that plateau is marked with a '1' on the output stream (all
+ * other samples are left at zero).
+ *
+ * You can use this in a Schmidl & Cox synchronisation algorithm to interpret
+ * the output of the normalized correlator. Just pass the length of the cyclic
+ * prefix (in samples) as the max_len parameter).
+ *
+ * Unlike the peak detectors, you must the now the absolute height of the plateau.
+ * Whenever the amplitude exceeds the given threshold, it starts assuming the
+ * presence of a plateau.
+ *
+ * An implicit hysteresis is provided by the fact that after detecting one plateau,
+ * it waits at least max_len samples before the next plateau can be detected.
+ *
+ * \ingroup level_blk
+ *
+ */
+ class BLOCKS_API plateau_detector_fb : virtual public gr_sync_block
+ {
+ public:
+ typedef boost::shared_ptr<plateau_detector_fb> sptr;
+
+ /*!
+ * \param max_len Maximum length of the plateau
+ * \param threshold Anything above this value is considered a plateau
+ */
+ static sptr make(int max_len, float threshold=0.9);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H */
+
diff --git a/gr-blocks/include/blocks/probe_rate.h b/gr-blocks/include/blocks/probe_rate.h
new file mode 100644
index 0000000000..3401d2acd1
--- /dev/null
+++ b/gr-blocks/include/blocks/probe_rate.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_PROBE_RATE_H
+#define INCLUDED_BLOCKS_PROBE_RATE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief throughput measurement
+ */
+ class BLOCKS_API probe_rate : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::probe_rate::sptr
+ typedef boost::shared_ptr<probe_rate> sptr;
+
+ /*!
+ * \brief Make a throughput measurement block
+ * \param itemsize size of each stream item
+ * \param update_rate_ms minimum update time in milliseconds
+ * \param alpha gain for running average filter
+ */
+ static sptr make(size_t itemsize, double update_rate_ms = 500.0, double alpha = 0.0001);
+
+ virtual void set_alpha(double alpha) = 0;
+
+ virtual double rate() = 0;
+
+ virtual bool start() = 0;
+ virtual bool stop() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_PROBE_RATE_H */
diff --git a/gr-blocks/include/blocks/repack_bits_bb.h b/gr-blocks/include/blocks/repack_bits_bb.h
new file mode 100644
index 0000000000..9ade0a4353
--- /dev/null
+++ b/gr-blocks/include/blocks/repack_bits_bb.h
@@ -0,0 +1,65 @@
+/* -*- 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_BLOCKS_REPACK_BITS_BB_H
+#define INCLUDED_BLOCKS_REPACK_BITS_BB_H
+
+#include <blocks/api.h>
+#include <gr_tagged_stream_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Pack \p k bits from the input stream onto \p k bits of the output stream.
+ * \ingroup blocks
+ *
+ * No bits are lost here; any value for k and l (within [1, 8]) is allowed.
+ * On every fresh input byte, it starts reading on the LSB, and starts copying
+ * to the LSB as well.
+ *
+ * If a packet length tag is given, this block assumes a tagged stream.
+ * In this case, the tag with the packet length is updated accordingly.
+ * Also, the number of input bits is padded with zeros if the number of input
+ * bits is not an integer multiple of \p l, or bits are truncated from the input
+ * if \p align_output is set to true.
+ */
+ class BLOCKS_API repack_bits_bb : virtual public gr_tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr<repack_bits_bb> sptr;
+
+ /*!
+ * \param k Number of relevant bits on the input stream
+ * \param l Number of relevant bits on the output stream
+ * \param len_tag_key If not empty, this is the key for the length tag.
+ * \param align_output If len_tag_key is given, this controls if the input
+ * or the output is aligned.
+ */
+ static sptr make(int k, int l=8, const std::string &len_tag_key="", bool align_output=false);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_BLOCKS_REPACK_BITS_BB_H */
+
diff --git a/gr-blocks/include/blocks/rotator.h b/gr-blocks/include/blocks/rotator.h
new file mode 100644
index 0000000000..96ece63574
--- /dev/null
+++ b/gr-blocks/include/blocks/rotator.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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 _GR_ROTATOR_H_
+#define _GR_ROTATOR_H_
+
+#include <blocks/api.h>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API rotator
+ {
+ private:
+ gr_complex d_phase;
+ gr_complex d_phase_incr;
+ unsigned int d_counter;
+
+ public:
+ rotator() : d_phase(1), d_phase_incr(1), d_counter(0)
+ { }
+
+ void set_phase(gr_complex phase) { d_phase = phase / abs(phase); }
+ void set_phase_incr(gr_complex incr) { d_phase_incr = incr / abs(incr); }
+
+ gr_complex rotate(gr_complex in)
+ {
+ d_counter++;
+
+ gr_complex z = in * d_phase; // rotate in by phase
+ d_phase *= d_phase_incr; // incr our phase (complex mult == add phases)
+
+ if((d_counter % 512) == 0)
+ d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation
+
+ return z;
+ }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* _GR_ROTATOR_H_ */
diff --git a/gr-blocks/include/blocks/skiphead.h b/gr-blocks/include/blocks/skiphead.h
new file mode 100644
index 0000000000..e6745af8ea
--- /dev/null
+++ b/gr-blocks/include/blocks/skiphead.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_SKIPHEAD_H
+#define INCLUDED_GR_SKIPHEAD_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief skips the first N items, from then on copies items to the output
+ * \ingroup slicedice_blk
+ *
+ * Useful for building test cases and sources which have metadata
+ * or junk at the start
+ */
+ class BLOCKS_API skiphead : virtual public gr_block
+ {
+ public:
+ // gr::blocks::skiphead::sptr
+ typedef boost::shared_ptr<skiphead> sptr;
+
+ static sptr make(size_t itemsize,
+ uint64_t nitems_to_skip);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SKIPHEAD_H */
diff --git a/gr-blocks/include/blocks/tagged_file_sink.h b/gr-blocks/include/blocks/tagged_file_sink.h
new file mode 100644
index 0000000000..62da72f789
--- /dev/null
+++ b/gr-blocks/include/blocks/tagged_file_sink.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_TAGGED_FILE_SINK_H
+#define INCLUDED_GR_TAGGED_FILE_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A file sink that uses tags to save files.
+ * \ingroup sink_blk
+ *
+ * The sink uses a tag with the key 'burst' to trigger the saving
+ * of the burst data to a new file. If the value of this tag is
+ * True, it will open a new file and start writing all incoming
+ * data to it. If the tag is False, it will close the file (if
+ * already opened). The file names are based on the time when the
+ * burst tag was seen. If there is an 'rx_time' tag (standard with
+ * UHD sources), that is used as the time. If no 'rx_time' tag is
+ * found, the new time is calculated based off the sample rate of
+ * the block.
+ */
+ class BLOCKS_API tagged_file_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::tagged_file_sink::sptr
+ typedef boost::shared_ptr<tagged_file_sink> sptr;
+
+ /*!
+ * \brief Build a tagged_file_sink block.
+ *
+ * \param itemsize The item size of the input data stream.
+ * \param samp_rate The sample rate used to determine the time
+ * difference between bursts
+ */
+ static sptr make(size_t itemsize, double samp_rate);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */
diff --git a/gr-blocks/include/blocks/tagged_stream_mux.h b/gr-blocks/include/blocks/tagged_stream_mux.h
new file mode 100644
index 0000000000..d271cf890f
--- /dev/null
+++ b/gr-blocks/include/blocks/tagged_stream_mux.h
@@ -0,0 +1,61 @@
+/* -*- 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_TAGGED_STREAM_MUX_H
+#define INCLUDED_TAGGED_STREAM_MUX_H
+
+#include <blocks/api.h>
+#include <gr_tagged_stream_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Combines tagged streams.
+ *
+ * Takes N streams as input. Each stream is tagged with packet lengths.
+ * Packets are output sequentially from each input stream.
+ *
+ * The output signal has a new length tag, which is the sum of all
+ * individual length tags. The old length tags are discarded.
+ *
+ * All other tags are propagated as expected, i.e. they stay associated
+ * with the same input item.
+ *
+ * \ingroup blocks
+ */
+ class BLOCKS_API tagged_stream_mux : virtual public gr_tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr<tagged_stream_mux> sptr;
+
+ /*!
+ * \param itemsize Items size (number of bytes per item)
+ * \param lengthtagname Length tag key
+ */
+ static sptr make(size_t itemsize, const std::string &lengthtagname);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_TAGGED_STREAM_MUX_H */
+
diff --git a/gr-blocks/include/blocks/udp_sink.h b/gr-blocks/include/blocks/udp_sink.h
new file mode 100644
index 0000000000..69c5f0ffae
--- /dev/null
+++ b/gr-blocks/include/blocks/udp_sink.h
@@ -0,0 +1,81 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_UDP_SINK_H
+#define INCLUDED_GR_UDP_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to an UDP socket.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API udp_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::udp_sink::sptr
+ typedef boost::shared_ptr<udp_sink> sptr;
+
+ /*!
+ * \brief UDP Sink Constructor
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None for no connection
+ * \param port Destination port to connect to on receiving host
+ * \param payload_size UDP payload size by default set to
+ * 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Send zero-length packet on disconnect
+ */
+ static sptr make(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size=1472, bool eof=true);
+
+ /*! \brief return the PAYLOAD_SIZE of the socket */
+ virtual int payload_size() = 0;
+
+ /*! \brief Change the connection to a new destination
+ *
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None to break the connection without closing
+ * \param port Destination port to connect to on receiving host
+ *
+ * Calls disconnect() to terminate any current connection first.
+ */
+ virtual void connect(const std::string &host, int port) = 0;
+
+ /*! \brief Send zero-length packet (if eof is requested) then stop sending
+ *
+ * Zero-byte packets can be interpreted as EOF by gr_udp_source.
+ * Note that disconnect occurs automatically when the sink is
+ * destroyed, but not when its top_block stops.*/
+ virtual void disconnect() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UDP_SINK_H */
diff --git a/gr-blocks/include/blocks/udp_source.h b/gr-blocks/include/blocks/udp_source.h
new file mode 100644
index 0000000000..b72db30db0
--- /dev/null
+++ b/gr-blocks/include/blocks/udp_source.h
@@ -0,0 +1,84 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_UDP_SOURCE_H
+#define INCLUDED_GR_UDP_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read stream from an UDP socket.
+ * \ingroup source_blk
+ */
+ class BLOCKS_API udp_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::udp_source::sptr
+ typedef boost::shared_ptr<udp_source> sptr;
+
+ /*!
+ * \brief UDP Source Constructor
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; can be
+ * NULL, None, or "0.0.0.0" to allow reading from any
+ * interface on the host
+ * \param port The port number on which to receive data; use 0 to
+ * have the system assign an unused port number
+ * \param payload_size UDP payload size by default set to 1472 =
+ * (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Interpret zero-length packet as EOF (default: true)
+ */
+ static sptr make(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size=1472,
+ bool eof=true);
+
+ /*! \brief Change the connection to a new destination
+ *
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None to break the connection without closing
+ * \param port Destination port to connect to on receiving host
+ *
+ * Calls disconnect() to terminate any current connection first.
+ */
+ virtual void connect(const std::string &host, int port) = 0;
+
+ /*! \brief Cut the connection if we have one set up.
+ */
+ virtual void disconnect() = 0;
+
+ /*! \brief return the PAYLOAD_SIZE of the socket */
+ virtual int payload_size() = 0;
+
+ /*! \brief return the port number of the socket */
+ virtual int get_port() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UDP_SOURCE_H */
diff --git a/gr-blocks/include/blocks/vco_f.h b/gr-blocks/include/blocks/vco_f.h
new file mode 100644
index 0000000000..0a5bf97d1f
--- /dev/null
+++ b/gr-blocks/include/blocks/vco_f.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_VCO_F_H
+#define INCLUDED_GR_VCO_F_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief VCO - Voltage controlled oscillator
+ * \ingroup misc
+ *
+ * input: float stream of control voltages; output: float oscillator output
+ */
+ class BLOCKS_API vco_f : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::vco_f::sptr
+ typedef boost::shared_ptr<vco_f> sptr;
+
+ /*!
+ * \brief VCO - Voltage controlled oscillator
+ *
+ * \param sampling_rate sampling rate (Hz)
+ * \param sensitivity units are radians/sec/volt
+ * \param amplitude output amplitude
+ */
+ static sptr make(double sampling_rate, double sensitivity, double amplitude);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_VCO_F_H */
diff --git a/gr-blocks/include/blocks/vector_insert_X.h.t b/gr-blocks/include/blocks/vector_insert_X.h.t
new file mode 100644
index 0000000000..aeb4a5248a
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_insert_X.h.t
@@ -0,0 +1,54 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief source of @TYPE@'s that gets its data from a vector
+ * \ingroup source_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(const std::vector<@TYPE@> &data,
+ int periodicity, int offset=0);
+
+ virtual void rewind() = 0;
+ virtual void set_data(const std::vector<@TYPE@> &data) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/vector_map.h b/gr-blocks/include/blocks/vector_map.h
new file mode 100644
index 0000000000..64c8744975
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_map.h
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_VECTOR_MAP_H
+#define INCLUDED_GR_VECTOR_MAP_H
+
+#include <blocks/api.h>
+#include <vector>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Maps elements from a set of input vectors to a set of output vectors.
+ * \ingroup slicedice_blk
+ *
+ * If in[i] is the input vector in the i'th stream then the output
+ * vector in the j'th stream is:
+ *
+ * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]]
+ *
+ * That is mapping is of the form (out_stream1_mapping,
+ * out_stream2_mapping, ...) and out_stream1_mapping is of the
+ * form (element1_mapping, element2_mapping, ...) and
+ * element1_mapping is of the form (in_stream, in_element).
+ */
+ class BLOCKS_API vector_map : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::vector_map::sptr
+ typedef boost::shared_ptr<vector_map> sptr;
+
+ /*!
+ * Build a vector map block.
+ *
+ * \param item_size (integer) size of vector elements
+ * \param in_vlens (vector of integers) number of elements in each
+ * input vector
+ * \param mapping (vector of vectors of vectors of integers) how to
+ * map elements from input to output vectors
+ */
+ static sptr make(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping);
+
+ virtual void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_VECTOR_MAP_H */
diff --git a/gr-blocks/include/blocks/vector_sink_X.h.t b/gr-blocks/include/blocks/vector_sink_X.h.t
new file mode 100644
index 0000000000..d15c795721
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_sink_X.h.t
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2009,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief @TYPE@ sink that writes to a vector
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(int vlen = 1);
+
+ virtual void reset() = 0;
+ virtual std::vector<@TYPE@> data() const = 0;
+ virtual std::vector<gr_tag_t> tags() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/vector_source_X.h.t b/gr-blocks/include/blocks/vector_source_X.h.t
new file mode 100644
index 0000000000..c68b638e62
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_source_X.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief source of @TYPE@'s that gets its data from a vector
+ * \ingroup source_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(const std::vector<@TYPE@> &data,
+ bool repeat=false, int vlen=1,
+ const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>());
+
+ virtual void rewind() = 0;
+ virtual void set_data(const std::vector<@TYPE@> &data,
+ const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/wavfile.h b/gr-blocks/include/blocks/wavfile.h
new file mode 100644
index 0000000000..b852c01e2d
--- /dev/null
+++ b/gr-blocks/include/blocks/wavfile.h
@@ -0,0 +1,101 @@
+/* -*- 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.
+ */
+
+// This file stores all the RIFF file type knowledge for the wavfile_*
+// blocks.
+
+#include <blocks/api.h>
+#include <cstdio>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read signal information from a given WAV file.
+ *
+ * \param[in] fp File pointer to an opened, empty file.
+ * \param[out] sample_rate Stores the sample rate [S/s]
+ * \param[out] nchans Number of channels
+ * \param[out] bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding o
+ * 8 or 16 bit samples, respectively)
+ * \param[out] first_sample_pos Number of the first byte containing a sample. Use this
+ * with fseek() to jump from the end of the file to the
+ * first sample when in repeat mode.
+ * \param[out] samples_per_chan Number of samples per channel
+ * \return True on a successful read, false if the file could not be read or is
+ * not a valid WAV file.
+ */
+ bool
+ wavheader_parse(FILE *fp,
+ unsigned int &sample_rate,
+ int &nchans,
+ int &bytes_per_sample,
+ int &first_sample_pos,
+ unsigned int &samples_per_chan);
+
+ /*!
+ * \brief Read one sample from an open WAV file at the current position.
+ *
+ * Takes care of endianness.
+ */
+ short int
+ wav_read_sample(FILE *fp, int bytes_per_sample);
+
+
+ /*!
+ * \brief Write a valid RIFF file header
+ *
+ * Note: Some header values are kept blank because they're usually
+ * not known a-priori (file and chunk lengths). Use
+ * gri_wavheader_complete() to fill these in.
+ */
+ bool
+ wavheader_write(FILE *fp,
+ unsigned int sample_rate,
+ int nchans,
+ int bytes_per_sample);
+
+ /*!
+ * \brief Write one sample to an open WAV file at the current position.
+ *
+ * Takes care of endianness.
+ */
+ void
+ wav_write_sample(FILE *fp, short int sample, int bytes_per_sample);
+
+
+ /*!
+ * \brief Complete a WAV header
+ *
+ * Note: The stream position is changed during this function. If
+ * anything needs to be written to the WAV file after calling this
+ * function (which shouldn't happen), you need to fseek() to the
+ * end of the file (or whereever).
+ *
+ * \param[in] fp File pointer to an open WAV file with a blank header
+ * \param[in] byte_count Length of all samples written to the file in bytes.
+ */
+ bool
+ wavheader_complete(FILE *fp, unsigned int byte_count);
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/include/blocks/wavfile_sink.h b/gr-blocks/include/blocks/wavfile_sink.h
new file mode 100644
index 0000000000..b095191d07
--- /dev/null
+++ b/gr-blocks/include/blocks/wavfile_sink.h
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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_WAVFILE_SINK_H
+#define INCLUDED_GR_WAVFILE_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to a Microsoft PCM (.wav) file.
+ *
+ * Values must be floats within [-1;1].
+ * Check gr_make_wavfile_sink() for extra info.
+ *
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API wavfile_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::wavfile_sink::sptr
+ typedef boost::shared_ptr<wavfile_sink> sptr;
+
+ /*
+ * \p filename The .wav file to be opened
+ * \p n_channels Number of channels (2 = stereo or I/Q output)
+ * \p sample_rate Sample rate [S/s]
+ * \p bits_per_sample 16 or 8 bit, default is 16
+ */
+ static sptr make(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample = 16);
+
+ /*!
+ * \brief Opens a new file and writes a WAV header. Thread-safe.
+ */
+ virtual bool open(const char* filename) = 0;
+
+ /*!
+ * \brief Closes the currently active file and completes the WAV
+ * header. Thread-safe.
+ */
+ virtual void close() = 0;
+
+ /*!
+ * \brief Set the sample rate. This will not affect the WAV file
+ * currently opened. Any following open() calls will use this new
+ * sample rate.
+ */
+ virtual void set_sample_rate(unsigned int sample_rate) = 0;
+
+ /*!
+ * \brief Set bits per sample. This will not affect the WAV file
+ * currently opened (see set_sample_rate()). If the value is
+ * neither 8 nor 16, the call is ignored and the current value
+ * is kept.
+ */
+ virtual void set_bits_per_sample(int bits_per_sample) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_WAVFILE_SINK_H */
diff --git a/gr-blocks/include/blocks/wavfile_source.h b/gr-blocks/include/blocks/wavfile_source.h
new file mode 100644
index 0000000000..46cb82b698
--- /dev/null
+++ b/gr-blocks/include/blocks/wavfile_source.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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_WAVFILE_SOURCE_H
+#define INCLUDED_GR_WAVFILE_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read stream from a Microsoft PCM (.wav) file, output floats
+ *
+ * Unless otherwise called, values are within [-1;1].
+ * Check gr_make_wavfile_source() for extra info.
+ *
+ * \ingroup source_blk
+ */
+ class BLOCKS_API wavfile_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::wavfile_source::sptr
+ typedef boost::shared_ptr<wavfile_source> sptr;
+
+ static sptr make(const char *filename, bool repeat = false);
+
+ /*!
+ * \brief Read the sample rate as specified in the wav file header
+ */
+ virtual unsigned int sample_rate() const = 0;
+
+ /*!
+ * \brief Return the number of bits per sample as specified in
+ * the wav file header. Only 8 or 16 bit are supported here.
+ */
+ virtual int bits_per_sample() const = 0;
+
+ /*!
+ * \brief Return the number of channels in the wav file as
+ * specified in the wav file header. This is also the max number
+ * of outputs you can have.
+ */
+ virtual int channels() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_WAVFILE_SOURCE_H */
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 60603ca31e..bdd7ca77a6 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -31,7 +31,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
#!${PYTHON_EXECUTABLE}
import sys, os, re
-sys.path.append('${GR_CORE_PYTHONPATH}')
+sys.path.append('${GR_RUNTIME_PYTHONPATH}')
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
@@ -91,8 +91,8 @@ endmacro(expand_cc_h_impl)
# Invoke macro to generate various sources
########################################################################
expand_cc_h_impl(add_XX ss ii cc)
-expand_cc_h_impl(add_const_XX ss ii ff cc)
-expand_cc_h_impl(add_const_vXX ss ii ff cc)
+expand_cc_h_impl(add_const_XX bb ss ii ff cc)
+expand_cc_h_impl(add_const_vXX bb ss ii ff cc)
expand_cc_h_impl(and_XX bb ss ii)
expand_cc_h_impl(and_const_XX bb ss ii)
expand_cc_h_impl(argmax_XX fs is ss)
@@ -114,6 +114,9 @@ expand_cc_h_impl(sub_XX ss ii ff cc)
expand_cc_h_impl(xor_XX bb ss ii)
expand_cc_h_impl(packed_to_unpacked_XX bb ss ii)
expand_cc_h_impl(unpacked_to_packed_XX bb ss ii)
+expand_cc_h_impl(vector_insert_X b s i f c)
+expand_cc_h_impl(vector_sink_X b s i f c)
+expand_cc_h_impl(vector_source_X b s i f c)
########################################################################
# Setup the include and linker paths
@@ -123,9 +126,8 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/../include
${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_INCLUDE_DIRS}
${VOLK_INCLUDE_DIRS}
- ${GRUEL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
@@ -141,12 +143,19 @@ endif(ENABLE_GR_CTRLPORT)
########################################################################
list(APPEND gr_blocks_sources
${generated_sources}
+ control_loop.cc
count_bits.cc
+ file_sink_base.cc
+ wavfile.cc
add_ff_impl.cc
+ annotator_1to1_impl.cc
+ annotator_alltoall_impl.cc
+ annotator_raw_impl.cc
bin_statistics_f_impl.cc
burst_tagger_impl.cc
char_to_float_impl.cc
char_to_short_impl.cc
+ check_lfsr_32k_s_impl.cc
complex_to_interleaved_short_impl.cc
complex_to_float_impl.cc
complex_to_real_impl.cc
@@ -155,8 +164,13 @@ list(APPEND gr_blocks_sources
complex_to_mag_squared_impl.cc
complex_to_arg_impl.cc
conjugate_cc_impl.cc
+ copy_impl.cc
deinterleave_impl.cc
delay_impl.cc
+ endian_swap_impl.cc
+ file_descriptor_sink_impl.cc
+ file_descriptor_source_impl.cc
+ file_sink_impl.cc
file_source_impl.cc
file_meta_sink_impl.cc
file_meta_source_impl.cc
@@ -167,12 +181,14 @@ list(APPEND gr_blocks_sources
float_to_short_impl.cc
float_array_to_uchar.cc
float_to_uchar_impl.cc
+ head_impl.cc
int_to_float_impl.cc
interleave_impl.cc
interleaved_short_array_to_complex.cc
interleaved_short_to_complex_impl.cc
keep_m_in_n_impl.cc
keep_one_in_n_impl.cc
+ lfsr_32k_source_s_impl.cc
message_debug_impl.cc
message_sink_impl.cc
message_source_impl.cc
@@ -184,6 +200,9 @@ list(APPEND gr_blocks_sources
multiply_const_cc_impl.cc
multiply_const_ff_impl.cc
nlog10_ff_impl.cc
+ nop_impl.cc
+ null_sink_impl.cc
+ null_source_impl.cc
pack_k_bits_bb_impl.cc
patterned_interleaver_impl.cc
pdu.cc
@@ -191,12 +210,16 @@ list(APPEND gr_blocks_sources
pdu_to_tagged_stream_impl.cc
peak_detector2_fb_impl.cc
random_pdu_impl.cc
+ plateau_detector_fb_impl.cc
+ probe_rate_impl.cc
regenerate_bb_impl.cc
+ repack_bits_bb_impl.cc
repeat_impl.cc
rms_cf_impl.cc
rms_ff_impl.cc
short_to_char_impl.cc
short_to_float_impl.cc
+ skiphead_impl.cc
socket_pdu_impl.cc
stream_mux_impl.cc
stream_pdu_base.cc
@@ -205,19 +228,34 @@ list(APPEND gr_blocks_sources
streams_to_stream_impl.cc
streams_to_vector_impl.cc
stretch_ff_impl.cc
+ tagged_file_sink_impl.cc
tagged_stream_to_pdu_impl.cc
threshold_ff_impl.cc
throttle_impl.cc
transcendental_impl.cc
tcp_connection.cc
tuntap_pdu_impl.cc
+ tagged_stream_mux_impl.cc
uchar_array_to_float.cc
uchar_to_float_impl.cc
+ udp_sink_impl.cc
+ udp_source_impl.cc
unpack_k_bits_bb_impl.cc
+ vco_f_impl.cc
+ vector_map_impl.cc
vector_to_stream_impl.cc
vector_to_streams_impl.cc
+ wavfile_sink_impl.cc
+ wavfile_source_impl.cc
)
+if(ENABLE_GR_CTRLPORT)
+list(APPEND gr_blocks_sources
+ ctrlport_probe_c_impl.cc
+ ctrlport_probe2_c_impl.cc
+)
+endif(ENABLE_GR_CTRLPORT)
+
#Add Windows DLL resource file if using MSVC
IF(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -233,10 +271,11 @@ IF(MSVC)
ENDIF(MSVC)
list(APPEND blocks_libs
- gnuradio-core
+ gnuradio-runtime
volk
${Boost_LIBRARIES}
${BLOCKS_LIBRARIES}
+ ${LOG4CPP_LIBRARIES}
)
add_library(gnuradio-blocks SHARED ${gr_blocks_sources})
@@ -244,3 +283,41 @@ add_dependencies(gnuradio-blocks blocks_generated_includes)
target_link_libraries(gnuradio-blocks ${blocks_libs})
GR_LIBRARY_FOO(gnuradio-blocks RUNTIME_COMPONENT "blocks_runtime" DEVEL_COMPONENT "blocks_devel")
+
+########################################################################
+# QA C++ Code for gr-filter
+########################################################################
+if(ENABLE_TESTING)
+ include(GrTest)
+
+ include_directories(
+ ${GR_BLOCKS_INCLUDE_DIRS}
+ ${CPPUNIT_INCLUDE_DIRS})
+ link_directories(${CPPUNIT_LIBRARY_DIRS})
+
+ list(APPEND test_gr_blocks_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_blocks.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_blocks.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_rotator.cc
+ )
+
+ add_executable(test-gr-blocks ${test_gr_blocks_sources})
+
+ list(APPEND GR_TEST_TARGET_DEPS test-gr-blocks gnuradio-blocks)
+
+ target_link_libraries(
+ test-gr-blocks
+ gnuradio-runtime
+ gnuradio-blocks
+ ${Boost_LIBRARIES}
+ ${CPPUNIT_LIBRARIES}
+ ${LOG4CPP_LIBRARIES}
+ )
+
+ GR_ADD_TEST(test_gr_blocks test-gr-blocks)
+endif(ENABLE_TESTING)
diff --git a/gr-blocks/lib/annotator_1to1_impl.cc b/gr-blocks/lib/annotator_1to1_impl.cc
new file mode 100644
index 0000000000..e7f105fc02
--- /dev/null
+++ b/gr-blocks/lib/annotator_1to1_impl.cc
@@ -0,0 +1,113 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 "annotator_1to1_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+namespace gr {
+ namespace blocks {
+
+ annotator_1to1::sptr
+ annotator_1to1::make(int when, size_t sizeof_stream_item)
+ {
+ return gnuradio::get_initial_sptr
+ (new annotator_1to1_impl(when, sizeof_stream_item));
+ }
+
+ annotator_1to1_impl::annotator_1to1_impl(int when, size_t sizeof_stream_item)
+ : gr_sync_block("annotator_1to1",
+ gr_make_io_signature(1, -1, sizeof_stream_item),
+ gr_make_io_signature(1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+ {
+ set_tag_propagation_policy(TPP_ONE_TO_ONE);
+
+ d_tag_counter = 0;
+ set_relative_rate(1.0);
+ }
+
+ annotator_1to1_impl::~annotator_1to1_impl()
+ {
+ }
+
+ int
+ annotator_1to1_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];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+
+ std::vector<gr_tag_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items);
+
+ std::vector<gr_tag_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Storing the current noutput_items as the value to the "noutput_items" key
+ pmt::pmt_t srcid = pmt::string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ // Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_read(0);
+ int noutputs = output_items.size();
+ for(int j = 0; j < noutput_items; j++) {
+ // the min() is a hack to make sure this doesn't segfault if
+ // there are a different number of ins and outs. This is
+ // specifically designed to test the 1-to-1 propagation policy.
+ for(int i = 0; i < std::min(noutputs, ninputs); i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ in = (const float*)input_items[i];
+ out = (float*)output_items[i];
+ out[j] = in[j];
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/annotator_1to1_impl.h b/gr-blocks/lib/annotator_1to1_impl.h
new file mode 100644
index 0000000000..3306602e2c
--- /dev/null
+++ b/gr-blocks/lib/annotator_1to1_impl.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_1TO1_IMPL_H
+#define INCLUDED_GR_ANNOTATOR_1TO1_IMPL_H
+
+#include <blocks/annotator_1to1.h>
+
+namespace gr {
+ namespace blocks {
+
+ class annotator_1to1_impl : public annotator_1to1
+ {
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<gr_tag_t> d_stored_tags;
+
+ public:
+ annotator_1to1_impl(int when, size_t sizeof_stream_item);
+ ~annotator_1to1_impl();
+
+ std::vector<gr_tag_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+ 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_ANNOTATOR_1TO1_IMPL_H */
diff --git a/gr-blocks/lib/annotator_alltoall_impl.cc b/gr-blocks/lib/annotator_alltoall_impl.cc
new file mode 100644
index 0000000000..4909f7f820
--- /dev/null
+++ b/gr-blocks/lib/annotator_alltoall_impl.cc
@@ -0,0 +1,117 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 "annotator_alltoall_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+namespace gr {
+ namespace blocks {
+
+ annotator_alltoall::sptr
+ annotator_alltoall::make(int when, size_t sizeof_stream_item)
+ {
+ return gnuradio::get_initial_sptr
+ (new annotator_alltoall_impl(when, sizeof_stream_item));
+ }
+
+ annotator_alltoall_impl::annotator_alltoall_impl(int when,
+ size_t sizeof_stream_item)
+ : gr_sync_block("annotator_alltoall",
+ gr_make_io_signature(1, -1, sizeof_stream_item),
+ gr_make_io_signature(1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+ {
+ set_tag_propagation_policy(TPP_ALL_TO_ALL);
+
+ d_tag_counter = 0;
+ }
+
+ annotator_alltoall_impl::~annotator_alltoall_impl()
+ {
+ }
+
+ int
+ annotator_alltoall_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];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0, end_N;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+ end_N = abs_N + (uint64_t)(noutput_items);
+
+ std::vector<gr_tag_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, end_N);
+
+ std::vector<gr_tag_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Source ID and key for any tag that might get applied from this block
+ pmt::pmt_t srcid = pmt::string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to
+ // outputs Adds a new tag when the number of items read is a
+ // multiple of d_when
+ abs_N = nitems_written(0);
+ int noutputs = output_items.size();
+
+ for(int j = 0; j < noutput_items; j++) {
+ for(int i = 0; i < noutputs; i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ // Sum all of the inputs together for each output. Just 'cause.
+ out = (float*)output_items[i];
+ out[j] = 0;
+ for(int ins = 0; ins < ninputs; ins++) {
+ in = (const float*)input_items[ins];
+ out[j] += in[j];
+ }
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/annotator_alltoall_impl.h b/gr-blocks/lib/annotator_alltoall_impl.h
new file mode 100644
index 0000000000..24c21948bc
--- /dev/null
+++ b/gr-blocks/lib/annotator_alltoall_impl.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_IMPL_H
+#define INCLUDED_GR_ANNOTATOR_ALLTOALL_IMPL_H
+
+#include <blocks/annotator_alltoall.h>
+
+namespace gr {
+ namespace blocks {
+
+ class annotator_alltoall_impl : public annotator_alltoall
+ {
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<gr_tag_t> d_stored_tags;
+
+ public:
+ annotator_alltoall_impl(int when, size_t sizeof_stream_item);
+ ~annotator_alltoall_impl();
+
+ std::vector<gr_tag_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+ 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_ANNOTATOR_ALLTOALL_IMPL_H */
diff --git a/gr-blocks/lib/annotator_raw_impl.cc b/gr-blocks/lib/annotator_raw_impl.cc
new file mode 100644
index 0000000000..ee5deb1f6b
--- /dev/null
+++ b/gr-blocks/lib/annotator_raw_impl.cc
@@ -0,0 +1,113 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 "annotator_raw_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+#include <stdexcept>
+
+using namespace pmt;
+
+namespace gr {
+ namespace blocks {
+
+ annotator_raw::sptr
+ annotator_raw::make(size_t sizeof_stream_item)
+ {
+ return gnuradio::get_initial_sptr
+ (new annotator_raw_impl(sizeof_stream_item));
+ }
+
+ annotator_raw_impl::annotator_raw_impl(size_t sizeof_stream_item)
+ : gr_sync_block("annotator_raw",
+ gr_make_io_signature(1, 1, sizeof_stream_item),
+ gr_make_io_signature(1, 1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item)
+ {
+ set_tag_propagation_policy(TPP_ONE_TO_ONE);
+ set_relative_rate(1.0);
+ }
+
+ annotator_raw_impl::~annotator_raw_impl()
+ {
+ }
+
+ void
+ annotator_raw_impl::add_tag(uint64_t offset, pmt_t key, pmt_t val)
+ {
+ gr::thread::scoped_lock l(d_mutex);
+
+ gr_tag_t tag;
+ tag.srcid = pmt::intern(name());
+ tag.key = key;
+ tag.value = val;
+ tag.offset = offset;
+
+ // add our new tag
+ d_queued_tags.push_back(tag);
+ // make sure our tags are in offset order
+ std::sort(d_queued_tags.begin(), d_queued_tags.end(),
+ gr_tag_t::offset_compare);
+ // make sure we are not adding an item in the past!
+ if(tag.offset > nitems_read(0)) {
+ throw std::runtime_error("annotator_raw::add_tag: item added too far in the past\n.");
+ }
+ }
+
+ int
+ annotator_raw_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock l(d_mutex);
+
+ const char *in = (const char*)input_items[0];
+ char *out = (char*)output_items[0];
+
+ uint64_t start_N = nitems_read(0);
+ uint64_t end_N = start_N + (uint64_t)(noutput_items);
+
+ // locate queued tags that fall in this range and insert them when appropriate
+ std::vector<gr_tag_t>::iterator i = d_queued_tags.begin();
+ while( i != d_queued_tags.end() ) {
+ if( (*i).offset >= start_N && (*i).offset < end_N) {
+ add_item_tag(0, (*i).offset,(*i).key, (*i).value, (*i).srcid);
+ i = d_queued_tags.erase(i);
+ }
+ else {
+ break;
+ }
+ }
+
+ // copy data across
+ memcpy(out, in, noutput_items*d_itemsize);
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/annotator_raw_impl.h b/gr-blocks/lib/annotator_raw_impl.h
new file mode 100644
index 0000000000..e0e16c30d6
--- /dev/null
+++ b/gr-blocks/lib/annotator_raw_impl.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_RAW_IMPL_H
+#define INCLUDED_GR_ANNOTATOR_RAW_IMPL_H
+
+#include <blocks/annotator_raw.h>
+#include <thread/thread.h>
+
+namespace gr {
+ namespace blocks {
+
+ class annotator_raw_impl : public annotator_raw
+ {
+ private:
+ size_t d_itemsize;
+ std::vector<gr_tag_t> d_queued_tags;
+ gr::thread::mutex d_mutex;
+
+ public:
+ annotator_raw_impl(size_t sizeof_stream_item);
+ ~annotator_raw_impl();
+
+ // insert a tag to be added
+ void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val);
+
+ 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_ANNOTATOR_RAW_IMPL_H */
diff --git a/gr-blocks/lib/check_lfsr_32k_s_impl.cc b/gr-blocks/lib/check_lfsr_32k_s_impl.cc
new file mode 100644
index 0000000000..5664067591
--- /dev/null
+++ b/gr-blocks/lib/check_lfsr_32k_s_impl.cc
@@ -0,0 +1,179 @@
+/* -*- 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 "check_lfsr_32k_s_impl.h"
+#include <gr_io_signature.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+namespace gr {
+ namespace blocks {
+
+ check_lfsr_32k_s::sptr
+ check_lfsr_32k_s::make()
+ {
+ return gnuradio::get_initial_sptr
+ (new check_lfsr_32k_s_impl());
+ }
+
+ check_lfsr_32k_s_impl::check_lfsr_32k_s_impl()
+ : gr_sync_block("check_lfsr_32k",
+ gr_make_io_signature(1, 1, sizeof(short)),
+ gr_make_io_signature(0, 0, 0)),
+ d_state(SEARCHING), d_history(0), d_ntotal(0), d_nright(0),
+ d_runlength(0), d_index(0)
+ {
+ lfsr_32k lfsr;
+
+ for(int i = 0; i < BUFSIZE; i++)
+ d_buffer[i] = lfsr.next_short();
+
+ enter_SEARCHING();
+ }
+
+ check_lfsr_32k_s_impl::~check_lfsr_32k_s_impl()
+ {
+ }
+
+ int
+ check_lfsr_32k_s_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ unsigned short *in = (unsigned short*)input_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ unsigned short x = in[i];
+ unsigned short expected;
+
+ switch(d_state) {
+ case MATCH0:
+ if(x == d_buffer[0])
+ enter_MATCH1();
+ break;
+
+ case MATCH1:
+ if(x == d_buffer[1])
+ enter_MATCH2();
+ else
+ enter_MATCH0();
+ break;
+
+ case MATCH2:
+ if(x == d_buffer[2])
+ enter_LOCKED();
+ else
+ enter_MATCH0();
+ break;
+
+ case LOCKED:
+ expected = d_buffer[d_index];
+ d_index = d_index + 1;
+ if(d_index >= BUFSIZE)
+ d_index = 0;
+
+ if(x == expected)
+ right();
+ else {
+ wrong();
+ log_error(expected, x);
+ if(wrong_three_times())
+ enter_SEARCHING();
+ }
+ break;
+
+ default:
+ abort();
+ }
+
+ d_ntotal++;
+ }
+
+ return noutput_items;
+ }
+
+ void
+ check_lfsr_32k_s_impl::enter_SEARCHING()
+ {
+ d_state = SEARCHING;
+ wrong(); // reset history
+ wrong();
+ wrong();
+
+ d_runlength = 0;
+ d_index = 0; // reset LFSR to beginning
+
+ if(0)
+ fprintf(stdout, "check_lfsr_32k: enter_SEARCHING at offset %8ld (0x%08lx)\n",
+ d_ntotal, d_ntotal);
+
+ enter_MATCH0();
+ }
+
+ void
+ check_lfsr_32k_s_impl::enter_MATCH0()
+ {
+ d_state = MATCH0;
+ }
+
+ void
+ check_lfsr_32k_s_impl::enter_MATCH1()
+ {
+ d_state = MATCH1;
+ }
+
+ void
+ check_lfsr_32k_s_impl::enter_MATCH2()
+ {
+ d_state = MATCH2;
+ }
+
+ void
+ check_lfsr_32k_s_impl::enter_LOCKED()
+ {
+ d_state = LOCKED;
+ right(); // setup history
+ right();
+ right();
+
+ d_index = 3; // already matched first 3 items
+
+ if(0)
+ fprintf(stdout, "check_lfsr_32k: enter_LOCKED at offset %8ld (0x%08lx)\n",
+ d_ntotal, d_ntotal);
+ }
+
+ void
+ check_lfsr_32k_s_impl::log_error(unsigned short expected, unsigned short actual)
+ {
+ if(0)
+ fprintf(stdout,
+ "check_lfsr_32k: expected %5d (0x%04x) got %5d (0x%04x) offset %8ld (0x%08lx)\n",
+ expected, expected, actual, actual, d_ntotal, d_ntotal);
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/check_lfsr_32k_s_impl.h b/gr-blocks/lib/check_lfsr_32k_s_impl.h
new file mode 100644
index 0000000000..f6d3c8daa2
--- /dev/null
+++ b/gr-blocks/lib/check_lfsr_32k_s_impl.h
@@ -0,0 +1,94 @@
+/* -*- 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_CHECK_LFSR_32K_S_IMPL_H
+#define INCLUDED_GR_CHECK_LFSR_32K_S_IMPL_H
+
+#include <blocks/check_lfsr_32k_s.h>
+#include <blocks/lfsr_32k.h>
+
+namespace gr {
+ namespace blocks {
+
+ class check_lfsr_32k_s_impl : public check_lfsr_32k_s
+ {
+ private:
+ enum state {
+ SEARCHING, // searching for synchronization
+ MATCH0,
+ MATCH1,
+ MATCH2,
+ LOCKED // is locked
+ };
+
+ state d_state;
+ unsigned int d_history; // bitmask of decisions
+
+ long d_ntotal; // total number of shorts
+ long d_nright; // # of correct shorts
+ long d_runlength; // # of correct shorts in a row
+
+ static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned
+ int d_index;
+ unsigned short d_buffer[BUFSIZE];
+
+ void enter_SEARCHING();
+ void enter_MATCH0();
+ void enter_MATCH1();
+ void enter_MATCH2();
+ void enter_LOCKED();
+
+ void right()
+ {
+ d_history = (d_history << 1) | 0x1;
+ d_nright++;
+ d_runlength++;
+ }
+
+ void wrong()
+ {
+ d_history = (d_history << 1) | 0x0;
+ d_runlength = 0;
+ }
+
+ bool right_three_times() { return (d_history & 0x7) == 0x7; }
+ bool wrong_three_times() { return (d_history & 0x7) == 0x0; }
+
+ void log_error(unsigned short expected, unsigned short actual);
+
+ public:
+ check_lfsr_32k_s_impl();
+ ~check_lfsr_32k_s_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ long ntotal() const { return d_ntotal; }
+ long nright() const { return d_nright; }
+ long runlength() const { return d_runlength; }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_CHECK_LFSR_32K_S_IMPL_H */
diff --git a/gr-blocks/lib/control_loop.cc b/gr-blocks/lib/control_loop.cc
new file mode 100644
index 0000000000..44f4e53394
--- /dev/null
+++ b/gr-blocks/lib/control_loop.cc
@@ -0,0 +1,214 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <blocks/control_loop.h>
+#include <gr_math.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace blocks {
+
+#define M_TWOPI (2.0f*M_PI)
+
+ control_loop::control_loop(float loop_bw,
+ float max_freq, float min_freq)
+ : d_phase(0), d_freq(0), d_max_freq(max_freq), d_min_freq(min_freq)
+ {
+ // Set the damping factor for a critically damped system
+ d_damping = sqrtf(2.0f)/2.0f;
+
+ // Set the bandwidth, which will then call update_gains()
+ set_loop_bandwidth(loop_bw);
+ }
+
+ control_loop::~control_loop()
+ {
+ }
+
+ void
+ control_loop::update_gains()
+ {
+ float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw);
+ d_alpha = (4*d_damping*d_loop_bw) / denom;
+ d_beta = (4*d_loop_bw*d_loop_bw) / denom;
+ }
+
+ void
+ control_loop::advance_loop(float error)
+ {
+ d_freq = d_freq + d_beta * error;
+ d_phase = d_phase + d_freq + d_alpha * error;
+ }
+
+ void
+ control_loop::phase_wrap()
+ {
+ while(d_phase>M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase<-M_TWOPI)
+ d_phase += M_TWOPI;
+ }
+
+ void
+ control_loop::frequency_limit()
+ {
+ if(d_freq > d_max_freq)
+ d_freq = d_max_freq;
+ else if(d_freq < d_min_freq)
+ d_freq = d_min_freq;
+ }
+
+ /*******************************************************************
+ * SET FUNCTIONS
+ *******************************************************************/
+
+ void
+ control_loop::set_loop_bandwidth(float bw)
+ {
+ if(bw < 0) {
+ throw std::out_of_range ("control_loop: invalid bandwidth. Must be >= 0.");
+ }
+
+ d_loop_bw = bw;
+ update_gains();
+ }
+
+ void
+ control_loop::set_damping_factor(float df)
+ {
+ if(df < 0 || df > 1.0) {
+ throw std::out_of_range ("control_loop: invalid damping factor. Must be in [0,1].");
+ }
+
+ d_damping = df;
+ update_gains();
+ }
+
+ void
+ control_loop::set_alpha(float alpha)
+ {
+ if(alpha < 0 || alpha > 1.0) {
+ throw std::out_of_range ("control_loop: invalid alpha. Must be in [0,1].");
+ }
+ d_alpha = alpha;
+ }
+
+ void
+ control_loop::set_beta(float beta)
+ {
+ if(beta < 0 || beta > 1.0) {
+ throw std::out_of_range ("control_loop: invalid beta. Must be in [0,1].");
+ }
+ d_beta = beta;
+ }
+
+ void
+ control_loop::set_frequency(float freq)
+ {
+ if(freq > d_max_freq)
+ d_freq = d_min_freq;
+ else if(freq < d_min_freq)
+ d_freq = d_max_freq;
+ else
+ d_freq = freq;
+ }
+
+ void
+ control_loop::set_phase(float phase)
+ {
+ d_phase = phase;
+ while(d_phase>M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase<-M_TWOPI)
+ d_phase += M_TWOPI;
+ }
+
+ void
+ control_loop::set_max_freq(float freq)
+ {
+ d_max_freq = freq;
+ }
+
+ void
+ control_loop::set_min_freq(float freq)
+ {
+ d_min_freq = freq;
+ }
+
+ /*******************************************************************
+ * GET FUNCTIONS
+ *******************************************************************/
+
+ float
+ control_loop::get_loop_bandwidth() const
+ {
+ return d_loop_bw;
+ }
+
+ float
+ control_loop::get_damping_factor() const
+ {
+ return d_damping;
+ }
+
+ float
+ control_loop::get_alpha() const
+ {
+ return d_alpha;
+ }
+
+ float
+ control_loop::get_beta() const
+ {
+ return d_beta;
+ }
+
+ float
+ control_loop::get_frequency() const
+ {
+ return d_freq;
+ }
+
+ float
+ control_loop::get_phase() const
+ {
+ return d_phase;
+ }
+
+ float
+ control_loop::get_max_freq() const
+ {
+ return d_max_freq;
+ }
+
+ float
+ control_loop::get_min_freq() const
+ {
+ return d_min_freq;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/copy_impl.cc b/gr-blocks/lib/copy_impl.cc
new file mode 100644
index 0000000000..929f22b7d3
--- /dev/null
+++ b/gr-blocks/lib/copy_impl.cc
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,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 "copy_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ copy::sptr
+ copy::make(size_t itemsize)
+ {
+ return gnuradio::get_initial_sptr
+ (new copy_impl(itemsize));
+ }
+
+ copy_impl::copy_impl(size_t itemsize)
+ : gr_block("copy",
+ gr_make_io_signature(1, -1, itemsize),
+ gr_make_io_signature(1, -1, itemsize)),
+ d_itemsize(itemsize),
+ d_enabled(true)
+ {
+ }
+
+ copy_impl::~copy_impl()
+ {
+ }
+
+ void
+ copy_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = noutput_items;
+ }
+
+ bool
+ copy_impl::check_topology(int ninputs, int noutputs)
+ {
+ return ninputs == noutputs;
+ }
+
+ int
+ copy_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const uint8_t **in = (const uint8_t**)&input_items[0];
+ uint8_t **out = (uint8_t**)&output_items[0];
+
+ int n = 0;
+ if(d_enabled) {
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ memcpy(out[i], in[i], noutput_items*d_itemsize);
+ }
+ n = noutput_items;
+ }
+
+ consume_each(noutput_items);
+ return n;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/copy_impl.h b/gr-blocks/lib/copy_impl.h
new file mode 100644
index 0000000000..1f0f1a655e
--- /dev/null
+++ b/gr-blocks/lib/copy_impl.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,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_COPY_IMPL_H
+#define INCLUDED_GR_COPY_IMPL_H
+
+#include <blocks/copy.h>
+
+namespace gr {
+ namespace blocks {
+
+ class copy_impl : public copy
+ {
+ private:
+ size_t d_itemsize;
+ bool d_enabled;
+
+ public:
+ copy_impl(size_t itemsize);
+ ~copy_impl();
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+ bool check_topology(int ninputs, int noutputs);
+
+ void set_enabled(bool enable) { d_enabled = enable; }
+ bool enabled() const { return d_enabled;}
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_COPY_IMPL_H */
diff --git a/gr-blocks/lib/ctrlport_probe2_c_impl.cc b/gr-blocks/lib/ctrlport_probe2_c_impl.cc
new file mode 100644
index 0000000000..f52e605a0d
--- /dev/null
+++ b/gr-blocks/lib/ctrlport_probe2_c_impl.cc
@@ -0,0 +1,163 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ctrlport_probe2_c_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ ctrlport_probe2_c::sptr
+ ctrlport_probe2_c::make(const std::string &id,
+ const std::string &desc, int len)
+ {
+ return gnuradio::get_initial_sptr
+ (new ctrlport_probe2_c_impl(id, desc, len));
+ }
+
+ ctrlport_probe2_c_impl::ctrlport_probe2_c_impl(const std::string &id,
+ const std::string &desc, int len)
+ : gr_sync_block("probe2_c",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(0, 0, 0)),
+ d_id(id), d_desc(desc), d_len(len)
+ {
+ set_length(len);
+ }
+
+ ctrlport_probe2_c_impl::~ctrlport_probe2_c_impl()
+ {
+ }
+
+ void
+ ctrlport_probe2_c_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ // make sure all inputs have noutput_items available
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = d_len;
+ }
+
+ // boost::shared_mutex mutex_buffer;
+ // mutable boost::mutex mutex_notify;
+ // boost::condition_variable condition_buffer_ready;
+ std::vector<gr_complex>
+ ctrlport_probe2_c_impl::get()
+ {
+ mutex_buffer.lock();
+ d_buffer.clear();
+ mutex_buffer.unlock();
+
+ // wait for condition
+ boost::mutex::scoped_lock lock(mutex_notify);
+ condition_buffer_ready.wait(lock);
+
+ mutex_buffer.lock();
+ std::vector<gr_complex> buf_copy = d_buffer;
+ assert(buf_copy.size() == d_len);
+ mutex_buffer.unlock();
+
+ return buf_copy;
+ }
+
+ void
+ ctrlport_probe2_c_impl::set_length(int len)
+ {
+ if(len > 8191) {
+ std::cerr << "probe2_c: length " << len
+ << " exceeds maximum buffer size of 8191" << std::endl;
+ len = 8191;
+ }
+
+ d_len = len;
+ d_buffer.reserve(d_len);
+ }
+
+ int
+ ctrlport_probe2_c_impl::length() const
+ {
+ return (int)d_len;
+ }
+
+ int
+ ctrlport_probe2_c_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+
+ // copy samples to get buffer if we need samples
+ mutex_buffer.lock();
+ if(d_buffer.size() < d_len) {
+ // copy smaller of remaining buffer space and num inputs to work()
+ int num_copy = std::min( (int)(d_len - d_buffer.size()), noutput_items );
+
+ // TODO: convert this to a copy operator for speed...
+ for(int i = 0; i < num_copy; i++) {
+ d_buffer.push_back(in[i]);
+ }
+
+ // notify the waiting get() if we fill up the buffer
+ if(d_buffer.size() == d_len) {
+ condition_buffer_ready.notify_one();
+ }
+ }
+ mutex_buffer.unlock();
+
+ return noutput_items;
+ }
+
+ void
+ ctrlport_probe2_c_impl::setup_rpc()
+ {
+#ifdef GR_CTRLPORT
+ int len = static_cast<int>(d_len);
+ d_rpc_vars.push_back(
+ rpcbasic_sptr(new rpcbasic_register_get<ctrlport_probe2_c, std::vector<std::complex<float> > >(
+ alias(), d_id.c_str(), &ctrlport_probe2_c::get,
+ pmt::make_c32vector(0,-2),
+ pmt::make_c32vector(0,2),
+ pmt::make_c32vector(0,0),
+ "volts", d_desc.c_str(), RPC_PRIVLVL_MIN,
+ DISPXY | DISPOPTSCATTER)));
+
+ d_rpc_vars.push_back(
+ rpcbasic_sptr(new rpcbasic_register_get<ctrlport_probe2_c, int>(
+ alias(), "length", &ctrlport_probe2_c::length,
+ pmt::mp(1), pmt::mp(10*len), pmt::mp(len),
+ "samples", "get vector length", RPC_PRIVLVL_MIN, DISPNULL)));
+
+ d_rpc_vars.push_back(
+ rpcbasic_sptr(new rpcbasic_register_set<ctrlport_probe2_c, int>(
+ alias(), "length", &ctrlport_probe2_c::set_length,
+ pmt::mp(1), pmt::mp(10*len), pmt::mp(len),
+ "samples", "set vector length", RPC_PRIVLVL_MIN, DISPNULL)));
+#endif /* GR_CTRLPORT */
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/ctrlport_probe2_c_impl.h b/gr-blocks/lib/ctrlport_probe2_c_impl.h
new file mode 100644
index 0000000000..4d290a4e8f
--- /dev/null
+++ b/gr-blocks/lib/ctrlport_probe2_c_impl.h
@@ -0,0 +1,67 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_CTRLPORT_PROBE2_C_IMPL_H
+#define INCLUDED_CTRLPORT_PROBE2_C_IMPL_H
+
+#include <blocks/ctrlport_probe2_c.h>
+#include <rpcregisterhelpers.h>
+#include <boost/thread/shared_mutex.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ class ctrlport_probe2_c_impl : public ctrlport_probe2_c
+ {
+ private:
+ std::string d_id;
+ std::string d_desc;
+ size_t d_len;
+ boost::shared_mutex mutex_buffer;
+ mutable boost::mutex mutex_notify;
+ boost::condition_variable condition_buffer_ready;
+
+ std::vector<gr_complex> d_buffer;
+
+ public:
+ ctrlport_probe2_c_impl(const std::string &id, const std::string &desc, int len);
+ ~ctrlport_probe2_c_impl();
+
+ void setup_rpc();
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ std::vector<gr_complex> get();
+
+ void set_length(int len);
+ int length() 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_CTRLPORT_PROBE2_C_IMPL_H */
+
diff --git a/gr-blocks/lib/ctrlport_probe_c_impl.cc b/gr-blocks/lib/ctrlport_probe_c_impl.cc
new file mode 100644
index 0000000000..e11bd0496e
--- /dev/null
+++ b/gr-blocks/lib/ctrlport_probe_c_impl.cc
@@ -0,0 +1,101 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ctrlport_probe_c_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ ctrlport_probe_c::sptr
+ ctrlport_probe_c::make(const std::string &id,
+ const std::string &desc)
+ {
+ return gnuradio::get_initial_sptr
+ (new ctrlport_probe_c_impl(id, desc));
+ }
+
+ ctrlport_probe_c_impl::ctrlport_probe_c_impl(const std::string &id,
+ const std::string &desc)
+ : gr_sync_block("probe_c",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(0, 0, 0)),
+ d_id(id), d_desc(desc), d_ptr(NULL), d_ptrLen(0)
+ {
+ }
+
+ ctrlport_probe_c_impl::~ctrlport_probe_c_impl()
+ {
+ }
+
+ std::vector<gr_complex>
+ ctrlport_probe_c_impl::get()
+ {
+ if(d_ptr != NULL && d_ptrLen > 0) {
+ ptrlock.lock();
+ std::vector<gr_complex> vec(d_ptr, d_ptr+d_ptrLen);
+ ptrlock.unlock();
+ return vec;
+ }
+ else {
+ std::vector<gr_complex> vec;
+ return vec;
+ }
+ }
+
+ int
+ ctrlport_probe_c_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+
+ // keep reference to symbols
+ ptrlock.lock();
+ d_ptr = in;
+ d_ptrLen = noutput_items;
+ ptrlock.unlock();
+
+ return noutput_items;
+ }
+
+ void
+ ctrlport_probe_c_impl::setup_rpc()
+ {
+#ifdef GR_CTRLPORT
+ d_rpc_vars.push_back(
+ rpcbasic_sptr(new rpcbasic_register_get<ctrlport_probe_c, std::vector<std::complex<float> > >(
+ alias(), d_id.c_str(), &ctrlport_probe_c::get,
+ pmt::make_c32vector(0,-2),
+ pmt::make_c32vector(0,2),
+ pmt::make_c32vector(0,0),
+ "volts", d_desc.c_str(), RPC_PRIVLVL_MIN,
+ DISPXY | DISPOPTSCATTER)));
+#endif /* GR_CTRLPORT */
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/ctrlport_probe_c_impl.h b/gr-blocks/lib/ctrlport_probe_c_impl.h
new file mode 100644
index 0000000000..5d9073ac10
--- /dev/null
+++ b/gr-blocks/lib/ctrlport_probe_c_impl.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_CTRLPORT_PROBE_C_IMPL_H
+#define INCLUDED_CTRLPORT_PROBE_C_IMPL_H
+
+#include <blocks/ctrlport_probe_c.h>
+#include <rpcregisterhelpers.h>
+#include <boost/thread/shared_mutex.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ class ctrlport_probe_c_impl : public ctrlport_probe_c
+ {
+ private:
+ boost::shared_mutex ptrlock;
+
+ std::string d_id;
+ std::string d_desc;
+ const gr_complex* d_ptr;
+ size_t d_ptrLen;
+
+ public:
+ ctrlport_probe_c_impl(const std::string &id, const std::string &desc);
+ ~ctrlport_probe_c_impl();
+
+ void setup_rpc();
+
+ std::vector<gr_complex> get();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_IMPL_H */
+
diff --git a/gr-blocks/lib/delay_impl.cc b/gr-blocks/lib/delay_impl.cc
index 67449aca20..08cd1db1c3 100644
--- a/gr-blocks/lib/delay_impl.cc
+++ b/gr-blocks/lib/delay_impl.cc
@@ -69,7 +69,7 @@ namespace gr {
// protects from quickly-repeated calls to this function that
// would end with d_delta=0.
if(d != dly()) {
- gruel::scoped_lock l(d_mutex_delay);
+ gr::thread::scoped_lock l(d_mutex_delay);
int old = dly();
set_history(d+1);
d_delta += dly() - old;
@@ -82,7 +82,7 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gruel::scoped_lock l(d_mutex_delay);
+ gr::thread::scoped_lock l(d_mutex_delay);
assert(input_items.size() == output_items.size());
const char *iptr;
diff --git a/gr-blocks/lib/delay_impl.h b/gr-blocks/lib/delay_impl.h
index 56d971b116..1cb959359e 100644
--- a/gr-blocks/lib/delay_impl.h
+++ b/gr-blocks/lib/delay_impl.h
@@ -24,7 +24,7 @@
#define INCLUDED_GR_DELAY_IMPL_H
#include <blocks/delay.h>
-#include <gruel/thread.h>
+#include <thread/thread.h>
namespace gr {
namespace blocks {
@@ -37,7 +37,7 @@ namespace gr {
size_t d_itemsize;
int d_delta;
- gruel::mutex d_mutex_delay;
+ gr::thread::mutex d_mutex_delay;
public:
delay_impl(size_t itemsize, int delay);
diff --git a/gr-blocks/lib/endian_swap_impl.cc b/gr-blocks/lib/endian_swap_impl.cc
new file mode 100644
index 0000000000..7e67c30147
--- /dev/null
+++ b/gr-blocks/lib/endian_swap_impl.cc
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "endian_swap_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ endian_swap::sptr
+ endian_swap::make(size_t item_size_bytes)
+ {
+ return gnuradio::get_initial_sptr
+ (new endian_swap_impl(item_size_bytes));
+ }
+
+ endian_swap_impl::endian_swap_impl (size_t item_size_bytes)
+ : gr_sync_block("endian_swap_impl",
+ gr_make_io_signature(1, 1, item_size_bytes),
+ gr_make_io_signature(1, 1, item_size_bytes))
+ {
+ const int alignment_multiple = volk_get_alignment();
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ endian_swap_impl::~endian_swap_impl()
+ {
+ }
+
+ int
+ endian_swap_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *in = (const char*)input_items[0];
+ char *out = (char*)output_items[0];
+
+ int nbytes(output_signature()->sizeof_stream_item(0));
+ if(is_unaligned()) {
+ switch(nbytes){
+ case 1:
+ memcpy(out,in,noutput_items);
+ break;
+ case 2:
+ memcpy(out,in,2*noutput_items);
+ volk_16u_byteswap_u((uint16_t*)out,noutput_items);
+ break;
+ case 4:
+ memcpy(out,in,4*noutput_items);
+ volk_32u_byteswap_u((uint32_t*)out,noutput_items);
+ break;
+ case 8:
+ memcpy(out,in,8*noutput_items);
+ volk_64u_byteswap_u((uint64_t*)out,noutput_items);
+ break;
+ default:
+ throw std::runtime_error("itemsize is not valid for endian_swap!");
+ }
+ }
+ else {
+ switch(nbytes) {
+ case 1:
+ memcpy(out,in,noutput_items);
+ break;
+ case 2:
+ memcpy(out,in,2*noutput_items);
+ volk_16u_byteswap_a((uint16_t*)out,noutput_items);
+ break;
+ case 4:
+ memcpy(out,in,4*noutput_items);
+ volk_32u_byteswap_a((uint32_t*)out,noutput_items);
+ break;
+ case 8:
+ memcpy(out,in,8*noutput_items);
+ volk_64u_byteswap_a((uint64_t*)out,noutput_items);
+ break;
+ default:
+ throw std::runtime_error("itemsize is not valid for endian_swap!");
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/endian_swap_impl.h b/gr-blocks/lib/endian_swap_impl.h
new file mode 100644
index 0000000000..517df44f17
--- /dev/null
+++ b/gr-blocks/lib/endian_swap_impl.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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_ENDIAN_SWAP_IMPL_H
+#define INCLUDED_GR_ENDIAN_SWAP_IMPL_H
+
+#include <blocks/endian_swap.h>
+
+namespace gr {
+ namespace blocks {
+
+ class endian_swap_impl : public endian_swap
+ {
+ private:
+ size_t item_size_bytes;
+
+ public:
+ endian_swap_impl(size_t item_size_bytes);
+ ~endian_swap_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_ENDIAN_SWAP_IMPL_H */
diff --git a/gr-blocks/lib/file_descriptor_sink_impl.cc b/gr-blocks/lib/file_descriptor_sink_impl.cc
new file mode 100644
index 0000000000..a1f26220d2
--- /dev/null
+++ b/gr-blocks/lib/file_descriptor_sink_impl.cc
@@ -0,0 +1,94 @@
+/* -*- 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 "file_descriptor_sink_impl.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 <stdio.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ file_descriptor_sink::sptr
+ file_descriptor_sink::make(size_t itemsize, int fd)
+ {
+ return gnuradio::get_initial_sptr
+ (new file_descriptor_sink_impl(itemsize, fd));
+ }
+
+ file_descriptor_sink_impl::file_descriptor_sink_impl(size_t itemsize, int fd)
+ : gr_sync_block("file_descriptor_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ d_itemsize(itemsize), d_fd(fd)
+ {
+ }
+
+ file_descriptor_sink_impl::~file_descriptor_sink_impl()
+ {
+ close(d_fd);
+ }
+
+ int
+ file_descriptor_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *inbuf = (char*)input_items[0];
+ unsigned long byte_size = noutput_items * d_itemsize;
+
+ while(byte_size > 0) {
+ ssize_t r;
+
+ r = write(d_fd, inbuf, byte_size);
+ if(r == -1) {
+ if(errno == EINTR)
+ continue;
+ else {
+ perror("file_descriptor_sink");
+ return -1; // indicate we're done
+ }
+ }
+ else {
+ byte_size -= r;
+ inbuf += r;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/file_descriptor_sink_impl.h b/gr-blocks/lib/file_descriptor_sink_impl.h
new file mode 100644
index 0000000000..90b02f4163
--- /dev/null
+++ b/gr-blocks/lib/file_descriptor_sink_impl.h
@@ -0,0 +1,49 @@
+/* -*- 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_FILE_DESCRIPTOR_SINK_IMPL_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SINK_IMPL_H
+
+#include <blocks/file_descriptor_sink.h>
+
+namespace gr {
+ namespace blocks {
+
+ class file_descriptor_sink_impl : public file_descriptor_sink
+ {
+ private:
+ size_t d_itemsize;
+ int d_fd;
+
+ public:
+ file_descriptor_sink_impl(size_t itemsize, int fd);
+ ~file_descriptor_sink_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_FILE_DESCRIPTOR_SINK_IMPL_H */
diff --git a/gr-blocks/lib/file_descriptor_source_impl.cc b/gr-blocks/lib/file_descriptor_source_impl.cc
new file mode 100644
index 0000000000..667e96b7fa
--- /dev/null
+++ b/gr-blocks/lib/file_descriptor_source_impl.cc
@@ -0,0 +1,156 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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 "file_descriptor_source_impl.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 <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ file_descriptor_source::sptr
+ file_descriptor_source::make(size_t itemsize, int fd, bool repeat)
+ {
+ return gnuradio::get_initial_sptr
+ (new file_descriptor_source_impl(itemsize, fd, repeat));
+ }
+
+ file_descriptor_source_impl::file_descriptor_source_impl(size_t itemsize,
+ int fd,
+ bool repeat)
+ : gr_sync_block("file_descriptor_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_fd(fd), d_repeat(repeat),
+ d_residue(new unsigned char[itemsize]), d_residue_len (0)
+ {
+ }
+
+ file_descriptor_source_impl::~file_descriptor_source_impl()
+ {
+ close(d_fd);
+ delete [] d_residue;
+ }
+
+ int
+ file_descriptor_source_impl::read_items(char *buf, int nitems)
+ {
+ assert(nitems > 0);
+ assert(d_residue_len < d_itemsize);
+
+ int nbytes_read = 0;
+
+ if(d_residue_len > 0) {
+ memcpy(buf, d_residue, d_residue_len);
+ nbytes_read = d_residue_len;
+ d_residue_len = 0;
+ }
+
+ int r = read(d_fd, buf + nbytes_read,
+ nitems * d_itemsize - nbytes_read);
+ if(r <= 0) {
+ handle_residue(buf, nbytes_read);
+ return r;
+ }
+
+ r = handle_residue(buf, r + nbytes_read);
+
+ if(r == 0) // block until we get something
+ return read_items(buf, nitems);
+
+ return r;
+ }
+
+ int
+ file_descriptor_source_impl::handle_residue(char *buf, int nbytes_read)
+ {
+ assert(nbytes_read >= 0);
+ int nitems_read = nbytes_read / d_itemsize;
+ d_residue_len = nbytes_read % d_itemsize;
+ if(d_residue_len > 0) {
+ // fprintf (stderr, "handle_residue: %d\n", d_residue_len);
+ memcpy(d_residue, buf + nbytes_read - d_residue_len, d_residue_len);
+ }
+ return nitems_read;
+ }
+
+ int
+ file_descriptor_source_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ assert(noutput_items > 0);
+
+ char *o = (char*)output_items[0];
+ int nread = 0;
+
+ while(1) {
+ int r = read_items(o, noutput_items - nread);
+ if(r == -1) {
+ if(errno == EINTR)
+ continue;
+ else {
+ perror("file_descriptor_source[read]");
+ return -1;
+ }
+ }
+ else if(r == 0) { // end of file
+ if(!d_repeat)
+ break;
+ else {
+ flush_residue();
+ if(lseek(d_fd, 0, SEEK_SET) == -1) {
+ perror("file_descriptor_source[lseek]");
+ return -1;
+ }
+ }
+ }
+ else {
+ o += r * d_itemsize;
+ nread += r;
+ break;
+ }
+ }
+
+ if(nread == 0) // EOF
+ return -1;
+
+ return nread;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/file_descriptor_source_impl.h b/gr-blocks/lib/file_descriptor_source_impl.h
new file mode 100644
index 0000000000..dd86e18af1
--- /dev/null
+++ b/gr-blocks/lib/file_descriptor_source_impl.h
@@ -0,0 +1,58 @@
+/* -*- 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_FILE_DESCRIPTOR_SOURCE_IMPL_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_IMPL_H
+
+#include <blocks/file_descriptor_source.h>
+
+namespace gr {
+ namespace blocks {
+
+ class file_descriptor_source_impl : public file_descriptor_source
+ {
+ private:
+ size_t d_itemsize;
+ int d_fd;
+ bool d_repeat;
+
+ unsigned char *d_residue;
+ unsigned long d_residue_len;
+
+ protected:
+ int read_items(char *buf, int nitems);
+ int handle_residue(char *buf, int nbytes_read);
+ void flush_residue() { d_residue_len = 0; }
+
+ public:
+ file_descriptor_source_impl(size_t itemsize, int fd, bool repeat);
+ ~file_descriptor_source_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_FILE_DESCRIPTOR_SOURCE_IMPL_H */
diff --git a/gr-blocks/lib/file_meta_sink_impl.cc b/gr-blocks/lib/file_meta_sink_impl.cc
index d996e7a93e..dc87a7e956 100644
--- a/gr-blocks/lib/file_meta_sink_impl.cc
+++ b/gr-blocks/lib/file_meta_sink_impl.cc
@@ -171,7 +171,7 @@ namespace gr {
bool
file_meta_sink_impl::_open(FILE **fp, const char *filename)
{
- gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
bool ret = true;
int fd;
@@ -201,7 +201,7 @@ namespace gr {
void
file_meta_sink_impl::close()
{
- gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
update_last_header();
if(d_state == STATE_DETACHED) {
@@ -222,7 +222,7 @@ namespace gr {
file_meta_sink_impl::do_update()
{
if(d_updated) {
- gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this block
if(d_state == STATE_DETACHED) {
if(d_hdr_fp)
fclose(d_hdr_fp);
diff --git a/gr-blocks/lib/file_meta_sink_impl.h b/gr-blocks/lib/file_meta_sink_impl.h
index 566c997b3d..d4048e1e4e 100644
--- a/gr-blocks/lib/file_meta_sink_impl.h
+++ b/gr-blocks/lib/file_meta_sink_impl.h
@@ -24,8 +24,8 @@
#define INCLUDED_BLOCKS_FILE_META_SINK_IMPL_H
#include <blocks/file_meta_sink.h>
-#include <gruel/pmt.h>
-#include <gruel/thread.h>
+#include <pmt/pmt.h>
+#include <thread/thread.h>
using namespace pmt;
diff --git a/gr-blocks/lib/file_meta_source_impl.cc b/gr-blocks/lib/file_meta_source_impl.cc
index 9d66193e53..5d64e40a26 100644
--- a/gr-blocks/lib/file_meta_source_impl.cc
+++ b/gr-blocks/lib/file_meta_source_impl.cc
@@ -297,7 +297,7 @@ namespace gr {
bool
file_meta_source_impl::_open(FILE **fp, const char *filename)
{
- gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
bool ret = true;
int fd;
@@ -326,7 +326,7 @@ namespace gr {
void
file_meta_source_impl::close()
{
- gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
if(d_state == STATE_DETACHED) {
if(d_new_hdr_fp) {
fclose(d_new_hdr_fp);
@@ -345,7 +345,7 @@ namespace gr {
file_meta_source_impl::do_update()
{
if(d_updated) {
- gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this block
if(d_state == STATE_DETACHED) {
if(d_hdr_fp)
fclose(d_hdr_fp);
@@ -395,7 +395,7 @@ namespace gr {
d_tags.pop_back();
}
- gruel::scoped_lock lock(d_mutex); // hold for the rest of this function
+ gr::thread::scoped_lock lock(d_mutex); // hold for the rest of this function
while(size) {
i = fread(out, d_itemsize, size, d_fp);
diff --git a/gr-blocks/lib/file_meta_source_impl.h b/gr-blocks/lib/file_meta_source_impl.h
index ca7ddc6e10..3f8ebda6ee 100644
--- a/gr-blocks/lib/file_meta_source_impl.h
+++ b/gr-blocks/lib/file_meta_source_impl.h
@@ -25,8 +25,8 @@
#include <blocks/file_meta_source.h>
#include <gr_tags.h>
-#include <gruel/pmt.h>
-#include <gruel/thread.h>
+#include <pmt/pmt.h>
+#include <thread/thread.h>
#include <blocks/file_meta_sink.h>
@@ -50,7 +50,7 @@ namespace gr {
bool d_updated;
bool d_repeat;
- gruel::mutex d_mutex;
+ gr::thread::mutex d_mutex;
FILE *d_new_fp, *d_new_hdr_fp;
FILE *d_fp, *d_hdr_fp;
meta_state_t d_state;
diff --git a/gr-blocks/lib/file_sink_base.cc b/gr-blocks/lib/file_sink_base.cc
new file mode 100644
index 0000000000..d3a36f3321
--- /dev/null
+++ b/gr-blocks/lib/file_sink_base.cc
@@ -0,0 +1,131 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2007,2009,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 <blocks/file_sink_base.h>
+#include <cstdio>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <thread/thread.h>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ file_sink_base::file_sink_base(const char *filename, bool is_binary)
+ : d_fp(0), d_new_fp(0), d_updated(false), d_is_binary(is_binary)
+ {
+ if (!open(filename))
+ throw std::runtime_error ("can't open file");
+ }
+
+ file_sink_base::~file_sink_base()
+ {
+ close();
+ if(d_fp) {
+ fclose(d_fp);
+ d_fp = 0;
+ }
+ }
+
+ bool
+ file_sink_base::open(const char *filename)
+ {
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+
+ // we use the open system call to get access to the O_LARGEFILE flag.
+ int fd;
+ if((fd = ::open(filename,
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror(filename);
+ return false;
+ }
+ if(d_new_fp) { // if we've already got a new one open, close it
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+
+ if((d_new_fp = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL) {
+ perror (filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ d_updated = true;
+ return d_new_fp != 0;
+ }
+
+ void
+ file_sink_base::close()
+ {
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+
+ if(d_new_fp) {
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+ d_updated = true;
+ }
+
+ void
+ file_sink_base::do_update()
+ {
+ if(d_updated) {
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ if(d_fp)
+ fclose(d_fp);
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+ d_updated = false;
+ }
+ }
+
+ void
+ file_sink_base::set_unbuffered(bool unbuffered)
+ {
+ d_unbuffered = unbuffered;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/file_sink_impl.cc b/gr-blocks/lib/file_sink_impl.cc
new file mode 100644
index 0000000000..88dcb5a021
--- /dev/null
+++ b/gr-blocks/lib/file_sink_impl.cc
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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 "file_sink_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace blocks {
+
+ file_sink::sptr
+ file_sink::make(size_t itemsize, const char *filename)
+ {
+ return gnuradio::get_initial_sptr
+ (new file_sink_impl(itemsize, filename));
+ }
+
+ file_sink_impl::file_sink_impl(size_t itemsize, const char *filename)
+ : gr_sync_block("file_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ file_sink_base(filename, true),
+ d_itemsize(itemsize)
+ {
+ }
+
+ file_sink_impl::~file_sink_impl()
+ {
+ }
+
+ int
+ file_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *inbuf = (char*)input_items[0];
+ int nwritten = 0;
+
+ do_update(); // update d_fp is reqd
+
+ if(!d_fp)
+ return noutput_items; // drop output on the floor
+
+ while(nwritten < noutput_items) {
+ int count = fwrite(inbuf, d_itemsize, noutput_items - nwritten, d_fp);
+ if(count == 0) {
+ if(ferror(d_fp)) {
+ std::stringstream s;
+ s << "file_sink write failed with error " << fileno(d_fp) << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ else { // is EOF
+ break;
+ }
+ }
+ nwritten += count;
+ inbuf += count * d_itemsize;
+ }
+
+ if(d_unbuffered)
+ fflush (d_fp);
+
+ return nwritten;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/file_sink_impl.h b/gr-blocks/lib/file_sink_impl.h
new file mode 100644
index 0000000000..8e802ad88a
--- /dev/null
+++ b/gr-blocks/lib/file_sink_impl.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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_FILE_SINK_IMPL_H
+#define INCLUDED_GR_FILE_SINK_IMPL_H
+
+#include <blocks/file_sink.h>
+
+namespace gr {
+ namespace blocks {
+
+ class file_sink_impl : public file_sink
+ {
+ private:
+ size_t d_itemsize;
+
+ public:
+ file_sink_impl(size_t itemsize, const char *filename);
+ ~file_sink_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_FILE_SINK_IMPL_H */
diff --git a/gr-blocks/lib/file_source_impl.cc b/gr-blocks/lib/file_source_impl.cc
index dcbd042106..3c30884a59 100644
--- a/gr-blocks/lib/file_source_impl.cc
+++ b/gr-blocks/lib/file_source_impl.cc
@@ -24,7 +24,7 @@
#include "config.h"
#endif
-#include <gruel/thread.h>
+#include <thread/thread.h>
#include "file_source_impl.h"
#include <gr_io_signature.h>
#include <cstdio>
@@ -85,7 +85,7 @@ namespace gr {
file_source_impl::open(const char *filename, bool repeat)
{
// obtain exclusive access for duration of this function
- gruel::scoped_lock lock(fp_mutex);
+ gr::thread::scoped_lock lock(fp_mutex);
int fd;
@@ -114,7 +114,7 @@ namespace gr {
file_source_impl::close()
{
// obtain exclusive access for duration of this function
- gruel::scoped_lock lock(fp_mutex);
+ gr::thread::scoped_lock lock(fp_mutex);
if(d_new_fp != NULL) {
fclose(d_new_fp);
@@ -127,7 +127,7 @@ namespace gr {
file_source_impl::do_update()
{
if(d_updated) {
- gruel::scoped_lock lock(fp_mutex); // hold while in scope
+ gr::thread::scoped_lock lock(fp_mutex); // hold while in scope
if(d_fp)
fclose(d_fp);
@@ -151,7 +151,7 @@ namespace gr {
if(d_fp == NULL)
throw std::runtime_error("work with file not open");
- gruel::scoped_lock lock(fp_mutex); // hold for the rest of this function
+ gr::thread::scoped_lock lock(fp_mutex); // hold for the rest of this function
while(size) {
i = fread(o, d_itemsize, size, (FILE*)d_fp);
diff --git a/gr-blocks/lib/head_impl.cc b/gr-blocks/lib/head_impl.cc
new file mode 100644
index 0000000000..7dfa36607c
--- /dev/null
+++ b/gr-blocks/lib/head_impl.cc
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 "head_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ head::sptr
+ head::make(size_t sizeof_stream_item, uint64_t nitems)
+ {
+ return gnuradio::get_initial_sptr
+ (new head_impl(sizeof_stream_item, nitems));
+ }
+
+ head_impl::head_impl(size_t sizeof_stream_item, uint64_t nitems)
+ : gr_sync_block("head",
+ gr_make_io_signature(1, 1, sizeof_stream_item),
+ gr_make_io_signature(1, 1, sizeof_stream_item)),
+ d_nitems(nitems), d_ncopied_items(0)
+ {
+ }
+
+ head_impl::~head_impl()
+ {
+ }
+
+ int
+ head_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ if(d_ncopied_items >= d_nitems)
+ return -1; // Done!
+
+ unsigned n = std::min(d_nitems - d_ncopied_items,
+ (uint64_t)noutput_items);
+
+ if(n == 0)
+ return 0;
+
+ memcpy(output_items[0], input_items[0],
+ n * input_signature()->sizeof_stream_item (0));
+ d_ncopied_items += n;
+
+ return n;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/head_impl.h b/gr-blocks/lib/head_impl.h
new file mode 100644
index 0000000000..a56acfbb27
--- /dev/null
+++ b/gr-blocks/lib/head_impl.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_HEAD_IMPL_H
+#define INCLUDED_GR_HEAD_IMPL_H
+
+#include <blocks/head.h>
+
+namespace gr {
+ namespace blocks {
+
+ class head_impl : public head
+ {
+ private:
+ uint64_t d_nitems;
+ uint64_t d_ncopied_items;
+
+ public:
+ head_impl(size_t sizeof_stream_item, uint64_t nitems);
+ ~head_impl();
+
+ void reset() { d_ncopied_items = 0; }
+ void set_length(int nitems) { d_nitems = nitems; }
+
+ 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_HEAD_IMPL_H */
diff --git a/gr-blocks/lib/lfsr_32k_source_s_impl.cc b/gr-blocks/lib/lfsr_32k_source_s_impl.cc
new file mode 100644
index 0000000000..738e732b49
--- /dev/null
+++ b/gr-blocks/lib/lfsr_32k_source_s_impl.cc
@@ -0,0 +1,79 @@
+/* -*- 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 "lfsr_32k_source_s_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace blocks {
+
+ lfsr_32k_source_s::sptr
+ lfsr_32k_source_s::make()
+ {
+ return gnuradio::get_initial_sptr
+ (new lfsr_32k_source_s_impl());
+ }
+
+ lfsr_32k_source_s_impl::lfsr_32k_source_s_impl()
+ : gr_sync_block("lfsr_32k_source_s",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, sizeof(short))),
+ d_index(0)
+ {
+ lfsr_32k lfsr;
+
+ for(int i = 0; i < BUFSIZE; i++)
+ d_buffer[i] = lfsr.next_short();
+ }
+
+ lfsr_32k_source_s_impl::~lfsr_32k_source_s_impl()
+ {
+ }
+
+ int
+ lfsr_32k_source_s_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ short *out = (short*)output_items[0];
+ short *buf = d_buffer;
+ int index = d_index;
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = buf[index];
+ // index = (index + 1) & (BUFSIZE - 1);
+ index = index + 1;
+ if(index >= BUFSIZE)
+ index = 0;
+ }
+
+ d_index = index;
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/lfsr_32k_source_s_impl.h b/gr-blocks/lib/lfsr_32k_source_s_impl.h
new file mode 100644
index 0000000000..b8c684e8d6
--- /dev/null
+++ b/gr-blocks/lib/lfsr_32k_source_s_impl.h
@@ -0,0 +1,52 @@
+/* -*- 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_LFSR_32K_SOURCE_S_IMPL_H
+#define INCLUDED_GR_LFSR_32K_SOURCE_S_IMPL_H
+
+#include <blocks/lfsr_32k_source_s.h>
+#include <blocks/lfsr_32k.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ class lfsr_32k_source_s_impl : public lfsr_32k_source_s
+ {
+ private:
+ static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned
+ int d_index;
+ short d_buffer[BUFSIZE];
+
+ public:
+ lfsr_32k_source_s_impl();
+ ~lfsr_32k_source_s_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_LFSR_32K_SOURCE_S_IMPL_H */
diff --git a/gr-blocks/lib/message_debug_impl.cc b/gr-blocks/lib/message_debug_impl.cc
index 6455513d76..04f31f88a2 100644
--- a/gr-blocks/lib/message_debug_impl.cc
+++ b/gr-blocks/lib/message_debug_impl.cc
@@ -50,7 +50,7 @@ namespace gr {
void
message_debug_impl::store(pmt::pmt_t msg)
{
- gruel::scoped_lock guard(d_mutex);
+ gr::thread::scoped_lock guard(d_mutex);
d_messages.push_back(msg);
}
@@ -87,7 +87,7 @@ namespace gr {
pmt::pmt_t
message_debug_impl::get_message(int i)
{
- gruel::scoped_lock guard(d_mutex);
+ gr::thread::scoped_lock guard(d_mutex);
if((size_t)i >= d_messages.size()) {
throw std::runtime_error("message_debug: index for message out of bounds.\n");
diff --git a/gr-blocks/lib/message_debug_impl.h b/gr-blocks/lib/message_debug_impl.h
index c9d82bd561..817a9a834c 100644
--- a/gr-blocks/lib/message_debug_impl.h
+++ b/gr-blocks/lib/message_debug_impl.h
@@ -25,8 +25,8 @@
#include <blocks/message_debug.h>
#include <gr_block.h>
-#include <gruel/thread.h>
-#include <gruel/pmt.h>
+#include <thread/thread.h>
+#include <pmt/pmt.h>
namespace gr {
namespace blocks {
@@ -72,7 +72,7 @@ namespace gr {
*/
void store(pmt::pmt_t msg);
- gruel::mutex d_mutex;
+ gr::thread::mutex d_mutex;
std::vector<pmt::pmt_t> d_messages;
public:
diff --git a/gr-blocks/lib/message_sink_impl.cc b/gr-blocks/lib/message_sink_impl.cc
index a8dbfb4c71..fbc7b27d58 100644
--- a/gr-blocks/lib/message_sink_impl.cc
+++ b/gr-blocks/lib/message_sink_impl.cc
@@ -44,11 +44,30 @@ namespace gr {
(new message_sink_impl(itemsize, msgq, dont_block));
}
+ message_sink::sptr
+ message_sink::make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block,
+ const std::string& lengthtagname)
+ {
+ return gnuradio::get_initial_sptr
+ (new message_sink_impl(itemsize, msgq, dont_block, lengthtagname));
+ }
+
message_sink_impl::message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block)
: gr_sync_block("message_sink",
gr_make_io_signature(1, 1, itemsize),
gr_make_io_signature(0, 0, 0)),
- d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block)
+ d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block),
+ d_tags(false), d_items_read(0)
+ {
+ }
+
+ message_sink_impl::message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block,
+ const std::string& lengthtagname)
+ : gr_sync_block("message_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block),
+ d_tags(true), d_lengthtagname(lengthtagname), d_items_read(0)
{
}
@@ -61,23 +80,53 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- const char *in = (const char*)input_items[0];
-
- // if we'd block, drop the data on the floor and say everything is OK
- if(d_dont_block && d_msgq->full_p())
- return noutput_items;
-
- // build a message to hold whatever we've got
- gr_message_sptr msg = gr_make_message(0, // msg type
- d_itemsize, // arg1 for other end
- noutput_items, // arg2 for other end (redundant)
- noutput_items * d_itemsize); // len of msg
- memcpy(msg->msg(), in, noutput_items * d_itemsize);
+ const char *in = (const char *) input_items[0];
- d_msgq->handle(msg); // send it
+ if (d_tags) {
+ long packet_length = 0;
+ std::vector<gr_tag_t> tags;
+ this->get_tags_in_range(tags, 0, d_items_read, d_items_read+1);
+ //const size_t ninput_items = noutput_items; //assumption for sync block, this can change
+ for (unsigned int i = 0; i < tags.size(); i++) {
+ if (pmt::symbol_to_string(tags[i].key) == d_lengthtagname) {
+ packet_length = pmt::to_long(tags[i].value);
+ }
+ }
+ assert(packet_length != 0);
+
+ // FIXME run this multiple times if input_items >= N * packet_length
+ if (noutput_items >= packet_length ) {
+ // If the message queue is full we drop the packet.
+ if (!d_msgq->full_p()) {
+ gr_message_sptr msg = gr_make_message(0, // msg type
+ d_itemsize, // arg1 for other end
+ packet_length, // arg2 for other end (redundant)
+ packet_length * d_itemsize); // len of msg
+ memcpy(msg->msg(), in, packet_length * d_itemsize);
+ d_msgq->handle(msg); // send it
+ }
+ d_items_read += packet_length;
+ return packet_length;
+ } else {
+ return 0;
+ }
+ } else {
+ // If the queue if full we drop all the data we got.
+ if (!d_msgq->full_p()) {
+ // build a message to hold whatever we've got
+ gr_message_sptr msg = gr_make_message(0, // msg type
+ d_itemsize, // arg1 for other end
+ noutput_items, // arg2 for other end (redundant)
+ noutput_items * d_itemsize); // len of msg
+ memcpy(msg->msg(), in, noutput_items * d_itemsize);
+
+ d_msgq->handle(msg); // send it
+ }
- return noutput_items;
+ return noutput_items;
+ }
}
} /* namespace blocks */
} /* namespace gr */
+
diff --git a/gr-blocks/lib/message_sink_impl.h b/gr-blocks/lib/message_sink_impl.h
index a3106bc058..280a46765e 100644
--- a/gr-blocks/lib/message_sink_impl.h
+++ b/gr-blocks/lib/message_sink_impl.h
@@ -34,9 +34,15 @@ namespace gr {
size_t d_itemsize;
gr_msg_queue_sptr d_msgq;
bool d_dont_block;
+ bool d_tags;
+ std::string d_lengthtagname;
+ uint64_t d_items_read;
public:
message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+ message_sink_impl(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block,
+ const std::string& lengthtagname);
+
~message_sink_impl();
int work(int noutput_items,
diff --git a/gr-blocks/lib/message_source_impl.cc b/gr-blocks/lib/message_source_impl.cc
index cda4fc16c0..818cd336f1 100644
--- a/gr-blocks/lib/message_source_impl.cc
+++ b/gr-blocks/lib/message_source_impl.cc
@@ -51,12 +51,20 @@ namespace gr {
(new message_source_impl(itemsize, msgq));
}
+ message_source::sptr
+ message_source::make(size_t itemsize, gr_msg_queue_sptr msgq,
+ const std::string& lengthtagname)
+ {
+ return gnuradio::get_initial_sptr
+ (new message_source_impl(itemsize, msgq, lengthtagname));
+ }
+
message_source_impl::message_source_impl(size_t itemsize, int msgq_limit)
: gr_sync_block("message_source",
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(1, 1, itemsize)),
d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)),
- d_msg_offset(0), d_eof(false)
+ d_msg_offset(0), d_eof(false), d_tags(false)
{
}
@@ -65,7 +73,17 @@ namespace gr {
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(1, 1, itemsize)),
d_itemsize(itemsize), d_msgq(msgq),
- d_msg_offset(0), d_eof(false)
+ d_msg_offset(0), d_eof(false), d_tags(false)
+ {
+ }
+
+ message_source_impl::message_source_impl(size_t itemsize, gr_msg_queue_sptr msgq,
+ const std::string& lengthtagname)
+ : gr_sync_block("message_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false),
+ d_tags(true), d_lengthtagname(lengthtagname)
{
}
@@ -82,42 +100,48 @@ namespace gr {
int nn = 0;
while(nn < noutput_items) {
- if(d_msg) {
- //
- // Consume whatever we can from the current message
- //
- int mm = std::min(noutput_items - nn,
- (int)((d_msg->length() - d_msg_offset) / d_itemsize));
- memcpy(out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize);
-
- nn += mm;
- out += mm * d_itemsize;
- d_msg_offset += mm * d_itemsize;
- assert(d_msg_offset <= d_msg->length());
-
- if(d_msg_offset == d_msg->length()) {
- if(d_msg->type() == 1) // type == 1 sets EOF
- d_eof = true;
- d_msg.reset();
- }
- }
- else {
- //
- // No current message
- //
- if(d_msgq->empty_p() && nn > 0) { // no more messages in the queue, return what we've got
- break;
- }
-
- if(d_eof)
- return -1;
-
- d_msg = d_msgq->delete_head(); // block, waiting for a message
- d_msg_offset = 0;
-
- if((d_msg->length() % d_itemsize) != 0)
- throw std::runtime_error("msg length is not a multiple of d_itemsize");
- }
+ if (d_msg){
+ //
+ // Consume whatever we can from the current message
+ //
+ int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize));
+ memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize);
+
+ if (d_tags && (d_msg_offset == 0)) {
+ const uint64_t offset = this->nitems_written(0) + nn;
+ pmt::pmt_t key = pmt::string_to_symbol(d_lengthtagname);
+ pmt::pmt_t value = pmt::from_long(d_msg->length());
+ this->add_item_tag(0, offset, key, value);
+ }
+ nn += mm;
+ out += mm * d_itemsize;
+ d_msg_offset += mm * d_itemsize;
+ assert(d_msg_offset <= d_msg->length());
+
+ if (d_msg_offset == d_msg->length()){
+ if (d_msg->type() == 1) // type == 1 sets EOF
+ d_eof = true;
+ d_msg.reset();
+ }
+ }
+ else {
+ //
+ // No current message
+ //
+ if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got
+ break;
+ }
+
+ if (d_eof)
+ return -1;
+
+ d_msg = d_msgq->delete_head(); // block, waiting for a message
+ d_msg_offset = 0;
+
+ if ((d_msg->length() % d_itemsize) != 0)
+ throw std::runtime_error("msg length is not a multiple of d_itemsize");
+ }
+
}
return nn;
diff --git a/gr-blocks/lib/message_source_impl.h b/gr-blocks/lib/message_source_impl.h
index c420704478..8fbd209e0a 100644
--- a/gr-blocks/lib/message_source_impl.h
+++ b/gr-blocks/lib/message_source_impl.h
@@ -37,10 +37,16 @@ namespace gr {
gr_message_sptr d_msg;
unsigned d_msg_offset;
bool d_eof;
+ bool d_tags;
+ // FIXME: Is this adequate tagname length.
+ std::string d_lengthtagname;
public:
message_source_impl(size_t itemsize, int msgq_limit);
message_source_impl(size_t itemsize, gr_msg_queue_sptr msgq);
+ message_source_impl(size_t itemsize, gr_msg_queue_sptr msgq,
+ const std::string& lengthtagname);
+
~message_source_impl();
gr_msg_queue_sptr msgq() const { return d_msgq; }
diff --git a/gr-blocks/lib/nop_impl.cc b/gr-blocks/lib/nop_impl.cc
new file mode 100644
index 0000000000..387eda0baf
--- /dev/null
+++ b/gr-blocks/lib/nop_impl.cc
@@ -0,0 +1,100 @@
+/* -*- 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 "nop_impl.h"
+#include <gr_io_signature.h>
+#include <boost/bind.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ nop::sptr
+ nop::make(size_t sizeof_stream_item)
+ {
+ return gnuradio::get_initial_sptr
+ (new nop_impl(sizeof_stream_item));
+ }
+
+ nop_impl::nop_impl (size_t sizeof_stream_item)
+ : gr_block("nop",
+ gr_make_io_signature(0, -1, sizeof_stream_item),
+ gr_make_io_signature(0, -1, sizeof_stream_item)),
+ d_nmsgs_recvd(0)
+ {
+ // Arrange to have count_received_msgs called when messages are received.
+ message_port_register_in(pmt::mp("port"));
+ set_msg_handler(pmt::mp("port"), boost::bind(&nop_impl::count_received_msgs, this, _1));
+ }
+
+ nop_impl::~nop_impl()
+ {
+ }
+
+ // Trivial message handler that just counts them.
+ // (N.B., This feature is used in qa_set_msg_handler)
+ void
+ nop_impl::count_received_msgs(pmt::pmt_t msg)
+ {
+ d_nmsgs_recvd++;
+ }
+
+ int
+ nop_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ // eat any input that's available
+ for(unsigned i = 0; i < ninput_items.size (); i++)
+ consume(i, ninput_items[i]);
+
+ return noutput_items;
+ }
+
+ void
+ nop_impl::setup_rpc()
+ {
+#ifdef GR_CTRLPORT
+ d_rpc_vars.push_back(
+ rpcbasic_sptr(new rpcbasic_register_get<nop, int>(
+ alias(), "test",
+ &nop::ctrlport_test,
+ pmt::mp(-256), pmt::mp(255), pmt::mp(0),
+ "", "Simple testing variable",
+ RPC_PRIVLVL_MIN, DISPNULL)));
+
+ d_rpc_vars.push_back(
+ rpcbasic_sptr(new rpcbasic_register_set<nop, int>(
+ alias(), "test",
+ &nop::set_ctrlport_test,
+ pmt::mp(-256), pmt::mp(255), pmt::mp(0),
+ "", "Simple testing variable",
+ RPC_PRIVLVL_MIN, DISPNULL)));
+#endif /* GR_CTRLPORT */
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/nop_impl.h b/gr-blocks/lib/nop_impl.h
new file mode 100644
index 0000000000..e01e8fc9d9
--- /dev/null
+++ b/gr-blocks/lib/nop_impl.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NOP_IMPL_H
+#define INCLUDED_GR_NOP_IMPL_H
+
+#include <blocks/nop.h>
+
+namespace gr {
+ namespace blocks {
+
+ class nop_impl : public nop
+ {
+ protected:
+ int d_nmsgs_recvd;
+ int d_ctrlport_test;
+
+ // Method that just counts any received messages.
+ void count_received_msgs(pmt::pmt_t msg);
+
+ public:
+ nop_impl(size_t sizeof_stream_item);
+ ~nop_impl();
+
+ void setup_rpc();
+
+ int nmsgs_received() const { return d_nmsgs_recvd; }
+
+ int ctrlport_test() const { return d_ctrlport_test; }
+ void set_ctrlport_test(int x) { d_ctrlport_test = x; }
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_NOP_IMPL_H */
diff --git a/gr-blocks/lib/null_sink_impl.cc b/gr-blocks/lib/null_sink_impl.cc
new file mode 100644
index 0000000000..b780a2405a
--- /dev/null
+++ b/gr-blocks/lib/null_sink_impl.cc
@@ -0,0 +1,60 @@
+/* -*- 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 "null_sink_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ null_sink::sptr
+ null_sink::make(size_t sizeof_stream_item)
+ {
+ return gnuradio::get_initial_sptr
+ (new null_sink_impl(sizeof_stream_item));
+ }
+
+ null_sink_impl::null_sink_impl(size_t sizeof_stream_item)
+ : gr_sync_block("null_sink",
+ gr_make_io_signature(1, 1, sizeof_stream_item),
+ gr_make_io_signature(0, 0, 0))
+ {
+ }
+
+ null_sink_impl::~null_sink_impl()
+ {
+ }
+
+ int
+ null_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/null_sink_impl.h b/gr-blocks/lib/null_sink_impl.h
new file mode 100644
index 0000000000..bb4c695c23
--- /dev/null
+++ b/gr-blocks/lib/null_sink_impl.h
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NULL_SINK_IMPL_H
+#define INCLUDED_GR_NULL_SINK_IMPL_H
+
+#include <blocks/null_sink.h>
+
+namespace gr {
+ namespace blocks {
+
+ class null_sink_impl : public null_sink
+ {
+ public:
+ null_sink_impl(size_t sizeof_stream_item);
+ ~null_sink_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_NULL_SINK_IMPL_H */
diff --git a/gr-blocks/lib/null_source_impl.cc b/gr-blocks/lib/null_source_impl.cc
new file mode 100644
index 0000000000..81999d0501
--- /dev/null
+++ b/gr-blocks/lib/null_source_impl.cc
@@ -0,0 +1,63 @@
+/* -*- 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 "null_source_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ null_source::sptr
+ null_source::make(size_t sizeof_stream_item)
+ {
+ return gnuradio::get_initial_sptr
+ (new null_source_impl(sizeof_stream_item));
+ }
+
+ null_source_impl::null_source_impl (size_t sizeof_stream_item)
+ : gr_sync_block("null_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, sizeof_stream_item))
+ {
+ }
+
+ null_source_impl::~null_source_impl()
+ {
+ }
+
+ int
+ null_source_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ void *optr = (void*)output_items[0];
+ memset(optr, 0, noutput_items * output_signature()->sizeof_stream_item(0));
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/null_source_impl.h b/gr-blocks/lib/null_source_impl.h
new file mode 100644
index 0000000000..36201d54b6
--- /dev/null
+++ b/gr-blocks/lib/null_source_impl.h
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NULL_SOURCE_IMPL_H
+#define INCLUDED_GR_NULL_SOURCE_IMPL_H
+
+#include <blocks/null_source.h>
+
+namespace gr {
+ namespace blocks {
+
+ class null_source_impl : public null_source
+ {
+ public:
+ null_source_impl(size_t sizeof_stream_item);
+ ~null_source_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_NULL_SOURCE_IMPL_H */
diff --git a/gr-blocks/lib/pdu.cc b/gr-blocks/lib/pdu.cc
index ae4b17aecc..9d5322bfe3 100644
--- a/gr-blocks/lib/pdu.cc
+++ b/gr-blocks/lib/pdu.cc
@@ -61,7 +61,7 @@ namespace gr {
}
pmt::pmt_t
- make_vector(vector_type type, const uint8_t *buf, size_t items)
+ make_pdu_vector(vector_type type, const uint8_t *buf, size_t items)
{
switch(type) {
case byte_t:
diff --git a/gr-blocks/lib/plateau_detector_fb_impl.cc b/gr-blocks/lib/plateau_detector_fb_impl.cc
new file mode 100644
index 0000000000..f68ef6463f
--- /dev/null
+++ b/gr-blocks/lib/plateau_detector_fb_impl.cc
@@ -0,0 +1,83 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_io_signature.h>
+#include "plateau_detector_fb_impl.h"
+
+namespace gr {
+ namespace blocks {
+
+ plateau_detector_fb::sptr
+ plateau_detector_fb::make(int max_len, float threshold)
+ {
+ return gnuradio::get_initial_sptr
+ (new plateau_detector_fb_impl(max_len, threshold));
+ }
+
+ plateau_detector_fb_impl::plateau_detector_fb_impl(int max_len, float threshold)
+ : gr_sync_block("plateau_detector_fb",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(char))),
+ d_max_len(max_len),
+ d_threshold(threshold)
+ {}
+
+ plateau_detector_fb_impl::~plateau_detector_fb_impl()
+ {
+ }
+
+ int
+ plateau_detector_fb_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];
+ unsigned char *out = (unsigned char *) output_items[0];
+ int flank_start;
+
+ memset((void *) out, 0x00, noutput_items);
+ int i;
+ for(i = 0; i < noutput_items; i++) {
+ if(in[i] >= d_threshold) {
+ if(noutput_items-i < 2*d_max_len) { // If we can't finish, come back later
+ break;
+ }
+ flank_start = i;
+ while(i < noutput_items && in[i] >= d_threshold)
+ i++;
+ if((i - flank_start) > 1) { // 1 Sample is not a plateau
+ out[flank_start + (i-flank_start)/2] = 1;
+ i = std::min(i+d_max_len, noutput_items-1);
+ }
+ }
+ }
+
+ return i;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
diff --git a/gr-blocks/lib/plateau_detector_fb_impl.h b/gr-blocks/lib/plateau_detector_fb_impl.h
new file mode 100644
index 0000000000..67682d00f3
--- /dev/null
+++ b/gr-blocks/lib/plateau_detector_fb_impl.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_IMPL_H
+#define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_IMPL_H
+
+#include <blocks/plateau_detector_fb.h>
+
+namespace gr {
+ namespace blocks {
+
+class plateau_detector_fb_impl : public plateau_detector_fb
+{
+ private:
+ int d_max_len;
+ float d_threshold;
+
+ public:
+ plateau_detector_fb_impl(int max_len, float threshold);
+ ~plateau_detector_fb_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_BLOCKS_PLATEAU_DETECTOR_FB_IMPL_H */
+
diff --git a/gr-blocks/lib/probe_rate_impl.cc b/gr-blocks/lib/probe_rate_impl.cc
new file mode 100644
index 0000000000..37749c85e3
--- /dev/null
+++ b/gr-blocks/lib/probe_rate_impl.cc
@@ -0,0 +1,119 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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 "probe_rate_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ probe_rate::sptr
+ probe_rate::make(size_t itemsize, double update_rate_ms, double alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new probe_rate_impl(itemsize,update_rate_ms,alpha));
+ }
+
+ probe_rate_impl::probe_rate_impl(size_t itemsize, double update_rate_ms, double alpha) :
+ gr_sync_block("probe_rate",
+ gr_make_io_signature(1,1,itemsize),
+ gr_make_io_signature(0,0,itemsize)),
+ d_alpha(alpha),
+ d_beta(1.0-alpha),
+ d_avg(0),
+ d_min_update_time(update_rate_ms),
+ d_lastthru(0),
+ d_itemsize(itemsize)
+ {
+ }
+
+ probe_rate_impl::~probe_rate_impl(){}
+
+ int probe_rate_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items){
+ d_lastthru += noutput_items;
+ boost::posix_time::ptime now(boost::posix_time::microsec_clock::local_time());
+ boost::posix_time::time_duration diff = now - d_last_update;
+ double diff_ms = diff.total_milliseconds();
+ if(diff_ms >= d_min_update_time){
+ double rate_this_update = d_lastthru *1e3 / diff_ms;
+ d_lastthru = 0;
+ d_last_update = now;
+ if(d_avg == 0){
+ d_avg = rate_this_update;
+ } else {
+ d_avg = rate_this_update*d_alpha + d_avg*d_beta;
+ }
+ }
+ return noutput_items;
+ }
+
+ void probe_rate_impl::setup_rpc(){
+#ifdef GR_CTRLPORT
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<probe_rate_impl, double >(
+ alias(), "rate_items",
+ &probe_rate_impl::rate,
+ pmt::mp(0), pmt::mp(1e6), pmt::mp(1),
+ "items/sec", "Item rate",
+ RPC_PRIVLVL_MIN, DISPTIME | DISPOPTSTRIP)));
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<probe_rate_impl, double >(
+ alias(), "timesincelast",
+ &probe_rate_impl::timesincelast,
+ pmt::mp(0), pmt::mp(d_min_update_time*2), pmt::mp(0),
+ "ms", "Time since last update",
+ RPC_PRIVLVL_MIN, DISPTIME | DISPOPTSTRIP)));
+#endif
+ }
+
+ void probe_rate_impl::set_alpha(double alpha){ d_alpha = alpha; }
+
+ double probe_rate_impl::rate(){ return d_avg; }
+
+ double probe_rate_impl::timesincelast(){
+ boost::posix_time::ptime now(boost::posix_time::microsec_clock::local_time());
+ boost::posix_time::time_duration diff = now - d_last_update;
+ return diff.total_milliseconds();
+ }
+
+ bool probe_rate_impl::start(){
+ d_avg = 0;
+ d_lastthru = 0;
+ d_last_update = boost::posix_time::microsec_clock::local_time();
+ return true;
+ }
+
+ bool probe_rate_impl::stop(){
+ return true;
+ }
+
+
+
+ } /* namespace blocks */
+} /* namespace gr */
+
diff --git a/gr-blocks/lib/probe_rate_impl.h b/gr-blocks/lib/probe_rate_impl.h
new file mode 100644
index 0000000000..81f7b4e138
--- /dev/null
+++ b/gr-blocks/lib/probe_rate_impl.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_PROBE_RATE_IMPL_H
+#define INCLUDED_GR_PROBE_RATE_IMPL_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <blocks/probe_rate.h>
+
+namespace gr {
+ namespace blocks {
+
+ class probe_rate_impl : public probe_rate
+ {
+ private:
+ double d_alpha, d_beta, d_avg;
+ double d_min_update_time;
+ boost::posix_time::ptime d_last_update;
+ uint64_t d_lastthru;
+ size_t d_itemsize;
+ void setup_rpc();
+
+ public:
+ probe_rate_impl(size_t itemsize, double update_rate_ms, double alpha = 0.0001);
+ ~probe_rate_impl();
+ void set_alpha(double alpha);
+ double rate();
+ double timesincelast();
+ bool start();
+ bool stop();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ }; // end class
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif
diff --git a/gr-blocks/lib/qa_block_tags.cc b/gr-blocks/lib/qa_block_tags.cc
new file mode 100644
index 0000000000..f3139245d8
--- /dev/null
+++ b/gr-blocks/lib/qa_block_tags.cc
@@ -0,0 +1,450 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 <qa_block_tags.h>
+#include <gr_block.h>
+#include <gr_top_block.h>
+#include <blocks/null_source.h>
+#include <blocks/null_sink.h>
+#include <blocks/head.h>
+#include <blocks/annotator_alltoall.h>
+#include <blocks/annotator_1to1.h>
+#include <blocks/keep_one_in_n.h>
+#include <gr_tags.h>
+
+
+// ----------------------------------------------------------------
+
+using namespace pmt;
+
+// set to 1 to turn on debug output
+// The debug output fully checks that the tags seen are what are expected. While
+// this behavior currently works with our implementation, there is no guarentee
+// that the tags will be coming in this specific order, so it's dangerous to
+// rely on this as a test of the tag system working. We would really want to
+// tags we know we should see and then test that they all occur once, but in no
+// particular order.
+#define QA_TAGS_DEBUG 0
+
+void
+qa_block_tags::t0()
+{
+ unsigned int N = 1000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr::blocks::null_source::make(sizeof(int)));
+ gr_block_sptr head (gr::blocks::head::make(sizeof(int), N));
+ gr_block_sptr snk (gr::blocks::null_sink::make(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, snk, 0);
+
+ //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error);
+ //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (uint64_t)0);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (uint64_t)0);
+
+ tb->run();
+
+ CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument);
+ CPPUNIT_ASSERT(src->nitems_written(0) >= N);
+ CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (uint64_t)1000);
+ CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument);
+}
+
+
+void
+qa_block_tags::t1()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr::blocks::null_source::make(sizeof(int)));
+ gr_block_sptr head (gr::blocks::head::make(sizeof(int), N));
+ gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann3(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann4(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int)));
+ gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags3 = ann3->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t1" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+void
+qa_block_tags::t2 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr::blocks::null_source::make(sizeof(int)));
+ gr_block_sptr head (gr::blocks::head::make(sizeof(int), N));
+ gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann3(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann4(gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int)));
+ gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int)));
+ gr_block_sptr snk2 (gr::blocks::null_sink::make(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann1, 1);
+ tb->connect(ann1, 0, ann2, 0);
+ tb->connect(ann1, 1, ann3, 0);
+ tb->connect(ann1, 2, ann4, 0);
+
+ tb->connect(ann2, 0, snk0, 0);
+ tb->connect(ann3, 0, snk1, 0);
+ tb->connect(ann4, 0, snk2, 0);
+
+ tb->run();
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags1 = ann1->data();
+ std::vector<gr_tag_t> tags2 = ann2->data();
+ std::vector<gr_tag_t> tags3 = ann4->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8);
+
+ // Make sure the rest all have 12 tags
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+
+ pmt_t expected_tags2[12];
+ expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(6));
+ expected_tags2[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags2[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags2[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(9));
+ expected_tags2[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags2[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ pmt_t expected_tags4[12];
+ expected_tags4[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags4[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(5));
+ expected_tags4[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(8));
+ expected_tags4[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags4[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(11));
+ expected_tags4[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags4[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t2" << std::endl;
+
+ // For annotator[2-4], we know it gets tags from ann0 and ann1
+ // but the tags from the different outputs of ann1 are different for each.
+ // Just testing ann2 and ann4; if they are correct it would be
+ // inconceivable for ann3 to have it wrong.
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i]));
+ }
+
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t3()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr::blocks::null_source::make(sizeof(int)));
+ gr_block_sptr head (gr::blocks::head::make(sizeof(int), N));
+ gr::blocks::annotator_1to1::sptr ann0 (gr::blocks::annotator_1to1::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann1 (gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_alltoall::sptr ann2 (gr::blocks::annotator_alltoall::make(10000, sizeof(int)));
+ gr::blocks::annotator_1to1::sptr ann3 (gr::blocks::annotator_1to1::make(10000, sizeof(int)));
+ gr::blocks::annotator_1to1::sptr ann4 (gr::blocks::annotator_1to1::make(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int)));
+ gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(head, 0, ann0, 1);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags3 = ann3->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t3" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t4()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr::blocks::null_source::make(sizeof(int)));
+ gr_block_sptr head (gr::blocks::head::make(sizeof(int), N));
+ gr::blocks::annotator_1to1::sptr ann0(gr::blocks::annotator_1to1::make(10000, sizeof(int)));
+ gr::blocks::annotator_1to1::sptr ann1(gr::blocks::annotator_1to1::make(10000, sizeof(int)));
+ gr::blocks::annotator_1to1::sptr ann2(gr::blocks::annotator_1to1::make(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int)));
+ gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int)));
+
+ // using 1-to-1 tag propagation without having equal number of
+ // ins and outs. Make sure this works; will just exit run early.
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, snk0, 0);
+ tb->connect(ann2, 0, snk1, 0);
+
+ std::cerr << std::endl
+ << "NOTE: This is supposed to produce an error from gr_block_executor"
+ << std::endl;
+ tb->run();
+}
+
+
+void
+qa_block_tags::t5()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr::blocks::null_source::make(sizeof(float)));
+ gr_block_sptr head (gr::blocks::head::make(sizeof(float), N));
+ gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(float)));
+ gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(float)));
+ gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(1000, sizeof(float)));
+ gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(float)));
+
+ // Rate change blocks
+ gr::blocks::keep_one_in_n::sptr dec10(gr::blocks::keep_one_in_n::make(sizeof(float), 10));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann1, 0, dec10, 0);
+ tb->connect(dec10, 0, ann2, 0);
+ tb->connect(ann2, 0, snk0, 0);
+
+ tb->run();
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags1 = ann1->data();
+ std::vector<gr_tag_t> tags2 = ann2->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4);
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags1[5];
+ expected_tags1[0] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags1[1] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags1[2] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags1[3] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(3));
+
+ pmt_t expected_tags2[10];
+ expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt::from_uint64(1000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt::from_uint64(1000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[4] = mp(pmt::from_uint64(2000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt::from_uint64(2000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[6] = mp(pmt::from_uint64(3000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[7] = mp(pmt::from_uint64(3000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[8] = mp(pmt::from_uint64(4000), mp(str1.str()), mp("seq"), mp(4));
+ expected_tags2[9] = mp(pmt::from_uint64(4000), mp(str0.str()), mp("seq"), mp(4));
+
+ std::cout << std::endl << "qa_block_tags::t5" << std::endl;
+
+ // annotator 1 gets tags from annotator 0
+ std::cout << "tags1.size(): " << tags1.size() << std::endl;
+ for(size_t i = 0; i < tags1.size(); i++) {
+ std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags1[i]), pmt::write_string(expected_tags1[i]));
+ }
+
+ // annotator 2 gets tags from annotators 0 and 1
+ std::cout << std::endl;
+ std::cout << "tags2.size(): " << tags2.size() << std::endl;
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i]));
+ }
+#endif
+}
+
diff --git a/gr-blocks/lib/qa_block_tags.h b/gr-blocks/lib/qa_block_tags.h
new file mode 100644
index 0000000000..83bebe23f6
--- /dev/null
+++ b/gr-blocks/lib/qa_block_tags.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_QA_BLOCK_TAGS_H
+#define INCLUDED_QA_BLOCK_TAGS_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_block_tags : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_block_tags);
+ CPPUNIT_TEST(t0);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST(t2);
+ CPPUNIT_TEST(t3);
+ CPPUNIT_TEST(t4);
+ CPPUNIT_TEST(t5);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t0();
+ void t1();
+ void t2();
+ void t3();
+ void t4();
+ void t5();
+};
+
+#endif /* INCLUDED_QA_BLOCK_TAGS_H */
diff --git a/gr-blocks/lib/qa_blocks.cc b/gr-blocks/lib/qa_blocks.cc
new file mode 100644
index 0000000000..409b5d5762
--- /dev/null
+++ b/gr-blocks/lib/qa_blocks.cc
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/*
+ * This class gathers together all the test cases for the gr-blocks
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include <qa_blocks.h>
+#include <qa_block_tags.h>
+#include <qa_rotator.h>
+
+CppUnit::TestSuite *
+qa_gr_blocks::suite()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite("gr-blocks");
+
+ s->addTest(qa_block_tags::suite());
+ s->addTest(qa_rotator::suite());
+
+ return s;
+}
diff --git a/gr-blocks/lib/qa_blocks.h b/gr-blocks/lib/qa_blocks.h
new file mode 100644
index 0000000000..ad538134bd
--- /dev/null
+++ b/gr-blocks/lib/qa_blocks.h
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+
+#ifndef _QA_GR_BLOCKS_H_
+#define _QA_GR_BLOCKS_H_
+
+#include <attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the gr-blocks directory
+
+class __GR_ATTR_EXPORT qa_gr_blocks
+{
+ public:
+ //! return suite of tests for all of gr-blocks directory
+ static CppUnit::TestSuite *suite();
+};
+
+#endif /* _QA_GR_BLOCKS_H_ */
diff --git a/gr-blocks/lib/qa_gr_block.cc b/gr-blocks/lib/qa_gr_block.cc
new file mode 100644
index 0000000000..7f4a01bbd0
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_block.cc
@@ -0,0 +1,89 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_block.h>
+#include <gr_block.h>
+#include <gr_io_signature.h>
+#include <blocks/null_sink.h>
+#include <blocks/null_source.h>
+
+
+// ----------------------------------------------------------------
+
+
+void
+qa_gr_block::t0 ()
+{
+ // test creation of sources
+ gr_block_sptr src1(gr::blocks::null_source::make(sizeof (int)));
+ CPPUNIT_ASSERT_EQUAL(std::string("null_source"), src1->name ());
+ CPPUNIT_ASSERT_EQUAL(0, src1->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL((int) sizeof(int),
+ src1->output_signature()->sizeof_stream_item (0));
+
+ gr_block_sptr src2(gr::blocks::null_source::make(sizeof(short)));
+ CPPUNIT_ASSERT_EQUAL(std::string ("null_source"), src2->name ());
+ CPPUNIT_ASSERT_EQUAL(0, src2->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL(1, src2->output_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL(1, src2->output_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL((int)sizeof (short),
+ src2->output_signature()->sizeof_stream_item (0));
+}
+
+
+void
+qa_gr_block::t1 ()
+{
+ // test creation of sinks
+ gr_block_sptr dst1 (gr::blocks::null_sink::make (sizeof (int)));
+ CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ());
+ CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (int),
+ dst1->input_signature()->sizeof_stream_item (0));
+
+ CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ());
+
+ gr_block_sptr dst2 (gr::blocks::null_sink::make (sizeof (short)));
+ CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ());
+ CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (short),
+ dst2->input_signature()->sizeof_stream_item (0));
+ CPPUNIT_ASSERT_EQUAL (0, dst2->output_signature()->max_streams ());
+}
+
+void
+qa_gr_block::t2 ()
+{
+}
+
+void
+qa_gr_block::t3 ()
+{
+}
diff --git a/gr-blocks/lib/qa_gr_block.h b/gr-blocks/lib/qa_gr_block.h
new file mode 100644
index 0000000000..14c7c40d1f
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_block.h
@@ -0,0 +1,48 @@
+/* -*- 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_QA_GR_BLOCK_H
+#define INCLUDED_QA_GR_BLOCK_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_block : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_block);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* INCLUDED_QA_GR_BLOCK_H */
diff --git a/gr-blocks/lib/qa_gr_flowgraph.cc b/gr-blocks/lib/qa_gr_flowgraph.cc
new file mode 100644
index 0000000000..1a3006039b
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_flowgraph.cc
@@ -0,0 +1,245 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_flowgraph.h>
+#include <gr_flowgraph.h>
+#include <blocks/nop.h>
+#include <blocks/null_source.h>
+#include <blocks/null_sink.h>
+
+void qa_gr_flowgraph::t0()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ CPPUNIT_ASSERT(fg);
+}
+
+void qa_gr_flowgraph::t1_connect()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+}
+
+void qa_gr_flowgraph::t2_connect_invalid_src_port_neg()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(nop1, -1, nop2, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t3_connect_src_port_exceeds()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(src, 1, dst, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t4_connect_invalid_dst_port_neg()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, -1), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t5_connect_dst_port_exceeds()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(src, 0, dst, 1), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t6_connect_dst_in_use()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src1 = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr src2 = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ fg->connect(src1, 0, dst, 0);
+ CPPUNIT_ASSERT_THROW(fg->connect(src2, 0, dst, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t7_connect_one_src_two_dst()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr dst1 = gr::blocks::null_sink::make(sizeof(int));
+ gr_block_sptr dst2 = gr::blocks::null_sink::make(sizeof(int));
+
+ fg->connect(src, 0, dst1, 0);
+ fg->connect(src, 0, dst2, 0);
+}
+
+void qa_gr_flowgraph::t8_connect_type_mismatch()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(char));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t9_disconnect()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->disconnect(nop1, 0, nop2, 0);
+}
+
+void qa_gr_flowgraph::t10_disconnect_unconnected_block()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop3 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop3, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t11_disconnect_unconnected_port()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop2, 1), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t12_validate()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->validate();
+}
+
+void qa_gr_flowgraph::t13_validate_missing_input_assignment()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->connect(nop1, 0, nop2, 2);
+ CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error);
+}
+
+void qa_gr_flowgraph::t14_validate_missing_output_assignment()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->connect(nop1, 2, nop2, 1);
+ CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error);
+}
+
+void qa_gr_flowgraph::t15_clear()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+
+ CPPUNIT_ASSERT(fg->edges().size() == 1);
+ CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 2);
+
+ fg->clear();
+
+ CPPUNIT_ASSERT(fg->edges().size() == 0);
+ CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 0);
+}
+
+void qa_gr_flowgraph::t16_partition()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop11 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop12 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop13 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop14 = gr::blocks::nop::make(sizeof(int));
+
+ gr_block_sptr nop21 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop22 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop23 = gr::blocks::nop::make(sizeof(int));
+
+ gr_block_sptr nop31 = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr nop32 = gr::blocks::nop::make(sizeof(int));
+
+ // Build disjoint graph #1
+ fg->connect(nop11, 0, nop12, 0);
+ fg->connect(nop12, 0, nop13, 0);
+ fg->connect(nop13, 0, nop14, 0);
+
+ // Build disjoint graph #2
+ fg->connect(nop21, 0, nop22, 0);
+ fg->connect(nop22, 0, nop23, 0);
+
+ // Build disjoint graph #3
+ fg->connect(nop31, 0, nop32, 0);
+
+ std::vector<gr_basic_block_vector_t> graphs = fg->partition();
+
+ CPPUNIT_ASSERT(graphs.size() == 3);
+ CPPUNIT_ASSERT(graphs[0].size() == 4);
+ CPPUNIT_ASSERT(graphs[1].size() == 3);
+ CPPUNIT_ASSERT(graphs[2].size() == 2);
+}
diff --git a/gr-blocks/lib/qa_gr_flowgraph.h b/gr-blocks/lib/qa_gr_flowgraph.h
new file mode 100644
index 0000000000..2c2686f71b
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_flowgraph.h
@@ -0,0 +1,75 @@
+/* -*- 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_QA_GR_FLOWGRAPH_H
+#define INCLUDED_QA_GR_FLOWGRAPH_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_flowgraph : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_flowgraph);
+
+ CPPUNIT_TEST(t0);
+ CPPUNIT_TEST(t1_connect);
+ CPPUNIT_TEST(t2_connect_invalid_src_port_neg);
+ CPPUNIT_TEST(t3_connect_src_port_exceeds);
+ CPPUNIT_TEST(t4_connect_invalid_dst_port_neg);
+ CPPUNIT_TEST(t5_connect_dst_port_exceeds);
+ CPPUNIT_TEST(t6_connect_dst_in_use);
+ CPPUNIT_TEST(t7_connect_one_src_two_dst);
+ CPPUNIT_TEST(t8_connect_type_mismatch);
+ CPPUNIT_TEST(t9_disconnect);
+ CPPUNIT_TEST(t10_disconnect_unconnected_block);
+ CPPUNIT_TEST(t11_disconnect_unconnected_port);
+ CPPUNIT_TEST(t12_validate);
+ CPPUNIT_TEST(t13_validate_missing_input_assignment);
+ CPPUNIT_TEST(t14_validate_missing_output_assignment);
+ CPPUNIT_TEST(t15_clear);
+ CPPUNIT_TEST(t16_partition);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+ void t0();
+ void t1_connect();
+ void t2_connect_invalid_src_port_neg();
+ void t3_connect_src_port_exceeds();
+ void t4_connect_invalid_dst_port_neg();
+ void t5_connect_dst_port_exceeds();
+ void t6_connect_dst_in_use();
+ void t7_connect_one_src_two_dst();
+ void t8_connect_type_mismatch();
+ void t9_disconnect();
+ void t10_disconnect_unconnected_block();
+ void t11_disconnect_unconnected_port();
+ void t12_validate();
+ void t13_validate_missing_input_assignment();
+ void t14_validate_missing_output_assignment();
+ void t15_clear();
+ void t16_partition();
+};
+
+#endif /* INCLUDED_QA_GR_FLOWGRAPH_H */
diff --git a/gr-blocks/lib/qa_gr_hier_block2.cc b/gr-blocks/lib/qa_gr_hier_block2.cc
new file mode 100644
index 0000000000..a3d599039c
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_hier_block2.cc
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2008,2009 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 <qa_gr_hier_block2.h>
+#include <gr_hier_block2.h>
+#include <gr_io_signature.h>
+
+void qa_gr_hier_block2::test_make()
+{
+ gr_hier_block2_sptr src1(gr_make_hier_block2("test",
+ gr_make_io_signature(1, 1, 1 * sizeof(int)),
+ gr_make_io_signature(1, 1, 1 * sizeof(int))));
+
+ CPPUNIT_ASSERT(src1);
+ CPPUNIT_ASSERT_EQUAL(std::string("test"), src1->name());
+
+ CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int),
+ src1->input_signature()->sizeof_stream_item(0));
+
+ CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->min_streams());
+ CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->max_streams());
+
+
+ CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int),
+ src1->output_signature()->sizeof_stream_item(0));
+
+ CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams());
+ CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams());
+
+}
+
+
diff --git a/gr-blocks/lib/qa_gr_hier_block2.h b/gr-blocks/lib/qa_gr_hier_block2.h
new file mode 100644
index 0000000000..653cd27251
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_hier_block2.h
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_QA_GR_HIER_BLOCK2_H
+#define INCLUDED_QA_GR_HIER_BLOCK2_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_hier_block2 : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_hier_block2);
+
+ CPPUNIT_TEST(test_make);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void test_make();
+};
+
+#endif /* INCLUDED_QA_GR_HIER_BLOCK2_H */
diff --git a/gr-blocks/lib/qa_gr_hier_block2_derived.cc b/gr-blocks/lib/qa_gr_hier_block2_derived.cc
new file mode 100644
index 0000000000..eb747d32cc
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_hier_block2_derived.cc
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_hier_block2_derived.h>
+#include <gr_top_block.h>
+#include <gr_io_signature.h>
+#include <blocks/null_source.h>
+#include <blocks/null_sink.h>
+#include <blocks/head.h>
+#include <blocks/copy.h>
+
+// Declare a test C++ hierarchical block
+
+class gr_derived_block;
+typedef boost::shared_ptr<gr_derived_block> gr_derived_block_sptr;
+gr_derived_block_sptr gr_make_derived_block();
+
+class gr_derived_block : public gr_hier_block2
+{
+private:
+ friend gr_derived_block_sptr gr_make_derived_block();
+ gr_derived_block();
+
+public:
+ ~gr_derived_block();
+};
+
+
+gr_derived_block_sptr
+gr_make_derived_block()
+{
+ return gnuradio::get_initial_sptr(new gr_derived_block());
+}
+
+gr_derived_block::gr_derived_block()
+ : gr_hier_block2("gr_derived_block",
+ gr_make_io_signature(1, 1, sizeof(int)), // Input signature
+ gr_make_io_signature(1, 1, sizeof(int))) // Output signature
+{
+ gr_block_sptr copy(gr::blocks::copy::make(sizeof(int)));
+
+ connect(self(), 0, copy, 0);
+ connect(copy, 0, self(), 0);
+}
+
+gr_derived_block::~gr_derived_block()
+{
+}
+
+void qa_gr_hier_block2_derived::test_1()
+{
+ gr_top_block_sptr tb(gr_make_top_block("test"));
+
+ gr_block_sptr src(gr::blocks::null_source::make(sizeof(int)));
+ gr_block_sptr head(gr::blocks::head::make(sizeof(int), 1000));
+ gr_derived_block_sptr blk(gr_make_derived_block());
+ gr_block_sptr dst(gr::blocks::null_sink::make(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, blk, 0);
+ tb->connect(blk, 0, dst, 0);
+
+ tb->run();
+}
diff --git a/gr-blocks/lib/qa_gr_hier_block2_derived.h b/gr-blocks/lib/qa_gr_hier_block2_derived.h
new file mode 100644
index 0000000000..8e0a1880ce
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_hier_block2_derived.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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_QA_GR_HIER_BLOCK2_DERIVED_H
+#define INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+// Declare a QA test case
+class qa_gr_hier_block2_derived : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_hier_block2_derived);
+ CPPUNIT_TEST(test_1);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void test_1();
+};
+
+#endif /* INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H */
diff --git a/gr-blocks/lib/qa_gr_top_block.cc b/gr-blocks/lib/qa_gr_top_block.cc
new file mode 100644
index 0000000000..cb75cd14d0
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_top_block.cc
@@ -0,0 +1,285 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_top_block.h>
+#include <gr_top_block.h>
+#include <blocks/head.h>
+#include <blocks/nop.h>
+#include <blocks/null_source.h>
+#include <blocks/null_sink.h>
+#include <iostream>
+
+#define VERBOSE 0
+
+void qa_gr_top_block::t0()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t0()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ CPPUNIT_ASSERT(tb);
+}
+
+void qa_gr_top_block::t1_run()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t1()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->run();
+}
+
+void qa_gr_top_block::t2_start_stop_wait()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t2()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+
+ tb->start();
+ tb->stop();
+ tb->wait();
+}
+
+void qa_gr_top_block::t3_lock_unlock()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t3()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ tb->connect(src, 0, dst, 0);
+
+ tb->start();
+
+ tb->lock();
+ tb->unlock();
+
+ tb->stop();
+ tb->wait();
+}
+
+void qa_gr_top_block::t4_reconfigure()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t4()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start();
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+
+void qa_gr_top_block::t5_max_noutputs()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t5()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->start(100);
+ tb->wait();
+}
+
+void qa_gr_top_block::t6_reconfig_max_noutputs()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t6()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start(100);
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->set_max_noutput_items(1000);
+ head->set_max_noutput_items(500);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+void qa_gr_top_block::t7_max_noutputs_per_block()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t7()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ head->set_max_noutput_items(100);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->start();
+ tb->wait();
+}
+
+void qa_gr_top_block::t8_reconfig_max_noutputs_per_block()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t8()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ head->set_max_noutput_items(99);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start(201);
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->set_max_noutput_items(1023);
+ head->set_max_noutput_items(513);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+void qa_gr_top_block::t9_max_output_buffer()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t9()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ head->set_max_output_buffer(1024);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->start();
+ tb->wait();
+}
+
+void qa_gr_top_block::t10_reconfig_max_output_buffer()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t10()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000);
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ head->set_max_output_buffer(1000);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start(201);
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ gr_block_sptr nop = gr::blocks::nop::make(sizeof(int));
+ nop->set_max_output_buffer(4000);
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, nop, 0);
+ tb->connect(nop, 0, dst, 0);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+void qa_gr_top_block::t11_set_block_affinity()
+{
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr::blocks::null_source::make(sizeof(float)));
+ gr_block_sptr snk (gr::blocks::null_sink::make(sizeof(float)));
+
+ std::vector<int> set(1, 0), ret;
+ src->set_processor_affinity(set);
+
+ tb->connect(src, 0, snk, 0);
+ tb->start();
+ tb->stop();
+ tb->wait();
+
+ ret = src->processor_affinity();
+
+ // We only set the core affinity to 0 because we always know at
+ // least one thread core exists to use.
+ CPPUNIT_ASSERT_EQUAL(set[0], ret[0]);
+}
diff --git a/gr-blocks/lib/qa_gr_top_block.h b/gr-blocks/lib/qa_gr_top_block.h
new file mode 100644
index 0000000000..634eeab1f8
--- /dev/null
+++ b/gr-blocks/lib/qa_gr_top_block.h
@@ -0,0 +1,66 @@
+/* -*- 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_QA_GR_TOP_BLOCK_H
+#define INCLUDED_QA_GR_TOP_BLOCK_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_top_block : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_top_block);
+
+ CPPUNIT_TEST(t0);
+ CPPUNIT_TEST(t1_run);
+ CPPUNIT_TEST(t2_start_stop_wait);
+ CPPUNIT_TEST(t3_lock_unlock);
+ CPPUNIT_TEST(t4_reconfigure); // triggers 'join never returns' bug
+ CPPUNIT_TEST(t5_max_noutputs);
+ CPPUNIT_TEST(t6_reconfig_max_noutputs);
+ CPPUNIT_TEST(t7_max_noutputs_per_block);
+ CPPUNIT_TEST(t8_reconfig_max_noutputs_per_block);
+ CPPUNIT_TEST(t9_max_output_buffer);
+ CPPUNIT_TEST(t10_reconfig_max_output_buffer);
+ CPPUNIT_TEST(t11_set_block_affinity);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+ void t0();
+ void t1_run();
+ void t2_start_stop_wait();
+ void t3_lock_unlock();
+ void t4_reconfigure();
+ void t5_max_noutputs();
+ void t6_reconfig_max_noutputs();
+ void t7_max_noutputs_per_block();
+ void t8_reconfig_max_noutputs_per_block();
+ void t9_max_output_buffer();
+ void t10_reconfig_max_output_buffer();
+ void t11_set_block_affinity();
+
+};
+
+#endif /* INCLUDED_QA_GR_TOP_BLOCK_H */
diff --git a/gr-blocks/lib/qa_rotator.cc b/gr-blocks/lib/qa_rotator.cc
new file mode 100644
index 0000000000..877392075a
--- /dev/null
+++ b/gr-blocks/lib/qa_rotator.cc
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 <attributes.h>
+#include <cppunit/TestAssert.h>
+#include <qa_rotator.h>
+#include <blocks/rotator.h>
+#include <stdio.h>
+#include <cmath>
+#include <gr_expj.h>
+
+// error vector magnitude
+__GR_ATTR_UNUSED static float
+error_vector_mag(gr_complex a, gr_complex b)
+{
+ return abs(a-b);
+}
+
+void
+qa_rotator::t1()
+{
+ static const unsigned int N = 100000;
+
+ gr::blocks::rotator r;
+
+ double phase_incr = 2*M_PI / 1003;
+ double phase = 0;
+
+ // Old code: We increment then return the rotated value, thus we
+ // need to start one tick back r.set_phase(gr_complex(1,0) *
+ // conj(gr_expj(phase_incr)));
+
+ r.set_phase(gr_complex(1,0));
+ r.set_phase_incr(gr_expj(phase_incr));
+
+ for(unsigned i = 0; i < N; i++) {
+ gr_complex expected = gr_expj(phase);
+ gr_complex actual = r.rotate(gr_complex(1, 0));
+
+#if 0
+ float evm = error_vector_mag(expected, actual);
+ printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n",
+ i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm);
+#endif
+
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001);
+
+ phase += phase_incr;
+ if(phase >= 2*M_PI)
+ phase -= 2*M_PI;
+ }
+}
diff --git a/gr-blocks/lib/qa_rotator.h b/gr-blocks/lib/qa_rotator.h
new file mode 100644
index 0000000000..575ea506c7
--- /dev/null
+++ b/gr-blocks/lib/qa_rotator.h
@@ -0,0 +1,39 @@
+/* -*- 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 _QA_GR_ROTATOR_H_
+#define _QA_GR_ROTATOR_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_rotator : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_rotator);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t1();
+};
+
+#endif /* _QA_GR_ROTATOR_H_ */
diff --git a/gr-blocks/lib/qa_set_msg_handler.cc b/gr-blocks/lib/qa_set_msg_handler.cc
new file mode 100644
index 0000000000..cc94243d89
--- /dev/null
+++ b/gr-blocks/lib/qa_set_msg_handler.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_set_msg_handler.h>
+#include <gr_top_block.h>
+#include <blocks/head.h>
+#include <blocks/null_source.h>
+#include <blocks/null_sink.h>
+#include <blocks/nop.h>
+#include <messages/msg_passing.h>
+#include <iostream>
+#include <boost/thread/thread.hpp>
+
+
+#define VERBOSE 0
+
+/*
+ * The gr::block::nop block has been instrumented so that it counts
+ * the number of messages sent to it. We use this feature to confirm
+ * that gr::blocks::nop's call to set_msg_handler is working correctly.
+ */
+
+void qa_set_msg_handler::t0()
+{
+ static const int NMSGS = 10;
+
+ if (VERBOSE) std::cout << "qa_set_msg_handler::t0()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr::blocks::null_source::make(sizeof(int));
+ gr::blocks::nop::sptr nop = gr::blocks::nop::make(sizeof(int));
+ gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int));
+
+ tb->connect(src, 0, nop, 0);
+ tb->connect(nop, 0, dst, 0);
+
+ // Must start graph before sending messages
+ tb->start();
+
+ // Send them...
+ pmt::pmt_t port(pmt::intern("port"));
+ for (int i = 0; i < NMSGS; i++){
+ send(nop, port, pmt::mp(pmt::mp("example-msg"), pmt::mp(i)));
+ }
+
+ // Give the messages a chance to be processed
+ boost::this_thread::sleep(boost::posix_time::milliseconds(100));
+
+ tb->stop();
+ tb->wait();
+
+ // Confirm that the nop block received the right number of messages.
+ CPPUNIT_ASSERT_EQUAL(NMSGS, nop->nmsgs_received());
+}
diff --git a/gr-blocks/lib/qa_set_msg_handler.h b/gr-blocks/lib/qa_set_msg_handler.h
new file mode 100644
index 0000000000..60277a12cc
--- /dev/null
+++ b/gr-blocks/lib/qa_set_msg_handler.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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_QA_SET_MSG_HANDLER_H
+#define INCLUDED_QA_SET_MSG_HANDLER_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_set_msg_handler : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_set_msg_handler);
+
+ CPPUNIT_TEST(t0);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+ void t0();
+};
+
+#endif /* INCLUDED_QA_SET_MSG_HANDLER_H */
diff --git a/gr-blocks/lib/repack_bits_bb_impl.cc b/gr-blocks/lib/repack_bits_bb_impl.cc
new file mode 100644
index 0000000000..c7ed054c8a
--- /dev/null
+++ b/gr-blocks/lib/repack_bits_bb_impl.cc
@@ -0,0 +1,123 @@
+/* -*- 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_io_signature.h>
+#include "repack_bits_bb_impl.h"
+
+namespace gr {
+ namespace blocks {
+
+ repack_bits_bb::sptr
+ repack_bits_bb::make(int k, int l, const std::string &len_tag_key, bool align_output)
+ {
+ return gnuradio::get_initial_sptr (new repack_bits_bb_impl(k, l, len_tag_key, align_output));
+ }
+
+ repack_bits_bb_impl::repack_bits_bb_impl(int k, int l, const std::string &len_tag_key, bool align_output)
+ : gr_tagged_stream_block("repack_bits_bb",
+ gr_make_io_signature(1, 1, sizeof (char)),
+ gr_make_io_signature(1, 1, sizeof (char)),
+ len_tag_key),
+ d_k(k), d_l(l),
+ d_packet_mode(!len_tag_key.empty()),
+ d_in_index(0), d_out_index(0),
+ d_align_output(align_output)
+ {
+ if (d_k > 8 || d_k < 1 || d_l > 8 || d_l < 1) {
+ throw std::invalid_argument("k and l must be in [1, 8]");
+ }
+
+ set_relative_rate((double) d_k / d_l);
+ }
+
+ repack_bits_bb_impl::~repack_bits_bb_impl()
+ {
+ }
+
+ int
+ repack_bits_bb_impl::calculate_output_stream_length(const gr_vector_int &ninput_items)
+ {
+ int n_out_bytes_required = (ninput_items[0] * d_k) / d_l;
+ if ((ninput_items[0] * d_k) % d_l && (!d_packet_mode || (d_packet_mode && !d_align_output))) {
+ n_out_bytes_required++;
+ }
+
+ return n_out_bytes_required;
+ }
+
+ int
+ repack_bits_bb_impl::work (int noutput_items,
+ gr_vector_int &ninput_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 bytes_to_write = noutput_items;
+
+ if (d_packet_mode) { // noutput_items could be larger than necessary
+ int bytes_to_read = ninput_items[0];
+ bytes_to_write = bytes_to_read * d_k / d_l;
+ if (!d_align_output && (((bytes_to_read * d_k) % d_l) != 0)) {
+ bytes_to_write++;
+ }
+ }
+
+ int n_read = 0;
+ int n_written = 0;
+ while(n_written < bytes_to_write && n_read < ninput_items[0]) {
+ if (d_out_index == 0) { // Starting a fresh byte
+ out[n_written] = 0;
+ }
+ out[n_written] |= ((in[n_read] >> d_in_index) & 0x01) << d_out_index;
+
+ d_in_index = (d_in_index + 1) % d_k;
+ d_out_index = (d_out_index + 1) % d_l;
+ if (d_in_index == 0) {
+ n_read++;
+ d_in_index = 0;
+ }
+ if (d_out_index == 0) {
+ n_written++;
+ d_out_index = 0;
+ }
+ }
+
+ if (d_packet_mode) {
+ if (d_out_index) {
+ n_written++;
+ d_out_index = 0;
+ }
+ } else {
+ consume_each(n_read);
+ }
+
+ return n_written;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
diff --git a/gr-blocks/lib/repack_bits_bb_impl.h b/gr-blocks/lib/repack_bits_bb_impl.h
new file mode 100644
index 0000000000..bf39f8cb0f
--- /dev/null
+++ b/gr-blocks/lib/repack_bits_bb_impl.h
@@ -0,0 +1,58 @@
+/* -*- 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_BLOCKS_REPACK_BITS_BB_IMPL_H
+#define INCLUDED_BLOCKS_REPACK_BITS_BB_IMPL_H
+
+#include <blocks/repack_bits_bb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class repack_bits_bb_impl : public repack_bits_bb
+ {
+ private:
+ const int d_k; //! Bits on input stream
+ const int d_l; //! Bits on output stream
+ const bool d_packet_mode;
+ int d_in_index; // Current bit of input byte
+ int d_out_index; // Current bit of output byte
+ bool d_align_output; //! true if the output shall be aligned, false if the input shall be aligned
+
+ protected:
+ int calculate_output_stream_length(const gr_vector_int &ninput_items);
+
+ public:
+ repack_bits_bb_impl(int k, int l, const std::string &len_tag_key, bool align_output);
+ ~repack_bits_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_BLOCKS_REPACK_BITS_BB_IMPL_H */
+
diff --git a/gr-blocks/lib/sine_table.h b/gr-blocks/lib/sine_table.h
new file mode 100644
index 0000000000..69834943bc
--- /dev/null
+++ b/gr-blocks/lib/sine_table.h
@@ -0,0 +1,1025 @@
+ // max_error = 2.353084136763606e-06
+ { 2.925817799165007e-09, 7.219194364267018e-09 },
+ { 2.925707643778599e-09, 2.526699001579799e-07 },
+ { 2.925487337153070e-09, 1.191140162167675e-06 },
+ { 2.925156887582842e-09, 3.284585035595589e-06 },
+ { 2.924716307509151e-09, 6.994872605695784e-06 },
+ { 2.924165613519592e-09, 1.278374920658798e-05 },
+ { 2.923504826347475e-09, 2.111280464718590e-05 },
+ { 2.922733970871080e-09, 3.244343744537165e-05 },
+ { 2.921853076112655e-09, 4.723682007436170e-05 },
+ { 2.920862175237416e-09, 6.595386421935634e-05 },
+ { 2.919761305552202e-09, 8.905518605213658e-05 },
+ { 2.918550508504146e-09, 1.170010715193098e-04 },
+ { 2.917229829679050e-09, 1.502514416517192e-04 },
+ { 2.915799318799769e-09, 1.892658178912071e-04 },
+ { 2.914259029724184e-09, 2.345032874456615e-04 },
+ { 2.912609020443340e-09, 2.864224686607020e-04 },
+ { 2.910849353079123e-09, 3.454814764261432e-04 },
+ { 2.908980093882049e-09, 4.121378876027343e-04 },
+ { 2.907001313228646e-09, 4.868487064877691e-04 },
+ { 2.904913085618902e-09, 5.700703303049837e-04 },
+ { 2.902715489673383e-09, 6.622585147355725e-04 },
+ { 2.900408608130373e-09, 7.638683394782519e-04 },
+ { 2.897992527842612e-09, 8.753541738578119e-04 },
+ { 2.895467339774186e-09, 9.971696424604937e-04 },
+ { 2.892833138996999e-09, 1.129767590823255e-03 },
+ { 2.890090024687216e-09, 1.273600051161478e-03 },
+ { 2.887238100121550e-09, 1.429118208142094e-03 },
+ { 2.884277472673313e-09, 1.596772364709564e-03 },
+ { 2.881208253808507e-09, 1.777011907950626e-03 },
+ { 2.878030559081432e-09, 1.970285275029487e-03 },
+ { 2.874744508130554e-09, 2.177039919152579e-03 },
+ { 2.871350224673798e-09, 2.397722275614272e-03 },
+ { 2.867847836504030e-09, 2.632777727878843e-03 },
+ { 2.864237475484149e-09, 2.882650573737405e-03 },
+ { 2.860519277542297e-09, 3.147783991507308e-03 },
+ { 2.856693382666432e-09, 3.428620006328931e-03 },
+ { 2.852759934899389e-09, 3.725599456482154e-03 },
+ { 2.848719082333207e-09, 4.039161959812243e-03 },
+ { 2.844570977103752e-09, 4.369745880190706e-03 },
+ { 2.840315775384800e-09, 4.717788294077374e-03 },
+ { 2.835953637382310e-09, 5.083724957128360e-03 },
+ { 2.831484727328322e-09, 5.467990270896617e-03 },
+ { 2.826909213474759e-09, 5.871017249604038e-03 },
+ { 2.822227268087134e-09, 6.293237486988512e-03 },
+ { 2.817439067438018e-09, 6.735081123237729e-03 },
+ { 2.812544791800534e-09, 7.196976811989608e-03 },
+ { 2.807544625441273e-09, 7.679351687456759e-03 },
+ { 2.802438756613836e-09, 8.182631331563162e-03 },
+ { 2.797227377551135e-09, 8.707239741274575e-03 },
+ { 2.791910684458716e-09, 9.253599295902304e-03 },
+ { 2.786488877507140e-09, 9.822130724578715e-03 },
+ { 2.780962160824228e-09, 1.041325307382490e-02 },
+ { 2.775330742487884e-09, 1.102738367513773e-02 },
+ { 2.769594834517682e-09, 1.166493811278924e-02 },
+ { 2.763754652867477e-09, 1.232633019159818e-02 },
+ { 2.757810417416620e-09, 1.301197190494069e-02 },
+ { 2.751762351962413e-09, 1.372227340270610e-02 },
+ { 2.745610684210923e-09, 1.445764295952962e-02 },
+ { 2.739355645769094e-09, 1.521848694296229e-02 },
+ { 2.732997472135539e-09, 1.600520978188769e-02 },
+ { 2.726536402691907e-09, 1.681821393496225e-02 },
+ { 2.719972680693777e-09, 1.765789985920713e-02 },
+ { 2.713306553261610e-09, 1.852466597868779e-02 },
+ { 2.706538271371373e-09, 1.941890865333146e-02 },
+ { 2.699668089844909e-09, 2.034102214787814e-02 },
+ { 2.692696267340880e-09, 2.129139860085272e-02 },
+ { 2.685623066344263e-09, 2.227042799383416e-02 },
+ { 2.678448753157212e-09, 2.327849812064098e-02 },
+ { 2.671173597888530e-09, 2.431599455681316e-02 },
+ { 2.663797874443630e-09, 2.538330062913108e-02 },
+ { 2.656321860514457e-09, 2.648079738524795e-02 },
+ { 2.648745837568575e-09, 2.760886356354952e-02 },
+ { 2.641070090839117e-09, 2.876787556300114e-02 },
+ { 2.633294909313421e-09, 2.995820741329835e-02 },
+ { 2.625420585722845e-09, 3.118023074495535e-02 },
+ { 2.617447416531143e-09, 3.243431475972608e-02 },
+ { 2.609375701923643e-09, 3.372082620101990e-02 },
+ { 2.601205745795833e-09, 3.504012932452527e-02 },
+ { 2.592937855741933e-09, 3.639258586895711e-02 },
+ { 2.584572343043400e-09, 3.777855502693250e-02 },
+ { 2.576109522656942e-09, 3.919839341605197e-02 },
+ { 2.567549713203028e-09, 4.065245505002102e-02 },
+ { 2.558893236953688e-09, 4.214109131001403e-02 },
+ { 2.550140419820252e-09, 4.366465091617666e-02 },
+ { 2.541291591341445e-09, 4.522347989919473e-02 },
+ { 2.532347084670572e-09, 4.681792157215026e-02 },
+ { 2.523307236563343e-09, 4.844831650239501e-02 },
+ { 2.514172387364900e-09, 5.011500248369893e-02 },
+ { 2.504942880997064e-09, 5.181831450849345e-02 },
+ { 2.495619064945627e-09, 5.355858474024022e-02 },
+ { 2.486201290246928e-09, 5.533614248606705e-02 },
+ { 2.476689911475047e-09, 5.715131416942842e-02 },
+ { 2.467085286727668e-09, 5.900442330315692e-02 },
+ { 2.457387777613798e-09, 6.089579046229943e-02 },
+ { 2.447597749239101e-09, 6.282573325755320e-02 },
+ { 2.437715570192557e-09, 6.479456630859221e-02 },
+ { 2.427741612532542e-09, 6.680260121764925e-02 },
+ { 2.417676251773166e-09, 6.885014654319160e-02 },
+ { 2.407519866869294e-09, 7.093750777401114e-02 },
+ { 2.397272840203310e-09, 7.306498730310884e-02 },
+ { 2.386935557569868e-09, 7.523288440214027e-02 },
+ { 2.376508408161815e-09, 7.744149519577415e-02 },
+ { 2.365991784555363e-09, 7.969111263635709e-02 },
+ { 2.355386082695641e-09, 8.198202647865405e-02 },
+ { 2.344691701881232e-09, 8.431452325495814e-02 },
+ { 2.333909044749407e-09, 8.668888625021409e-02 },
+ { 2.323038517261246e-09, 8.910539547731611e-02 },
+ { 2.312080528685971e-09, 9.156432765274414e-02 },
+ { 2.301035491585642e-09, 9.406595617227698e-02 },
+ { 2.289903821799651e-09, 9.661055108691619e-02 },
+ { 2.278685938428940e-09, 9.919837907903295e-02 },
+ { 2.267382263820762e-09, 1.018297034385580e-01 },
+ { 2.255993223551837e-09, 1.045047840397028e-01 },
+ { 2.244519246413220e-09, 1.072238773174577e-01 },
+ { 2.232960764393620e-09, 1.099872362446146e-01 },
+ { 2.221318212663309e-09, 1.127951103088245e-01 },
+ { 2.209592029557811e-09, 1.156477454898748e-01 },
+ { 2.197782656561395e-09, 1.185453842371912e-01 },
+ { 2.185890538290176e-09, 1.214882654476019e-01 },
+ { 2.173916122475606e-09, 1.244766244431883e-01 },
+ { 2.161859859947797e-09, 1.275106929493488e-01 },
+ { 2.149722204618256e-09, 1.305906990731841e-01 },
+ { 2.137503613462743e-09, 1.337168672820376e-01 },
+ { 2.125204546504321e-09, 1.368894183821595e-01 },
+ { 2.112825466795944e-09, 1.401085694976751e-01 },
+ { 2.100366840402933e-09, 1.433745340497602e-01 },
+ { 2.087829136385612e-09, 1.466875217359607e-01 },
+ { 2.075212826781308e-09, 1.500477385098620e-01 },
+ { 2.062518386587093e-09, 1.534553865607503e-01 },
+ { 2.049746293741359e-09, 1.569106642937665e-01 },
+ { 2.036897029106193e-09, 1.604137663100403e-01 },
+ { 2.023971076449323e-09, 1.639648833871233e-01 },
+ { 2.010968922425217e-09, 1.675642024598467e-01 },
+ { 1.997891056557933e-09, 1.712119066008896e-01 },
+ { 1.984737971221581e-09, 1.749081750021970e-01 },
+ { 1.971510161622434e-09, 1.786531829561379e-01 },
+ { 1.958208125780130e-09, 1.824471018371070e-01 },
+ { 1.944832364508511e-09, 1.862900990834311e-01 },
+ { 1.931383381397782e-09, 1.901823381790926e-01 },
+ { 1.917861682794392e-09, 1.941239786363039e-01 },
+ { 1.904267777782611e-09, 1.981151759777950e-01 },
+ { 1.890602178165317e-09, 2.021560817195309e-01 },
+ { 1.876865398444616e-09, 2.062468433536743e-01 },
+ { 1.863057955802572e-09, 2.103876043317229e-01 },
+ { 1.849180370081465e-09, 2.145785040479915e-01 },
+ { 1.835233163764673e-09, 2.188196778231083e-01 },
+ { 1.821216861956509e-09, 2.231112568880342e-01 },
+ { 1.807131992362945e-09, 2.274533683680190e-01 },
+ { 1.792979085271234e-09, 2.318461352671018e-01 },
+ { 1.778758673530482e-09, 2.362896764525300e-01 },
+ { 1.764471292530943e-09, 2.407841066397789e-01 },
+ { 1.750117480184598e-09, 2.453295363773890e-01 },
+ { 1.735697776904342e-09, 2.499260720324433e-01 },
+ { 1.721212725583874e-09, 2.545738157760434e-01 },
+ { 1.706662871577097e-09, 2.592728655691494e-01 },
+ { 1.692048762677849e-09, 2.640233151485341e-01 },
+ { 1.677370949099090e-09, 2.688252540131204e-01 },
+ { 1.662629983452104e-09, 2.736787674105404e-01 },
+ { 1.647826420726167e-09, 2.785839363237506e-01 },
+ { 1.632960818266680e-09, 2.835408374583758e-01 },
+ { 1.618033735755429e-09, 2.885495432295704e-01 },
+ { 1.603045735188609e-09, 2.936101217498361e-01 },
+ { 1.587997380855918e-09, 2.987226368167127e-01 },
+ { 1.572889239319430e-09, 3.038871479007593e-01 },
+ { 1.557721879392051e-09, 3.091037101339017e-01 },
+ { 1.542495872116447e-09, 3.143723742978435e-01 },
+ { 1.527211790743024e-09, 3.196931868130269e-01 },
+ { 1.511870210708909e-09, 3.250661897274744e-01 },
+ { 1.496471709615926e-09, 3.304914207062036e-01 },
+ { 1.481016867208896e-09, 3.359689130207621e-01 },
+ { 1.465506265353924e-09, 3.414986955389885e-01 },
+ { 1.449940488016384e-09, 3.470807927151147e-01 },
+ { 1.434320121238994e-09, 3.527152245800635e-01 },
+ { 1.418645753119802e-09, 3.584020067320109e-01 },
+ { 1.402917973789838e-09, 3.641411503272979e-01 },
+ { 1.387137375391042e-09, 3.699326620714776e-01 },
+ { 1.371304552054134e-09, 3.757765442106153e-01 },
+ { 1.355420099875958e-09, 3.816727945230153e-01 },
+ { 1.339484616897137e-09, 3.876214063110671e-01 },
+ { 1.323498703079580e-09, 3.936223683933865e-01 },
+ { 1.307462960283922e-09, 3.996756650972121e-01 },
+ { 1.291377992246768e-09, 4.057812762511174e-01 },
+ { 1.275244404558188e-09, 4.119391771778626e-01 },
+ { 1.259062804638585e-09, 4.181493386877248e-01 },
+ { 1.242833801715929e-09, 4.244117270719281e-01 },
+ { 1.226558006803155e-09, 4.307263040962509e-01 },
+ { 1.210236032674760e-09, 4.370930269951803e-01 },
+ { 1.193868493843725e-09, 4.435118484661861e-01 },
+ { 1.177456006538695e-09, 4.499827166641340e-01 },
+ { 1.160999188680582e-09, 4.565055751961679e-01 },
+ { 1.144498659859216e-09, 4.630803631168164e-01 },
+ { 1.127955041310214e-09, 4.697070149232604e-01 },
+ { 1.111368955891417e-09, 4.763854605510119e-01 },
+ { 1.094741028059551e-09, 4.831156253697562e-01 },
+ { 1.078071883846871e-09, 4.898974301794375e-01 },
+ { 1.061362150836978e-09, 4.967307912069362e-01 },
+ { 1.044612458142151e-09, 5.036156201023686e-01 },
+ { 1.027823436378632e-09, 5.105518239364775e-01 },
+ { 1.010995717643647e-09, 5.175393051975563e-01 },
+ { 9.941299354913699e-10, 5.245779617890562e-01 },
+ { 9.772267249089968e-10, 5.316676870274011e-01 },
+ { 9.602867222926046e-10, 5.388083696401416e-01 },
+ { 9.433105654240147e-10, 5.459998937639375e-01 },
+ { 9.262988934458084e-10, 5.532421389435711e-01 },
+ { 9.092523468378193e-10, 5.605349801305876e-01 },
+ { 8.921715673928355e-10, 5.678782876825250e-01 },
+ { 8.750571981926701e-10, 5.752719273622372e-01 },
+ { 8.579098835836508e-10, 5.827157603377209e-01 },
+ { 8.407302691522673e-10, 5.902096431821322e-01 },
+ { 8.235190017016133e-10, 5.977534278737073e-01 },
+ { 8.062767292259225e-10, 6.053469617967722e-01 },
+ { 7.890041008871165e-10, 6.129900877421282e-01 },
+ { 7.717017669898175e-10, 6.206826439083659e-01 },
+ { 7.543703789572603e-10, 6.284244639030392e-01 },
+ { 7.370105893063053e-10, 6.362153767444958e-01 },
+ { 7.196230516231919e-10, 6.440552068636356e-01 },
+ { 7.022084205389746e-10, 6.519437741060674e-01 },
+ { 6.847673517046416e-10, 6.598808937346672e-01 },
+ { 6.673005017664976e-10, 6.678663764322770e-01 },
+ { 6.498085283416530e-10, 6.759000283046127e-01 },
+ { 6.322920899929834e-10, 6.839816508836737e-01 },
+ { 6.147518462045659e-10, 6.921110411311926e-01 },
+ { 5.971884573565851e-10, 7.002879914425926e-01 },
+ { 5.796025847007168e-10, 7.085122896509806e-01 },
+ { 5.619948903351406e-10, 7.167837190315758e-01 },
+ { 5.443660371796048e-10, 7.251020583063744e-01 },
+ { 5.267166889504394e-10, 7.334670816491009e-01 },
+ { 5.090475101356742e-10, 7.418785586903696e-01 },
+ { 4.913591659698399e-10, 7.503362545232619e-01 },
+ { 4.736523224091392e-10, 7.588399297089872e-01 },
+ { 4.559276461062478e-10, 7.673893402829834e-01 },
+ { 4.381858043851147e-10, 7.759842377612828e-01 },
+ { 4.204274652161870e-10, 7.846243691469355e-01 },
+ { 4.026532971908398e-10, 7.933094769370790e-01 },
+ { 3.848639694963359e-10, 8.020392991300200e-01 },
+ { 3.670601518910503e-10, 8.108135692324444e-01 },
+ { 3.492425146784233e-10, 8.196320162675177e-01 },
+ { 3.314117286825031e-10, 8.284943647824689e-01 },
+ { 3.135684652223755e-10, 8.374003348569865e-01 },
+ { 2.957133960867535e-10, 8.463496421118015e-01 },
+ { 2.778471935089361e-10, 8.553419977173513e-01 },
+ { 2.599705301412391e-10, 8.643771084029740e-01 },
+ { 2.420840790301135e-10, 8.734546764660205e-01 },
+ { 2.241885135902046e-10, 8.825743997817682e-01 },
+ { 2.062845075795238e-10, 8.917359718130367e-01 },
+ { 1.883727350736140e-10, 9.009390816205823e-01 },
+ { 1.704538704408269e-10, 9.101834138731877e-01 },
+ { 1.525285883160648e-10, 9.194686488588080e-01 },
+ { 1.345975635762696e-10, 9.287944624950824e-01 },
+ { 1.166614713141648e-10, 9.381605263410157e-01 },
+ { 9.872098681369190e-11, 9.475665076080466e-01 },
+ { 8.077678552380464e-11, 9.570120691722380e-01 },
+ { 6.282954303364090e-11, 9.664968695860140e-01 },
+ { 4.487993504668797e-11, 9.760205630906909e-01 },
+ { 2.692863735553042e-11, 9.855827996289697e-01 },
+ { 8.976325816439114e-12, 9.951832248577780e-01 },
+ { -8.976323676304494e-12, 1.004821480161519e+00 },
+ { -2.692863521550168e-11, 1.014497202665280e+00 },
+ { -4.487993290681805e-11, 1.024210025248670e+00 },
+ { -6.282954089398273e-11, 1.033959576559617e+00 },
+ { -8.077678338451706e-11, 1.043745481028715e+00 },
+ { -9.872098467477489e-11, 1.053567358883467e+00 },
+ { -1.166614691757772e-10, 1.063424826163223e+00 },
+ { -1.345975614383584e-10, 1.073317494734013e+00 },
+ { -1.525285861788948e-10, 1.083244972303963e+00 },
+ { -1.704538683042922e-10, 1.093206862438572e+00 },
+ { -1.883727329379793e-10, 1.103202764576806e+00 },
+ { -2.062845054446831e-10, 1.113232274046796e+00 },
+ { -2.241885114563697e-10, 1.123294982082432e+00 },
+ { -2.420840768973375e-10, 1.133390475839767e+00 },
+ { -2.599705280096278e-10, 1.143518338413855e+00 },
+ { -2.778471913784365e-10, 1.153678148855860e+00 },
+ { -2.957133939575774e-10, 1.163869482190458e+00 },
+ { -3.135684630945758e-10, 1.174091909433296e+00 },
+ { -3.314117265561857e-10, 1.184344997608959e+00 },
+ { -3.492425125535882e-10, 1.194628309769018e+00 },
+ { -3.670601497678034e-10, 1.204941405010466e+00 },
+ { -3.848639673748360e-10, 1.215283838494269e+00 },
+ { -4.026532950710339e-10, 1.225655161464298e+00 },
+ { -4.204274630982869e-10, 1.236054921266445e+00 },
+ { -4.381858022691734e-10, 1.246482661367958e+00 },
+ { -4.559276439922654e-10, 1.256937921377146e+00 },
+ { -4.736523202972214e-10, 1.267420237063216e+00 },
+ { -4.913591638600925e-10, 1.277929140376502e+00 },
+ { -5.090475080282032e-10, 1.288464159468706e+00 },
+ { -5.267166868452449e-10, 1.299024818713528e+00 },
+ { -5.443660350768455e-10, 1.309610638727845e+00 },
+ { -5.619948882348695e-10, 1.320221136392390e+00 },
+ { -5.796025826029868e-10, 1.330855824873457e+00 },
+ { -5.971884552615020e-10, 1.341514213644420e+00 },
+ { -6.147518441122357e-10, 1.352195808507556e+00 },
+ { -6.322920879034590e-10, 1.362900111616144e+00 },
+ { -6.498085262549874e-10, 1.373626621496939e+00 },
+ { -6.673004996827436e-10, 1.384374833072571e+00 },
+ { -6.847673496239581e-10, 1.395144237684605e+00 },
+ { -7.022084184613616e-10, 1.405934323116231e+00 },
+ { -7.196230495488082e-10, 1.416744573616104e+00 },
+ { -7.370105872352039e-10, 1.427574469921397e+00 },
+ { -7.543703768894941e-10, 1.438423489281758e+00 },
+ { -7.717017649255453e-10, 1.449291105483472e+00 },
+ { -7.890040988262324e-10, 1.460176788873383e+00 },
+ { -8.062767271686383e-10, 1.471080006383765e+00 },
+ { -8.235189996479819e-10, 1.482000221556656e+00 },
+ { -8.407302671024475e-10, 1.492936894569018e+00 },
+ { -8.579098815375368e-10, 1.503889482257845e+00 },
+ { -8.750571961505266e-10, 1.514857438145604e+00 },
+ { -8.921715653546624e-10, 1.525840212465756e+00 },
+ { -9.092523448036167e-10, 1.536837252188703e+00 },
+ { -9.262988914157881e-10, 1.547848001047890e+00 },
+ { -9.433105633981766e-10, 1.558871899565883e+00 },
+ { -9.602867202711075e-10, 1.569908385081254e+00 },
+ { -9.772267228916820e-10, 1.580956891774897e+00 },
+ { -9.941299334786078e-10, 1.592016850697478e+00 },
+ { -1.010995715635332e-09, 1.603087689796053e+00 },
+ { -1.027823434374870e-09, 1.614168833942028e+00 },
+ { -1.044612456143047e-09, 1.625259704958335e+00 },
+ { -1.061362148842745e-09, 1.636359721647526e+00 },
+ { -1.078071881857297e-09, 1.647468299819543e+00 },
+ { -1.094741026074900e-09, 1.658584852320419e+00 },
+ { -1.111368953911690e-09, 1.669708789060341e+00 },
+ { -1.127955039335462e-09, 1.680839517042381e+00 },
+ { -1.144498657889600e-09, 1.691976440391624e+00 },
+ { -1.160999186716154e-09, 1.703118960383971e+00 },
+ { -1.177456004579561e-09, 1.714266475475616e+00 },
+ { -1.193868491889832e-09, 1.725418381332405e+00 },
+ { -1.210236030726319e-09, 1.736574070859850e+00 },
+ { -1.226558004860220e-09, 1.747732934232508e+00 },
+ { -1.242833799778447e-09, 1.758894358924547e+00 },
+ { -1.259062802706714e-09, 1.770057729740021e+00 },
+ { -1.275244402631982e-09, 1.781222428842935e+00 },
+ { -1.291377990326492e-09, 1.792387835788660e+00 },
+ { -1.307462958369363e-09, 1.803553327553897e+00 },
+ { -1.323498701170897e-09, 1.814718278568759e+00 },
+ { -1.339484614994490e-09, 1.825882060747428e+00 },
+ { -1.355420097979292e-09, 1.837044043519582e+00 },
+ { -1.371304550163662e-09, 1.848203593862598e+00 },
+ { -1.387137373506711e-09, 1.859360076332671e+00 },
+ { -1.402917971911754e-09, 1.870512853097495e+00 },
+ { -1.418645751248018e-09, 1.881661283967967e+00 },
+ { -1.434320119373722e-09, 1.892804726431080e+00 },
+ { -1.449940486157623e-09, 1.903942535681972e+00 },
+ { -1.465506263501516e-09, 1.915074064656886e+00 },
+ { -1.481016865363264e-09, 1.926198664066737e+00 },
+ { -1.496471707776859e-09, 1.937315682428795e+00 },
+ { -1.511870208876724e-09, 1.948424466101625e+00 },
+ { -1.527211788917509e-09, 1.959524359317042e+00 },
+ { -1.542495870297867e-09, 1.970614704215133e+00 },
+ { -1.557721877580406e-09, 1.981694840876775e+00 },
+ { -1.572889237514880e-09, 1.992764107358707e+00 },
+ { -1.587997379058514e-09, 2.003821839726753e+00 },
+ { -1.603045733398246e-09, 2.014867372090665e+00 },
+ { -1.618033733972424e-09, 2.025900036638798e+00 },
+ { -1.632960816490822e-09, 2.036919163671778e+00 },
+ { -1.647826418957721e-09, 2.047924081638631e+00 },
+ { -1.662629981691070e-09, 2.058914117170269e+00 },
+ { -1.677370947345626e-09, 2.069888595116115e+00 },
+ { -1.692048760931849e-09, 2.080846838577820e+00 },
+ { -1.706662869838827e-09, 2.091788168946183e+00 },
+ { -1.721212723853279e-09, 2.102711905935372e+00 },
+ { -1.735697775181424e-09, 2.113617367619504e+00 },
+ { -1.750117478469621e-09, 2.124503870468520e+00 },
+ { -1.764471290823748e-09, 2.135370729383332e+00 },
+ { -1.778758671831281e-09, 2.146217257733207e+00 },
+ { -1.792979083579974e-09, 2.157042767390815e+00 },
+ { -1.807131990679890e-09, 2.167846568770014e+00 },
+ { -1.821216860281448e-09, 2.178627970860822e+00 },
+ { -1.835233162097977e-09, 2.189386281268046e+00 },
+ { -1.849180368423027e-09, 2.200120806246095e+00 },
+ { -1.863057954152340e-09, 2.210830850737588e+00 },
+ { -1.876865396802907e-09, 2.221515718409926e+00 },
+ { -1.890602176531920e-09, 2.232174711691990e+00 },
+ { -1.904267776157843e-09, 2.242807131812679e+00 },
+ { -1.917861681178094e-09, 2.253412278837029e+00 },
+ { -1.931383379790273e-09, 2.263989451705295e+00 },
+ { -1.944832362909578e-09, 2.274537948269257e+00 },
+ { -1.958208124189984e-09, 2.285057065331676e+00 },
+ { -1.971510160041235e-09, 2.295546098682665e+00 },
+ { -1.984737969649064e-09, 2.306004343138794e+00 },
+ { -1.997891054994522e-09, 2.316431092581699e+00 },
+ { -2.010968920870647e-09, 2.326825639994779e+00 },
+ { -2.023971074903858e-09, 2.337187277503834e+00 },
+ { -2.036897027569834e-09, 2.347515296413520e+00 },
+ { -2.049746292214264e-09, 2.357808987247877e+00 },
+ { -2.062518385069210e-09, 2.368067639787542e+00 },
+ { -2.075212825272584e-09, 2.378290543109652e+00 },
+ { -2.087829134886364e-09, 2.388476985626922e+00 },
+ { -2.100366838912949e-09, 2.398626255125417e+00 },
+ { -2.112825465315542e-09, 2.408737638805759e+00 },
+ { -2.125204545033289e-09, 2.418810423320288e+00 },
+ { -2.137503612001452e-09, 2.428843894814472e+00 },
+ { -2.149722203166389e-09, 2.438837338964302e+00 },
+ { -2.161859858505829e-09, 2.448790041018174e+00 },
+ { -2.173916121043380e-09, 2.458701285834241e+00 },
+ { -2.185890536867478e-09, 2.468570357921585e+00 },
+ { -2.197782655148702e-09, 2.478396541480230e+00 },
+ { -2.209592028154913e-09, 2.488179120439544e+00 },
+ { -2.221318211270522e-09, 2.497917378500214e+00 },
+ { -2.232960763010574e-09, 2.507610599172123e+00 },
+ { -2.244519245040444e-09, 2.517258065817044e+00 },
+ { -2.255993222189014e-09, 2.526859061686102e+00 },
+ { -2.267382262468209e-09, 2.536412869962689e+00 },
+ { -2.278685937086658e-09, 2.545918773800664e+00 },
+ { -2.289903820467374e-09, 2.555376056366064e+00 },
+ { -2.301035490263848e-09, 2.564784000877677e+00 },
+ { -2.312080527374447e-09, 2.574141890646339e+00 },
+ { -2.323038515960257e-09, 2.583449009117307e+00 },
+ { -2.333909043458635e-09, 2.592704639909166e+00 },
+ { -2.344691700601153e-09, 2.601908066856634e+00 },
+ { -2.355386081425938e-09, 2.611058574048749e+00 },
+ { -2.365991783296513e-09, 2.620155445872768e+00 },
+ { -2.376508406913500e-09, 2.629197967052127e+00 },
+ { -2.386935556332088e-09, 2.638185422689490e+00 },
+ { -2.397272838976436e-09, 2.647117098307332e+00 },
+ { -2.407519865653114e-09, 2.655992279887846e+00 },
+ { -2.417676250567891e-09, 2.664810253915885e+00 },
+ { -2.427741611338014e-09, 2.673570307418169e+00 },
+ { -2.437715569009093e-09, 2.682271728006635e+00 },
+ { -2.447597748066437e-09, 2.690913803917100e+00 },
+ { -2.457387776452357e-09, 2.699495824053297e+00 },
+ { -2.467085285577292e-09, 2.708017078025636e+00 },
+ { -2.476689910335470e-09, 2.716476856194105e+00 },
+ { -2.486201289118733e-09, 2.724874449709689e+00 },
+ { -2.495619063828443e-09, 2.733209150554255e+00 },
+ { -2.504942879891263e-09, 2.741480251583985e+00 },
+ { -2.514172386270163e-09, 2.749687046568741e+00 },
+ { -2.523307235480146e-09, 2.757828830235740e+00 },
+ { -2.532347083598520e-09, 2.765904898308531e+00 },
+ { -2.541291590280960e-09, 2.773914547551261e+00 },
+ { -2.550140418771202e-09, 2.781857075807392e+00 },
+ { -2.558893235915887e-09, 2.789731782043156e+00 },
+ { -2.567549712176927e-09, 2.797537966388929e+00 },
+ { -2.576109521642196e-09, 2.805274930179221e+00 },
+ { -2.584572342040407e-09, 2.812941975996573e+00 },
+ { -2.592937854750428e-09, 2.820538407710556e+00 },
+ { -2.601205744816134e-09, 2.828063530521908e+00 },
+ { -2.609375700955458e-09, 2.835516651001539e+00 },
+ { -2.617447415574869e-09, 2.842897077134583e+00 },
+ { -2.625420584778350e-09, 2.850204118359573e+00 },
+ { -2.633294908380520e-09, 2.857437085611509e+00 },
+ { -2.641070089918234e-09, 2.864595291363663e+00 },
+ { -2.648745836659391e-09, 2.871678049666939e+00 },
+ { -2.656321859617343e-09, 2.878684676194483e+00 },
+ { -2.663797873558322e-09, 2.885614488280000e+00 },
+ { -2.671173597015318e-09, 2.892466804962122e+00 },
+ { -2.678448752295859e-09, 2.899240947023252e+00 },
+ { -2.685623065495139e-09, 2.905936237033475e+00 },
+ { -2.692696266503800e-09, 2.912551999389617e+00 },
+ { -2.699668089019767e-09, 2.919087560358171e+00 },
+ { -2.706538270558513e-09, 2.925542248116882e+00 },
+ { -2.713306552460767e-09, 2.931915392794031e+00 },
+ { -2.719972679905295e-09, 2.938206326512581e+00 },
+ { -2.726536401915442e-09, 2.944414383428562e+00 },
+ { -2.732997471371516e-09, 2.950538899775061e+00 },
+ { -2.739355645017194e-09, 2.956579213900666e+00 },
+ { -2.745610683471516e-09, 2.962534666313284e+00 },
+ { -2.751762351235315e-09, 2.968404599718795e+00 },
+ { -2.757810416701751e-09, 2.974188359063684e+00 },
+ { -2.763754652165128e-09, 2.979885291576143e+00 },
+ { -2.769594833827588e-09, 2.985494746805227e+00 },
+ { -2.775330741810390e-09, 2.991016076664491e+00 },
+ { -2.780962160159068e-09, 2.996448635469842e+00 },
+ { -2.786488876854607e-09, 3.001791779983262e+00 },
+ { -2.791910683818570e-09, 3.007044869450794e+00 },
+ { -2.797227376923695e-09, 3.012207265645876e+00 },
+ { -2.802438755998943e-09, 3.017278332907412e+00 },
+ { -2.807544624838820e-09, 3.022257438182037e+00 },
+ { -2.812544791210840e-09, 3.027143951064684e+00 },
+ { -2.817439066860792e-09, 3.031937243837070e+00 },
+ { -2.822227267522746e-09, 3.036636691510884e+00 },
+ { -2.826909212922864e-09, 3.041241671864994e+00 },
+ { -2.831484726789317e-09, 3.045751565488710e+00 },
+ { -2.835953636855826e-09, 3.050165755818853e+00 },
+ { -2.840315774871260e-09, 3.054483629182857e+00 },
+ { -2.844570976602957e-09, 3.058704574835744e+00 },
+ { -2.848719081844986e-09, 3.062827985002047e+00 },
+ { -2.852759934424164e-09, 3.066853254915581e+00 },
+ { -2.856693382203833e-09, 3.070779782857041e+00 },
+ { -2.860519277092708e-09, 3.074606970196721e+00 },
+ { -2.864237475047239e-09, 3.078334221430809e+00 },
+ { -2.867847836080156e-09, 3.081960944223928e+00 },
+ { -2.871350224262603e-09, 3.085486549445314e+00 },
+ { -2.874744507732462e-09, 3.088910451211251e+00 },
+ { -2.878030558696270e-09, 3.092232066921130e+00 },
+ { -2.881208253436038e-09, 3.095450817298478e+00 },
+ { -2.884277472313999e-09, 3.098566126429974e+00 },
+ { -2.887238099774968e-09, 3.101577421802070e+00 },
+ { -2.890090024353816e-09, 3.104484134342861e+00 },
+ { -2.892833138676371e-09, 3.107285698457308e+00 },
+ { -2.895467339466766e-09, 3.109981552069083e+00 },
+ { -2.897992527547963e-09, 3.112571136655481e+00 },
+ { -2.900408607848946e-09, 3.115053897289195e+00 },
+ { -2.902715489404992e-09, 3.117429282673042e+00 },
+ { -2.904913085363323e-09, 3.119696745180238e+00 },
+ { -2.907001312986328e-09, 3.121855740892224e+00 },
+ { -2.908980093652563e-09, 3.123905729634218e+00 },
+ { -2.910849352862924e-09, 3.125846175016163e+00 },
+ { -2.912609020239985e-09, 3.127676544466606e+00 },
+ { -2.914259029534118e-09, 3.129396309273659e+00 },
+ { -2.915799318622574e-09, 3.131004944618667e+00 },
+ { -2.917229829515169e-09, 3.132501929616775e+00 },
+ { -2.918550508353347e-09, 3.133886747350606e+00 },
+ { -2.919761305414294e-09, 3.135158884909254e+00 },
+ { -2.920862175112829e-09, 3.136317833424958e+00 },
+ { -2.921853076000972e-09, 3.137363088107359e+00 },
+ { -2.922733970772719e-09, 3.138294148283254e+00 },
+ { -2.923504826262027e-09, 3.139110517429204e+00 },
+ { -2.924165613447473e-09, 3.139811703211207e+00 },
+ { -2.924716307449950e-09, 3.140397217517018e+00 },
+ { -2.925156887536978e-09, 3.140866576495489e+00 },
+ { -2.925487337120335e-09, 3.141219300588825e+00 },
+ { -2.925707643758784e-09, 3.141454914570261e+00 },
+ { -2.925817799158535e-09, 3.141572947579352e+00 },
+ { -2.925817799171455e-09, 3.141572933154836e+00 },
+ { -2.925707643798390e-09, 3.141454409272987e+00 },
+ { -2.925487337185779e-09, 3.141216918378770e+00 },
+ { -2.925156887628892e-09, 3.140860007424112e+00 },
+ { -2.924716307568119e-09, 3.140383227898687e+00 },
+ { -2.924165613591896e-09, 3.139786135867868e+00 },
+ { -2.923504826432903e-09, 3.139068292003385e+00 },
+ { -2.922733970969412e-09, 3.138229261619561e+00 },
+ { -2.921853076224321e-09, 3.137268614707029e+00 },
+ { -2.920862175361976e-09, 3.136185925964038e+00 },
+ { -2.919761305690083e-09, 3.134980774833275e+00 },
+ { -2.918550508654911e-09, 3.133652745531368e+00 },
+ { -2.917229829843137e-09, 3.132201427085629e+00 },
+ { -2.915799318976726e-09, 3.130626413363146e+00 },
+ { -2.914259029914435e-09, 3.128927303107136e+00 },
+ { -2.912609020646661e-09, 3.127103699965947e+00 },
+ { -2.910849353295315e-09, 3.125155212527586e+00 },
+ { -2.908980094111509e-09, 3.123081454351802e+00 },
+ { -2.907001313470937e-09, 3.120882043999591e+00 },
+ { -2.904913085874448e-09, 3.118556605068443e+00 },
+ { -2.902715489941767e-09, 3.116104766219928e+00 },
+ { -2.900408608411958e-09, 3.113526161214776e+00 },
+ { -2.897992528137022e-09, 3.110820428940251e+00 },
+ { -2.895467340081818e-09, 3.107987213444579e+00 },
+ { -2.892833139317615e-09, 3.105026163964191e+00 },
+ { -2.890090025020589e-09, 3.101936934956479e+00 },
+ { -2.887238100468092e-09, 3.098719186130021e+00 },
+ { -2.884277473032614e-09, 3.095372582472161e+00 },
+ { -2.881208254180937e-09, 3.091896794282404e+00 },
+ { -2.878030559466594e-09, 3.088291497198199e+00 },
+ { -2.874744508528832e-09, 3.084556372228054e+00 },
+ { -2.871350225084755e-09, 3.080691105776848e+00 },
+ { -2.867847836928063e-09, 3.076695389678615e+00 },
+ { -2.864237475921086e-09, 3.072568921221621e+00 },
+ { -2.860519277991847e-09, 3.068311403179147e+00 },
+ { -2.856693383129018e-09, 3.063922543837792e+00 },
+ { -2.852759935374575e-09, 3.059402057023109e+00 },
+ { -2.848719082821403e-09, 3.054749662130841e+00 },
+ { -2.844570977604520e-09, 3.049965084150782e+00 },
+ { -2.840315775898525e-09, 3.045048053697736e+00 },
+ { -2.835953637908582e-09, 3.039998307034967e+00 },
+ { -2.831484727867511e-09, 3.034815586104635e+00 },
+ { -2.826909214026628e-09, 3.029499638550941e+00 },
+ { -2.822227268651470e-09, 3.024050217748861e+00 },
+ { -2.817439068015245e-09, 3.018467082830179e+00 },
+ { -2.812544792390175e-09, 3.012749998707001e+00 },
+ { -2.807544626043751e-09, 3.006898736100911e+00 },
+ { -2.802438757228650e-09, 3.000913071564665e+00 },
+ { -2.797227378178760e-09, 2.994792787510961e+00 },
+ { -2.791910685098702e-09, 2.988537672233504e+00 },
+ { -2.786488878159805e-09, 2.982147519935565e+00 },
+ { -2.780962161489413e-09, 2.975622130750641e+00 },
+ { -2.775330743165298e-09, 2.968961310769028e+00 },
+ { -2.769594835207775e-09, 2.962164872061613e+00 },
+ { -2.763754653569747e-09, 2.955232632701135e+00 },
+ { -2.757810418131543e-09, 2.948164416789036e+00 },
+ { -2.751762352689432e-09, 2.940960054474719e+00 },
+ { -2.745610684950541e-09, 2.933619381982341e+00 },
+ { -2.739355646520809e-09, 2.926142241629213e+00 },
+ { -2.732997472899722e-09, 2.918528481852205e+00 },
+ { -2.726536403468318e-09, 2.910777957226018e+00 },
+ { -2.719972681482232e-09, 2.902890528487386e+00 },
+ { -2.713306554062453e-09, 2.894866062556452e+00 },
+ { -2.706538272184154e-09, 2.886704432555728e+00 },
+ { -2.699668090670078e-09, 2.878405517834426e+00 },
+ { -2.692696268177908e-09, 2.869969203985464e+00 },
+ { -2.685623067193599e-09, 2.861395382869544e+00 },
+ { -2.678448754018380e-09, 2.852683952631486e+00 },
+ { -2.671173598761847e-09, 2.843834817723832e+00 },
+ { -2.663797875328991e-09, 2.834847888922988e+00 },
+ { -2.656321861411517e-09, 2.825723083350459e+00 },
+ { -2.648745838477759e-09, 2.816460324492298e+00 },
+ { -2.641070091759922e-09, 2.807059542215146e+00 },
+ { -2.633294910246296e-09, 2.797520672788269e+00 },
+ { -2.625420586667340e-09, 2.787843658897949e+00 },
+ { -2.617447417487602e-09, 2.778028449668942e+00 },
+ { -2.609375702891616e-09, 2.768075000678399e+00 },
+ { -2.601205746775692e-09, 2.757983273976943e+00 },
+ { -2.592937856733464e-09, 2.747753238101915e+00 },
+ { -2.584572344046340e-09, 2.737384868096553e+00 },
+ { -2.576109523671634e-09, 2.726878145526201e+00 },
+ { -2.567549714229129e-09, 2.716233058492422e+00 },
+ { -2.558893237991435e-09, 2.705449601651722e+00 },
+ { -2.550140420869302e-09, 2.694527776227857e+00 },
+ { -2.541291592402089e-09, 2.683467590030445e+00 },
+ { -2.532347085742440e-09, 2.672269057466213e+00 },
+ { -2.523307237646751e-09, 2.660932199557362e+00 },
+ { -2.514172388459584e-09, 2.649457043952206e+00 },
+ { -2.504942882102813e-09, 2.637843624941622e+00 },
+ { -2.495619066062810e-09, 2.626091983472908e+00 },
+ { -2.486201291375123e-09, 2.614202167160335e+00 },
+ { -2.476689912614465e-09, 2.602174230302269e+00 },
+ { -2.467085287878098e-09, 2.590008233889805e+00 },
+ { -2.457387778775451e-09, 2.577704245623143e+00 },
+ { -2.447597750411553e-09, 2.565262339920002e+00 },
+ { -2.437715571376127e-09, 2.552682597931055e+00 },
+ { -2.427741613727123e-09, 2.539965107548168e+00 },
+ { -2.417676252978335e-09, 2.527109963417675e+00 },
+ { -2.407519868085581e-09, 2.514117266951687e+00 },
+ { -2.397272841430131e-09, 2.500987126335739e+00 },
+ { -2.386935558807595e-09, 2.487719656543254e+00 },
+ { -2.376508409410024e-09, 2.474314979341178e+00 },
+ { -2.365991785814531e-09, 2.460773223303822e+00 },
+ { -2.355386083965131e-09, 2.447094523817833e+00 },
+ { -2.344691703161363e-09, 2.433279023095734e+00 },
+ { -2.333909046040126e-09, 2.419326870180582e+00 },
+ { -2.323038518562289e-09, 2.405238220956597e+00 },
+ { -2.312080529997549e-09, 2.391013238157397e+00 },
+ { -2.301035492907384e-09, 2.376652091371587e+00 },
+ { -2.289903823131822e-09, 2.362154957053137e+00 },
+ { -2.278685939771276e-09, 2.347522018525197e+00 },
+ { -2.267382265173420e-09, 2.332753465990296e+00 },
+ { -2.255993224914501e-09, 2.317849496533128e+00 },
+ { -2.244519247786155e-09, 2.302810314130351e+00 },
+ { -2.232960765776561e-09, 2.287636129652823e+00 },
+ { -2.221318214056095e-09, 2.272327160873552e+00 },
+ { -2.209592030960763e-09, 2.256883632472565e+00 },
+ { -2.197782657974034e-09, 2.241305776039511e+00 },
+ { -2.185890539712767e-09, 2.225593830081461e+00 },
+ { -2.173916123907886e-09, 2.209748040023618e+00 },
+ { -2.161859861389976e-09, 2.193768658216360e+00 },
+ { -2.149722206070124e-09, 2.177655943935795e+00 },
+ { -2.137503614923981e-09, 2.161410163388424e+00 },
+ { -2.125204547975352e-09, 2.145031589714984e+00 },
+ { -2.112825468276292e-09, 2.128520502989477e+00 },
+ { -2.100366841892917e-09, 2.111877190225612e+00 },
+ { -2.087829137884807e-09, 2.095101945374541e+00 },
+ { -2.075212828290086e-09, 2.078195069329960e+00 },
+ { -2.062518388104923e-09, 2.061156869925600e+00 },
+ { -2.049746295268559e-09, 2.043987661939897e+00 },
+ { -2.036897030642658e-09, 2.026687767092888e+00 },
+ { -2.023971077994576e-09, 2.009257514048162e+00 },
+ { -2.010968923979840e-09, 1.991697238413571e+00 },
+ { -1.997891058121344e-09, 1.974007282737320e+00 },
+ { -1.984737972794098e-09, 1.956187996511354e+00 },
+ { -1.971510163203686e-09, 1.938239736166060e+00 },
+ { -1.958208127370276e-09, 1.920162865072273e+00 },
+ { -1.944832366107339e-09, 1.901957753535934e+00 },
+ { -1.931383383005451e-09, 1.883624778799427e+00 },
+ { -1.917861684410531e-09, 1.865164325035177e+00 },
+ { -1.904267779407432e-09, 1.846576783346324e+00 },
+ { -1.890602179798714e-09, 1.827862551760622e+00 },
+ { -1.876865400086483e-09, 1.809022035228338e+00 },
+ { -1.863057957452539e-09, 1.790055645617624e+00 },
+ { -1.849180371740008e-09, 1.770963801711725e+00 },
+ { -1.835233165431475e-09, 1.751746929201178e+00 },
+ { -1.821216863631569e-09, 1.732405460681919e+00 },
+ { -1.807131994045840e-09, 1.712939835648088e+00 },
+ { -1.792979086962494e-09, 1.693350500488565e+00 },
+ { -1.778758675229683e-09, 1.673637908477153e+00 },
+ { -1.764471294238191e-09, 1.653802519770021e+00 },
+ { -1.750117481899733e-09, 1.633844801396848e+00 },
+ { -1.735697778626995e-09, 1.613765227254186e+00 },
+ { -1.721212727314574e-09, 1.593564278099856e+00 },
+ { -1.706662873315474e-09, 1.573242441540939e+00 },
+ { -1.692048764423848e-09, 1.552800212030258e+00 },
+ { -1.677370950852395e-09, 1.532238090855187e+00 },
+ { -1.662629985213192e-09, 1.511556586131055e+00 },
+ { -1.647826422494560e-09, 1.490756212788764e+00 },
+ { -1.632960820042537e-09, 1.469837492568651e+00 },
+ { -1.618033737538645e-09, 1.448800954008929e+00 },
+ { -1.603045736978760e-09, 1.427647132435469e+00 },
+ { -1.587997382653428e-09, 1.406376569953373e+00 },
+ { -1.572889241124034e-09, 1.384989815432507e+00 },
+ { -1.557721881203696e-09, 1.363487424499449e+00 },
+ { -1.542495873934815e-09, 1.341869959524515e+00 },
+ { -1.527211792568486e-09, 1.320137989611176e+00 },
+ { -1.511870212541253e-09, 1.298292090581491e+00 },
+ { -1.496471711454994e-09, 1.276332844965754e+00 },
+ { -1.481016869054634e-09, 1.254260841988828e+00 },
+ { -1.465506267206068e-09, 1.232076677556547e+00 },
+ { -1.449940489875303e-09, 1.209780954243628e+00 },
+ { -1.434320123104372e-09, 1.187374281276747e+00 },
+ { -1.418645754991533e-09, 1.164857274523495e+00 },
+ { -1.402917975667710e-09, 1.142230556475749e+00 },
+ { -1.387137377275425e-09, 1.119494756236361e+00 },
+ { -1.371304553944712e-09, 1.096650509501278e+00 },
+ { -1.355420101772623e-09, 1.073698458546610e+00 },
+ { -1.339484618799891e-09, 1.050639252211352e+00 },
+ { -1.323498704988051e-09, 1.027473545880543e+00 },
+ { -1.307462962198534e-09, 1.004202001471034e+00 },
+ { -1.291377994167204e-09, 9.808252874104182e-01 },
+ { -1.275244406484394e-09, 9.573440786237052e-01 },
+ { -1.259062806570190e-09, 9.337590565128454e-01 },
+ { -1.242833803653464e-09, 9.100709089414796e-01 },
+ { -1.226558008746195e-09, 8.862803302125812e-01 },
+ { -1.210236034623253e-09, 8.623880210538113e-01 },
+ { -1.193868495797618e-09, 8.383946885959868e-01 },
+ { -1.177456008497777e-09, 8.143010463544786e-01 },
+ { -1.160999190645010e-09, 7.901078142102129e-01 },
+ { -1.144498661828833e-09, 7.658157183877095e-01 },
+ { -1.127955043284965e-09, 7.414254914366063e-01 },
+ { -1.111368957870986e-09, 7.169378722095157e-01 },
+ { -1.094741030044308e-09, 6.923536058430697e-01 },
+ { -1.078071885836393e-09, 6.676734437331688e-01 },
+ { -1.061362152831423e-09, 6.428981435165511e-01 },
+ { -1.044612460141255e-09, 6.180284690466404e-01 },
+ { -1.027823438382183e-09, 5.930651903718045e-01 },
+ { -1.010995719652015e-09, 5.680090837138436e-01 },
+ { -9.941299375042378e-10, 5.428609314418970e-01 },
+ { -9.772267269262058e-10, 5.176215220520872e-01 },
+ { -9.602867243141016e-10, 4.922916501421032e-01 },
+ { -9.433105674499058e-10, 4.668721163885412e-01 },
+ { -9.262988954758817e-10, 4.413637275202624e-01 },
+ { -9.092523488719689e-10, 4.157672962958654e-01 },
+ { -8.921715694311144e-10, 3.900836414778084e-01 },
+ { -8.750572002347607e-10, 3.643135878065193e-01 },
+ { -8.579098856296589e-10, 3.384579659762392e-01 },
+ { -8.407302712022458e-10, 3.125176126069478e-01 },
+ { -8.235190037551917e-10, 2.864933702193017e-01 },
+ { -8.062767312831008e-10, 2.603860872080448e-01 },
+ { -7.890041029479477e-10, 2.341966178147619e-01 },
+ { -7.717017690542486e-10, 2.079258220999725e-01 },
+ { -7.543703810250266e-10, 1.815745659161734e-01 },
+ { -7.370105913774597e-10, 1.551437208801425e-01 },
+ { -7.196230536974697e-10, 1.286341643433767e-01 },
+ { -7.022084226165876e-10, 1.020467793657360e-01 },
+ { -6.847673537853251e-10, 7.538245468350446e-02 },
+ { -6.673005038502516e-10, 4.864208468284503e-02 },
+ { -6.498085304282128e-10, 2.182656936863137e-02 },
+ { -6.322920920826137e-10, -5.063185663820913e-03 },
+ { -6.147518482969490e-10, -3.202626926150343e-02 },
+ { -5.971884594516681e-10, -5.906176474160862e-02 },
+ { -5.796025867984469e-10, -8.616874992366363e-02 },
+ { -5.619948924353588e-10, -1.133462971605448e-01 },
+ { -5.443660392823640e-10, -1.405934733692621e-01 },
+ { -5.267166910556339e-10, -1.679093400638023e-01 },
+ { -5.090475122431451e-10, -1.952929533862739e-01 },
+ { -4.913591680795342e-10, -2.227433641394564e-01 },
+ { -4.736523245210571e-10, -2.502596178194491e-01 },
+ { -4.559276482202303e-10, -2.778407546490776e-01 },
+ { -4.381858065011618e-10, -3.054858096104932e-01 },
+ { -4.204274673340870e-10, -3.331938124792702e-01 },
+ { -4.026532993105397e-10, -3.609637878577768e-01 },
+ { -3.848639716178888e-10, -3.887947552098022e-01 },
+ { -3.670601540142443e-10, -4.166857288948674e-01 },
+ { -3.492425168032583e-10, -4.446357182029681e-01 },
+ { -3.314117308088734e-10, -4.726437273896633e-01 },
+ { -3.135684673501752e-10, -5.007087557112619e-01 },
+ { -2.957133982159296e-10, -5.288297974607742e-01 },
+ { -2.778471956393828e-10, -5.570058420037128e-01 },
+ { -2.599705322729564e-10, -5.852358738143247e-01 },
+ { -2.420840811628366e-10, -6.135188725122560e-01 },
+ { -2.241885157240923e-10, -6.418538128986450e-01 },
+ { -2.062845097142585e-10, -6.702396649949099e-01 },
+ { -1.883727372093546e-10, -6.986753940779493e-01 },
+ { -1.704538725773087e-10, -7.271599607197149e-01 },
+ { -1.525285904532877e-10, -7.556923208240308e-01 },
+ { -1.345975657140748e-10, -7.842714256651911e-01 },
+ { -1.166614734526054e-10, -8.128962219265712e-01 },
+ { -9.872098895260891e-11, -8.415656517393372e-01 },
+ { -8.077678766314517e-11, -8.702786527215916e-01 },
+ { -6.282954517324612e-11, -8.990341580176152e-01 },
+ { -4.487993718655790e-11, -9.278310963373758e-01 },
+ { -2.692863949561210e-11, -9.566683919968972e-01 },
+ { -8.976327956520795e-12, -9.855449649582175e-01 },
+ { 8.976321536169872e-12, -1.014459730869357e+00 },
+ { 2.692863307547294e-11, -1.043411601105914e+00 },
+ { 4.487993076694813e-11, -1.072399482811314e+00 },
+ { 6.282953875437751e-11, -1.101422278938424e+00 },
+ { 8.077678124517653e-11, -1.130478888291020e+00 },
+ { 9.872098253591082e-11, -1.159568205565684e+00 },
+ { 1.166614670373367e-10, -1.188689121393192e+00 },
+ { 1.345975593005002e-10, -1.217840522381901e+00 },
+ { 1.525285840416718e-10, -1.247021291159495e+00 },
+ { 1.704538661678104e-10, -1.276230306415868e+00 },
+ { 1.883727308022916e-10, -1.305466442946703e+00 },
+ { 2.062845033098954e-10, -1.334728571696106e+00 },
+ { 2.241885093225349e-10, -1.364015559800721e+00 },
+ { 2.420840747645085e-10, -1.393326270633325e+00 },
+ { 2.599705258779635e-10, -1.422659563847049e+00 },
+ { 2.778471892479898e-10, -1.452014295419243e+00 },
+ { 2.957133918284542e-10, -1.481389317696831e+00 },
+ { 3.135684609667761e-10, -1.510783479440191e+00 },
+ { 3.314117244297624e-10, -1.540195625869043e+00 },
+ { 3.492425104288060e-10, -1.569624598707558e+00 },
+ { 3.670601476445565e-10, -1.599069236228850e+00 },
+ { 3.848639652533361e-10, -1.628528373302631e+00 },
+ { 4.026532929512281e-10, -1.658000841439269e+00 },
+ { 4.204274609803869e-10, -1.687485468837799e+00 },
+ { 4.381858001531792e-10, -1.716981080430596e+00 },
+ { 4.559276418782829e-10, -1.746486497931567e+00 },
+ { 4.736523181853565e-10, -1.776000539882225e+00 },
+ { 4.913591617503452e-10, -1.805522021699094e+00 },
+ { 5.090475059206794e-10, -1.835049755721194e+00 },
+ { 5.267166847401562e-10, -1.864582551257262e+00 },
+ { 5.443660329740862e-10, -1.894119214633676e+00 },
+ { 5.619948861345454e-10, -1.923658549242818e+00 },
+ { 5.796025805053097e-10, -1.953199355591180e+00 },
+ { 5.971884531664190e-10, -1.982740431347091e+00 },
+ { 6.147518420199055e-10, -2.012280571390674e+00 },
+ { 6.322920858139346e-10, -2.041818567861395e+00 },
+ { 6.498085241682158e-10, -2.071353210208005e+00 },
+ { 6.673004975990425e-10, -2.100883285238127e+00 },
+ { 6.847673475432746e-10, -2.130407577166309e+00 },
+ { 7.022084163838545e-10, -2.159924867664933e+00 },
+ { 7.196230474743716e-10, -2.189433935913779e+00 },
+ { 7.370105851640495e-10, -2.218933558650552e+00 },
+ { 7.543703748217808e-10, -2.248422510220072e+00 },
+ { 7.717017628611672e-10, -2.277899562625407e+00 },
+ { 7.890040967654542e-10, -2.307363485579104e+00 },
+ { 8.062767251113011e-10, -2.336813046552684e+00 },
+ { 8.235189975944034e-10, -2.366247010829556e+00 },
+ { 8.407302650525749e-10, -2.395664141553858e+00 },
+ { 8.579098794915287e-10, -2.425063199784153e+00 },
+ { 8.750571941082773e-10, -2.454442944543319e+00 },
+ { 8.921715633164894e-10, -2.483802132872044e+00 },
+ { 9.092523427695200e-10, -2.513139519878584e+00 },
+ { 9.262988893857148e-10, -2.542453858792682e+00 },
+ { 9.433105613723914e-10, -2.571743901017465e+00 },
+ { 9.602867182493987e-10, -2.601008396180870e+00 },
+ { 9.772267208744730e-10, -2.630246092190425e+00 },
+ { 9.941299314658458e-10, -2.659455735283526e+00 },
+ { 1.010995713627070e-09, -2.688636070081818e+00 },
+ { 1.027823432371055e-09, -2.717785839644439e+00 },
+ { 1.044612454143997e-09, -2.746903785521352e+00 },
+ { 1.061362146848353e-09, -2.775988647805256e+00 },
+ { 1.078071879867828e-09, -2.805039165187255e+00 },
+ { 1.094741024090249e-09, -2.834054075009077e+00 },
+ { 1.111368951931856e-09, -2.863032113318052e+00 },
+ { 1.127955037360817e-09, -2.891972014920939e+00 },
+ { 1.144498655920037e-09, -2.920872513436805e+00 },
+ { 1.160999184751779e-09, -2.949732341353290e+00 },
+ { 1.177456002620215e-09, -2.978550230079517e+00 },
+ { 1.193868489936097e-09, -3.007324910002949e+00 },
+ { 1.210236028777826e-09, -3.036055110540183e+00 },
+ { 1.226558002917232e-09, -3.064739560196251e+00 },
+ { 1.242833797841123e-09, -3.093376986616735e+00 },
+ { 1.259062800774685e-09, -3.121966116643377e+00 },
+ { 1.275244400705935e-09, -3.150505676371791e+00 },
+ { 1.291377988406056e-09, -3.178994391202159e+00 },
+ { 1.307462956454857e-09, -3.207430985899192e+00 },
+ { 1.323498699262108e-09, -3.235814184645077e+00 },
+ { 1.339484613091842e-09, -3.264142711097884e+00 },
+ { 1.355420096082785e-09, -3.292415288443373e+00 },
+ { 1.371304548273191e-09, -3.320630639454825e+00 },
+ { 1.387137371622433e-09, -3.348787486547389e+00 },
+ { 1.402917970033511e-09, -3.376884551834256e+00 },
+ { 1.418645749376393e-09, -3.404920557184582e+00 },
+ { 1.434320117508396e-09, -3.432894224276359e+00 },
+ { 1.449940484298756e-09, -3.460804274656981e+00 },
+ { 1.465506261649108e-09, -3.488649429796768e+00 },
+ { 1.481016863517580e-09, -3.516428411149154e+00 },
+ { 1.496471705937951e-09, -3.544139940202303e+00 },
+ { 1.511870207044433e-09, -3.571782738540999e+00 },
+ { 1.527211787092206e-09, -3.599355527901174e+00 },
+ { 1.542495868479076e-09, -3.626857030226671e+00 },
+ { 1.557721875768920e-09, -3.654285967729458e+00 },
+ { 1.572889235710329e-09, -3.681641062941412e+00 },
+ { 1.587997377261005e-09, -3.708921038776707e+00 },
+ { 1.603045731607830e-09, -3.736124618586623e+00 },
+ { 1.618033732189314e-09, -3.763250526218862e+00 },
+ { 1.632960814715177e-09, -3.790297486071938e+00 },
+ { 1.647826417189275e-09, -3.817264223155802e+00 },
+ { 1.662629979930247e-09, -3.844149463148589e+00 },
+ { 1.677370945591844e-09, -3.870951932452996e+00 },
+ { 1.692048759186008e-09, -3.897670358257890e+00 },
+ { 1.706662868100504e-09, -3.924303468590212e+00 },
+ { 1.721212722122685e-09, -3.950849992378278e+00 },
+ { 1.735697773458400e-09, -3.977308659506432e+00 },
+ { 1.750117476754591e-09, -4.003678200876669e+00 },
+ { 1.764471289116712e-09, -4.029957348461003e+00 },
+ { 1.778758670132079e-09, -4.056144835364877e+00 },
+ { 1.792979081888926e-09, -4.082239395882965e+00 },
+ { 1.807131988996465e-09, -4.108239765556996e+00 },
+ { 1.821216858606652e-09, -4.134144681236933e+00 },
+ { 1.835233160431175e-09, -4.159952881133585e+00 },
+ { 1.849180366764537e-09, -4.185663104882633e+00 },
+ { 1.863057952502055e-09, -4.211274093599509e+00 },
+ { 1.876865395161145e-09, -4.236784589940537e+00 },
+ { 1.890602174898734e-09, -4.262193338157148e+00 },
+ { 1.904267774533022e-09, -4.287499084158302e+00 },
+ { 1.917861679562008e-09, -4.312700575567174e+00 },
+ { 1.931383378182392e-09, -4.337796561778708e+00 },
+ { 1.944832361310856e-09, -4.362785794021793e+00 },
+ { 1.958208122599839e-09, -4.387667025411434e+00 },
+ { 1.971510158459931e-09, -4.412439011013396e+00 },
+ { 1.984737968076495e-09, -4.437100507898339e+00 },
+ { 1.997891053431005e-09, -4.461650275204912e+00 },
+ { 2.010968919316289e-09, -4.486087074191693e+00 },
+ { 2.023971073358447e-09, -4.510409668301784e+00 },
+ { 2.036897026033634e-09, -4.534616823217992e+00 },
+ { 2.049746290686799e-09, -4.558707306921882e+00 },
+ { 2.062518383551274e-09, -4.582679889754607e+00 },
+ { 2.075212823764071e-09, -4.606533344469879e+00 },
+ { 2.087829133387063e-09, -4.630266446298172e+00 },
+ { 2.100366837422912e-09, -4.653877973001258e+00 },
+ { 2.112825463835087e-09, -4.677366704934605e+00 },
+ { 2.125204543562522e-09, -4.700731425099899e+00 },
+ { 2.137503610540056e-09, -4.723970919208608e+00 },
+ { 2.149722201714786e-09, -4.747083975738060e+00 },
+ { 2.161859857063438e-09, -4.770069385989595e+00 },
+ { 2.173916119610994e-09, -4.792925944149308e+00 },
+ { 2.185890535445098e-09, -4.815652447340950e+00 },
+ { 2.197782653735957e-09, -4.838247695689436e+00 },
+ { 2.209592026751962e-09, -4.860710492376411e+00 },
+ { 2.221318209877576e-09, -4.883039643700314e+00 },
+ { 2.232960761627846e-09, -4.905233959130168e+00 },
+ { 2.244519243667616e-09, -4.927292251368517e+00 },
+ { 2.255993220826402e-09, -4.949213336406265e+00 },
+ { 2.267382261115285e-09, -4.970996033581527e+00 },
+ { 2.278685935744269e-09, -4.992639165639563e+00 },
+ { 2.289903819135414e-09, -5.014141558784778e+00 },
+ { 2.301035488942000e-09, -5.035502042744443e+00 },
+ { 2.312080526062763e-09, -5.056719450823151e+00 },
+ { 2.323038514659161e-09, -5.077792619963239e+00 },
+ { 2.333909042168180e-09, -5.098720390796817e+00 },
+ { 2.344691699320969e-09, -5.119501607709159e+00 },
+ { 2.355386080156553e-09, -5.140135118892792e+00 },
+ { 2.365991782037187e-09, -5.160619776404897e+00 },
+ { 2.376508405665132e-09, -5.180954436227641e+00 },
+ { 2.386935555094626e-09, -5.201137958319343e+00 },
+ { 2.397272837749508e-09, -5.221169206676762e+00 },
+ { 2.407519864436774e-09, -5.241047049389645e+00 },
+ { 2.417676249362563e-09, -5.260770358700167e+00 },
+ { 2.427741610143750e-09, -5.280338011053974e+00 },
+ { 2.437715567825576e-09, -5.299748887163106e+00 },
+ { 2.447597746894037e-09, -5.319001872058887e+00 },
+ { 2.457387775290440e-09, -5.338095855149190e+00 },
+ { 2.467085284426756e-09, -5.357029730277389e+00 },
+ { 2.476689909196263e-09, -5.375802395772283e+00 },
+ { 2.486201287990485e-09, -5.394412754510426e+00 },
+ { 2.495619062711154e-09, -5.412859713968929e+00 },
+ { 2.504942878785408e-09, -5.431142186284682e+00 },
+ { 2.514172385175743e-09, -5.449259088303476e+00 },
+ { 2.523307234396791e-09, -5.467209341642627e+00 },
+ { 2.532347082526785e-09, -5.484991872743321e+00 },
+ { 2.541291589219998e-09, -5.502605612925014e+00 },
+ { 2.550140417722072e-09, -5.520049498445633e+00 },
+ { 2.558893234878378e-09, -5.537322470548212e+00 },
+ { 2.567549711150773e-09, -5.554423475524196e+00 },
+ { 2.576109520627371e-09, -5.571351464763084e+00 },
+ { 2.584572341037361e-09, -5.588105394812198e+00 },
+ { 2.592937853759161e-09, -5.604684227423386e+00 },
+ { 2.601205743836355e-09, -5.621086929615246e+00 },
+ { 2.609375699987564e-09, -5.637312473723475e+00 },
+ { 2.617447414618146e-09, -5.653359837454964e+00 },
+ { 2.625420583833750e-09, -5.669228003945694e+00 },
+ { 2.633294907447937e-09, -5.684915961806963e+00 },
+ { 2.641070088997271e-09, -5.700422705186584e+00 },
+ { 2.648745835750128e-09, -5.715747233817712e+00 },
+ { 2.656321858720176e-09, -5.730888553077074e+00 },
+ { 2.663797872673252e-09, -5.745845674030161e+00 },
+ { 2.671173596142054e-09, -5.760617613492118e+00 },
+ { 2.678448751434797e-09, -5.775203394076705e+00 },
+ { 2.685623064645538e-09, -5.789602044248679e+00 },
+ { 2.692696265666640e-09, -5.803812598380606e+00 },
+ { 2.699668088194915e-09, -5.817834096797069e+00 },
+ { 2.706538269745573e-09, -5.831665585834668e+00 },
+ { 2.713306551659817e-09, -5.845306117889361e+00 },
+ { 2.719972679116734e-09, -5.858754751472542e+00 },
+ { 2.726536401139295e-09, -5.872010551255358e+00 },
+ { 2.732997470607439e-09, -5.885072588127400e+00 },
+ { 2.739355644265558e-09, -5.897939939244211e+00 },
+ { 2.745610682731633e-09, -5.910611688078208e+00 },
+ { 2.751762350508137e-09, -5.923086924473290e+00 },
+ { 2.757810415987146e-09, -5.935364744687794e+00 },
+ { 2.763754651462700e-09, -5.947444251452243e+00 },
+ { 2.769594833137415e-09, -5.959324554015538e+00 },
+ { 2.775330741132843e-09, -5.971004768198829e+00 },
+ { 2.780962159494174e-09, -5.982484016437981e+00 },
+ { 2.786488876202047e-09, -5.993761427840588e+00 },
+ { 2.791910683178690e-09, -6.004836138231525e+00 },
+ { 2.797227376295779e-09, -6.015707290202086e+00 },
+ { 2.802438755383971e-09, -6.026374033162623e+00 },
+ { 2.807544624236659e-09, -6.036835523383457e+00 },
+ { 2.812544790621093e-09, -6.047090924050914e+00 },
+ { 2.817439066283459e-09, -6.057139405311101e+00 },
+ { 2.822227266958278e-09, -6.066980144322601e+00 },
+ { 2.826909212371261e-09, -6.076612325295799e+00 },
+ { 2.831484726250221e-09, -6.086035139548830e+00 },
+ { 2.835953636329660e-09, -6.095247785550617e+00 },
+ { 2.840315774357203e-09, -6.104249468967751e+00 },
+ { 2.844570976102082e-09, -6.113039402715685e+00 },
+ { 2.848719081357095e-09, -6.121616806996519e+00 },
+ { 2.852759933948860e-09, -6.129980909353977e+00 },
+ { 2.856693381741114e-09, -6.138130944714082e+00 },
+ { 2.860519276643053e-09, -6.146066155436312e+00 },
+ { 2.864237474610633e-09, -6.153785791350256e+00 },
+ { 2.867847835656203e-09, -6.161289109809551e+00 },
+ { 2.871350223851726e-09, -6.168575375732642e+00 },
+ { 2.874744507333867e-09, -6.175643861647406e+00 },
+ { 2.878030558310989e-09, -6.182493847739853e+00 },
+ { 2.881208253063899e-09, -6.189124621889823e+00 },
+ { 2.884277471954592e-09, -6.195535479723423e+00 },
+ { 2.887238099428306e-09, -6.201725724651554e+00 },
+ { 2.890090024020323e-09, -6.207694667918394e+00 },
+ { 2.892833138356060e-09, -6.213441628635915e+00 },
+ { 2.895467339159240e-09, -6.218965933835304e+00 },
+ { 2.897992527253659e-09, -6.224266918505075e+00 },
+ { 2.900408607567016e-09, -6.229343925633495e+00 },
+ { 2.902715489136496e-09, -6.234196306254763e+00 },
+ { 2.904913085108075e-09, -6.238823419482017e+00 },
+ { 2.907001312743911e-09, -6.243224632557377e+00 },
+ { 2.908980093422997e-09, -6.247399320887848e+00 },
+ { 2.910849352646620e-09, -6.251346868091392e+00 },
+ { 2.912609020036956e-09, -6.255066666028537e+00 },
+ { 2.914259029343965e-09, -6.258558114851525e+00 },
+ { 2.915799318445710e-09, -6.261820623039620e+00 },
+ { 2.917229829350759e-09, -6.264853607438842e+00 },
+ { 2.918550508202463e-09, -6.267656493305673e+00 },
+ { 2.919761305276718e-09, -6.270228714337005e+00 },
+ { 2.920862174988150e-09, -6.272569712717951e+00 },
+ { 2.921853075889193e-09, -6.274678939154603e+00 },
+ { 2.922733970674264e-09, -6.276555852917634e+00 },
+ { 2.923504826176907e-09, -6.278199921870962e+00 },
+ { 2.924165613375264e-09, -6.279610622518139e+00 },
+ { 2.924716307391075e-09, -6.280787440034993e+00 },
+ { 2.925156887490598e-09, -6.281729868306345e+00 },
+ { 2.925487337087508e-09, -6.282437409966992e+00 },
+ { 2.925707643739298e-09, -6.282909576428774e+00 },
+ { 2.925817799151970e-09, -6.283145887925411e+00 },
diff --git a/gr-blocks/lib/skiphead_impl.cc b/gr-blocks/lib/skiphead_impl.cc
new file mode 100644
index 0000000000..feb39eb8f4
--- /dev/null
+++ b/gr-blocks/lib/skiphead_impl.cc
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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 "skiphead_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ skiphead::sptr
+ skiphead::make(size_t itemsize, uint64_t nitems_to_skip)
+ {
+ return gnuradio::get_initial_sptr
+ (new skiphead_impl(itemsize, nitems_to_skip));
+ }
+
+ skiphead_impl::skiphead_impl(size_t itemsize, uint64_t nitems_to_skip)
+ : gr_block("skiphead",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_nitems_to_skip(nitems_to_skip), d_nitems(0)
+ {
+ }
+
+ skiphead_impl::~skiphead_impl()
+ {
+ }
+
+ int
+ skiphead_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items_,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *in = (const char*)input_items[0];
+ char *out = (char*)output_items[0];
+
+ int ninput_items = std::min(ninput_items_[0], noutput_items);
+ int ii = 0; // input index
+
+ while (ii < ninput_items) {
+ uint64_t ni_total = ii + d_nitems; // total items processed so far
+ if(ni_total < d_nitems_to_skip) { // need to skip some more
+
+ int n_to_skip = (int)std::min(d_nitems_to_skip - ni_total,
+ (uint64_t)(ninput_items - ii));
+ ii += n_to_skip;
+ }
+
+ else { // nothing left to skip. copy away
+ int n_to_copy = ninput_items - ii;
+ if(n_to_copy > 0) {
+ size_t itemsize = output_signature()->sizeof_stream_item(0);
+ memcpy(out, in + (ii*itemsize), n_to_copy*itemsize);
+ }
+
+ d_nitems += ninput_items;
+ consume_each(ninput_items);
+ return n_to_copy;
+ }
+ }
+
+ d_nitems += ninput_items;
+ consume_each(ninput_items);
+ return 0;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/skiphead_impl.h b/gr-blocks/lib/skiphead_impl.h
new file mode 100644
index 0000000000..d8e0870cb1
--- /dev/null
+++ b/gr-blocks/lib/skiphead_impl.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_SKIPHEAD_IMPL_H
+#define INCLUDED_GR_SKIPHEAD_IMPL_H
+
+#include <blocks/skiphead.h>
+
+namespace gr {
+ namespace blocks {
+
+ class skiphead_impl : public skiphead
+ {
+ private:
+ uint64_t d_nitems_to_skip;
+ uint64_t d_nitems; // total items seen
+
+ public:
+ skiphead_impl(size_t itemsize, uint64_t nitems_to_skip);
+ ~skiphead_impl();
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SKIPHEAD_IMPL_H */
diff --git a/gr-blocks/lib/socket_pdu_impl.cc b/gr-blocks/lib/socket_pdu_impl.cc
index 4ff5ce6eb9..e4ef40f87a 100644
--- a/gr-blocks/lib/socket_pdu_impl.cc
+++ b/gr-blocks/lib/socket_pdu_impl.cc
@@ -104,7 +104,7 @@ namespace gr {
else
throw std::runtime_error("gr::blocks:socket_pdu: unknown socket type");
- d_thread = gruel::thread(boost::bind(&socket_pdu_impl::run_io_service, this));
+ d_thread = gr::thread::thread(boost::bind(&socket_pdu_impl::run_io_service, this));
d_started = true;
}
diff --git a/gr-blocks/lib/stream_pdu_base.cc b/gr-blocks/lib/stream_pdu_base.cc
index 0c4e7e0863..c887ad2fac 100644
--- a/gr-blocks/lib/stream_pdu_base.cc
+++ b/gr-blocks/lib/stream_pdu_base.cc
@@ -61,7 +61,7 @@ namespace gr {
{
d_blk = blk;
d_port = port;
- d_thread = gruel::thread(boost::bind(&stream_pdu_base::run, this));
+ d_thread = gr::thread::thread(boost::bind(&stream_pdu_base::run, this));
d_started = true;
}
diff --git a/gr-blocks/lib/stream_pdu_base.h b/gr-blocks/lib/stream_pdu_base.h
index 66eaaf0c04..c305880b07 100644
--- a/gr-blocks/lib/stream_pdu_base.h
+++ b/gr-blocks/lib/stream_pdu_base.h
@@ -23,8 +23,8 @@
#ifndef INCLUDED_STREAM_PDU_BASE_H
#define INCLUDED_STREAM_PDU_BASE_H
-#include <gruel/thread.h>
-#include <gruel/pmt.h>
+#include <thread/thread.h>
+#include <pmt/pmt.h>
class gr_basic_block;
@@ -42,7 +42,7 @@ namespace gr {
bool d_started;
bool d_finished;
std::vector<uint8_t> d_rxbuf;
- gruel::thread d_thread;
+ gr::thread::thread d_thread;
pmt::pmt_t d_port;
gr_basic_block *d_blk;
diff --git a/gr-blocks/lib/tag_debug_impl.cc b/gr-blocks/lib/tag_debug_impl.cc
index c595d41db5..3bcffb664f 100644
--- a/gr-blocks/lib/tag_debug_impl.cc
+++ b/gr-blocks/lib/tag_debug_impl.cc
@@ -56,14 +56,14 @@ namespace gr {
std::vector<gr_tag_t>
tag_debug_impl::current_tags()
{
- gruel::scoped_lock l(d_mutex);
+ gr::thread::scoped_lock l(d_mutex);
return d_tags;
}
void
tag_debug_impl::set_display(bool d)
{
- gruel::scoped_lock l(d_mutex);
+ gr::thread::scoped_lock l(d_mutex);
d_display = d;
}
@@ -72,7 +72,7 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gruel::scoped_lock l(d_mutex);
+ gr::thread::scoped_lock l(d_mutex);
std::stringstream sout;
if(d_display) {
diff --git a/gr-blocks/lib/tag_debug_impl.h b/gr-blocks/lib/tag_debug_impl.h
index 988d0e1103..caf5b6b4f5 100644
--- a/gr-blocks/lib/tag_debug_impl.h
+++ b/gr-blocks/lib/tag_debug_impl.h
@@ -24,7 +24,7 @@
#define INCLUDED_GR_TAG_DEBUG_IMPL_H
#include <blocks/tag_debug.h>
-#include <gruel/thread.h>
+#include <thread/thread.h>
#include <stddef.h>
namespace gr {
@@ -37,7 +37,7 @@ namespace gr {
std::vector<gr_tag_t> d_tags;
std::vector<gr_tag_t>::iterator d_tags_itr;
bool d_display;
- gruel::mutex d_mutex;
+ gr::thread::mutex d_mutex;
public:
tag_debug_impl(size_t sizeof_stream_item, const std::string &name);
diff --git a/gr-blocks/lib/tagged_file_sink_impl.cc b/gr-blocks/lib/tagged_file_sink_impl.cc
new file mode 100644
index 0000000000..7d011e45f0
--- /dev/null
+++ b/gr-blocks/lib/tagged_file_sink_impl.cc
@@ -0,0 +1,235 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 "tagged_file_sink_impl.h"
+#include <gr_io_signature.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <iostream>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ tagged_file_sink::sptr
+ tagged_file_sink::make(size_t itemsize, double samp_rate)
+ {
+ return gnuradio::get_initial_sptr
+ (new tagged_file_sink_impl(itemsize, samp_rate));
+ }
+
+ tagged_file_sink_impl::tagged_file_sink_impl(size_t itemsize, double samp_rate)
+ : gr_sync_block("tagged_file_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ d_itemsize (itemsize), d_n(0), d_sample_rate(samp_rate)
+ {
+ d_state = NOT_IN_BURST;
+ d_last_N = 0;
+ d_timeval = 0;
+ }
+
+ tagged_file_sink_impl::~tagged_file_sink_impl()
+ {
+ }
+
+ int
+ tagged_file_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *inbuf = (char*)input_items[0];
+
+ uint64_t start_N = nitems_read(0);
+ uint64_t end_N = start_N + (uint64_t)(noutput_items);
+ pmt::pmt_t bkey = pmt::string_to_symbol("burst");
+ pmt::pmt_t tkey = pmt::string_to_symbol("rx_time"); // use gr_tags::key_time
+
+ std::vector<gr_tag_t> all_tags;
+ get_tags_in_range(all_tags, 0, start_N, end_N);
+
+ std::sort(all_tags.begin(), all_tags.end(), gr_tag_t::offset_compare);
+
+ std::vector<gr_tag_t>::iterator vitr = all_tags.begin();
+
+ // Look for a time tag and initialize d_timeval.
+ std::vector<gr_tag_t> time_tags_outer;
+ get_tags_in_range(time_tags_outer, 0, start_N, end_N, tkey);
+ if(time_tags_outer.size() > 0) {
+ const gr_tag_t tag = time_tags_outer[0];
+ uint64_t offset = tag.offset;
+ pmt::pmt_t time = tag.value;
+ uint64_t tsecs = pmt::to_uint64(pmt::tuple_ref(time, 0));
+ double tfrac = pmt::to_double(pmt::tuple_ref(time, 1));
+ double delta = (double)offset / d_sample_rate;
+ d_timeval = (double)tsecs + tfrac + delta;
+ d_last_N = offset;
+ }
+
+ int idx = 0, idx_stop = 0;
+ while(idx < noutput_items) {
+ if(d_state == NOT_IN_BURST) {
+ while(vitr != all_tags.end()) {
+ if((pmt::eqv((*vitr).key, bkey)) &&
+ pmt::is_true((*vitr).value)) {
+
+ uint64_t N = (*vitr).offset;
+ idx = (int)(N - start_N);
+
+ //std::cout << std::endl << "Found start of burst: "
+ // << idx << ", " << N << std::endl;
+
+ // Find time burst occurred by getting latest time tag and extrapolating
+ // to new time based on sample rate of this block.
+ std::vector<gr_tag_t> time_tags;
+ //get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time);
+ get_tags_in_range(time_tags, 0, d_last_N, N, tkey);
+ if(time_tags.size() > 0) {
+ const gr_tag_t tag = time_tags[time_tags.size()-1];
+
+ uint64_t time_nitems = tag.offset;
+
+ // Get time based on last time tag from USRP
+ pmt::pmt_t time = tag.value;
+ uint64_t tsecs = pmt::to_uint64(pmt::tuple_ref(time, 0));
+ double tfrac = pmt::to_double(pmt::tuple_ref(time, 1));
+
+ // Get new time from last time tag + difference in time to when
+ // burst tag occured based on the sample rate
+ double delta = (double)(N - time_nitems) / d_sample_rate;
+ d_timeval = (double)tsecs + tfrac + delta;
+
+ //std::cout.setf(std::ios::fixed, std::ios::floatfield);
+ //std::cout.precision(8);
+ //std::cout << "Time found: " << (double)tsecs + tfrac << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ //std::cout << " time at N = " << time_nitems << " burst N = " << N << std::endl;
+ }
+ else {
+ // if no time tag, use last seen tag and update time based on
+ // sample rate of the block
+ d_timeval += (double)(N - d_last_N) / d_sample_rate;
+ //std::cout << "Time not found" << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ }
+ d_last_N = N;
+
+ std::stringstream filename;
+ filename.setf(std::ios::fixed, std::ios::floatfield);
+ filename.precision(8);
+ filename << "file" << unique_id() << "_" << d_n << "_" << d_timeval << ".dat";
+ d_n++;
+
+ int fd;
+ if((fd = ::open(filename.str().c_str(),
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror(filename.str().c_str());
+ return -1;
+ }
+
+ // FIXME:
+ //if((d_handle = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL) {
+ if((d_handle = fdopen (fd, "wb")) == NULL) {
+ perror(filename.str().c_str());
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ //std::cout << "Created new file: " << filename.str() << std::endl;
+
+ d_state = IN_BURST;
+ break;
+ }
+
+ vitr++;
+ }
+ if(d_state == NOT_IN_BURST)
+ return noutput_items;
+ }
+ else { // In burst
+ while(vitr != all_tags.end()) {
+ if((pmt::eqv((*vitr).key, bkey)) &&
+ pmt::is_false((*vitr).value)) {
+ uint64_t N = (*vitr).offset;
+ idx_stop = (int)N - start_N;
+
+ //std::cout << "Found end of burst: "
+ // << idx_stop << ", " << N << std::endl;
+
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize,
+ idx_stop-idx, d_handle);
+ if(count == 0) {
+ if(ferror(d_handle)) {
+ perror("tagged_file_sink: error writing file");
+ }
+ }
+ idx = idx_stop;
+ d_state = NOT_IN_BURST;
+ vitr++;
+ fclose(d_handle);
+ break;
+ }
+ else {
+ vitr++;
+ }
+ }
+ if(d_state == IN_BURST) {
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize,
+ noutput_items-idx, d_handle);
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("tagged_file_sink: error writing file");
+ }
+ }
+ idx = noutput_items;
+ }
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/tagged_file_sink_impl.h b/gr-blocks/lib/tagged_file_sink_impl.h
new file mode 100644
index 0000000000..f64cedf2f9
--- /dev/null
+++ b/gr-blocks/lib/tagged_file_sink_impl.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_TAGGED_FILE_SINK_IMPL_H
+#define INCLUDED_GR_TAGGED_FILE_SINK_IMPL_H
+
+#include <blocks/tagged_file_sink.h>
+#include <cstdio> // for FILE
+
+namespace gr {
+ namespace blocks {
+
+ class tagged_file_sink_impl : public tagged_file_sink
+ {
+ private:
+ enum {
+ NOT_IN_BURST = 0,
+ IN_BURST
+ };
+
+ size_t d_itemsize;
+ int d_state;
+ FILE *d_handle;
+ int d_n;
+ double d_sample_rate;
+ uint64_t d_last_N;
+ double d_timeval;
+
+ public:
+ tagged_file_sink_impl(size_t itemsize, double samp_rate);
+ ~tagged_file_sink_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_TAGGED_FILE_SINK_IMPL_H */
diff --git a/gr-blocks/lib/tagged_stream_mux_impl.cc b/gr-blocks/lib/tagged_stream_mux_impl.cc
new file mode 100644
index 0000000000..59e36fa07e
--- /dev/null
+++ b/gr-blocks/lib/tagged_stream_mux_impl.cc
@@ -0,0 +1,93 @@
+/* -*- 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_io_signature.h>
+#include "tagged_stream_mux_impl.h"
+
+namespace gr {
+ namespace blocks {
+
+ tagged_stream_mux::sptr
+ tagged_stream_mux::make(size_t itemsize, const std::string &lengthtagname)
+ {
+ return gnuradio::get_initial_sptr (new tagged_stream_mux_impl(itemsize, lengthtagname));
+ }
+
+ tagged_stream_mux_impl::tagged_stream_mux_impl(size_t itemsize, const std::string &lengthtagname)
+ : gr_tagged_stream_block("tagged_stream_mux",
+ gr_make_io_signature(1, -1, itemsize),
+ gr_make_io_signature(1, 1, itemsize),
+ lengthtagname),
+ d_itemsize(itemsize)
+ {
+ set_tag_propagation_policy(TPP_DONT);
+ }
+
+ tagged_stream_mux_impl::~tagged_stream_mux_impl()
+ {
+ }
+
+ int
+ tagged_stream_mux_impl::calculate_output_stream_length(const gr_vector_int &ninput_items)
+ {
+ int nout = 0;
+ for (unsigned i = 0; i < ninput_items.size(); i++) {
+ nout += ninput_items[i];
+ }
+ return nout;
+ }
+
+ int
+ tagged_stream_mux_impl::work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ unsigned char *out = (unsigned char *) output_items[0];
+ int n_produced = 0;
+
+ set_relative_rate(ninput_items.size());
+
+ for (unsigned int i = 0; i < input_items.size(); i++) {
+ const unsigned char *in = (const unsigned char *) input_items[i];
+
+ std::vector<gr_tag_t> tags;
+ get_tags_in_range(tags, i, nitems_read(i), nitems_read(i)+ninput_items[i]);
+ for (unsigned int j = 0; j < tags.size(); j++) {
+ const uint64_t offset = tags[j].offset - nitems_read(i) + nitems_written(0) + n_produced;
+ add_item_tag(0, offset, tags[j].key, tags[j].value);
+ }
+ memcpy((void *) out, (const void *) in, ninput_items[i] * d_itemsize);
+ out += ninput_items[i] * d_itemsize;
+ n_produced += ninput_items[i];
+ }
+
+ return n_produced;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
diff --git a/gr-blocks/lib/tagged_stream_mux_impl.h b/gr-blocks/lib/tagged_stream_mux_impl.h
new file mode 100644
index 0000000000..19862e6868
--- /dev/null
+++ b/gr-blocks/lib/tagged_stream_mux_impl.h
@@ -0,0 +1,54 @@
+/* -*- 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_TAGGED_STREAM_MUX_IMPL_H
+#define INCLUDED_TAGGED_STREAM_MUX_IMPL_H
+
+#include <vector>
+#include <blocks/tagged_stream_mux.h>
+
+namespace gr {
+ namespace blocks {
+
+ class tagged_stream_mux_impl : public tagged_stream_mux
+ {
+ private:
+ size_t d_itemsize;
+
+ protected:
+ int calculate_output_stream_length(const std::vector<int> &ninput_items);
+
+ public:
+ tagged_stream_mux_impl(size_t itemsize, const std::string &lengthtagname);
+ ~tagged_stream_mux_impl();
+
+ int work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif
+
diff --git a/gr-blocks/lib/tagged_stream_to_pdu_impl.cc b/gr-blocks/lib/tagged_stream_to_pdu_impl.cc
index fc5c8f6424..4abc5818b0 100644
--- a/gr-blocks/lib/tagged_stream_to_pdu_impl.cc
+++ b/gr-blocks/lib/tagged_stream_to_pdu_impl.cc
@@ -93,14 +93,14 @@ namespace gr {
// copy samples for this vector into either a pmt or our save buffer
if (ncopy == d_pdu_remain) { // we will send this pdu
if (d_save.size() == 0) {
- d_pdu_vector = pdu::make_vector(d_type, in, ncopy);
+ d_pdu_vector = pdu::make_pdu_vector(d_type, in, ncopy);
send_message();
}
else {
size_t oldsize = d_save.size();
d_save.resize((oldsize + ncopy)*d_itemsize, 0);
memcpy(&d_save[oldsize*d_itemsize], in, ncopy*d_itemsize);
- d_pdu_vector = pdu::make_vector(d_type, &d_save[0], d_pdu_length);
+ d_pdu_vector = pdu::make_pdu_vector(d_type, &d_save[0], d_pdu_length);
send_message();
d_save.clear();
}
diff --git a/gr-blocks/lib/tcp_connection.h b/gr-blocks/lib/tcp_connection.h
index ba57de0783..32a5ef8c79 100644
--- a/gr-blocks/lib/tcp_connection.h
+++ b/gr-blocks/lib/tcp_connection.h
@@ -25,7 +25,7 @@
#include <boost/array.hpp>
#include <boost/asio.hpp>
-#include <gruel/pmt.h>
+#include <pmt/pmt.h>
class gr_basic_block;
diff --git a/gr-blocks/lib/test_gr_blocks.cc b/gr-blocks/lib/test_gr_blocks.cc
new file mode 100644
index 0000000000..14f047fb7b
--- /dev/null
+++ b/gr-blocks/lib/test_gr_blocks.cc
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include <qa_blocks.h>
+#include <iostream>
+
+int
+main(int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("gr_blocks.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest(qa_gr_blocks::suite());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gr-blocks/lib/udp_sink_impl.cc b/gr-blocks/lib/udp_sink_impl.cc
new file mode 100644
index 0000000000..4bce4ae9c5
--- /dev/null
+++ b/gr-blocks/lib/udp_sink_impl.cc
@@ -0,0 +1,148 @@
+/* -*- 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 "udp_sink_impl.h"
+#include <gr_io_signature.h>
+#include <boost/asio.hpp>
+#include <boost/format.hpp>
+#include <thread/thread.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ udp_sink::sptr
+ udp_sink::make(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size, bool eof)
+ {
+ return gnuradio::get_initial_sptr
+ (new udp_sink_impl(itemsize, host, port,
+ payload_size, eof));
+ }
+
+ udp_sink_impl::udp_sink_impl(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size, bool eof)
+ : gr_sync_block("udp_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ d_itemsize(itemsize), d_payload_size(payload_size), d_eof(eof),
+ d_connected(false)
+ {
+ // Get the destination address
+ connect(host, port);
+ }
+
+ // public constructor that returns a shared_ptr
+ udp_sink_impl::~udp_sink_impl()
+ {
+ if(d_connected)
+ disconnect();
+ }
+
+ void
+ udp_sink_impl::connect(const std::string &host, int port)
+ {
+ if(d_connected)
+ disconnect();
+
+ std::string s_port = (boost::format("%d")%port).str();
+ if(host.size() > 0) {
+ boost::asio::ip::udp::resolver resolver(d_io_service);
+ boost::asio::ip::udp::resolver::query query(boost::asio::ip::udp::v4(),
+ host, s_port);
+ d_endpoint = *resolver.resolve(query);
+
+ d_socket = new boost::asio::ip::udp::socket(d_io_service);
+ d_socket->open(boost::asio::ip::udp::v4());
+
+ boost::asio::socket_base::reuse_address roption(true);
+ d_socket->set_option(roption);
+
+ d_connected = true;
+ }
+ }
+
+ void
+ udp_sink_impl::disconnect()
+ {
+ if(!d_connected)
+ return;
+
+ gr::thread::scoped_lock guard(d_mutex); // protect d_socket from work()
+
+ // Send a few zero-length packets to signal receiver we are done
+ boost::array<char, 1> send_buf = {{ 0 }};
+ if(d_eof) {
+ int i;
+ for(i = 0; i < 3; i++)
+ d_socket->send_to(boost::asio::buffer(send_buf), d_endpoint);
+ }
+
+ d_socket->close();
+ delete d_socket;
+
+ d_connected = false;
+ }
+
+ int
+ udp_sink_impl::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *in = (const char *) input_items[0];
+ ssize_t r=0, bytes_sent=0, bytes_to_send=0;
+ ssize_t total_size = noutput_items*d_itemsize;
+
+ gr::thread::scoped_lock guard(d_mutex); // protect d_socket
+
+ while(bytes_sent < total_size) {
+ bytes_to_send = std::min((ssize_t)d_payload_size, (total_size-bytes_sent));
+
+ if(d_connected) {
+ try {
+ r = d_socket->send_to(boost::asio::buffer((void*)(in+bytes_sent), bytes_to_send),
+ d_endpoint);
+ }
+ catch(std::exception& e) {
+ GR_LOG_ERROR(d_logger, boost::format("send error: %s") % e.what());
+ return -1;
+ }
+ }
+ else
+ r = bytes_to_send; // discarded for lack of connection
+ bytes_sent += r;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
diff --git a/gr-blocks/lib/udp_sink_impl.h b/gr-blocks/lib/udp_sink_impl.h
new file mode 100644
index 0000000000..0f0d081422
--- /dev/null
+++ b/gr-blocks/lib/udp_sink_impl.h
@@ -0,0 +1,65 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_UDP_SINK_IMPL_H
+#define INCLUDED_GR_UDP_SINK_IMPL_H
+
+#include <blocks/udp_sink.h>
+#include <boost/asio.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ class udp_sink_impl : public udp_sink
+ {
+ private:
+ size_t d_itemsize;
+
+ int d_payload_size; // maximum transmission unit (packet length)
+ bool d_eof; // send zero-length packet on disconnect
+ bool d_connected; // are we connected?
+ gr::thread::mutex d_mutex; // protects d_socket and d_connected
+
+ boost::asio::ip::udp::socket *d_socket; // handle to socket
+ boost::asio::ip::udp::endpoint d_endpoint;
+ boost::asio::io_service d_io_service;
+
+ public:
+ udp_sink_impl(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size, bool eof);
+ ~udp_sink_impl();
+
+ int payload_size() { return d_payload_size; }
+
+ void connect(const std::string &host, int port);
+ void disconnect();
+
+ 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_UDP_SINK_IMPL_H */
diff --git a/gr-blocks/lib/udp_source_impl.cc b/gr-blocks/lib/udp_source_impl.cc
new file mode 100644
index 0000000000..5b108c393e
--- /dev/null
+++ b/gr-blocks/lib/udp_source_impl.cc
@@ -0,0 +1,215 @@
+/* -*- 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 "udp_source_impl.h"
+#include <gr_io_signature.h>
+#include <gr_math.h>
+#include <stdexcept>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ udp_source::sptr
+ udp_source::make(size_t itemsize,
+ const std::string &ipaddr, int port,
+ int payload_size, bool eof)
+ {
+ return gnuradio::get_initial_sptr
+ (new udp_source_impl(itemsize, ipaddr, port,
+ payload_size, eof));
+ }
+
+ udp_source_impl::udp_source_impl(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size, bool eof)
+ : gr_sync_block("udp_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_payload_size(payload_size),
+ d_eof(eof), d_connected(false), d_residual(0), d_sent(0), d_offset(0)
+ {
+ // Give us some more room to play.
+ d_rxbuf = new char[4*d_payload_size];
+ d_residbuf = new char[50*d_payload_size];
+
+ connect(host, port);
+ }
+
+ udp_source_impl::~udp_source_impl()
+ {
+ if(d_connected)
+ disconnect();
+
+ delete [] d_rxbuf;
+ delete [] d_residbuf;
+ }
+
+ void
+ udp_source_impl::connect(const std::string &host, int port)
+ {
+ if(d_connected)
+ disconnect();
+
+ d_host = host;
+ d_port = static_cast<unsigned short>(port);
+
+ std::string s_port;
+ s_port = (boost::format("%d")%d_port).str();
+
+ if(host.size() > 0) {
+ boost::asio::ip::udp::resolver resolver(d_io_service);
+ boost::asio::ip::udp::resolver::query query(boost::asio::ip::udp::v4(),
+ host, s_port);
+ d_endpoint = *resolver.resolve(query);
+
+ d_socket = new boost::asio::ip::udp::socket(d_io_service);
+ d_socket->open(d_endpoint.protocol());
+
+ boost::asio::socket_base::linger loption(true, 0);
+ d_socket->set_option(loption);
+
+ boost::asio::socket_base::reuse_address roption(true);
+ d_socket->set_option(roption);
+
+ d_socket->bind(d_endpoint);
+
+ start_receive();
+ d_udp_thread = gr::thread::thread(boost::bind(&udp_source_impl::run_io_service, this));
+ d_connected = true;
+ }
+ }
+
+ void
+ udp_source_impl::disconnect()
+ {
+ gr::thread::scoped_lock lock(d_setlock);
+
+ if(!d_connected)
+ return;
+
+ d_io_service.stop();
+
+ d_socket->close();
+ delete d_socket;
+
+ d_connected = false;
+ }
+
+ // Return port number of d_socket
+ int
+ udp_source_impl::get_port(void)
+ {
+ //return d_endpoint.port();
+ return d_socket->local_endpoint().port();
+ }
+
+ void
+ udp_source_impl::start_receive()
+ {
+ d_socket->async_receive_from(boost::asio::buffer((void*)d_rxbuf, d_payload_size), d_endpoint_rcvd,
+ boost::bind(&udp_source_impl::handle_read, this,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred));
+ }
+
+ void
+ udp_source_impl::handle_read(const boost::system::error_code& error,
+ size_t bytes_transferred)
+ {
+ if(!error) {
+ {
+ boost::lock_guard<gr::thread::mutex> lock(d_udp_mutex);
+ if(d_eof && (bytes_transferred == 1) && (d_rxbuf[0] == 0x00)) {
+ // If we are using EOF notification, test for it and don't
+ // add anything to the output.
+ d_residual = -1;
+ d_cond_wait.notify_one();
+ return;
+ }
+ else {
+ // Make sure we never go beyond the boundary of the
+ // residual buffer. This will just drop the last bit of
+ // data in the buffer if we've run out of room.
+ if((int)(d_residual + bytes_transferred) > (50*d_payload_size)) {
+ GR_LOG_WARN(d_logger, "Too much data; dropping packet.");
+ }
+ else {
+ // otherwise, copy receid data into local buffer for
+ // copying later.
+ memcpy(d_residbuf+d_residual, d_rxbuf, bytes_transferred);
+ d_residual += bytes_transferred;
+ }
+ }
+ d_cond_wait.notify_one();
+ }
+ }
+ start_receive();
+ }
+
+ int
+ udp_source_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock l(d_setlock);
+
+ char *out = (char*)output_items[0];
+
+ // Use async receive_from to get data from UDP buffer and wait
+ // on a conditional signal before proceeding. We use this
+ // because the conditional wait is interruptable while a
+ // synchronous receive_from is not.
+ boost::unique_lock<boost::mutex> lock(d_udp_mutex);
+ d_cond_wait.wait(lock);
+
+ if(d_residual < 0)
+ return -1;
+
+ int to_be_sent = (int)(d_residual - d_sent);
+ int to_send = std::min(noutput_items, to_be_sent);
+
+ // Copy the received data in the residual buffer to the output stream
+ memcpy(out, d_residbuf+d_sent, to_send);
+ int nitems = to_send/d_itemsize;
+
+ // Keep track of where we are if we don't have enough output
+ // space to send all the data in the residbuf.
+ if(to_send == to_be_sent) {
+ d_residual = 0;
+ d_sent = 0;
+ }
+ else {
+ d_sent += to_send;
+ }
+
+ return nitems;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/udp_source_impl.h b/gr-blocks/lib/udp_source_impl.h
new file mode 100644
index 0000000000..d6c773726b
--- /dev/null
+++ b/gr-blocks/lib/udp_source_impl.h
@@ -0,0 +1,84 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_UDP_SOURCE_IMPL_H
+#define INCLUDED_GR_UDP_SOURCE_IMPL_H
+
+#include <blocks/udp_source.h>
+#include <boost/asio.hpp>
+#include <boost/format.hpp>
+#include <thread/thread.h>
+
+namespace gr {
+ namespace blocks {
+
+ class udp_source_impl : public udp_source
+ {
+ private:
+ size_t d_itemsize;
+ int d_payload_size; // maximum transmission unit (packet length)
+ bool d_eof; // look for an EOF signal
+ bool d_connected; // are we connected?
+ char *d_rxbuf; // get UDP buffer items
+ char *d_residbuf; // hold buffer between calls
+ ssize_t d_residual; // hold information about number of bytes stored in residbuf
+ ssize_t d_sent; // track how much of d_residbuf we've outputted
+ size_t d_offset; // point to residbuf location offset
+
+ std::string d_host;
+ unsigned short d_port;
+
+ boost::asio::ip::udp::socket *d_socket;
+ boost::asio::ip::udp::endpoint d_endpoint;
+ boost::asio::ip::udp::endpoint d_endpoint_rcvd;
+ boost::asio::io_service d_io_service;
+
+ gr::thread::condition_variable d_cond_wait;
+ gr::thread::mutex d_udp_mutex;
+ gr::thread::thread d_udp_thread;
+
+ void start_receive();
+ void handle_read(const boost::system::error_code& error,
+ size_t bytes_transferred);
+ void run_io_service() { d_io_service.run(); }
+
+ public:
+ udp_source_impl(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size, bool eof);
+ ~udp_source_impl();
+
+ void connect(const std::string &host, int port);
+ void disconnect();
+
+ int payload_size() { return d_payload_size; }
+ int get_port();
+
+ 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_UDP_SOURCE_H */
diff --git a/gr-blocks/lib/vco_f_impl.cc b/gr-blocks/lib/vco_f_impl.cc
new file mode 100644
index 0000000000..21e7d0a0f2
--- /dev/null
+++ b/gr-blocks/lib/vco_f_impl.cc
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vco_f_impl.h"
+#include <gr_io_signature.h>
+#include <math.h>
+
+namespace gr {
+ namespace blocks {
+
+ vco_f::sptr
+ vco_f::make(double sampling_rate, double sensitivity, double amplitude)
+ {
+ return gnuradio::get_initial_sptr
+ (new vco_f_impl(sampling_rate, sensitivity, amplitude));
+ }
+
+ vco_f_impl::vco_f_impl(double sampling_rate, double sensitivity, double amplitude)
+ : gr_sync_block("vco_f",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_sampling_rate(sampling_rate), d_sensitivity(sensitivity),
+ d_amplitude(amplitude), d_k(d_sensitivity/d_sampling_rate)
+ {
+ }
+
+ vco_f_impl::~vco_f_impl()
+ {
+ }
+
+ int
+ vco_f_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *input = (const float*)input_items[0];
+ float *output = (float*)output_items[0];
+
+ d_vco.cos(output, input, noutput_items, d_k, d_amplitude);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/vco_f_impl.h b/gr-blocks/lib/vco_f_impl.h
new file mode 100644
index 0000000000..37435b7736
--- /dev/null
+++ b/gr-blocks/lib/vco_f_impl.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_VCO_F_IMPL_H
+#define INCLUDED_GR_VCO_F_IMPL_H
+
+#include <blocks/vco_f.h>
+#include <gr_fxpt_vco.h>
+
+namespace gr {
+ namespace blocks {
+
+ class vco_f_impl : public vco_f
+ {
+ private:
+ double d_sampling_rate;
+ double d_sensitivity;
+ double d_amplitude;
+ double d_k;
+ gr_fxpt_vco d_vco;
+
+ public:
+ vco_f_impl(double sampling_rate, double sensitivity, double amplitude);
+ ~vco_f_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_VCO_F_H */
diff --git a/gr-blocks/lib/vector_insert_X_impl.cc.t b/gr-blocks/lib/vector_insert_X_impl.cc.t
new file mode 100644
index 0000000000..adf31fe05a
--- /dev/null
+++ b/gr-blocks/lib/vector_insert_X_impl.cc.t
@@ -0,0 +1,109 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <algorithm>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <stdio.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr
+ @NAME@::make(const std::vector<@TYPE@> &data, int periodicity, int offset)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME_IMPL@(data, periodicity, offset));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data,
+ int periodicity, int offset)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@TYPE@))),
+ d_data(data),
+ d_offset(offset),
+ d_periodicity(periodicity)
+ {
+ //printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset);
+ // some sanity checks
+ assert(offset < periodicity);
+ assert(offset >= 0);
+ assert((size_t)periodicity > data.size());
+ }
+
+ @NAME_IMPL@::~@NAME_IMPL@()
+ {}
+
+ int
+ @NAME_IMPL@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ @TYPE@ *out = (@TYPE@ *)output_items[0];
+ const @TYPE@ *in = (const @TYPE@ *)input_items[0];
+
+ int ii(0), oo(0);
+
+ while((oo < noutput_items) && (ii < ninput_items[0])) {
+ //printf("oo = %d, ii = %d, d_offset = %d, noutput_items = %d, ninput_items[0] = %d", oo, ii, d_offset, noutput_items, ninput_items[0]);
+ //printf(", d_periodicity = %d\n", d_periodicity);
+
+ if(d_offset >= ((int)d_data.size())) { // if we are in the copy region
+ int max_copy = std::min(std::min(noutput_items - oo, ninput_items[0] - ii),
+ d_periodicity - d_offset);
+ //printf("copy %d from input\n", max_copy);
+ memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy );
+ //printf(" * memcpy returned.\n");
+ ii += max_copy;
+ oo += max_copy;
+ d_offset = (d_offset + max_copy)%d_periodicity;
+ }
+ else { // if we are in the insertion region
+ int max_copy = std::min(noutput_items - oo, ((int)d_data.size()) - d_offset);
+ //printf("copy %d from d_data[%d] to out[%d]\n", max_copy, d_offset, oo);
+ memcpy(&out[oo], &d_data[d_offset], sizeof(@TYPE@)*max_copy);
+ //printf(" * memcpy returned.\n");
+ oo += max_copy;
+ d_offset = (d_offset + max_copy)%d_periodicity;
+ //printf(" ## (inelse) oo = %d, d_offset = %d\n", oo, d_offset);
+ }
+
+ //printf(" # exit else, on to next loop.\n");
+ }
+ //printf(" # got out of loop\n");
+
+ //printf("consume = %d, produce = %d\n", ii, oo);
+ consume_each(ii);
+ return oo;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/vector_insert_X_impl.h.t b/gr-blocks/lib/vector_insert_X_impl.h.t
new file mode 100644
index 0000000000..f447ef1e80
--- /dev/null
+++ b/gr-blocks/lib/vector_insert_X_impl.h.t
@@ -0,0 +1,58 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class @NAME_IMPL@ : public @NAME@
+ {
+ private:
+ std::vector<@TYPE@> d_data;
+ int d_offset;
+ int d_periodicity;
+
+ public:
+ @NAME_IMPL@(const std::vector<@TYPE@> &data,
+ int periodicity, int offset);
+ ~@NAME_IMPL@();
+
+ void rewind() { d_offset=0; }
+ void set_data(const std::vector<@TYPE@> &data) {
+ d_data = data; rewind(); }
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/vector_map_impl.cc b/gr-blocks/lib/vector_map_impl.cc
new file mode 100644
index 0000000000..19b57bac8b
--- /dev/null
+++ b/gr-blocks/lib/vector_map_impl.cc
@@ -0,0 +1,127 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vector_map_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ std::vector<int>
+ get_in_sizeofs(size_t item_size, std::vector<size_t> in_vlens)
+ {
+ std::vector<int> in_sizeofs;
+ for(unsigned int i = 0; i < in_vlens.size(); i++) {
+ in_sizeofs.push_back(in_vlens[i]*item_size);
+ }
+ return in_sizeofs;
+ }
+
+ std::vector<int>
+ get_out_sizeofs(size_t item_size,
+ std::vector< std::vector< std::vector<size_t> > > mapping)
+ {
+ std::vector<int> out_sizeofs;
+ for(unsigned int i = 0; i < mapping.size(); i++) {
+ out_sizeofs.push_back(mapping[i].size()*item_size);
+ }
+ return out_sizeofs;
+ }
+
+ vector_map::sptr
+ vector_map::make(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping)
+ {
+ return gnuradio::get_initial_sptr
+ (new vector_map_impl(item_size, in_vlens, mapping));
+ }
+
+ vector_map_impl::vector_map_impl(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping)
+ : gr_sync_block("vector_map",
+ gr_make_io_signaturev(in_vlens.size(), in_vlens.size(),
+ get_in_sizeofs(item_size, in_vlens)),
+ gr_make_io_signaturev(mapping.size(), mapping.size(),
+ get_out_sizeofs(item_size, mapping))),
+ d_item_size(item_size), d_in_vlens(in_vlens)
+ {
+ set_mapping(mapping);
+ }
+
+ vector_map_impl::~vector_map_impl()
+ {
+ }
+
+ void
+ vector_map_impl::set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping)
+ {
+ // Make sure the contents of the mapping vectors are possible.
+ for(unsigned int i=0; i<mapping.size(); i++) {
+ for(unsigned int j=0; j<mapping[i].size(); j++) {
+ if(mapping[i][j].size() != 2) {
+ throw std::runtime_error("Mapping must be of the form (out_mapping_stream1, out_mapping_stream2, ...), where out_mapping_stream1 is of the form (mapping_element1, mapping_element2, ...), where mapping_element1 is of the form (input_stream, input_element). This error is raised because a mapping_element vector does not contain exactly 2 items.");
+ }
+ unsigned int s = mapping[i][j][0];
+ unsigned int index = mapping[i][j][1];
+ if(s >= d_in_vlens.size()) {
+ throw std::runtime_error("Stream numbers in mapping must be less than the number of input streams.");
+ }
+ if((index < 0) || (index >= d_in_vlens[s])) {
+ throw std::runtime_error ("Indices in mapping must be greater than 0 and less than the input vector lengths.");
+ }
+ }
+ }
+ gr::thread::scoped_lock guard(d_mutex);
+ d_mapping = mapping;
+ }
+
+ int
+ vector_map_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char **inv = (const char**)&input_items[0];
+ char **outv = (char**)&output_items[0];
+
+ for(unsigned int n = 0; n < (unsigned int)(noutput_items); n++) {
+ for(unsigned int i = 0; i < d_mapping.size(); i++) {
+ unsigned int out_vlen = d_mapping[i].size();
+ for(unsigned int j = 0; j < out_vlen; j++) {
+ unsigned int s = d_mapping[i][j][0];
+ unsigned int k = d_mapping[i][j][1];
+ memcpy(outv[i] + out_vlen*d_item_size*n +
+ d_item_size*j, inv[s] + d_in_vlens[s]*d_item_size*n +
+ k*d_item_size, d_item_size);
+ }
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/vector_map_impl.h b/gr-blocks/lib/vector_map_impl.h
new file mode 100644
index 0000000000..08faa2ce09
--- /dev/null
+++ b/gr-blocks/lib/vector_map_impl.h
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_VECTOR_MAP_IMPL_H
+#define INCLUDED_GR_VECTOR_MAP_IMPL_H
+
+#include <blocks/vector_map.h>
+#include <thread/thread.h>
+
+namespace gr {
+ namespace blocks {
+
+ class vector_map_impl : public vector_map
+ {
+ private:
+ size_t d_item_size;
+ std::vector<size_t> d_in_vlens;
+ std::vector< std::vector< std::vector<size_t> > > d_mapping;
+ gr::thread::mutex d_mutex; // mutex to protect set/work access
+
+ public:
+ vector_map_impl(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping);
+ ~vector_map_impl();
+
+ void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping);
+
+ 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_VECTOR_MAP_IMPL_H */
diff --git a/gr-blocks/lib/vector_sink_X_impl.cc.t b/gr-blocks/lib/vector_sink_X_impl.cc.t
new file mode 100644
index 0000000000..3be2861025
--- /dev/null
+++ b/gr-blocks/lib/vector_sink_X_impl.cc.t
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+#include <algorithm>
+#include <iostream>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr
+ @BASE_NAME@::make(int vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(int vlen)
+ : gr_sync_block("@NAME@",
+ gr_make_io_signature(1, 1, sizeof(@TYPE@) * vlen),
+ gr_make_io_signature(0, 0, 0)),
+ d_vlen(vlen)
+ {
+ }
+
+ @NAME_IMPL@::~@NAME_IMPL@()
+ {}
+
+ std::vector<@TYPE@>
+ @NAME_IMPL@::data() const
+ {
+ return d_data;
+ }
+
+ std::vector<gr_tag_t>
+ @NAME_IMPL@::tags() const
+ {
+ return d_tags;
+ }
+
+ int
+ @NAME_IMPL@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ @TYPE@ *iptr = (@TYPE@*)input_items[0];
+
+ for(int i = 0; i < noutput_items * d_vlen; i++)
+ d_data.push_back (iptr[i]);
+ std::vector<gr_tag_t> tags;
+ get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + noutput_items);
+ d_tags.insert(d_tags.end(), tags.begin(), tags.end());
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/vector_sink_X_impl.h.t b/gr-blocks/lib/vector_sink_X_impl.h.t
new file mode 100644
index 0000000000..60d21e0c8c
--- /dev/null
+++ b/gr-blocks/lib/vector_sink_X_impl.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2009,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class @NAME_IMPL@ : public @NAME@
+ {
+ private:
+ std::vector<@TYPE@> d_data;
+ std::vector<gr_tag_t> d_tags;
+ int d_vlen;
+
+ public:
+ @NAME_IMPL@(int vlen);
+ ~@NAME_IMPL@();
+
+ void reset() { d_data.clear(); }
+ std::vector<@TYPE@> data() const;
+ std::vector<gr_tag_t> tags() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/vector_source_X_impl.cc.t b/gr-blocks/lib/vector_source_X_impl.cc.t
new file mode 100644
index 0000000000..9c1c63a213
--- /dev/null
+++ b/gr-blocks/lib/vector_source_X_impl.cc.t
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <algorithm>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr
+ @NAME@::make(const std::vector<@TYPE@> &data,
+ bool repeat, int vlen,
+ const std::vector<gr_tag_t> &tags)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME_IMPL@(data, repeat, vlen, tags));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data,
+ bool repeat, int vlen,
+ const std::vector<gr_tag_t> &tags)
+ : gr_sync_block("@BASE_NAME@",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, sizeof(@TYPE@) * vlen)),
+ d_data(data),
+ d_repeat(repeat),
+ d_offset(0),
+ d_vlen(vlen),
+ d_tags(tags),
+ d_tagpos(0)
+ {
+ if(tags.size() == 0) {
+ d_settags = 0;
+ }
+ else {
+ d_settags = 1;
+ set_output_multiple(data.size() / vlen);
+ }
+ if((data.size() % vlen) != 0)
+ throw std::invalid_argument("data length must be a multiple of vlen");
+ }
+
+ @NAME_IMPL@::~@NAME_IMPL@()
+ {}
+
+ void
+ @NAME_IMPL@::set_data (const std::vector<@TYPE@> &data,
+ const std::vector<gr_tag_t> &tags)
+ {
+ d_data = data;
+ d_tags = tags;
+ rewind();
+ if(tags.size() == 0) {
+ d_settags = false;
+ }
+ else {
+ d_settags = true;
+ }
+ }
+
+ int
+ @NAME_IMPL@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ @TYPE@ *optr = (@TYPE@ *) output_items[0];
+
+ if(d_repeat) {
+ unsigned int size = d_data.size ();
+ unsigned int offset = d_offset;
+ if(size == 0)
+ return -1;
+
+ if(d_settags) {
+ int n_outputitems_per_vector = d_data.size() / d_vlen;
+ for(int i = 0; i < noutput_items; i += n_outputitems_per_vector) {
+ // FIXME do proper vector copy
+ memcpy((void *) optr, (const void*)&d_data[0], size*sizeof (@TYPE@));
+ optr += size;
+ for(unsigned t = 0; t < d_tags.size(); t++) {
+ add_item_tag(0, nitems_written(0)+i+d_tags[t].offset,
+ d_tags[t].key, d_tags[t].value);
+ }
+ }
+ }
+ else {
+ for(int i = 0; i < noutput_items*d_vlen; i++) {
+ optr[i] = d_data[offset++];
+ if(offset >= size) {
+ offset = 0;
+ }
+ }
+ }
+
+ d_offset = offset;
+ return noutput_items;
+ }
+ else {
+ if(d_offset >= d_data.size ())
+ return -1; // Done!
+
+ unsigned n = std::min((unsigned)d_data.size() - d_offset,
+ (unsigned)noutput_items*d_vlen);
+ for(unsigned i = 0; i < n; i++) {
+ optr[i] = d_data[d_offset + i];
+ }
+ for(unsigned t = 0; t < d_tags.size(); t++) {
+ if((d_tags[t].offset >= d_offset) && (d_tags[t].offset < d_offset+n))
+ add_item_tag(0, d_tags[t].offset, d_tags[t].key, d_tags[t].value);
+ }
+ d_offset += n;
+ return n/d_vlen;
+ }
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/vector_source_X_impl.h.t b/gr-blocks/lib/vector_source_X_impl.h.t
new file mode 100644
index 0000000000..78ec52bacf
--- /dev/null
+++ b/gr-blocks/lib/vector_source_X_impl.h.t
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class @NAME_IMPL@ : public @NAME@
+ {
+ private:
+ std::vector<@TYPE@> d_data;
+ bool d_repeat;
+ unsigned int d_offset;
+ int d_vlen;
+ bool d_settags;
+ std::vector<gr_tag_t> d_tags;
+ unsigned int d_tagpos;
+
+ public:
+ @NAME_IMPL@(const std::vector<@TYPE@> &data,
+ bool repeat, int vlen,
+ const std::vector<gr_tag_t> &tags);
+ ~@NAME_IMPL@();
+
+ void rewind() { d_offset=0; }
+ void set_data(const std::vector<@TYPE@> &data,
+ const std::vector<gr_tag_t> &tags);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/wavfile.cc b/gr-blocks/lib/wavfile.cc
new file mode 100644
index 0000000000..16d80adc83
--- /dev/null
+++ b/gr-blocks/lib/wavfile.cc
@@ -0,0 +1,258 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <blocks/wavfile.h>
+#include <cstring>
+#include <stdint.h>
+#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN
+
+namespace gr {
+ namespace blocks {
+
+#define VALID_COMPRESSION_TYPE 0x0001
+
+ // Basically, this is the opposite of htonx() and ntohx()
+ // Define host to/from worknet (little endian) short and long
+#ifdef BOOST_BIG_ENDIAN
+
+ static inline uint16_t __wav_bs16(uint16_t x)
+ {
+ return (x>>8) | (x<<8);
+ }
+
+ static inline uint32_t __wav_bs32(uint32_t x)
+ {
+ return (uint32_t(__wav_bs16(uint16_t(x&0xfffful)))<<16) | (__wav_bs16(uint16_t(x>>16)));
+ }
+
+ #define htowl(x) __gri_wav_bs32(x)
+ #define wtohl(x) __gri_wav_bs32(x)
+ #define htows(x) __gri_wav_bs16(x)
+ #define wtohs(x) __gri_wav_bs16(x)
+
+#else
+
+ #define htowl(x) uint32_t(x)
+ #define wtohl(x) uint32_t(x)
+ #define htows(x) uint16_t(x)
+ #define wtohs(x) uint16_t(x)
+
+#endif // BOOST_BIG_ENDIAN
+
+ // WAV files are always little-endian, so we need some byte switching macros
+ static inline uint32_t host_to_wav(uint32_t x) { return htowl(x); }
+ static inline uint16_t host_to_wav(uint16_t x) { return htows(x); }
+ static inline int16_t host_to_wav(int16_t x) { return htows(x); }
+ static inline uint32_t wav_to_host(uint32_t x) { return wtohl(x); }
+ static inline uint16_t wav_to_host(uint16_t x) { return wtohs(x); }
+ static inline int16_t wav_to_host(int16_t x) { return wtohs(x); }
+
+ bool
+ wavheader_parse(FILE *fp,
+ unsigned int &sample_rate_o,
+ int &nchans_o,
+ int &bytes_per_sample_o,
+ int &first_sample_pos_o,
+ unsigned int &samples_per_chan_o)
+ {
+ // _o variables take return values
+ char str_buf[8] = {0};
+
+ uint32_t file_size;
+ uint32_t fmt_hdr_skip;
+ uint16_t compression_type;
+ uint16_t nchans;
+ uint32_t sample_rate;
+ uint32_t avg_bytes_per_sec;
+ uint16_t block_align;
+ uint16_t bits_per_sample;
+ uint32_t chunk_size;
+
+ size_t fresult;
+
+ fresult = fread(str_buf, 1, 4, fp);
+ if(fresult != 4 || strncmp(str_buf, "RIFF", 4) || feof(fp)) {
+ return false;
+ }
+
+ fresult = fread(&file_size, 1, 4, fp);
+
+ fresult = fread(str_buf, 1, 8, fp);
+ if(fresult != 8 || strncmp(str_buf, "WAVEfmt ", 8) || feof(fp)) {
+ return false;
+ }
+
+ fresult = fread(&fmt_hdr_skip, 1, 4, fp);
+
+ fresult = fread(&compression_type, 1, 2, fp);
+ if(wav_to_host(compression_type) != VALID_COMPRESSION_TYPE) {
+ return false;
+ }
+
+ fresult = fread(&nchans, 1, 2, fp);
+ fresult = fread(&sample_rate, 1, 4, fp);
+ fresult = fread(&avg_bytes_per_sec, 1, 4, fp);
+ fresult = fread(&block_align, 1, 2, fp);
+ fresult = fread(&bits_per_sample, 1, 2, fp);
+
+ if(ferror(fp)) {
+ return false;
+ }
+
+ fmt_hdr_skip = wav_to_host(fmt_hdr_skip);
+ nchans = wav_to_host(nchans);
+ sample_rate = wav_to_host(sample_rate);
+ bits_per_sample = wav_to_host(bits_per_sample);
+
+ if(bits_per_sample != 8 && bits_per_sample != 16) {
+ return false;
+ }
+
+ fmt_hdr_skip -= 16;
+ if(fmt_hdr_skip) {
+ fseek(fp, fmt_hdr_skip, SEEK_CUR);
+ }
+
+ // data chunk
+ fresult = fread(str_buf, 1, 4, fp);
+ if(strncmp(str_buf, "data", 4)) {
+ return false;
+ }
+
+ fresult = fread(&chunk_size, 1, 4, fp);
+ if(ferror(fp)) {
+ return false;
+ }
+
+ // More byte swapping
+ chunk_size = wav_to_host(chunk_size);
+
+ // Output values
+ sample_rate_o = (unsigned)sample_rate;
+ nchans_o = (int)nchans;
+ bytes_per_sample_o = (int)(bits_per_sample / 8);
+ first_sample_pos_o = (int)ftell(fp);
+ samples_per_chan_o = (unsigned)(chunk_size / (bytes_per_sample_o * nchans));
+ return true;
+ }
+
+
+ short int
+ wav_read_sample(FILE *fp, int bytes_per_sample)
+ {
+ int16_t buf_16bit;
+
+ if(!fread(&buf_16bit, bytes_per_sample, 1, fp)) {
+ return 0;
+ }
+ if(bytes_per_sample == 1) {
+ return (short)buf_16bit;
+ }
+ return (short)wav_to_host(buf_16bit);
+ }
+
+
+ bool
+ wavheader_write(FILE *fp,
+ unsigned int sample_rate,
+ int nchans,
+ int bytes_per_sample)
+ {
+ const int header_len = 44;
+ char wav_hdr[header_len] = "RIFF\0\0\0\0WAVEfmt \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0data\0\0\0";
+ uint16_t nchans_f = (uint16_t) nchans;
+ uint32_t sample_rate_f = (uint32_t) sample_rate;
+ uint16_t block_align = bytes_per_sample * nchans;
+ uint32_t avg_bytes = sample_rate * block_align;
+ uint16_t bits_per_sample = bytes_per_sample * 8;
+
+ nchans_f = host_to_wav(nchans_f);
+ sample_rate_f = host_to_wav(sample_rate_f);
+ block_align = host_to_wav(block_align);
+ avg_bytes = host_to_wav(avg_bytes);
+ bits_per_sample = host_to_wav(bits_per_sample);
+
+ wav_hdr[16] = 0x10; // no extra bytes
+ wav_hdr[20] = 0x01; // no compression
+ memcpy((void*)(wav_hdr + 22), (void*)&nchans_f, 2);
+ memcpy((void*)(wav_hdr + 24), (void*)&sample_rate_f, 4);
+ memcpy((void*)(wav_hdr + 28), (void*)&avg_bytes, 4);
+ memcpy((void*)(wav_hdr + 32), (void*)&block_align, 2);
+ memcpy((void*)(wav_hdr + 34), (void*)&bits_per_sample, 2);
+
+ fwrite(&wav_hdr, 1, header_len, fp);
+ if(ferror(fp)) {
+ return false;
+ }
+
+ return true;
+ }
+
+
+ void
+ wav_write_sample(FILE *fp, short int sample, int bytes_per_sample)
+ {
+ void *data_ptr;
+ unsigned char buf_8bit;
+ int16_t buf_16bit;
+
+ if(bytes_per_sample == 1) {
+ buf_8bit = (unsigned char)sample;
+ data_ptr = (void*)&buf_8bit;
+ }
+ else {
+ buf_16bit = host_to_wav((int16_t) sample);
+ data_ptr = (void *) &buf_16bit;
+ }
+
+ fwrite(data_ptr, 1, bytes_per_sample, fp);
+ }
+
+
+ bool
+ wavheader_complete(FILE *fp, unsigned int byte_count)
+ {
+ uint32_t chunk_size = (uint32_t)byte_count;
+ chunk_size = host_to_wav(chunk_size);
+
+ fseek(fp, 40, SEEK_SET);
+ fwrite(&chunk_size, 1, 4, fp);
+
+ chunk_size = (uint32_t)byte_count + 36; // fmt chunk and data header
+ chunk_size = host_to_wav(chunk_size);
+ fseek(fp, 4, SEEK_SET);
+
+ fwrite(&chunk_size, 1, 4, fp);
+
+ if(ferror(fp)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/wavfile_sink_impl.cc b/gr-blocks/lib/wavfile_sink_impl.cc
new file mode 100644
index 0000000000..4591b1f9fa
--- /dev/null
+++ b/gr-blocks/lib/wavfile_sink_impl.cc
@@ -0,0 +1,293 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006-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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "wavfile_sink_impl.h"
+#include <blocks/wavfile.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <climits>
+#include <cstring>
+#include <cmath>
+#include <fcntl.h>
+#include <thread/thread.h>
+#include <boost/math/special_functions/round.hpp>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ wavfile_sink::sptr
+ wavfile_sink::make(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample)
+ {
+ return gnuradio::get_initial_sptr
+ (new wavfile_sink_impl(filename, n_channels,
+ sample_rate, bits_per_sample));
+ }
+
+ wavfile_sink_impl::wavfile_sink_impl(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample)
+ : gr_sync_block("wavfile_sink",
+ gr_make_io_signature(1, n_channels, sizeof(float)),
+ gr_make_io_signature(0, 0, 0)),
+ d_sample_rate(sample_rate), d_nchans(n_channels),
+ d_fp(0), d_new_fp(0), d_updated(false)
+ {
+ if(bits_per_sample != 8 && bits_per_sample != 16) {
+ throw std::runtime_error("Invalid bits per sample (supports 8 and 16)");
+ }
+ d_bytes_per_sample = bits_per_sample / 8;
+ d_bytes_per_sample_new = d_bytes_per_sample;
+
+ if(!open(filename)) {
+ throw std::runtime_error("can't open file");
+ }
+
+ if(bits_per_sample == 8) {
+ d_max_sample_val = 0xFF;
+ d_min_sample_val = 0;
+ d_normalize_fac = d_max_sample_val/2;
+ d_normalize_shift = 1;
+ }
+ else {
+ d_max_sample_val = 0x7FFF;
+ d_min_sample_val = -0x7FFF;
+ d_normalize_fac = d_max_sample_val;
+ d_normalize_shift = 0;
+ if(bits_per_sample != 16) {
+ fprintf(stderr, "Invalid bits per sample value requested, using 16");
+ }
+ }
+ }
+
+ bool
+ wavfile_sink_impl::open(const char* filename)
+ {
+ gr::thread::scoped_lock guard(d_mutex);
+
+ // we use the open system call to get access to the O_LARGEFILE flag.
+ int fd;
+ if((fd = ::open(filename,
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0) {
+ perror(filename);
+ return false;
+ }
+
+ if(d_new_fp) { // if we've already got a new one open, close it
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+
+ if((d_new_fp = fdopen (fd, "wb")) == NULL) {
+ perror(filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ return false;
+ }
+ d_updated = true;
+
+ if(!wavheader_write(d_new_fp,
+ d_sample_rate,
+ d_nchans,
+ d_bytes_per_sample_new)) {
+ fprintf(stderr, "[%s] could not write to WAV file\n", __FILE__);
+ exit(-1);
+ }
+
+ return true;
+ }
+
+ void
+ wavfile_sink_impl::close()
+ {
+ gr::thread::scoped_lock guard(d_mutex);
+
+ if(!d_fp)
+ return;
+
+ close_wav();
+ }
+
+ void
+ wavfile_sink_impl::close_wav()
+ {
+ unsigned int byte_count = d_sample_count * d_bytes_per_sample;
+
+ wavheader_complete(d_fp, byte_count);
+
+ fclose(d_fp);
+ d_fp = NULL;
+ }
+
+ wavfile_sink_impl::~wavfile_sink_impl()
+ {
+ if(d_new_fp) {
+ fclose(d_new_fp);
+ }
+
+ close();
+ }
+
+ int
+ wavfile_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float **in = (float**)&input_items[0];
+ int n_in_chans = input_items.size();
+
+ short int sample_buf_s;
+
+ int nwritten;
+
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ do_update(); // update: d_fp is reqd
+ if(!d_fp) // drop output on the floor
+ return noutput_items;
+
+ for(nwritten = 0; nwritten < noutput_items; nwritten++) {
+ for(int chan = 0; chan < d_nchans; chan++) {
+ // Write zeros to channels which are in the WAV file
+ // but don't have any inputs here
+ if(chan < n_in_chans) {
+ sample_buf_s =
+ convert_to_short(in[chan][nwritten]);
+ }
+ else {
+ sample_buf_s = 0;
+ }
+
+ wav_write_sample(d_fp, sample_buf_s, d_bytes_per_sample);
+
+ if(feof(d_fp) || ferror(d_fp)) {
+ fprintf(stderr, "[%s] file i/o error\n", __FILE__);
+ close();
+ exit(-1);
+ }
+ d_sample_count++;
+ }
+ }
+
+ return nwritten;
+ }
+
+ short int
+ wavfile_sink_impl::convert_to_short(float sample)
+ {
+ sample += d_normalize_shift;
+ sample *= d_normalize_fac;
+ if(sample > d_max_sample_val) {
+ sample = d_max_sample_val;
+ }
+ else if(sample < d_min_sample_val) {
+ sample = d_min_sample_val;
+ }
+
+ return (short int)boost::math::iround(sample);
+ }
+
+ void
+ wavfile_sink_impl::set_bits_per_sample(int bits_per_sample)
+ {
+ gr::thread::scoped_lock guard(d_mutex);
+ if(bits_per_sample == 8 || bits_per_sample == 16) {
+ d_bytes_per_sample_new = bits_per_sample / 8;
+ }
+ }
+
+ void
+ wavfile_sink_impl::set_sample_rate(unsigned int sample_rate)
+ {
+ gr::thread::scoped_lock guard(d_mutex);
+ d_sample_rate = sample_rate;
+ }
+
+ int
+ wavfile_sink_impl::bits_per_sample()
+ {
+ return d_bytes_per_sample_new;
+ }
+
+ unsigned int
+ wavfile_sink_impl::sample_rate()
+ {
+ return d_sample_rate;
+ }
+
+ void
+ wavfile_sink_impl::do_update()
+ {
+ if(!d_updated) {
+ return;
+ }
+
+ if(d_fp) {
+ close_wav();
+ }
+
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+ d_sample_count = 0;
+ d_bytes_per_sample = d_bytes_per_sample_new;
+
+ if(d_bytes_per_sample == 1) {
+ d_max_sample_val = UCHAR_MAX;
+ d_min_sample_val = 0;
+ d_normalize_fac = d_max_sample_val/2;
+ d_normalize_shift = 1;
+ }
+ else if(d_bytes_per_sample == 2) {
+ d_max_sample_val = SHRT_MAX;
+ d_min_sample_val = SHRT_MIN;
+ d_normalize_fac = d_max_sample_val;
+ d_normalize_shift = 0;
+ }
+
+ d_updated = false;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/wavfile_sink_impl.h b/gr-blocks/lib/wavfile_sink_impl.h
new file mode 100644
index 0000000000..4ad9958884
--- /dev/null
+++ b/gr-blocks/lib/wavfile_sink_impl.h
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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_WAVFILE_SINK_IMPL_H
+#define INCLUDED_GR_WAVFILE_SINK_IMPL_H
+
+#include <blocks/wavfile_sink.h>
+
+namespace gr {
+ namespace blocks {
+
+ class wavfile_sink_impl : public wavfile_sink
+ {
+ private:
+ unsigned d_sample_rate;
+ int d_nchans;
+ unsigned d_sample_count;
+ int d_bytes_per_sample;
+ int d_bytes_per_sample_new;
+ int d_max_sample_val;
+ int d_min_sample_val;
+ int d_normalize_shift;
+ int d_normalize_fac;
+
+ FILE *d_fp;
+ FILE *d_new_fp;
+ bool d_updated;
+ boost::mutex d_mutex;
+
+ /*!
+ * \brief Convert a sample value within [-1;+1] to a corresponding
+ * short integer value
+ */
+ short convert_to_short(float sample);
+
+ /*!
+ * \brief If any file changes have occurred, update now. This is called
+ * internally by work() and thus doesn't usually need to be called by
+ * hand.
+ */
+ void do_update();
+
+ /*!
+ * \brief Writes information to the WAV header which is not available
+ * a-priori (chunk size etc.) and closes the file. Not thread-safe and
+ * assumes d_fp is a valid file pointer, should thus only be called by
+ * other methods.
+ */
+ void close_wav();
+
+ public:
+ wavfile_sink_impl(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample);
+ ~wavfile_sink_impl();
+
+ bool open(const char* filename);
+ void close();
+
+ void set_sample_rate(unsigned int sample_rate);
+ void set_bits_per_sample(int bits_per_sample);
+
+ int bits_per_sample();
+ unsigned int sample_rate();
+
+ 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_WAVFILE_SINK_IMPL_H */
diff --git a/gr-blocks/lib/wavfile_source_impl.cc b/gr-blocks/lib/wavfile_source_impl.cc
new file mode 100644
index 0000000000..2e3b0e240c
--- /dev/null
+++ b/gr-blocks/lib/wavfile_source_impl.cc
@@ -0,0 +1,174 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 "wavfile_source_impl.h"
+#include <gr_io_signature.h>
+#include <blocks/wavfile.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <stdexcept>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ wavfile_source::sptr
+ wavfile_source::make(const char *filename, bool repeat)
+ {
+ return gnuradio::get_initial_sptr
+ (new wavfile_source_impl(filename, repeat));
+ }
+
+ wavfile_source_impl::wavfile_source_impl (const char *filename, bool repeat)
+ : gr_sync_block("wavfile_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 2, sizeof(float))),
+ d_fp(NULL), d_repeat(repeat),
+ d_sample_rate(1), d_nchans(1), d_bytes_per_sample(2), d_first_sample_pos(0),
+ d_samples_per_chan(0), d_sample_idx(0)
+ {
+ // we use "open" to use to the O_LARGEFILE flag
+
+ int fd;
+ if((fd = open (filename, O_RDONLY | OUR_O_LARGEFILE | OUR_O_BINARY)) < 0) {
+ perror(filename);
+ throw std::runtime_error("can't open file");
+ }
+
+ if((d_fp = fdopen(fd, "rb")) == NULL) {
+ perror(filename);
+ throw std::runtime_error("can't open file");
+ }
+
+ // Scan headers, check file validity
+ if(!wavheader_parse(d_fp,
+ d_sample_rate,
+ d_nchans,
+ d_bytes_per_sample,
+ d_first_sample_pos,
+ d_samples_per_chan)) {
+ throw std::runtime_error("is not a valid wav file");
+ }
+
+ if(d_samples_per_chan == 0) {
+ throw std::runtime_error("WAV file does not contain any samples");
+ }
+
+ if(d_bytes_per_sample == 1) {
+ d_normalize_fac = 128;
+ d_normalize_shift = 1;
+ }
+ else {
+ d_normalize_fac = 0x7FFF;
+ d_normalize_shift = 0;
+ }
+
+ // Re-set the output signature
+ set_output_signature(gr_make_io_signature(1, d_nchans, sizeof(float)));
+ }
+
+ wavfile_source_impl::~wavfile_source_impl ()
+ {
+ fclose(d_fp);
+ }
+
+ float
+ wavfile_source_impl::convert_to_float(short int sample)
+ {
+ float sample_out = (float)sample;
+ sample_out /= d_normalize_fac;
+ sample_out -= d_normalize_shift;
+ return sample_out;
+ }
+
+ int
+ wavfile_source_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float **out = (float**)&output_items[0];
+ int n_out_chans = output_items.size();
+
+ int i;
+ short sample;
+
+ for(i = 0; i < noutput_items; i++) {
+ if(d_sample_idx >= d_samples_per_chan) {
+ if(!d_repeat) {
+ // if nothing was read at all, say we're done.
+ return i ? i : -1;
+ }
+
+ if(fseek (d_fp, d_first_sample_pos, SEEK_SET) == -1) {
+ fprintf(stderr, "[%s] fseek failed\n", __FILE__);
+ exit(-1);
+ }
+
+ d_sample_idx = 0;
+ }
+
+ for(int chan = 0; chan < d_nchans; chan++) {
+ sample = wav_read_sample(d_fp, d_bytes_per_sample);
+
+ if(chan < n_out_chans) {
+ out[chan][i] = convert_to_float(sample);
+ }
+ }
+
+ d_sample_idx++;
+
+ // OK, EOF is not necessarily an error. But we're not going to
+ // deal with handling corrupt wav files, so if they give us any
+ // trouble they won't be processed. Serves them bloody right.
+ if(feof(d_fp) || ferror(d_fp)) {
+ if(i == 0) {
+ fprintf(stderr, "[%s] WAV file has corrupted header or i/o error\n", __FILE__);
+ return -1;
+ }
+ return i;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/wavfile_source_impl.h b/gr-blocks/lib/wavfile_source_impl.h
new file mode 100644
index 0000000000..4875731a08
--- /dev/null
+++ b/gr-blocks/lib/wavfile_source_impl.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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_WAVFILE_SOURCE_IMPL_H
+#define INCLUDED_GR_WAVFILE_SOURCE_IMPL_H
+
+#include <blocks/wavfile_source.h>
+#include <cstdio> // for FILE
+
+namespace gr {
+ namespace blocks {
+
+ class wavfile_source_impl : public wavfile_source
+ {
+ private:
+ FILE *d_fp;
+ bool d_repeat;
+
+ unsigned d_sample_rate;
+ int d_nchans;
+ int d_bytes_per_sample;
+ int d_first_sample_pos;
+ unsigned d_samples_per_chan;
+ unsigned d_sample_idx;
+ int d_normalize_shift;
+ int d_normalize_fac;
+
+ /*!
+ * \brief Convert an integer sample value to a float value within [-1;1]
+ */
+ float convert_to_float(short int sample);
+
+ public:
+ wavfile_source_impl(const char *filename, bool repeat);
+ ~wavfile_source_impl();
+
+ unsigned int sample_rate() const { return d_sample_rate; };
+
+ int bits_per_sample() const { return d_bytes_per_sample * 8; };
+
+ int channels() const { return d_nchans; };
+
+ 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_WAVFILE_SOURCE_IMPL_H */
diff --git a/gr-blocks/python/blocks/CMakeLists.txt b/gr-blocks/python/blocks/CMakeLists.txt
index 312445e2b3..aa8d3b6c81 100644
--- a/gr-blocks/python/blocks/CMakeLists.txt
+++ b/gr-blocks/python/blocks/CMakeLists.txt
@@ -43,8 +43,18 @@ if(ENABLE_TESTING)
include(GrTest)
file(GLOB py_qa_test_files "qa_*.py")
+
+ # Force out the controlport QA tests if we've disabled it.
+ if(NOT ENABLE_GR_CTRLPORT)
+ list(REMOVE_ITEM py_qa_test_files
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_cpp_py_binding.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_cpp_py_binding_set.py
+ )
+ endif(NOT ENABLE_GR_CTRLPORT)
+
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
endforeach(py_qa_test_file)
+
endif(ENABLE_TESTING)
diff --git a/gr-blocks/python/blocks/parse_file_metadata.py b/gr-blocks/python/blocks/parse_file_metadata.py
index eaa8025bbf..a876f49b07 100644
--- a/gr-blocks/python/blocks/parse_file_metadata.py
+++ b/gr-blocks/python/blocks/parse_file_metadata.py
@@ -22,12 +22,7 @@
import sys
from gnuradio import gr
-
-try:
- import pmt
-except ImportError:
- from gruel import pmt
-
+import pmt
try:
import blocks_swig as blocks
diff --git a/gr-blocks/python/blocks/qa_add_mult_div_sub.py b/gr-blocks/python/blocks/qa_add_mult_div_sub.py
index 06bc9c3db5..7c9b2beac0 100755
--- a/gr-blocks/python/blocks/qa_add_mult_div_sub.py
+++ b/gr-blocks/python/blocks/qa_add_mult_div_sub.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,9 +32,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
def help_ii(self, src_data, exp_data, op):
for s in zip(range(len(src_data)), src_data):
- src = gr.vector_source_i(s[1])
+ src = blocks.vector_source_i(s[1])
self.tb.connect(src, (op, s[0]))
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(op, dst)
self.tb.run()
result_data = dst.data()
@@ -42,9 +42,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
def help_ss(self, src_data, exp_data, op):
for s in zip(range(len(src_data)), src_data):
- src = gr.vector_source_s(s[1])
+ src = blocks.vector_source_s(s[1])
self.tb.connect(src, (op, s[0]))
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(op, dst)
self.tb.run()
result_data = dst.data()
@@ -52,9 +52,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
def help_ff(self, src_data, exp_data, op):
for s in zip(range(len(src_data)), src_data):
- src = gr.vector_source_f(s[1])
+ src = blocks.vector_source_f(s[1])
self.tb.connect(src, (op, s[0]))
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(op, dst)
self.tb.run()
result_data = dst.data()
@@ -62,9 +62,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
def help_cc(self, src_data, exp_data, op):
for s in zip(range(len(src_data)), src_data):
- src = gr.vector_source_c(s[1])
+ src = blocks.vector_source_c(s[1])
self.tb.connect(src, (op, s[0]))
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(op, dst)
self.tb.run()
result_data = dst.data()
diff --git a/gr-blocks/python/blocks/qa_add_mult_v.py b/gr-blocks/python/blocks/qa_add_mult_v.py
index 2c79aace6d..721ee4eca6 100755
--- a/gr-blocks/python/blocks/qa_add_mult_v.py
+++ b/gr-blocks/python/blocks/qa_add_mult_v.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,12 +32,12 @@ class test_add_mult_v(gr_unittest.TestCase):
def help_ss(self, size, src_data, exp_data, op):
for s in zip(range (len (src_data)), src_data):
- src = gr.vector_source_s(s[1])
+ src = blocks.vector_source_s(s[1])
srcv = blocks.stream_to_vector(gr.sizeof_short, size)
self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
rhs = blocks.vector_to_stream(gr.sizeof_short, size)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(op, rhs, dst)
self.tb.run()
result_data = dst.data()
@@ -45,12 +45,12 @@ class test_add_mult_v(gr_unittest.TestCase):
def help_ii(self, size, src_data, exp_data, op):
for s in zip(range (len (src_data)), src_data):
- src = gr.vector_source_i(s[1])
+ src = blocks.vector_source_i(s[1])
srcv = blocks.stream_to_vector(gr.sizeof_int, size)
self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
rhs = blocks.vector_to_stream(gr.sizeof_int, size)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(op, rhs, dst)
self.tb.run()
result_data = dst.data()
@@ -58,12 +58,12 @@ class test_add_mult_v(gr_unittest.TestCase):
def help_ff(self, size, src_data, exp_data, op):
for s in zip(range (len (src_data)), src_data):
- src = gr.vector_source_f(s[1])
+ src = blocks.vector_source_f(s[1])
srcv = blocks.stream_to_vector(gr.sizeof_float, size)
self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
rhs = blocks.vector_to_stream(gr.sizeof_float, size)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(op, rhs, dst)
self.tb.run()
result_data = dst.data()
@@ -71,52 +71,52 @@ class test_add_mult_v(gr_unittest.TestCase):
def help_cc(self, size, src_data, exp_data, op):
for s in zip(range (len (src_data)), src_data):
- src = gr.vector_source_c(s[1])
+ src = blocks.vector_source_c(s[1])
srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, size)
self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, size)
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(op, rhs, dst)
self.tb.run()
result_data = dst.data()
self.assertEqual(exp_data, result_data)
def help_const_ss(self, src_data, exp_data, op):
- src = gr.vector_source_s(src_data)
+ src = blocks.vector_source_s(src_data)
srcv = blocks.stream_to_vector(gr.sizeof_short, len(src_data))
rhs = blocks.vector_to_stream(gr.sizeof_short, len(src_data))
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
result_data = dst.data()
self.assertEqual(exp_data, result_data)
def help_const_ii(self, src_data, exp_data, op):
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
srcv = blocks.stream_to_vector(gr.sizeof_int, len(src_data))
rhs = blocks.vector_to_stream(gr.sizeof_int, len(src_data))
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
result_data = dst.data()
self.assertEqual(exp_data, result_data)
def help_const_ff(self, src_data, exp_data, op):
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
srcv = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
rhs = blocks.vector_to_stream(gr.sizeof_float, len(src_data))
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
result_data = dst.data()
self.assertEqual(exp_data, result_data)
def help_const_cc(self, src_data, exp_data, op):
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, len(src_data))
rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, len(src_data))
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
result_data = dst.data()
diff --git a/gr-blocks/python/blocks/qa_argmax.py b/gr-blocks/python/blocks/qa_argmax.py
index 3b394c6e62..fead481c0f 100644
--- a/gr-blocks/python/blocks/qa_argmax.py
+++ b/gr-blocks/python/blocks/qa_argmax.py
@@ -39,20 +39,20 @@ class test_arg_max(gr_unittest.TestCase):
src2_data = (0,0.0,3.0,0,10,0)
src3_data = (0,0.0,3.0,0,1,0)
- src1 = gr.vector_source_f(src1_data)
+ src1 = blocks.vector_source_f(src1_data)
s2v1 = blocks.stream_to_vector(gr.sizeof_float, len(src1_data))
tb.connect(src1, s2v1)
- src2 = gr.vector_source_f(src2_data)
+ src2 = blocks.vector_source_f(src2_data)
s2v2 = blocks.stream_to_vector(gr.sizeof_float, len(src1_data))
tb.connect(src2, s2v2)
- src3 = gr.vector_source_f(src3_data)
+ src3 = blocks.vector_source_f(src3_data)
s2v3 = blocks.stream_to_vector(gr.sizeof_float, len(src1_data))
tb.connect(src3, s2v3)
- dst1 = gr.vector_sink_s()
- dst2 = gr.vector_sink_s()
+ dst1 = blocks.vector_sink_s()
+ dst2 = blocks.vector_sink_s()
argmax = blocks.argmax_fs(len(src1_data))
tb.connect(s2v1, (argmax, 0))
diff --git a/gr-blocks/python/blocks/qa_bin_statistics.py b/gr-blocks/python/blocks/qa_bin_statistics.py
index 3be3eef681..52b8585721 100755
--- a/gr-blocks/python/blocks/qa_bin_statistics.py
+++ b/gr-blocks/python/blocks/qa_bin_statistics.py
@@ -120,7 +120,7 @@ class test_bin_statistics(gr_unittest.TestCase):
13, 14, 15, 16
)])
- src = gr.vector_source_f(src_data, False)
+ src = blocks.vector_source_f(src_data, False)
s2v = blocks.stream_to_vector(gr.sizeof_float, vlen)
stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
self.tb.connect(src, s2v, stats)
@@ -148,7 +148,7 @@ class test_bin_statistics(gr_unittest.TestCase):
expected_results = tuple([float(x) for x in
( 9, 10, 11, 12)])
- src = gr.vector_source_f(src_data, False)
+ src = blocks.vector_source_f(src_data, False)
s2v = blocks.stream_to_vector(gr.sizeof_float, vlen)
stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
self.tb.connect(src, s2v, stats)
@@ -178,7 +178,7 @@ class test_bin_statistics(gr_unittest.TestCase):
expected_results = tuple([float(x) for x in
( 9, 10, 11, 12)])
- src = gr.vector_source_f(src_data, False)
+ src = blocks.vector_source_f(src_data, False)
s2v = blocks.stream_to_vector(gr.sizeof_float, vlen)
stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
self.tb.connect(src, s2v, stats)
@@ -210,7 +210,7 @@ class test_bin_statistics(gr_unittest.TestCase):
expected_results = tuple([float(x) for x in
( 9, 10, 11, 12)])
- src = gr.vector_source_f(src_data, False)
+ src = blocks.vector_source_f(src_data, False)
s2v = blocks.stream_to_vector(gr.sizeof_float, vlen)
stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
self.tb.connect(src, s2v, stats)
diff --git a/gr-blocks/python/blocks/qa_boolean_operators.py b/gr-blocks/python/blocks/qa_boolean_operators.py
index 9ef6ef6118..cbcd5688a1 100755
--- a/gr-blocks/python/blocks/qa_boolean_operators.py
+++ b/gr-blocks/python/blocks/qa_boolean_operators.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2008,2010 Free Software Foundation, Inc.
+# Copyright 2004,2007,2008,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,9 +32,9 @@ class test_boolean_operators (gr_unittest.TestCase):
def help_ss (self, src_data, exp_data, op):
for s in zip (range (len (src_data)), src_data):
- src = gr.vector_source_s (s[1])
+ src = blocks.vector_source_s (s[1])
self.tb.connect (src, (op, s[0]))
- dst = gr.vector_sink_s ()
+ dst = blocks.vector_sink_s ()
self.tb.connect (op, dst)
self.tb.run ()
result_data = dst.data ()
@@ -42,9 +42,9 @@ class test_boolean_operators (gr_unittest.TestCase):
def help_bb (self, src_data, exp_data, op):
for s in zip (range (len (src_data)), src_data):
- src = gr.vector_source_b (s[1])
+ src = blocks.vector_source_b (s[1])
self.tb.connect (src, (op, s[0]))
- dst = gr.vector_sink_b ()
+ dst = blocks.vector_sink_b ()
self.tb.connect (op, dst)
self.tb.run ()
result_data = dst.data ()
@@ -52,9 +52,9 @@ class test_boolean_operators (gr_unittest.TestCase):
def help_ii (self, src_data, exp_data, op):
for s in zip (range (len (src_data)), src_data):
- src = gr.vector_source_i (s[1])
+ src = blocks.vector_source_i (s[1])
self.tb.connect (src, (op, s[0]))
- dst = gr.vector_sink_i ()
+ dst = blocks.vector_sink_i ()
self.tb.connect (op, dst)
self.tb.run ()
result_data = dst.data ()
@@ -114,9 +114,9 @@ class test_boolean_operators (gr_unittest.TestCase):
def test_and_const_ss (self):
src_data = (1, 2, 3, 0x5004, 0x1150)
expected_result = (0, 2, 2, 0x5000, 0x1100)
- src = gr.vector_source_s(src_data)
+ src = blocks.vector_source_s(src_data)
op = blocks.and_const_ss (0x55AA)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(dst.data(), expected_result)
@@ -124,9 +124,9 @@ class test_boolean_operators (gr_unittest.TestCase):
def test_and_const_bb (self):
src_data = (1, 2, 3, 0x50, 0x11)
expected_result = (0, 2, 2, 0x00, 0x00)
- src = gr.vector_source_b(src_data)
+ src = blocks.vector_source_b(src_data)
op = blocks.and_const_bb (0xAA)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(dst.data(), expected_result)
@@ -135,9 +135,9 @@ class test_boolean_operators (gr_unittest.TestCase):
def test_and_const_ii (self):
src_data = (1, 2, 3, 0x5004, 0x1150)
expected_result = (0, 2, 2, 0x5000, 0x1100)
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op = blocks.and_const_ii (0x55AA)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(dst.data(), expected_result)
diff --git a/gr-blocks/python/blocks/qa_burst_tagger.py b/gr-blocks/python/blocks/qa_burst_tagger.py
index 912a46b80d..50aaf893bd 100644
--- a/gr-blocks/python/blocks/qa_burst_tagger.py
+++ b/gr-blocks/python/blocks/qa_burst_tagger.py
@@ -33,11 +33,10 @@ class test_burst_tagger(gr_unittest.TestCase):
self.tb = None
def test_001(self):
- # Just run some data through and make sure it doesn't puke.
src_data = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
trg_data = (-1, -1, 1, 1, -1, -1, 1, 1, -1, -1)
- src = gr.vector_source_i(src_data)
- trg = gr.vector_source_s(trg_data)
+ src = blocks.vector_source_i(src_data)
+ trg = blocks.vector_source_s(trg_data)
op = blocks.burst_tagger(gr.sizeof_int)
snk = blocks.tag_debug(gr.sizeof_int, "burst tagger QA")
self.tb.connect(src, (op,0))
diff --git a/gr-blocks/python/blocks/qa_conjugate.py b/gr-blocks/python/blocks/qa_conjugate.py
index e8c409995c..36172e30a0 100644
--- a/gr-blocks/python/blocks/qa_conjugate.py
+++ b/gr-blocks/python/blocks/qa_conjugate.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
#
@@ -39,9 +39,9 @@ class test_conjugate (gr_unittest.TestCase):
2+2j, 1+1j, 2-2j, 1-1j,
0-0j)
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.conjugate_cc ()
- dst = gr.vector_sink_c ()
+ dst = blocks.vector_sink_c ()
self.tb.connect(src, op)
self.tb.connect(op, dst)
diff --git a/gr-blocks/python/blocks/qa_delay.py b/gr-blocks/python/blocks/qa_delay.py
index 38a03475ae..a0853309b3 100755
--- a/gr-blocks/python/blocks/qa_delay.py
+++ b/gr-blocks/python/blocks/qa_delay.py
@@ -36,9 +36,9 @@ class test_delay(gr_unittest.TestCase):
src_data = [float(x) for x in range(0, 100)]
expected_result = tuple(delta_t*[0.0] + src_data)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.delay(gr.sizeof_float, delta_t)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
tb.connect(src, op, dst)
tb.run()
@@ -51,9 +51,9 @@ class test_delay(gr_unittest.TestCase):
src_data = [float(x) for x in range(0, 100)]
expected_result = tuple(delta_t*[0.0] + src_data)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.delay(gr.sizeof_float, delta_t)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
tb.connect(src, op, dst)
tb.run()
diff --git a/gr-blocks/python/blocks/qa_file_metadata.py b/gr-blocks/python/blocks/qa_file_metadata.py
index 7afd6a70f5..4b262e5c40 100644
--- a/gr-blocks/python/blocks/qa_file_metadata.py
+++ b/gr-blocks/python/blocks/qa_file_metadata.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
#
@@ -55,7 +55,7 @@ class test_file_metadata(gr_unittest.TestCase):
extras_str = pmt.serialize_str(extras)
data = sig_source_c(samp_rate, 1000, 1, N)
- src = gr.vector_source_c(data)
+ src = blocks.vector_source_c(data)
fsnk = blocks.file_meta_sink(gr.sizeof_gr_complex, outfile,
samp_rate, 1,
blocks.GR_FILE_FLOAT, True,
@@ -97,9 +97,9 @@ class test_file_metadata(gr_unittest.TestCase):
# Test file metadata source
src.rewind()
fsrc = blocks.file_meta_source(outfile, False)
- vsnk = gr.vector_sink_c()
+ vsnk = blocks.vector_sink_c()
tsnk = blocks.tag_debug(gr.sizeof_gr_complex, "QA")
- ssnk = gr.vector_sink_c()
+ ssnk = blocks.vector_sink_c()
self.tb.disconnect(src, fsnk)
self.tb.connect(fsrc, vsnk)
self.tb.connect(fsrc, tsnk)
@@ -134,7 +134,7 @@ class test_file_metadata(gr_unittest.TestCase):
extras_str = pmt.serialize_str(extras)
data = sig_source_c(samp_rate, 1000, 1, N)
- src = gr.vector_source_c(data)
+ src = blocks.vector_source_c(data)
fsnk = blocks.file_meta_sink(gr.sizeof_gr_complex, outfile,
samp_rate, 1,
blocks.GR_FILE_FLOAT, True,
@@ -176,9 +176,9 @@ class test_file_metadata(gr_unittest.TestCase):
# Test file metadata source
src.rewind()
fsrc = blocks.file_meta_source(outfile, False, detached, outfile_hdr)
- vsnk = gr.vector_sink_c()
+ vsnk = blocks.vector_sink_c()
tsnk = blocks.tag_debug(gr.sizeof_gr_complex, "QA")
- ssnk = gr.vector_sink_c()
+ ssnk = blocks.vector_sink_c()
self.tb.disconnect(src, fsnk)
self.tb.connect(fsrc, vsnk)
self.tb.connect(fsrc, tsnk)
diff --git a/gr-blocks/python/blocks/qa_integrate.py b/gr-blocks/python/blocks/qa_integrate.py
index c01adc60c2..6128169a61 100755
--- a/gr-blocks/python/blocks/qa_integrate.py
+++ b/gr-blocks/python/blocks/qa_integrate.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008,2010 Free Software Foundation, Inc.
+# Copyright 2008,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,8 +22,6 @@
from gnuradio import gr, gr_unittest, blocks
-import math
-
class test_integrate (gr_unittest.TestCase):
def setUp (self):
@@ -35,9 +33,9 @@ class test_integrate (gr_unittest.TestCase):
def test_000_ss(self):
src_data = (1, 2, 3, 4, 5, 6)
dst_data = (6, 15)
- src = gr.vector_source_s(src_data)
+ src = blocks.vector_source_s(src_data)
itg = blocks.integrate_ss(3)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, itg, dst)
self.tb.run()
self.assertEqual(dst_data, dst.data())
@@ -45,9 +43,9 @@ class test_integrate (gr_unittest.TestCase):
def test_001_ii(self):
src_data = (1, 2, 3, 4, 5, 6)
dst_data = (6, 15)
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
itg = blocks.integrate_ii(3)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, itg, dst)
self.tb.run()
self.assertEqual(dst_data, dst.data())
@@ -55,9 +53,9 @@ class test_integrate (gr_unittest.TestCase):
def test_002_ff(self):
src_data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
dst_data = [6.0, 15.0]
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
itg = blocks.integrate_ff(3)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, itg, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
@@ -65,9 +63,9 @@ class test_integrate (gr_unittest.TestCase):
def test_003_cc(self):
src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j]
dst_data = [6.0+6.0j, 15.0+15.0j]
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
itg = blocks.integrate_cc(3)
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(src, itg, dst)
self.tb.run()
self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
diff --git a/gr-blocks/python/blocks/qa_interleave.py b/gr-blocks/python/blocks/qa_interleave.py
index 3fcfb230cc..9eaf87c83c 100755
--- a/gr-blocks/python/blocks/qa_interleave.py
+++ b/gr-blocks/python/blocks/qa_interleave.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,8 +22,6 @@
from gnuradio import gr, gr_unittest, blocks
-import math
-
class test_interleave (gr_unittest.TestCase):
def setUp (self):
@@ -34,12 +32,12 @@ class test_interleave (gr_unittest.TestCase):
def test_int_001 (self):
lenx = 64
- src0 = gr.vector_source_f (range (0, lenx, 4))
- src1 = gr.vector_source_f (range (1, lenx, 4))
- src2 = gr.vector_source_f (range (2, lenx, 4))
- src3 = gr.vector_source_f (range (3, lenx, 4))
+ src0 = blocks.vector_source_f (range (0, lenx, 4))
+ src1 = blocks.vector_source_f (range (1, lenx, 4))
+ src2 = blocks.vector_source_f (range (2, lenx, 4))
+ src3 = blocks.vector_source_f (range (3, lenx, 4))
op = blocks.interleave (gr.sizeof_float)
- dst = gr.vector_sink_f ()
+ dst = blocks.vector_sink_f ()
self.tb.connect (src0, (op, 0))
self.tb.connect (src1, (op, 1))
@@ -53,12 +51,12 @@ class test_interleave (gr_unittest.TestCase):
def test_deint_001 (self):
lenx = 64
- src = gr.vector_source_f (range (lenx))
+ src = blocks.vector_source_f (range (lenx))
op = blocks.deinterleave (gr.sizeof_float)
- dst0 = gr.vector_sink_f ()
- dst1 = gr.vector_sink_f ()
- dst2 = gr.vector_sink_f ()
- dst3 = gr.vector_sink_f ()
+ dst0 = blocks.vector_sink_f ()
+ dst1 = blocks.vector_sink_f ()
+ dst2 = blocks.vector_sink_f ()
+ dst3 = blocks.vector_sink_f ()
self.tb.connect (src, op)
self.tb.connect ((op, 0), dst0)
diff --git a/gr-blocks/python/blocks/qa_keep_m_in_n.py b/gr-blocks/python/blocks/qa_keep_m_in_n.py
index 19730fb656..4db48335b2 100755
--- a/gr-blocks/python/blocks/qa_keep_m_in_n.py
+++ b/gr-blocks/python/blocks/qa_keep_m_in_n.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008,2010,2012 Free Software Foundation, Inc.
+# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,15 +35,15 @@ class test_keep_m_in_n(gr_unittest.TestCase):
def test_001(self):
self.maxDiff = None;
tb = gr.top_block()
- src = gr.vector_source_b( range(0,100) )
+ src = blocks.vector_source_b( range(0,100) )
# itemsize, M, N, offset
km2 = blocks.keep_m_in_n( 1, 1, 2, 0 );
km3 = blocks.keep_m_in_n( 1, 1, 3, 1 );
km7 = blocks.keep_m_in_n( 1, 1, 7, 2 );
- snk2 = gr.vector_sink_b();
- snk3 = gr.vector_sink_b();
- snk7 = gr.vector_sink_b();
+ snk2 = blocks.vector_sink_b();
+ snk3 = blocks.vector_sink_b();
+ snk7 = blocks.vector_sink_b();
tb.connect(src,km2,snk2);
tb.connect(src,km3,snk3);
tb.connect(src,km7,snk7);
diff --git a/gr-blocks/python/blocks/qa_keep_one_in_n.py b/gr-blocks/python/blocks/qa_keep_one_in_n.py
index 8a13df71f7..d8251fe611 100755
--- a/gr-blocks/python/blocks/qa_keep_one_in_n.py
+++ b/gr-blocks/python/blocks/qa_keep_one_in_n.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
#
@@ -33,9 +33,9 @@ class test_keep_one_in_n(gr_unittest.TestCase):
def test_001(self):
src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
expected_data = (5, 10)
- src = gr.vector_source_b(src_data);
+ src = blocks.vector_source_b(src_data);
op = blocks.keep_one_in_n(gr.sizeof_char, 5)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(dst.data(), expected_data)
diff --git a/gr-blocks/python/blocks/qa_max.py b/gr-blocks/python/blocks/qa_max.py
index 6cd42269eb..441582ac88 100755
--- a/gr-blocks/python/blocks/qa_max.py
+++ b/gr-blocks/python/blocks/qa_max.py
@@ -36,10 +36,10 @@ class test_max(gr_unittest.TestCase):
src_data = (0,0.2,-0.3,0,12,0)
expected_result = (float(max(src_data)),)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
op = blocks.max_ff(len(src_data))
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, s2v, op, dst)
self.tb.run()
@@ -50,10 +50,10 @@ class test_max(gr_unittest.TestCase):
src_data=(-100,-99,-98,-97,-96,-1)
expected_result = (float(max(src_data)),)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
op = blocks.max_ff(len(src_data))
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, s2v, op, dst)
self.tb.run()
diff --git a/gr-blocks/python/blocks/qa_message.py b/gr-blocks/python/blocks/qa_message.py
index 75e9f3f778..abfc652199 100755
--- a/gr-blocks/python/blocks/qa_message.py
+++ b/gr-blocks/python/blocks/qa_message.py
@@ -93,8 +93,8 @@ class test_message(gr_unittest.TestCase):
def test_300(self):
input_data = (0,1,2,3,4,5,6,7,8,9)
- src = gr.vector_source_b(input_data)
- dst = gr.vector_sink_b()
+ src = blocks.vector_source_b(input_data)
+ dst = blocks.vector_sink_b()
tb = gr.top_block()
tb.connect(src, dst)
tb.run()
@@ -103,7 +103,7 @@ class test_message(gr_unittest.TestCase):
def test_301(self):
# Use itemsize, limit constructor
src = blocks.message_source(gr.sizeof_char)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb = gr.top_block()
tb.connect(src, dst)
src.msgq().insert_tail(gr.message_from_string('01234'))
@@ -118,7 +118,7 @@ class test_message(gr_unittest.TestCase):
# Use itemsize, msgq constructor
msgq = gr.msg_queue()
src = blocks.message_source(gr.sizeof_char, msgq)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb = gr.top_block()
tb.connect(src, dst)
src.msgq().insert_tail(gr.message_from_string('01234'))
diff --git a/gr-blocks/python/blocks/qa_moving_average.py b/gr-blocks/python/blocks/qa_moving_average.py
index 2262011623..2c58805925 100644
--- a/gr-blocks/python/blocks/qa_moving_average.py
+++ b/gr-blocks/python/blocks/qa_moving_average.py
@@ -53,9 +53,9 @@ class test_moving_average(gr_unittest.TestCase):
data = make_random_float_tuple(N, 1)
expected_result = N*[0,]
- src = gr.vector_source_f(data, False)
+ src = blocks.vector_source_f(data, False)
op = blocks.moving_average_ff(100, 0.001)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
tb.connect(src, op)
tb.connect(op, dst)
@@ -74,9 +74,9 @@ class test_moving_average(gr_unittest.TestCase):
data = make_random_complex_tuple(N, 1)
expected_result = N*[0,]
- src = gr.vector_source_c(data, False)
+ src = blocks.vector_source_c(data, False)
op = blocks.moving_average_cc(100, 0.001)
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
tb.connect(src, op)
tb.connect(op, dst)
diff --git a/gr-blocks/python/blocks/qa_multiply_conjugate.py b/gr-blocks/python/blocks/qa_multiply_conjugate.py
index a78e4ebd04..c2391f1410 100644
--- a/gr-blocks/python/blocks/qa_multiply_conjugate.py
+++ b/gr-blocks/python/blocks/qa_multiply_conjugate.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
#
@@ -41,10 +41,10 @@ class test_multiply_conjugate (gr_unittest.TestCase):
exp_data = (12+0j, 8+0j, 12+0j, 8+0j,
12+0j, 8+0j, 12+0j, 8+0j,
0+0j)
- src0 = gr.vector_source_c(src_data0)
- src1 = gr.vector_source_c(src_data1)
+ src0 = blocks.vector_source_c(src_data0)
+ src1 = blocks.vector_source_c(src_data1)
op = blocks.multiply_conjugate_cc ()
- dst = gr.vector_sink_c ()
+ dst = blocks.vector_sink_c ()
self.tb.connect(src0, (op,0))
self.tb.connect(src1, (op,1))
diff --git a/gr-blocks/python/blocks/qa_mute.py b/gr-blocks/python/blocks/qa_mute.py
index c4228b980c..97ee5bd821 100755
--- a/gr-blocks/python/blocks/qa_mute.py
+++ b/gr-blocks/python/blocks/qa_mute.py
@@ -32,9 +32,9 @@ class test_mute(gr_unittest.TestCase):
def help_ii(self, src_data, exp_data, op):
for s in zip(range(len(src_data)), src_data):
- src = gr.vector_source_i(s[1])
+ src = blocks.vector_source_i(s[1])
self.tb.connect(src, (op, s[0]))
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(op, dst)
self.tb.run()
result_data = dst.data()
@@ -42,9 +42,9 @@ class test_mute(gr_unittest.TestCase):
def help_ff(self, src_data, exp_data, op):
for s in zip(range(len(src_data)), src_data):
- src = gr.vector_source_f(s[1])
+ src = blocks.vector_source_f(s[1])
self.tb.connect(src, (op, s[0]))
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(op, dst)
self.tb.run()
result_data = dst.data()
@@ -52,9 +52,9 @@ class test_mute(gr_unittest.TestCase):
def help_cc(self, src_data, exp_data, op):
for s in zip(range(len(src_data)), src_data):
- src = gr.vector_source_c(s[1])
+ src = blocks.vector_source_c(s[1])
self.tb.connect(src, (op, s[0]))
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(op, dst)
self.tb.run()
result_data = dst.data()
diff --git a/gr-blocks/python/blocks/qa_nlog10.py b/gr-blocks/python/blocks/qa_nlog10.py
index 9e6294cf5f..0194e85d48 100755
--- a/gr-blocks/python/blocks/qa_nlog10.py
+++ b/gr-blocks/python/blocks/qa_nlog10.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2007,2010,2012 Free Software Foundation, Inc.
+# Copyright 2005,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -33,9 +33,9 @@ class test_nlog10(gr_unittest.TestCase):
def test_001(self):
src_data = (-10, 0, 10, 100, 1000, 10000, 100000)
expected_result = (-180, -180, 10, 20, 30, 40, 50)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.nlog10_ff(10)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect (src, op, dst)
self.tb.run()
result_data = dst.data()
diff --git a/gr-blocks/python/blocks/qa_pack_k_bits.py b/gr-blocks/python/blocks/qa_pack_k_bits.py
index 992b5e1b78..b73bf3d5a9 100755
--- a/gr-blocks/python/blocks/qa_pack_k_bits.py
+++ b/gr-blocks/python/blocks/qa_pack_k_bits.py
@@ -35,9 +35,9 @@ class test_pack(gr_unittest.TestCase):
def test_001(self):
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)
+ src = blocks.vector_source_b(src_data,False)
op = blocks.pack_k_bits_bb(1)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_results, dst.data())
@@ -45,9 +45,9 @@ class test_pack(gr_unittest.TestCase):
def test_002(self):
src_data = (1,0,1,1,0,0,0,1)
expected_results = ( 2, 3, 0, 1)
- src = gr.vector_source_b(src_data,False)
+ src = blocks.vector_source_b(src_data,False)
op = blocks.pack_k_bits_bb(2)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
#self.assertEqual(expected_results, dst.data())
@@ -55,10 +55,10 @@ 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 );
+ src = blocks.vector_source_b( src_data );
pack = blocks.pack_k_bits_bb(2);
unpack = blocks.unpack_k_bits_bb(2);
- snk = gr.vector_sink_b();
+ snk = blocks.vector_sink_b();
self.tb.connect(src,unpack,pack,snk);
self.tb.run()
self.assertEqual(list(expected_results), list(snk.data()));
diff --git a/gr-blocks/python/blocks/qa_packed_to_unpacked.py b/gr-blocks/python/blocks/qa_packed_to_unpacked.py
index 4eb6e5251b..02dc872490 100755
--- a/gr-blocks/python/blocks/qa_packed_to_unpacked.py
+++ b/gr-blocks/python/blocks/qa_packed_to_unpacked.py
@@ -35,9 +35,9 @@ class test_packing(gr_unittest.TestCase):
def test_001(self):
src_data = (0x80,)
expected_results = (1,0,0,0,0,0,0,0)
- src = gr.vector_source_b(src_data, False)
+ src = blocks.vector_source_b(src_data, False)
op = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -48,9 +48,9 @@ class test_packing(gr_unittest.TestCase):
def test_002(self):
src_data = (0x80,)
expected_results = (0,0,0,0,0,0,0,1)
- src = gr.vector_source_b(src_data, False)
+ src = blocks.vector_source_b(src_data, False)
op = blocks.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -61,9 +61,9 @@ class test_packing(gr_unittest.TestCase):
def test_003(self):
src_data = (0x11,)
expected_results = (4, 2)
- src = gr.vector_source_b(src_data, False)
+ src = blocks.vector_source_b(src_data, False)
op = blocks.packed_to_unpacked_bb(3, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -74,9 +74,9 @@ class test_packing(gr_unittest.TestCase):
def test_004(self):
src_data = (0x11,)
expected_results = (0, 4)
- src = gr.vector_source_b(src_data, False)
+ src = blocks.vector_source_b(src_data, False)
op = blocks.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -87,9 +87,9 @@ class test_packing(gr_unittest.TestCase):
def test_005(self):
src_data = (1,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0)
expected_results = (0x82, 0x5a)
- src = gr.vector_source_b(src_data, False)
+ src = blocks.vector_source_b(src_data, False)
op = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -100,9 +100,9 @@ class test_packing(gr_unittest.TestCase):
def test_006(self):
src_data = (0,1,0,0,0,0,0,1,0,1,0,1,1,0,1,0)
expected_results = (0x82, 0x5a)
- src = gr.vector_source_b(src_data, False)
+ src = blocks.vector_source_b(src_data, False)
op = blocks.unpacked_to_packed_bb(1, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -113,9 +113,9 @@ class test_packing(gr_unittest.TestCase):
def test_007(self):
src_data = (4, 2, 0,0,0)
expected_results = (0x11,)
- src = gr.vector_source_b(src_data, False)
+ src = blocks.vector_source_b(src_data, False)
op = blocks.unpacked_to_packed_bb(3, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -126,9 +126,9 @@ class test_packing(gr_unittest.TestCase):
def test_008(self):
src_data = (0, 4, 2,0,0)
expected_results = (0x11,)
- src = gr.vector_source_b(src_data,False)
+ src = blocks.vector_source_b(src_data,False)
op = blocks.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op)
self.tb.connect(op, dst)
@@ -144,10 +144,10 @@ class test_packing(gr_unittest.TestCase):
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_b(tuple(src_data), False)
+ src = blocks.vector_source_b(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST)
op2 = blocks.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -162,10 +162,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(0,255)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_b(tuple(src_data), False)
+ src = blocks.vector_source_b(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST)
op2 = blocks.unpacked_to_packed_bb(7, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -180,10 +180,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(0,255)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_b(tuple(src_data),False)
+ src = blocks.vector_source_b(tuple(src_data),False)
op1 = blocks.packed_to_unpacked_bb(7, gr.GR_LSB_FIRST)
op2 = blocks.unpacked_to_packed_bb(7, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -200,10 +200,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_s(tuple(src_data), False)
+ src = blocks.vector_source_s(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ss(1, gr.GR_MSB_FIRST)
op2 = blocks.unpacked_to_packed_ss(1, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -218,10 +218,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_s(tuple(src_data), False)
+ src = blocks.vector_source_s(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ss(1, gr.GR_LSB_FIRST)
op2 = blocks.unpacked_to_packed_ss(1, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -236,10 +236,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_s(tuple(src_data), False)
+ src = blocks.vector_source_s(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ss(8, gr.GR_MSB_FIRST)
op2 = blocks.unpacked_to_packed_ss(8, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -254,10 +254,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_s(tuple(src_data), False)
+ src = blocks.vector_source_s(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ss(8, gr.GR_LSB_FIRST)
op2 = blocks.unpacked_to_packed_ss(8, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -274,10 +274,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_i(tuple(src_data), False)
+ src = blocks.vector_source_i(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ii(1, gr.GR_MSB_FIRST)
op2 = blocks.unpacked_to_packed_ii(1, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -292,10 +292,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_i(tuple(src_data), False)
+ src = blocks.vector_source_i(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ii(1, gr.GR_LSB_FIRST)
op2 = blocks.unpacked_to_packed_ii(1, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -310,10 +310,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_i(tuple(src_data), False)
+ src = blocks.vector_source_i(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ii(8, gr.GR_MSB_FIRST)
op2 = blocks.unpacked_to_packed_ii(8, gr.GR_MSB_FIRST)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
@@ -328,10 +328,10 @@ class test_packing(gr_unittest.TestCase):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
- src = gr.vector_source_i(tuple(src_data), False)
+ src = blocks.vector_source_i(tuple(src_data), False)
op1 = blocks.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST)
op2 = blocks.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op1, op2)
self.tb.connect(op2, dst)
diff --git a/gr-blocks/python/blocks/qa_patterned_interleaver.py b/gr-blocks/python/blocks/qa_patterned_interleaver.py
index 005ac0f916..c9fe7b123b 100755
--- a/gr-blocks/python/blocks/qa_patterned_interleaver.py
+++ b/gr-blocks/python/blocks/qa_patterned_interleaver.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008,2010 Free Software Foundation, Inc.
+# Copyright 2008,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -34,12 +34,12 @@ class test_patterned_interleaver (gr_unittest.TestCase):
def test_000(self):
dst_data = [0,0,1,2,0,2,1,0];
- src0 = gr.vector_source_f(200*[0])
- src1 = gr.vector_source_f(200*[1])
- src2 = gr.vector_source_f(200*[2])
+ src0 = blocks.vector_source_f(200*[0])
+ src1 = blocks.vector_source_f(200*[1])
+ src2 = blocks.vector_source_f(200*[2])
itg = blocks.patterned_interleaver(gr.sizeof_float, dst_data)
- dst = gr.vector_sink_f()
- head = gr.head(gr.sizeof_float, 8);
+ dst = blocks.vector_sink_f()
+ head = blocks.head(gr.sizeof_float, 8);
self.tb.connect( src0, (itg,0) );
self.tb.connect( src1, (itg,1) );
diff --git a/gr-blocks/python/blocks/qa_pdu.py b/gr-blocks/python/blocks/qa_pdu.py
index 0c396b71c7..685d1dbaae 100755
--- a/gr-blocks/python/blocks/qa_pdu.py
+++ b/gr-blocks/python/blocks/qa_pdu.py
@@ -39,7 +39,7 @@ class test_pdu(gr_unittest.TestCase):
src = blocks.pdu_to_tagged_stream(blocks.byte_t)
snk3 = blocks.tagged_stream_to_pdu(blocks.byte_t)
- snk2 = gr.vector_sink_b()
+ snk2 = blocks.vector_sink_b()
snk = blocks.tag_debug(1, "test")
snk.set_display(False)
diff --git a/gr-blocks/python/blocks/qa_peak_detector.py b/gr-blocks/python/blocks/qa_peak_detector.py
index 9b0eb01592..c855e92530 100644
--- a/gr-blocks/python/blocks/qa_peak_detector.py
+++ b/gr-blocks/python/blocks/qa_peak_detector.py
@@ -39,9 +39,9 @@ class test_peak_detector(gr_unittest.TestCase):
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)
+ src = blocks.vector_source_f(data, False)
regen = blocks.peak_detector_fb()
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb.connect(src, regen)
tb.connect(regen, dst)
@@ -60,9 +60,9 @@ class test_peak_detector(gr_unittest.TestCase):
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_i(data, False)
+ src = blocks.vector_source_i(data, False)
regen = blocks.peak_detector_ib()
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb.connect(src, regen)
tb.connect(regen, dst)
@@ -81,9 +81,9 @@ class test_peak_detector(gr_unittest.TestCase):
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_s(data, False)
+ src = blocks.vector_source_s(data, False)
regen = blocks.peak_detector_sb()
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb.connect(src, regen)
tb.connect(regen, dst)
diff --git a/gr-blocks/python/blocks/qa_peak_detector2.py b/gr-blocks/python/blocks/qa_peak_detector2.py
index 2f2d983993..475897eac2 100644
--- a/gr-blocks/python/blocks/qa_peak_detector2.py
+++ b/gr-blocks/python/blocks/qa_peak_detector2.py
@@ -40,9 +40,9 @@ class test_peak_detector2(gr_unittest.TestCase):
0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
- src = gr.vector_source_f(data, False)
+ src = blocks.vector_source_f(data, False)
regen = blocks.peak_detector2_fb()
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb.connect(src, regen)
tb.connect(regen, dst)
diff --git a/gr-blocks/python/blocks/qa_pipe_fittings.py b/gr-blocks/python/blocks/qa_pipe_fittings.py
index d69aee485b..bc29cc750e 100755
--- a/gr-blocks/python/blocks/qa_pipe_fittings.py
+++ b/gr-blocks/python/blocks/qa_pipe_fittings.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2007,2010,2012 Free Software Foundation, Inc.
+# Copyright 2005,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -49,13 +49,13 @@ class test_pipe_fittings(gr_unittest.TestCase):
expected_results = calc_expected_result(src_data, n)
#print "expected results: ", expected_results
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op = blocks.stream_to_streams(gr.sizeof_int, n)
self.tb.connect(src, op)
dsts = []
for i in range(n):
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect((op, i), (dst, 0))
dsts.append(dst)
@@ -73,10 +73,10 @@ class test_pipe_fittings(gr_unittest.TestCase):
src_data = tuple(range(src_len))
expected_results = src_data
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op1 = blocks.stream_to_streams(gr.sizeof_int, n)
op2 = blocks.streams_to_stream(gr.sizeof_int, n)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op1)
for i in range(n):
@@ -95,11 +95,11 @@ class test_pipe_fittings(gr_unittest.TestCase):
src_data = tuple(range(src_len))
expected_results = src_data
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op1 = blocks.stream_to_streams(gr.sizeof_int, n)
op2 = blocks.streams_to_vector(gr.sizeof_int, n)
op3 = blocks.vector_to_stream(gr.sizeof_int, n)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op1)
for i in range(n):
@@ -118,11 +118,11 @@ class test_pipe_fittings(gr_unittest.TestCase):
src_data = tuple(range(src_len))
expected_results = src_data
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op1 = blocks.stream_to_vector(gr.sizeof_int, n)
op2 = blocks.vector_to_streams(gr.sizeof_int, n)
op3 = blocks.streams_to_stream(gr.sizeof_int, n)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op1, op2)
for i in range(n):
diff --git a/gr-blocks/python/blocks/qa_probe_signal.py b/gr-blocks/python/blocks/qa_probe_signal.py
index e04f29f413..8194cafdb0 100644
--- a/gr-blocks/python/blocks/qa_probe_signal.py
+++ b/gr-blocks/python/blocks/qa_probe_signal.py
@@ -35,7 +35,7 @@ class test_probe_signal(gr_unittest.TestCase):
repeats = 100
src_data = [value] * repeats
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
dst = blocks.probe_signal_f()
self.tb.connect(src, dst)
@@ -49,7 +49,7 @@ class test_probe_signal(gr_unittest.TestCase):
value = [0.5+i for i in range(0, vector_length)]
src_data = value * repeats
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
s2v = blocks.stream_to_vector(gr.sizeof_float, vector_length)
dst = blocks.probe_signal_vf(vector_length)
diff --git a/gr-blocks/python/blocks/qa_regenerate.py b/gr-blocks/python/blocks/qa_regenerate.py
index 2e20aab81d..52b6bdb515 100755
--- a/gr-blocks/python/blocks/qa_regenerate.py
+++ b/gr-blocks/python/blocks/qa_regenerate.py
@@ -42,9 +42,9 @@ class test_regenerate(gr_unittest.TestCase):
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
- src = gr.vector_source_b(data, False)
+ src = blocks.vector_source_b(data, False)
regen = blocks.regenerate_bb(5, 2)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb.connect(src, regen)
tb.connect(regen, dst)
@@ -72,9 +72,9 @@ class test_regenerate(gr_unittest.TestCase):
expected_result[119] = 1
expected_result[129] = 1
- src = gr.vector_source_b(data, False)
+ src = blocks.vector_source_b(data, False)
regen = blocks.regenerate_bb(10, 3)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
tb.connect(src, regen)
tb.connect(regen, dst)
diff --git a/gr-blocks/python/blocks/qa_repeat.py b/gr-blocks/python/blocks/qa_repeat.py
index 2a381a5590..eaf20d4e27 100755
--- a/gr-blocks/python/blocks/qa_repeat.py
+++ b/gr-blocks/python/blocks/qa_repeat.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008,2010,2012 Free Software Foundation, Inc.
+# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,8 +22,6 @@
from gnuradio import gr, gr_unittest, blocks
-import math
-
class test_repeat (gr_unittest.TestCase):
def setUp (self):
@@ -38,9 +36,9 @@ class test_repeat (gr_unittest.TestCase):
for n in range(100):
dst_data += [1.0*n, 1.0*n, 1.0*n]
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
rpt = blocks.repeat(gr.sizeof_float, 3)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, rpt, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
diff --git a/gr-blocks/python/blocks/qa_rms.py b/gr-blocks/python/blocks/qa_rms.py
index ee3b7607e7..0b07c37bdc 100644
--- a/gr-blocks/python/blocks/qa_rms.py
+++ b/gr-blocks/python/blocks/qa_rms.py
@@ -50,10 +50,10 @@ class test_rms(gr_unittest.TestCase):
expected_data = amp/math.sqrt(2.0)
- src = gr.vector_source_f(src_data, True)
- head = gr.head(gr.sizeof_float, N)
+ src = blocks.vector_source_f(src_data, True)
+ head = blocks.head(gr.sizeof_float, N)
op = blocks.rms_ff(0.0001)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, head, op, dst)
self.tb.run()
@@ -68,10 +68,10 @@ class test_rms(gr_unittest.TestCase):
expected_data = amp
- src = gr.vector_source_c(src_data, True)
- head = gr.head(gr.sizeof_gr_complex, N)
+ src = blocks.vector_source_c(src_data, True)
+ head = blocks.head(gr.sizeof_gr_complex, N)
op = blocks.rms_cf(0.0001)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, head, op, dst)
self.tb.run()
diff --git a/gr-blocks/python/blocks/qa_sample_and_hold.py b/gr-blocks/python/blocks/qa_sample_and_hold.py
index 4c738f0dce..d6aedc23cc 100644
--- a/gr-blocks/python/blocks/qa_sample_and_hold.py
+++ b/gr-blocks/python/blocks/qa_sample_and_hold.py
@@ -36,10 +36,10 @@ class test_sample_and_hold(gr_unittest.TestCase):
ctrl_data = 10*[1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0]
expected_result = 10*(0,0,0,0,4,5,6,7,8,9,9,9,9,9,9,9,9,9)
- src = gr.vector_source_f(src_data)
- ctrl = gr.vector_source_b(ctrl_data)
+ src = blocks.vector_source_f(src_data)
+ ctrl = blocks.vector_source_b(ctrl_data)
op = blocks.sample_and_hold_ff()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, (op,0))
self.tb.connect(ctrl, (op,1))
diff --git a/gr-blocks/python/blocks/qa_stream_mux.py b/gr-blocks/python/blocks/qa_stream_mux.py
index fe28c2de9a..7abbced54c 100755
--- a/gr-blocks/python/blocks/qa_stream_mux.py
+++ b/gr-blocks/python/blocks/qa_stream_mux.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005,2007,2010,2012 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -34,12 +34,12 @@ class test_stream_mux (gr_unittest.TestCase):
self.tb = None
def help_stream_2ff(self, N, stream_sizes):
- v0 = gr.vector_source_f(N*[1,], False)
- v1 = gr.vector_source_f(N*[2,], False)
+ v0 = blocks.vector_source_f(N*[1,], False)
+ v1 = blocks.vector_source_f(N*[2,], False)
mux = blocks.stream_mux(gr.sizeof_float, stream_sizes)
- dst = gr.vector_sink_f ()
+ dst = blocks.vector_sink_f ()
self.tb.connect (v0, (mux,0))
self.tb.connect (v1, (mux,1))
@@ -53,12 +53,12 @@ class test_stream_mux (gr_unittest.TestCase):
r2 = range(N)
r2.reverse()
- v0 = gr.vector_source_f(r1, False)
- v1 = gr.vector_source_f(r2, False)
+ v0 = blocks.vector_source_f(r1, False)
+ v1 = blocks.vector_source_f(r2, False)
mux = blocks.stream_mux(gr.sizeof_float, stream_sizes)
- dst = gr.vector_sink_f ()
+ dst = blocks.vector_sink_f ()
self.tb.connect (v0, (mux,0))
self.tb.connect (v1, (mux,1))
diff --git a/gr-blocks/python/blocks/qa_stretch.py b/gr-blocks/python/blocks/qa_stretch.py
index be95914f33..66a04d53f6 100755
--- a/gr-blocks/python/blocks/qa_stretch.py
+++ b/gr-blocks/python/blocks/qa_stretch.py
@@ -40,13 +40,13 @@ class test_stretch(gr_unittest.TestCase):
expected_result0 = 10*[0.05,]
expected_result1 = 10*[0.1,]
- src0 = gr.vector_source_f(data0, False)
- src1 = gr.vector_source_f(data1, False)
+ src0 = blocks.vector_source_f(data0, False)
+ src1 = blocks.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()
+ dst0 = blocks.vector_sink_f()
+ dst1 = blocks.vector_sink_f()
tb.connect(src0, (inter,0))
tb.connect(src1, (inter,1))
diff --git a/gr-blocks/python/blocks/qa_tag_debug.py b/gr-blocks/python/blocks/qa_tag_debug.py
index a21c668bf1..5ccb285a5d 100755
--- a/gr-blocks/python/blocks/qa_tag_debug.py
+++ b/gr-blocks/python/blocks/qa_tag_debug.py
@@ -33,7 +33,7 @@ class test_tag_debug(gr_unittest.TestCase):
def test_001(self):
# Just run some data through and make sure it doesn't puke.
src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op = blocks.tag_debug(gr.sizeof_int, "tag QA")
self.tb.connect(src, op)
self.tb.run()
diff --git a/gr-blocks/python/blocks/qa_threshold.py b/gr-blocks/python/blocks/qa_threshold.py
index d2db145926..49798426f3 100644
--- a/gr-blocks/python/blocks/qa_threshold.py
+++ b/gr-blocks/python/blocks/qa_threshold.py
@@ -37,9 +37,9 @@ class test_threshold(gr_unittest.TestCase):
expected_result = (0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1)
- src = gr.vector_source_f(data, False)
+ src = blocks.vector_source_f(data, False)
op = blocks.threshold_ff(1, 1)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
tb.connect(src, op)
tb.connect(op, dst)
diff --git a/gr-blocks/python/blocks/qa_transcendental.py b/gr-blocks/python/blocks/qa_transcendental.py
index cc88c61123..1da56381f4 100644
--- a/gr-blocks/python/blocks/qa_transcendental.py
+++ b/gr-blocks/python/blocks/qa_transcendental.py
@@ -38,9 +38,9 @@ class test_transcendental(gr_unittest.TestCase):
data = 100*[0,]
expected_result = 100*[1,]
- src = gr.vector_source_f(data, False)
+ src = blocks.vector_source_f(data, False)
op = blocks.transcendental("cos", "float")
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
tb.connect(src, op)
tb.connect(op, dst)
@@ -56,9 +56,9 @@ class test_transcendental(gr_unittest.TestCase):
data = 100*[3,]
expected_result = 100*[math.log10(3),]
- src = gr.vector_source_f(data, False)
+ src = blocks.vector_source_f(data, False)
op = blocks.transcendental("log10", "float")
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
tb.connect(src, op)
tb.connect(op, dst)
@@ -74,9 +74,9 @@ class test_transcendental(gr_unittest.TestCase):
data = 100*[3,]
expected_result = 100*[math.tanh(3),]
- src = gr.vector_source_f(data, False)
+ src = blocks.vector_source_f(data, False)
op = blocks.transcendental("tanh", "float")
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
tb.connect(src, op)
tb.connect(op, dst)
diff --git a/gr-blocks/python/blocks/qa_type_conversions.py b/gr-blocks/python/blocks/qa_type_conversions.py
index 4eb3299255..0246320159 100755
--- a/gr-blocks/python/blocks/qa_type_conversions.py
+++ b/gr-blocks/python/blocks/qa_type_conversions.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
#
@@ -35,9 +35,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_char_to_float_identity(self):
src_data = (1, 2, 3, 4, 5)
expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- src = gr.vector_source_b(src_data)
+ src = blocks.vector_source_b(src_data)
op = blocks.char_to_float()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -45,9 +45,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_char_to_float_scale(self):
src_data = (1, 2, 3, 4, 5)
expected_data = (0.5, 1.0, 1.5, 2.0, 2.5)
- src = gr.vector_source_b(src_data)
+ src = blocks.vector_source_b(src_data)
op = blocks.char_to_float(scale=2.0)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -55,9 +55,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_char_to_short(self):
src_data = (1, 2, 3, 4, 5)
expected_data = (256, 512, 768, 1024, 1280)
- src = gr.vector_source_b(src_data)
+ src = blocks.vector_source_b(src_data)
op = blocks.char_to_short()
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -65,9 +65,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_complex_to_interleaved_short(self):
src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
expected_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_interleaved_short()
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -75,9 +75,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_complex_to_float_1(self):
src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_float()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -86,10 +86,10 @@ class test_type_conversions(gr_unittest.TestCase):
src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
expected_data1 = (1.0, 3.0, 5.0, 7.0, 9.0)
expected_data2 = (2.0, 4.0, 6.0, 8.0, 10.0)
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_float()
- dst1 = gr.vector_sink_f()
- dst2 = gr.vector_sink_f()
+ dst1 = blocks.vector_sink_f()
+ dst2 = blocks.vector_sink_f()
self.tb.connect(src, op)
self.tb.connect((op, 0), dst1)
self.tb.connect((op, 1), dst2)
@@ -100,9 +100,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_complex_to_real(self):
src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_real()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -110,9 +110,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_complex_to_imag(self):
src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
expected_data = (2.0, 4.0, 6.0, 8.0, 10.0)
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_imag()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -120,9 +120,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_complex_to_mag(self):
src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j)
expected_data = (sqrt(5), sqrt(25), sqrt(61), sqrt(113), sqrt(181))
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_mag()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data(), 5)
@@ -130,9 +130,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_complex_to_mag_squared(self):
src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j)
expected_data = (5.0, 25.0, 61.0, 113.0, 181.0)
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_mag_squared()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -140,9 +140,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_complex_to_arg(self):
src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j)
expected_data = (atan2(2, 1), atan2(-4,3), atan2(6, 5), atan2(-8, 7), atan2(10,-9))
- src = gr.vector_source_c(src_data)
+ src = blocks.vector_source_c(src_data)
op = blocks.complex_to_arg()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data(), 2)
@@ -150,9 +150,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_char_identity(self):
src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
expected_data = (1, 2, 3, 4, 5)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_char()
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -160,9 +160,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_char_scale(self):
src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
expected_data = (5, 10, 15, 20, 25)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_char(1, 5)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -170,9 +170,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_complex_1(self):
src_data = (1.0, 3.0, 5.0, 7.0, 9.0)
expected_data = (1+0j, 3+0j, 5+0j, 7+0j, 9+0j)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_complex()
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -181,10 +181,10 @@ class test_type_conversions(gr_unittest.TestCase):
src1_data = (1.0, 3.0, 5.0, 7.0, 9.0)
src2_data = (2.0, 4.0, 6.0, 8.0, 10.0)
expected_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
- src1 = gr.vector_source_f(src1_data)
- src2 = gr.vector_source_f(src2_data)
+ src1 = blocks.vector_source_f(src1_data)
+ src2 = blocks.vector_source_f(src2_data)
op = blocks.float_to_complex()
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(src1, (op, 0))
self.tb.connect(src2, (op, 1))
self.tb.connect(op, dst)
@@ -194,9 +194,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_int_identity(self):
src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
expected_data = (1, 2, 3, 4, 5)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_int()
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -204,9 +204,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_int_scale(self):
src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
expected_data = (5, 10, 15, 20, 25)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_int(1, 5)
- dst = gr.vector_sink_i()
+ dst = blocks.vector_sink_i()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -214,9 +214,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_short_identity(self):
src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
expected_data = (1, 2, 3, 4, 5)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_short()
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -224,9 +224,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_short_scale(self):
src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
expected_data = (5, 10, 15, 20, 25)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_short(1, 5)
- dst = gr.vector_sink_s()
+ dst = blocks.vector_sink_s()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -234,9 +234,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_float_to_uchar(self):
src_data = (1.0, -2.0, 3.0, -4.0, 256.0)
expected_data = (1, 0, 3, 0, 255)
- src = gr.vector_source_f(src_data)
+ src = blocks.vector_source_f(src_data)
op = blocks.float_to_uchar()
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -244,9 +244,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_int_to_float_identity(self):
src_data = (1, 2, 3, 4, 5)
expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op = blocks.int_to_float()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -254,9 +254,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_int_to_float_scale(self):
src_data = (1, 2, 3, 4, 5)
expected_data = (0.2, 0.4, 0.6, 0.8, 1.0)
- src = gr.vector_source_i(src_data)
+ src = blocks.vector_source_i(src_data)
op = blocks.int_to_float(1, 5)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
@@ -264,9 +264,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_interleaved_short_to_complex(self):
src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
expected_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
- src = gr.vector_source_s(src_data)
+ src = blocks.vector_source_s(src_data)
op = blocks.interleaved_short_to_complex()
- dst = gr.vector_sink_c()
+ dst = blocks.vector_sink_c()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -274,9 +274,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_short_to_char(self):
src_data = (256, 512, 768, 1024, 1280)
expected_data = (1, 2, 3, 4, 5)
- src = gr.vector_source_s(src_data)
+ src = blocks.vector_source_s(src_data)
op = blocks.short_to_char()
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -284,9 +284,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_short_to_float_identity(self):
src_data = (1, 2, 3, 4, 5)
expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- src = gr.vector_source_s(src_data)
+ src = blocks.vector_source_s(src_data)
op = blocks.short_to_float()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -294,9 +294,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_short_to_float_scale(self):
src_data = (5, 10, 15, 20, 25)
expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- src = gr.vector_source_s(src_data)
+ src = blocks.vector_source_s(src_data)
op = blocks.short_to_float(1, 5)
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
@@ -304,9 +304,9 @@ class test_type_conversions(gr_unittest.TestCase):
def test_uchar_to_float(self):
src_data = (1, 2, 3, 4, 5)
expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- src = gr.vector_source_b(src_data)
+ src = blocks.vector_source_b(src_data)
op = blocks.uchar_to_float()
- dst = gr.vector_sink_f()
+ dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_data, dst.data())
diff --git a/gr-blocks/python/blocks/qa_unpack_k_bits.py b/gr-blocks/python/blocks/qa_unpack_k_bits.py
index ffa00824d6..765c459dfa 100755
--- a/gr-blocks/python/blocks/qa_unpack_k_bits.py
+++ b/gr-blocks/python/blocks/qa_unpack_k_bits.py
@@ -35,9 +35,9 @@ class test_unpack(gr_unittest.TestCase):
def test_001(self):
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)
+ src = blocks.vector_source_b(src_data,False)
op = blocks.unpack_k_bits_bb(1)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_results, dst.data())
@@ -45,9 +45,9 @@ class test_unpack(gr_unittest.TestCase):
def test_002(self):
src_data = ( 2, 3, 0, 1)
expected_results = (1,0,1,1,0,0,0,1)
- src = gr.vector_source_b(src_data,False)
+ src = blocks.vector_source_b(src_data,False)
op = blocks.unpack_k_bits_bb(2)
- dst = gr.vector_sink_b()
+ dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(expected_results, dst.data())
diff --git a/gr-blocks/python/qa_affinity.py b/gr-blocks/python/qa_affinity.py
new file mode 100644
index 0000000000..f06b2804fe
--- /dev/null
+++ b/gr-blocks/python/qa_affinity.py
@@ -0,0 +1,50 @@
+#!/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_affinity(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ # Just run some data through and make sure it doesn't puke.
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+ src = blocks.vector_source_f(src_data)
+ snk = blocks.vector_sink_f()
+
+ src.set_processor_affinity([0,])
+ self.tb.connect(src, snk)
+ self.tb.run()
+
+ a = src.processor_affinity()
+
+ self.assertEqual((0,), a)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_affinity, "test_affinity.xml")
diff --git a/gr-blocks/python/qa_block_gateway.py b/gr-blocks/python/qa_block_gateway.py
new file mode 100644
index 0000000000..20a2660cba
--- /dev/null
+++ b/gr-blocks/python/qa_block_gateway.py
@@ -0,0 +1,256 @@
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import pmt
+import numpy
+import blocks_swig as blocks
+
+class add_2_f32_1_f32(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "add 2 f32",
+ in_sig = [numpy.float32, numpy.float32],
+ out_sig = [numpy.float32],
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = input_items[0] + input_items[1]
+ return len(output_items[0])
+
+class add_2_fc32_1_fc32(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "add 2 fc32",
+ in_sig = [numpy.complex64, numpy.complex64],
+ out_sig = [numpy.complex64],
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = input_items[0] + input_items[1]
+ return len(output_items[0])
+
+class convolve(gr.sync_block):
+ """
+ A demonstration using block history to properly perform a convolution.
+ """
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "convolve",
+ in_sig = [numpy.float32],
+ out_sig = [numpy.float32]
+ )
+ self._taps = [1, 0, 0, 0]
+ self.set_history(len(self._taps))
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = numpy.convolve(input_items[0], self._taps, mode='valid')
+ return len(output_items[0])
+
+class decim2x(gr.decim_block):
+ def __init__(self):
+ gr.decim_block.__init__(
+ self,
+ name = "decim2x",
+ in_sig = [numpy.float32],
+ out_sig = [numpy.float32],
+ decim = 2
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = input_items[0][::2]
+ return len(output_items[0])
+
+class interp2x(gr.interp_block):
+ def __init__(self):
+ gr.interp_block.__init__(
+ self,
+ name = "interp2x",
+ in_sig = [numpy.float32],
+ out_sig = [numpy.float32],
+ interp = 2
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][1::2] = input_items[0]
+ output_items[0][::2] = input_items[0]
+ return len(output_items[0])
+
+class tag_source(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "tag source",
+ in_sig = None,
+ out_sig = [numpy.float32],
+ )
+
+ def work(self, input_items, output_items):
+ num_output_items = len(output_items[0])
+
+ #put code here to fill the output items...
+
+ #make a new tag on the middle element every time work is called
+ count = self.nitems_written(0) + num_output_items/2
+ key = pmt.string_to_symbol("example_key")
+ value = pmt.string_to_symbol("example_value")
+ self.add_item_tag(0, count, key, value)
+
+ return num_output_items
+
+class tag_sink(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "tag sink",
+ in_sig = [numpy.float32],
+ out_sig = None,
+ )
+ self.key = None
+
+ def work(self, input_items, output_items):
+ num_input_items = len(input_items[0])
+
+ #put code here to process the input items...
+
+ #print all the tags received in this work call
+ nread = self.nitems_read(0)
+ tags = self.get_tags_in_range(0, nread, nread+num_input_items)
+ for tag in tags:
+ #print tag.offset
+ #print pmt.symbol_to_string(tag.key)
+ #print pmt.symbol_to_string(tag.value)
+ self.key = pmt.symbol_to_string(tag.key)
+
+ return num_input_items
+
+class fc32_to_f32_2(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "fc32_to_f32_2",
+ in_sig = [numpy.complex64],
+ out_sig = [(numpy.float32, 2)],
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][::,0] = numpy.real(input_items[0])
+ output_items[0][::,1] = numpy.imag(input_items[0])
+ return len(output_items[0])
+
+class vector_to_stream(gr.interp_block):
+ def __init__(self, itemsize, nitems_per_block):
+ gr.interp_block.__init__(
+ self,
+ name = "vector_to_stream",
+ in_sig = [(itemsize, nitems_per_block)],
+ out_sig = [itemsize],
+ interp = nitems_per_block
+ )
+ self.block_size = nitems_per_block
+
+ def work(self, input_items, output_items):
+ n = 0
+ for i in xrange(len(input_items[0])):
+ for j in xrange(self.block_size):
+ output_items[0][n] = input_items[0][i][j]
+ n += 1
+
+ return len(output_items[0])
+
+class test_block_gateway(gr_unittest.TestCase):
+
+ def test_add_f32(self):
+ tb = gr.top_block()
+ src0 = blocks.vector_source_f([1, 3, 5, 7, 9], False)
+ src1 = blocks.vector_source_f([0, 2, 4, 6, 8], False)
+ adder = add_2_f32_1_f32()
+ sink = blocks.vector_sink_f()
+ tb.connect((src0, 0), (adder, 0))
+ tb.connect((src1, 0), (adder, 1))
+ tb.connect(adder, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 5, 9, 13, 17))
+
+ def test_add_fc32(self):
+ tb = gr.top_block()
+ src0 = blocks.vector_source_c([1, 3j, 5, 7j, 9], False)
+ src1 = blocks.vector_source_c([0, 2j, 4, 6j, 8], False)
+ adder = add_2_fc32_1_fc32()
+ sink = blocks.vector_sink_c()
+ tb.connect((src0, 0), (adder, 0))
+ tb.connect((src1, 0), (adder, 1))
+ tb.connect(adder, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 5j, 9, 13j, 17))
+
+ def test_convolve(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False)
+ cv = convolve()
+ sink = blocks.vector_sink_f()
+ tb.connect(src, cv, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8))
+
+ def test_decim2x(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False)
+ d2x = decim2x()
+ sink = blocks.vector_sink_f()
+ tb.connect(src, d2x, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 3, 5, 7))
+
+ def test_interp2x(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_f([1, 3, 5, 7, 9], False)
+ i2x = interp2x()
+ sink = blocks.vector_sink_f()
+ tb.connect(src, i2x, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 1, 3, 3, 5, 5, 7, 7, 9, 9))
+
+ def test_tags(self):
+ src = tag_source()
+ sink = tag_sink()
+ head = blocks.head(gr.sizeof_float, 50000) #should be enough items to get a tag through
+ tb = gr.top_block()
+ tb.connect(src, head, sink)
+ tb.run()
+ self.assertEqual(sink.key, "example_key")
+
+ def test_fc32_to_f32_2(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_c([1+2j, 3+4j, 5+6j, 7+8j, 9+10j], False)
+ convert = fc32_to_f32_2()
+ v2s = vector_to_stream(numpy.float32, 2)
+ sink = blocks.vector_sink_f()
+ tb.connect(src, convert, v2s, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_block_gateway, "test_block_gateway.xml")
+
diff --git a/gr-blocks/python/qa_copy.py b/gr-blocks/python/qa_copy.py
new file mode 100755
index 0000000000..04f6454231
--- /dev/null
+++ b/gr-blocks/python/qa_copy.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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_copy(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_copy(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_result = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ src = blocks.vector_source_b(src_data)
+ op = blocks.copy(gr.sizeof_char)
+ dst = blocks.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ dst_data = dst.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_copy_drop (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_result = ()
+ src = blocks.vector_source_b(src_data)
+ op = blocks.copy(gr.sizeof_char)
+ op.set_enabled(False)
+ dst = blocks.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ dst_data = dst.data()
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_copy, "test_copy.xml")
diff --git a/gr-blocks/python/qa_cpp_py_binding.py b/gr-blocks/python/qa_cpp_py_binding.py
new file mode 100755
index 0000000000..c3d6a3f3bc
--- /dev/null
+++ b/gr-blocks/python/qa_cpp_py_binding.py
@@ -0,0 +1,174 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+#
+# This program tests mixed python and c++ ctrlport exports in a single app
+#
+
+import Ice
+import sys, time, random, numpy
+from gnuradio import gr, gr_unittest
+
+from gnuradio.ctrlport import GNURadio
+from gnuradio import ctrlport
+import os
+
+import blocks_swig as blocks
+
+def get1():
+ return "success"
+
+def get2():
+ return "failure"
+
+class inc_class:
+ def __init__(self):
+ self.val = 1
+ def pp(self):
+ self.val = self.val+1
+ return self.val
+
+get3 = inc_class()
+
+def get4():
+ random.seed(0)
+ rv = random.random()
+ return rv
+
+def get5():
+ numpy.random.seed(0)
+ samp_t = numpy.random.randn(24)+1j*numpy.random.randn(24);
+ samp_f = numpy.fft.fft(samp_t);
+ log_pow_f = 20*numpy.log10(numpy.abs(samp_f))
+ rv = list(log_pow_f)
+ return rv;
+
+def get6():
+ numpy.random.seed(0)
+ samp_t = numpy.random.randn(1024)+1j*numpy.random.randn(1024);
+ rv = list(samp_t)
+ return rv;
+
+class test_cpp_py_binding(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'True'
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ v1 = gr.RPC_get_string("pyland", "v1", "unit_1_string",
+ "Python Exported String", "", "", "",
+ gr.DISPNULL)
+ v1.activate(get1)
+
+ v2 = gr.RPC_get_string("pyland", "v2", "unit_2_string",
+ "Python Exported String", "", "", "",
+ gr.DISPNULL)
+ v2.activate(get2)
+
+ v3 = gr.RPC_get_int("pyland", "v3", "unit_3_int",
+ "Python Exported Int", 0, 100, 1,
+ gr.DISPNULL)
+ v3.activate(get3.pp)
+
+ v4 = gr.RPC_get_double("pyland", "time", "unit_4_time_double",
+ "Python Exported Double", 0, 1000, 1,
+ gr.DISPNULL)
+ v4.activate(get4)
+
+ v5 = gr.RPC_get_vector_float("pyland", "fvec", "unit_5_float_vector",
+ "Python Exported Float Vector", [], [], [],
+ gr.DISPTIME | gr.DISPOPTCPLX)
+ v5.activate(get5)
+
+ v6 = gr.RPC_get_vector_gr_complex("pyland", "cvec", "unit_6_gr_complex_vector",
+ "Python Exported Complex Vector", [], [], [],
+ gr.DISPXY | gr.DISPOPTSCATTER)
+ v6.activate(get6)
+
+ # print some variables locally
+ val = get1()
+ rval = v1.get()
+ self.assertEqual(val, rval)
+
+ val = get2()
+ rval = v2.get()
+ self.assertEqual(val, rval)
+
+ val = get3.pp()
+ rval = v3.get()
+ self.assertEqual(val+1, rval)
+
+ val = get4()
+ rval = v4.get()
+ self.assertEqual(val, rval)
+
+ val = get5()
+ rval = v5.get()
+ self.assertComplexTuplesAlmostEqual(val, rval, 5)
+
+ val = get6()
+ rval = v6.get()
+ self.assertComplexTuplesAlmostEqual(val, rval, 5)
+
+ def test_002(self):
+ data = range(1,9)
+
+ self.src = blocks.vector_source_c(data)
+ self.p1 = blocks.ctrlport_probe_c("aaa","C++ exported variable")
+ self.p2 = blocks.ctrlport_probe_c("bbb","C++ exported variable")
+ probe_name = self.p2.alias()
+
+ self.tb.connect(self.src, self.p1)
+ self.tb.connect(self.src, self.p2)
+ self.tb.start()
+
+ # Probes return complex values as list of floats with re, im
+ # Imaginary parts of this data set are 0.
+ expected_result = [1, 0, 2, 0, 3, 0, 4, 0,
+ 5, 0, 6, 0, 7, 0, 8, 0]
+
+ # Make sure we have time for flowgraph to run
+ time.sleep(0.1)
+
+ # Get available endpoint
+ ep = gr.rpcmanager_get().endpoints()[0]
+
+ # Initialize a simple Ice client from endpoint
+ ic = Ice.initialize(sys.argv)
+ base = ic.stringToProxy(ep)
+ radio = GNURadio.ControlPortPrx.checkedCast(base)
+
+ # Get all exported knobs
+ ret = radio.get([probe_name + "::bbb"])
+ for name in ret.keys():
+ result = ret[name].value
+ self.assertEqual(result, expected_result)
+
+ self.tb.stop()
+
+if __name__ == '__main__':
+ gr_unittest.run(test_cpp_py_binding, "test_cpp_py_binding.xml")
+
diff --git a/gr-blocks/python/qa_cpp_py_binding_set.py b/gr-blocks/python/qa_cpp_py_binding_set.py
new file mode 100755
index 0000000000..28ddc48b2f
--- /dev/null
+++ b/gr-blocks/python/qa_cpp_py_binding_set.py
@@ -0,0 +1,152 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+#
+# This program tests mixed python and c++ GRCP sets in a single app
+#
+
+import Ice
+import sys, time, random, numpy
+from gnuradio import gr, gr_unittest
+
+from gnuradio.ctrlport import GNURadio
+from gnuradio import ctrlport
+import os
+
+import blocks_swig as blocks
+
+class inc_class:
+ def __init__(self,val):
+ self.val = val;
+
+ def _get(self):
+ #print "returning get (val = %s)"%(str(self.val));
+ return self.val;
+
+ def _set(self,val):
+ #print "updating val to %s"%(str(val));
+ self.val = val;
+ return;
+
+getset1 = inc_class(10);
+getset2 = inc_class(100.0);
+getset3 = inc_class("test");
+
+class test_cpp_py_binding_set(gr_unittest.TestCase):
+ def setUp(self):
+ self.tb = gr.top_block()
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'True'
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+
+ g1 = gr.RPC_get_int("pyland", "v1", "unit_1_int",
+ "Python Exported Int", 0, 100, 10,
+ gr.DISPNULL)
+ g1.activate(getset1._get)
+ s1 = gr.RPC_get_int("pyland", "v1", "unit_1_int",
+ "Python Exported Int", 0, 100, 10,
+ gr.DISPNULL)
+ s1.activate(getset1._set)
+ time.sleep(0.01)
+
+ # test int variables
+ getset1._set(21)
+ val = getset1._get()
+ rval = g1.get()
+ self.assertEqual(val, rval)
+
+ g2 = gr.RPC_get_float("pyland", "v2", "unit_2_float",
+ "Python Exported Float", -100, 1000.0, 100.0,
+ gr.DISPNULL)
+ g2.activate(getset2._get)
+ s2 = gr.RPC_get_float("pyland", "v2", "unit_2_float",
+ "Python Exported Float", -100, 1000.0, 100.0,
+ gr.DISPNULL)
+ s2.activate(getset2._set)
+ time.sleep(0.01)
+
+ # test float variables
+ getset2._set(123.456)
+ val = getset2._get()
+ rval = g2.get()
+ self.assertAlmostEqual(val, rval, 4)
+
+ g3 = gr.RPC_get_string("pyland", "v3", "unit_3_string",
+ "Python Exported String", "", "", "",
+ gr.DISPNULL)
+ g3.activate(getset3._get)
+ s3 = gr.RPC_get_string("pyland", "v3", "unit_3_string",
+ "Python Exported String", "", "", "",
+ gr.DISPNULL)
+ s3.activate(getset3._set)
+ time.sleep(0.01)
+
+ # test string variables
+ getset3._set("third test")
+ val = getset3._get()
+ rval = g3.get()
+ self.assertEqual(val, rval)
+
+
+ def test_002(self):
+ data = range(1, 10)
+
+ self.src = blocks.vector_source_c(data, True)
+ self.p = blocks.nop(gr.sizeof_gr_complex)
+ self.p.set_ctrlport_test(0);
+ probe_info = self.p.alias()
+
+ self.tb.connect(self.src, self.p)
+
+ # Get available endpoint
+ ep = gr.rpcmanager_get().endpoints()[0]
+
+ # Initialize a simple Ice client from endpoint
+ ic = Ice.initialize(sys.argv)
+ base = ic.stringToProxy(ep)
+ radio = GNURadio.ControlPortPrx.checkedCast(base)
+
+ self.tb.start()
+
+ # Make sure we have time for flowgraph to run
+ time.sleep(0.1)
+
+ # Get all exported knobs
+ key_name_test = probe_info+"::test"
+ ret = radio.get([key_name_test,])
+
+ ret[key_name_test].value = 10
+ radio.set({key_name_test: ret[key_name_test]})
+
+ ret = radio.get([])
+ result_test = ret[key_name_test].value
+ self.assertEqual(result_test, 10)
+
+ self.tb.stop()
+ self.tb.wait()
+
+if __name__ == '__main__':
+ gr_unittest.run(test_cpp_py_binding_set, "test_cpp_py_binding_set.xml")
+
diff --git a/gr-blocks/python/qa_endian_swap.py b/gr-blocks/python/qa_endian_swap.py
new file mode 100644
index 0000000000..5180293052
--- /dev/null
+++ b/gr-blocks/python/qa_endian_swap.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import ctypes
+
+class test_endian_swap(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = [1,2,3,4]
+ expected_result = [256, 512, 768, 1024];
+
+ src = blocks.vector_source_s(src_data)
+ op = blocks.endian_swap(2)
+ dst = blocks.vector_sink_s()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ src_data = [1,2,3,4]
+ expected_result = [16777216, 33554432, 50331648, 67108864];
+
+ src = blocks.vector_source_i(src_data)
+ op = blocks.endian_swap(4)
+ dst = blocks.vector_sink_i()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_endian_swap, "test_endian_swap.xml")
+
diff --git a/gr-blocks/python/qa_file_source_sink.py b/gr-blocks/python/qa_file_source_sink.py
new file mode 100644
index 0000000000..cf3b512db0
--- /dev/null
+++ b/gr-blocks/python/qa_file_source_sink.py
@@ -0,0 +1,94 @@
+#!/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 os
+
+class test_file_source_sink(gr_unittest.TestCase):
+
+ def setUp (self):
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = range(1000)
+ expected_result = range(1000)
+
+ filename = "tmp.32f"
+ src = blocks.vector_source_f(src_data)
+ snk = blocks.file_sink(gr.sizeof_float, filename)
+ snk.set_unbuffered(True)
+
+ src2 = blocks.file_source(gr.sizeof_float, filename)
+ snk2 = blocks.vector_sink_f()
+
+ self.tb.connect(src, snk)
+ self.tb.run()
+
+ self.tb.disconnect(src, snk)
+ self.tb.connect(src2, snk2)
+ self.tb.run()
+
+ os.remove(filename)
+
+ result_data = snk2.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_descriptor_001(self):
+ src_data = range(1000)
+ expected_result = range(1000)
+
+ filename = "tmp.32f"
+ fhandle0 = open(filename, "wb")
+ fd0 = fhandle0.fileno()
+
+ src = blocks.vector_source_f(src_data)
+ snk = blocks.file_descriptor_sink(gr.sizeof_float, fd0)
+
+ self.tb.connect(src, snk)
+ self.tb.run()
+ os.fsync(fd0)
+ fhandle0.close()
+
+ fhandle1 = open(filename, "rb")
+ fd1 = fhandle1.fileno()
+ src2 = blocks.file_descriptor_source(gr.sizeof_float, fd1, False)
+ snk2 = blocks.vector_sink_f()
+
+ self.tb.disconnect(src, snk)
+ self.tb.connect(src2, snk2)
+ self.tb.run()
+ os.fsync(fd1)
+ fhandle1.close()
+
+ os.remove(filename)
+
+ result_data = snk2.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_file_source_sink, "test_file_source_sink.xml")
+
diff --git a/gr-blocks/python/qa_head.py b/gr-blocks/python/qa_head.py
new file mode 100755
index 0000000000..39b1255978
--- /dev/null
+++ b/gr-blocks/python/qa_head.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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_head(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_head(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_result = (1, 2, 3, 4)
+ src1 = blocks.vector_source_i(src_data)
+ op = blocks.head(gr.sizeof_int, 4)
+ dst1 = blocks.vector_sink_i()
+ self.tb.connect(src1, op)
+ self.tb.connect(op, dst1)
+ self.tb.run()
+ dst_data = dst1.data()
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_head, "test_head.xml")
diff --git a/gr-blocks/python/qa_hier_block2.py b/gr-blocks/python/qa_hier_block2.py
new file mode 100755
index 0000000000..f482fda8cf
--- /dev/null
+++ b/gr-blocks/python/qa_hier_block2.py
@@ -0,0 +1,398 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import numpy
+
+class add_ff(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "add_ff",
+ in_sig = [numpy.float32, numpy.float32],
+ out_sig = [numpy.float32],
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = input_items[0] + input_items[1]
+ return len(output_items[0])
+
+class multiply_const_ff(gr.sync_block):
+ def __init__(self, k):
+ gr.sync_block.__init__(
+ self,
+ name = "multiply_ff",
+ in_sig = [numpy.float32],
+ out_sig = [numpy.float32],
+ )
+ self.k = k
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = map(lambda x: self.k*x, input_items[0])
+ return len(output_items[0])
+
+class test_hier_block2(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_001_make(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ self.assertEqual("test_block", hblock.name())
+ self.assertEqual(1, hblock.input_signature().max_streams())
+ self.assertEqual(1, hblock.output_signature().min_streams())
+ self.assertEqual(1, hblock.output_signature().max_streams())
+ self.assertEqual(gr.sizeof_int, hblock.output_signature().sizeof_stream_item(0))
+
+ def test_002_connect_input(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+
+ def test_004_connect_output(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+
+ def test_005_connect_output_in_use(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ nop2 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(nop2, hblock))
+
+ def test_006_connect_invalid_src_port_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect((hblock, -1), nop1))
+
+ def test_005_connect_invalid_src_port_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect((hblock, 1), nop1))
+
+ def test_007_connect_invalid_dst_port_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ nop2 = blocks.nop(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(nop1, (nop2, -1)))
+
+ def test_008_connect_invalid_dst_port_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.null_sink(gr.sizeof_int)
+ nop2 = blocks.null_sink(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(nop1, (nop2, 1)))
+
+ def test_009_check_topology(self):
+ hblock = gr.top_block("test_block")
+ hblock.check_topology(0, 0)
+
+ def test_010_run(self):
+ expected = (1.0, 2.0, 3.0, 4.0)
+ hblock = gr.top_block("test_block")
+ src = blocks.vector_source_f(expected, False)
+ sink1 = blocks.vector_sink_f()
+ sink2 = blocks.vector_sink_f()
+ hblock.connect(src, sink1)
+ hblock.connect(src, sink2)
+ hblock.run()
+ actual1 = sink1.data()
+ actual2 = sink2.data()
+ self.assertEquals(expected, actual1)
+ self.assertEquals(expected, actual2)
+
+ def test_012_disconnect_input(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ hblock.disconnect(hblock, nop1)
+
+ def test_013_disconnect_input_not_connected(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ nop2 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(hblock, nop2))
+
+ def test_014_disconnect_input_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect((hblock, -1), nop1))
+
+ def test_015_disconnect_input_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect((hblock, 1), nop1))
+
+ def test_016_disconnect_output(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ hblock.disconnect(nop1, hblock)
+
+ def test_017_disconnect_output_not_connected(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ nop2 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(nop2, hblock))
+
+ def test_018_disconnect_output_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(nop1, (hblock, -1)))
+
+ def test_019_disconnect_output_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(nop1, (hblock, 1)))
+
+ def test_020_run(self):
+ hblock = gr.top_block("test_block")
+ data = (1.0, 2.0, 3.0, 4.0)
+ src = blocks.vector_source_f(data, False)
+ dst = blocks.vector_sink_f()
+ hblock.connect(src, dst)
+ hblock.run()
+ self.assertEquals(data, dst.data())
+
+ def test_021_connect_single(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ hblock.connect(blk)
+
+ def test_022_connect_single_with_ports(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(blk))
+
+ def test_023_connect_single_twice(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ hblock.connect(blk)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(blk))
+
+ def test_024_disconnect_single(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ hblock.connect(blk)
+ hblock.disconnect(blk)
+
+ def test_025_disconnect_single_not_connected(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(blk))
+
+ def test_026_run_single(self):
+ expected_data = (1.0,)
+ tb = gr.top_block("top_block")
+ hb = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ src = blocks.vector_source_f(expected_data)
+ dst = blocks.vector_sink_f()
+ hb.connect(src, dst)
+ tb.connect(hb)
+ tb.run()
+ self.assertEquals(expected_data, dst.data())
+
+ def test_027a_internally_unconnected_input(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hsrc = blocks.vector_source_b([1,])
+ hb.connect(hsrc, hb) # wire output internally
+ src = blocks.vector_source_b([1, ])
+ dst = blocks.vector_sink_b()
+ tb.connect(src, hb, dst) # hb's input is not connected internally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_027b_internally_unconnected_output(self):
+ tb = gr.top_block()
+
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hdst = blocks.vector_sink_b()
+ hb.connect(hb, hdst) # wire input internally
+ src = blocks.vector_source_b([1, ])
+ dst = blocks.vector_sink_b()
+ tb.connect(src, hb, dst) # hb's output is not connected internally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_027c_fully_unconnected_output(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hsrc = blocks.vector_sink_b()
+ hb.connect(hb, hsrc) # wire input internally
+ src = blocks.vector_source_b([1, ])
+ dst = blocks.vector_sink_b()
+ tb.connect(src, hb) # hb's output is not connected internally or externally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_027d_fully_unconnected_input(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hdst = blocks.vector_source_b([1,])
+ hb.connect(hdst, hb) # wire output internally
+ dst = blocks.vector_sink_b()
+ tb.connect(hb, dst) # hb's input is not connected internally or externally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_028_singleton_reconfigure(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0))
+ src = blocks.vector_source_b([1, ])
+ dst = blocks.vector_sink_b()
+ hb.connect(src, dst)
+ tb.connect(hb) # Singleton connect
+ tb.lock()
+ tb.disconnect_all()
+ tb.connect(src, dst)
+ tb.unlock()
+
+ def test_029_singleton_disconnect(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_b([1, ])
+ dst = blocks.vector_sink_b()
+ tb.connect(src, dst)
+ tb.disconnect(src) # Singleton disconnect
+ tb.connect(src, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (1,))
+
+ def test_030_nested_input(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_b([1,])
+ hb1 = gr.hier_block2("hb1",
+ gr.io_signature(1, 1, gr.sizeof_char),
+ gr.io_signature(0, 0, 0))
+ hb2 = gr.hier_block2("hb2",
+ gr.io_signature(1, 1, gr.sizeof_char),
+ gr.io_signature(0, 0, 0))
+ dst = blocks.vector_sink_b()
+ tb.connect(src, hb1)
+ hb1.connect(hb1, hb2)
+ hb2.connect(hb2, blocks.copy(gr.sizeof_char), dst)
+ tb.run()
+ self.assertEquals(dst.data(), (1,))
+
+ def test_031_multiple_internal_inputs(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_f([1.0,])
+ hb = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+ m1 = multiply_const_ff(1.0)
+ m2 = multiply_const_ff(2.0)
+ add = add_ff()
+ hb.connect(hb, m1) # m1 is connected to hb external input #0
+ hb.connect(hb, m2) # m2 is also connected to hb external input #0
+ hb.connect(m1, (add, 0))
+ hb.connect(m2, (add, 1))
+ hb.connect(add, hb) # add is connected to hb external output #0
+ dst = blocks.vector_sink_f()
+ tb.connect(src, hb, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (3.0,))
+
+ def test_032_nested_multiple_internal_inputs(self):
+ tb = gr.top_block()
+ src = blocks.vector_source_f([1.0,])
+ hb = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+ hb2 = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+
+ m1 = multiply_const_ff(1.0)
+ m2 = multiply_const_ff(2.0)
+ add = add_ff()
+ hb2.connect(hb2, m1) # m1 is connected to hb2 external input #0
+ hb2.connect(hb2, m2) # m2 is also connected to hb2 external input #0
+ hb2.connect(m1, (add, 0))
+ hb2.connect(m2, (add, 1))
+ hb2.connect(add, hb2) # add is connected to hb2 external output #0
+ hb.connect(hb, hb2, hb) # hb as hb2 as nested internal block
+ dst = blocks.vector_sink_f()
+ tb.connect(src, hb, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (3.0,))
+
+
+if __name__ == "__main__":
+ gr_unittest.run(test_hier_block2, "test_hier_block2.xml")
diff --git a/gr-blocks/python/qa_message_tags.py b/gr-blocks/python/qa_message_tags.py
new file mode 100644
index 0000000000..0ab857b1aa
--- /dev/null
+++ b/gr-blocks/python/qa_message_tags.py
@@ -0,0 +1,27 @@
+import time
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_message_tags (gr_unittest.TestCase):
+
+ def test_1 (self):
+ data = ('hello', 'you', 'there')
+ tx_msgq = gr.msg_queue ()
+ rx_msgq = gr.msg_queue ()
+ for d in data:
+ tx_msgq.insert_tail(gr.message_from_string(d))
+ tb = gr.top_block()
+ src = blocks.message_source(gr.sizeof_char, tx_msgq, "packet_length")
+ snk = blocks.message_sink(gr.sizeof_char, rx_msgq, False, "packet_length")
+ tb.connect(src, snk)
+ tb.start()
+ time.sleep(1)
+ tb.stop()
+ for d in data:
+ msg = rx_msgq.delete_head()
+ contents = msg.to_string()
+ self.assertEqual(d, contents)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_message_tags, "test_message_tags.xml")
diff --git a/gr-blocks/python/qa_null_sink_source.py b/gr-blocks/python/qa_null_sink_source.py
new file mode 100644
index 0000000000..60552cb207
--- /dev/null
+++ b/gr-blocks/python/qa_null_sink_source.py
@@ -0,0 +1,46 @@
+#!/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_null_sink_source(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ # Just running some data through null source/sink
+ src = blocks.null_source(gr.sizeof_float)
+ hed = blocks.head(gr.sizeof_float, 100)
+ dst = blocks.null_sink(gr.sizeof_float)
+
+ self.tb.connect(src, hed, dst)
+ self.tb.run()
+
+if __name__ == '__main__':
+ gr_unittest.run(test_null_sink_source, "test_null_sink_source.xml")
+
diff --git a/gr-blocks/python/qa_plateau_detector_fb.py b/gr-blocks/python/qa_plateau_detector_fb.py
new file mode 100755
index 0000000000..2f4b643fe0
--- /dev/null
+++ b/gr-blocks/python/qa_plateau_detector_fb.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class qa_plateau_detector_fb (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ # | Spur spike 1 | Plateau | Spur spike 2
+ test_signal = (0, 1, .2, .4, .6, .8, 1, 1, 1, 1, 1, .8, .6, .4, 1, 0)
+ expected_sig = (0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)
+ # | Center of Plateau
+ sink = blocks.vector_sink_b()
+ self.tb.connect(blocks.vector_source_f(test_signal), blocks.plateau_detector_fb(5), sink)
+ self.tb.run ()
+ self.assertEqual(expected_sig, sink.data())
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_plateau_detector_fb, "qa_plateau_detector_fb.xml")
diff --git a/gr-blocks/python/qa_python_message_passing.py b/gr-blocks/python/qa_python_message_passing.py
new file mode 100644
index 0000000000..58bf9e59bd
--- /dev/null
+++ b/gr-blocks/python/qa_python_message_passing.py
@@ -0,0 +1,123 @@
+#!/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 pmt
+import numpy
+import time
+import blocks_swig as blocks
+
+# Simple block to generate messages
+class message_generator(gr.sync_block):
+ def __init__(self, msg_list, msg_interval):
+ gr.sync_block.__init__(
+ self,
+ name = "message generator",
+ in_sig = [numpy.float32],
+ out_sig = None
+ )
+ self.msg_list = msg_list
+ self.msg_interval = msg_interval
+ self.msg_ctr = 0
+ self.message_port_register_out(pmt.intern('out_port'))
+
+
+ def work(self, input_items, output_items):
+ inLen = len(input_items[0])
+ while self.msg_ctr < len(self.msg_list) and \
+ (self.msg_ctr * self.msg_interval) < \
+ (self.nitems_read(0) + inLen):
+ self.message_port_pub(pmt.intern('out_port'),
+ self.msg_list[self.msg_ctr])
+ self.msg_ctr += 1
+ return inLen
+
+# Simple block to consume messages
+class message_consumer(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "message consumer",
+ in_sig = None,
+ out_sig = None
+ )
+ self.msg_list = []
+ self.message_port_register_in(pmt.intern('in_port'))
+ self.set_msg_handler(pmt.intern('in_port'),
+ self.handle_msg)
+
+ def handle_msg(self, msg):
+ # Create a new PMT from long value and put in list
+ self.msg_list.append(pmt.from_long(pmt.to_long(msg)))
+
+class test_python_message_passing(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ num_msgs = 10
+ msg_interval = 1000
+ msg_list = []
+ for i in range(num_msgs):
+ msg_list.append(pmt.from_long(i))
+
+ # Create vector source with dummy data to trigger messages
+ src_data = []
+ for i in range(num_msgs*msg_interval):
+ src_data.append(float(i))
+ src = blocks.vector_source_f(src_data, False)
+ msg_gen = message_generator(msg_list, msg_interval)
+ msg_cons = message_consumer()
+
+ # Connect vector source to message gen
+ self.tb.connect(src, msg_gen)
+
+ # Connect message generator to message consumer
+ self.tb.msg_connect(msg_gen, 'out_port', msg_cons, 'in_port')
+
+ # Verify that the messgae port query functions work
+ self.assertEqual(pmt.symbol_to_string(pmt.vector_ref(
+ msg_gen.message_ports_out(), 0)), 'out_port')
+ self.assertEqual(pmt.symbol_to_string(pmt.vector_ref(
+ msg_cons.message_ports_in(), 0)), 'in_port')
+
+ # Run to verify message passing
+ self.tb.start()
+
+ # Wait for all messages to be sent
+ while msg_gen.msg_ctr < num_msgs:
+ time.sleep(0.5)
+ self.tb.stop()
+ self.tb.wait()
+
+ # Verify that the message consumer got all the messages
+ self.assertEqual(num_msgs, len(msg_cons.msg_list))
+ for i in range(num_msgs):
+ self.assertTrue(pmt.equal(msg_list[i], msg_cons.msg_list[i]))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_python_message_passing,
+ 'test_python_message_passing.xml')
diff --git a/gr-blocks/python/qa_repack_bits_bb.py b/gr-blocks/python/qa_repack_bits_bb.py
new file mode 100755
index 0000000000..9da6cf26c6
--- /dev/null
+++ b/gr-blocks/python/qa_repack_bits_bb.py
@@ -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.
+#
+
+import random
+from gnuradio import gr, gr_unittest
+import pmt
+import blocks_swig as blocks
+
+class qa_repack_bits_bb (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_simple (self):
+ """ Very simple test, 2 bits -> 1 """
+ src_data = (0b11, 0b01, 0b10)
+ expected_data = (0b1, 0b1, 0b1, 0b0, 0b0, 0b1)
+ k = 2
+ l = 1
+ src = blocks.vector_source_b(src_data, False, 1)
+ repack = blocks.repack_bits_bb(k, l)
+ sink = blocks.vector_sink_b()
+ self.tb.connect(src, repack, sink)
+ self.tb.run ()
+ self.assertEqual(sink.data(), expected_data)
+
+ def test_002_three (self):
+ """ 8 -> 3 """
+ src_data = (0b11111101, 0b11111111, 0b11111111)
+ expected_data = (0b101,) + (0b111,) * 7
+ k = 8
+ l = 3
+ src = blocks.vector_source_b(src_data, False, 1)
+ repack = blocks.repack_bits_bb(k, l)
+ sink = blocks.vector_sink_b()
+ self.tb.connect(src, repack, sink)
+ self.tb.run ()
+ self.assertEqual(sink.data(), expected_data)
+
+ def test_003_lots_of_bytes (self):
+ """ Lots and lots of bytes, multiple packer stages """
+ src_data = tuple([random.randint(0, 255) for x in range(3*5*7*8 * 10)])
+ src = blocks.vector_source_b(src_data, False, 1)
+ repack1 = blocks.repack_bits_bb(8, 3)
+ repack2 = blocks.repack_bits_bb(3, 5)
+ repack3 = blocks.repack_bits_bb(5, 7)
+ repack4 = blocks.repack_bits_bb(7, 8)
+ sink = blocks.vector_sink_b()
+ self.tb.connect(src, repack1, repack2, repack3, repack4, sink)
+ self.tb.run ()
+ self.assertEqual(sink.data(), src_data)
+
+ def test_004_three_with_tags (self):
+ """ 8 -> 3 """
+ src_data = (0b11111101, 0b11111111)
+ expected_data = (0b101,) + (0b111,) * 4 + (0b001,)
+ k = 8
+ l = 3
+ tag_name = "len"
+ tag = gr.gr_tag_t()
+ tag.offset = 0
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(src_data))
+ src = blocks.vector_source_b(src_data, False, 1, (tag,))
+ repack = blocks.repack_bits_bb(k, l, tag_name)
+ sink = blocks.vector_sink_b()
+ self.tb.connect(src, repack, sink)
+ self.tb.run ()
+ self.assertEqual(sink.data(), expected_data)
+ try:
+ out_tag = sink.tags()[0]
+ except:
+ self.assertFail()
+ self.assertEqual(out_tag.offset, 0)
+ self.assertEqual(pmt.symbol_to_string(out_tag.key), tag_name)
+ self.assertEqual(pmt.to_long(out_tag.value), len(expected_data))
+
+ def test_005_three_with_tags_trailing (self):
+ """ 3 -> 8, trailing bits """
+ src_data = (0b101,) + (0b111,) * 4 + (0b001,)
+ expected_data = (0b11111101, 0b11111111)
+ k = 3
+ l = 8
+ tag_name = "len"
+ tag = gr.gr_tag_t()
+ tag.offset = 0
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(src_data))
+ src = blocks.vector_source_b(src_data, False, 1, (tag,))
+ repack = blocks.repack_bits_bb(k, l, tag_name, True)
+ sink = blocks.vector_sink_b()
+ self.tb.connect(src, repack, sink)
+ self.tb.run ()
+ self.assertEqual(sink.data(), expected_data)
+ try:
+ out_tag = sink.tags()[0]
+ except:
+ self.assertFail()
+ self.assertEqual(out_tag.offset, 0)
+ self.assertEqual(pmt.symbol_to_string(out_tag.key), tag_name)
+ self.assertEqual(pmt.to_long(out_tag.value), len(expected_data))
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_repack_bits_bb, "qa_repack_bits_bb.xml")
+
diff --git a/gr-blocks/python/qa_skiphead.py b/gr-blocks/python/qa_skiphead.py
new file mode 100755
index 0000000000..50a9bbc639
--- /dev/null
+++ b/gr-blocks/python/qa_skiphead.py
@@ -0,0 +1,103 @@
+#!/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_skiphead(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+ self.src_data = [int(x) for x in range(65536)]
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_skip_0(self):
+ skip_cnt = 0
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = blocks.vector_source_i(self.src_data)
+ op = blocks.skiphead(gr.sizeof_int, skip_cnt)
+ dst1 = blocks.vector_sink_i()
+ self.tb.connect(src1, op, dst1)
+ self.tb.run()
+ dst_data = dst1.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_skip_1(self):
+ skip_cnt = 1
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = blocks.vector_source_i(self.src_data)
+ op = blocks.skiphead(gr.sizeof_int, skip_cnt)
+ dst1 = blocks.vector_sink_i()
+ self.tb.connect(src1, op, dst1)
+ self.tb.run()
+ dst_data = dst1.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_skip_1023(self):
+ skip_cnt = 1023
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = blocks.vector_source_i(self.src_data)
+ op = blocks.skiphead(gr.sizeof_int, skip_cnt)
+ dst1 = blocks.vector_sink_i()
+ self.tb.connect(src1, op, dst1)
+ self.tb.run()
+ dst_data = dst1.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_skip_6339(self):
+ skip_cnt = 6339
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = blocks.vector_source_i(self.src_data)
+ op = blocks.skiphead(gr.sizeof_int, skip_cnt)
+ dst1 = blocks.vector_sink_i()
+ self.tb.connect(src1, op, dst1)
+ self.tb.run()
+ dst_data = dst1.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_skip_12678(self):
+ skip_cnt = 12678
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = blocks.vector_source_i(self.src_data)
+ op = blocks.skiphead(gr.sizeof_int, skip_cnt)
+ dst1 = blocks.vector_sink_i()
+ self.tb.connect(src1, op, dst1)
+ self.tb.run()
+ dst_data = dst1.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_skip_all(self):
+ skip_cnt = len(self.src_data)
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = blocks.vector_source_i(self.src_data)
+ op = blocks.skiphead(gr.sizeof_int, skip_cnt)
+ dst1 = blocks.vector_sink_i()
+ self.tb.connect(src1, op, dst1)
+ self.tb.run()
+ dst_data = dst1.data()
+ self.assertEqual(expected_result, dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_skiphead, "test_skiphead.xml")
diff --git a/gr-blocks/python/qa_tag_file_sink.py b/gr-blocks/python/qa_tag_file_sink.py
new file mode 100644
index 0000000000..e41e6544fd
--- /dev/null
+++ b/gr-blocks/python/qa_tag_file_sink.py
@@ -0,0 +1,72 @@
+#!/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 os, struct
+
+class test_tag_file_sink(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ trg_data = (-1, -1, 1, 1, -1, -1, 1, 1, -1, -1)
+ src = blocks.vector_source_i(src_data)
+ trg = blocks.vector_source_s(trg_data)
+ op = blocks.burst_tagger(gr.sizeof_int)
+ snk = blocks.tagged_file_sink(gr.sizeof_int, 1)
+ self.tb.connect(src, (op,0))
+ self.tb.connect(trg, (op,1))
+ self.tb.connect(op, snk)
+ self.tb.run()
+
+ # Tagged file sink gets 2 burst tags at index 2 and index 5.
+ # Creates two new files, each with two integers in them from
+ # src_data at these indexes (3,4) and (7,8).
+ file0 = "file{0}_0_2.00000000.dat".format(snk.unique_id())
+ file1 = "file{0}_1_6.00000000.dat".format(snk.unique_id())
+
+ # Open the files and read in the data, then remove the files
+ # to clean up the directory.
+ outfile0 = file(file0, 'rb')
+ outfile1 = file(file1, 'rb')
+ data0 = outfile0.read(8)
+ data1 = outfile1.read(8)
+ outfile0.close()
+ outfile1.close()
+ os.remove(file0)
+ os.remove(file1)
+
+ # Convert the 8 bytes from the files into a tuple of 2 ints.
+ idata0 = struct.unpack('ii', data0)
+ idata1 = struct.unpack('ii', data1)
+
+ self.assertEqual(idata0, (3, 4))
+ self.assertEqual(idata1, (7, 8))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_tag_file_sink, "test_tag_file_sink.xml")
diff --git a/gr-blocks/python/qa_tagged_stream_mux.py b/gr-blocks/python/qa_tagged_stream_mux.py
new file mode 100755
index 0000000000..1759c44623
--- /dev/null
+++ b/gr-blocks/python/qa_tagged_stream_mux.py
@@ -0,0 +1,111 @@
+#!/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 pmt
+import blocks_swig as blocks
+import numpy
+
+def make_len_tags(tupl, key):
+ tags = []
+ tag = gr.gr_tag_t()
+ tag.key = pmt.string_to_symbol(key)
+ n_read = 0
+ for element in tupl:
+ tag.offset = n_read
+ n_read += len(element)
+ tag.value = pmt.to_pmt(len(element))
+ tags.append(tag)
+ return tags
+
+def make_len_tag(offset, key, value):
+ tag = gr.gr_tag_t()
+ tag.offset = offset
+ tag.key = pmt.string_to_symbol(key)
+ tag.value = pmt.to_pmt(value)
+ return tag
+
+
+class qa_tagged_stream_mux (gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_1(self):
+ datas = (
+ 0, 1, 2, 5, 6, 10, 14, 15, 16,
+ 3, 4, 7, 8, 9, 11, 12, 13, 17
+ )
+ expected = tuple(range(18))
+
+ tagname = "packet_length"
+ len_tags_0 = (
+ make_len_tag(0, tagname, 3),
+ make_len_tag(3, tagname, 2),
+ make_len_tag(5, tagname, 1),
+ make_len_tag(6, tagname, 3)
+ )
+ len_tags_1 = (
+ make_len_tag(0, tagname, 2),
+ make_len_tag(2, tagname, 3),
+ make_len_tag(5, tagname, 3),
+ make_len_tag(8, tagname, 1)
+ )
+ test_tag_0 = gr.gr_tag_t()
+ test_tag_0.key = pmt.string_to_symbol('spam')
+ test_tag_0.offset = 4 # On the second '1'
+ test_tag_0.value = pmt.to_pmt(42)
+ test_tag_1 = gr.gr_tag_t()
+ test_tag_1.key = pmt.string_to_symbol('eggs')
+ test_tag_1.offset = 3 # On the first '3' of the 2nd stream
+ test_tag_1.value = pmt.to_pmt(23)
+
+ src0 = blocks.vector_source_b(datas[0:9], False, 1, len_tags_0 + (test_tag_0,))
+ src1 = blocks.vector_source_b(datas[9:], False, 1, len_tags_1 + (test_tag_1,))
+ tagged_stream_mux = blocks.tagged_stream_mux(gr.sizeof_char, tagname)
+ snk = blocks.vector_sink_b()
+ self.tb.connect(src0, (tagged_stream_mux, 0))
+ self.tb.connect(src1, (tagged_stream_mux, 1))
+ self.tb.connect(tagged_stream_mux, snk)
+ self.tb.run()
+
+ self.assertEqual(expected, snk.data())
+
+ tags = [gr.tag_to_python(x) for x in snk.tags()]
+ tags = sorted([(x.offset, x.key, x.value) for x in tags])
+ tags_expected = [
+ (0, 'packet_length', 5),
+ (5, 'packet_length', 5),
+ (6, 'spam', 42),
+ (8, 'eggs', 23),
+ (10, 'packet_length', 4),
+ (14, 'packet_length', 4)
+ ]
+ self.assertEqual(tags, tags_expected)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_tagged_stream_mux, "qa_tagged_stream_mux.xml")
+
diff --git a/gr-blocks/python/qa_udp_source_sink.py b/gr-blocks/python/qa_udp_source_sink.py
new file mode 100644
index 0000000000..ac8a9d0eb1
--- /dev/null
+++ b/gr-blocks/python/qa_udp_source_sink.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import os
+
+from threading import Timer
+
+class test_udp_sink_source(gr_unittest.TestCase):
+
+ def setUp(self):
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
+ self.tb_snd = gr.top_block()
+ self.tb_rcv = gr.top_block()
+
+ def tearDown(self):
+ self.tb_rcv = None
+ self.tb_snd = None
+
+ def test_001(self):
+ # Tests calling disconnect/reconnect.
+
+ port = 65500
+
+ n_data = 16
+ src_data = [x for x in range(n_data)]
+ expected_result = tuple(src_data)
+ src = blocks.vector_source_s(src_data, False)
+ udp_snd = blocks.udp_sink(gr.sizeof_short, 'localhost', port)
+ self.tb_snd.connect(src, udp_snd)
+
+ self.tb_snd.run()
+ udp_snd.disconnect()
+
+ udp_snd.connect('localhost', port+1)
+ src.rewind()
+ self.tb_snd.run()
+
+ def test_002(self):
+ port = 65500
+
+ n_data = 100
+ src_data = [float(x) for x in range(n_data)]
+ expected_result = tuple(src_data)
+ src = blocks.vector_source_f(src_data, False)
+ udp_snd = blocks.udp_sink(gr.sizeof_float, 'localhost', port)
+ self.tb_snd.connect(src, udp_snd)
+
+ udp_rcv = blocks.udp_source(gr.sizeof_float, 'localhost', port)
+ dst = blocks.vector_sink_f()
+ self.tb_rcv.connect(udp_rcv, dst)
+
+ self.tb_rcv.start()
+ self.tb_snd.run()
+ udp_snd.disconnect()
+ self.timeout = False
+ q = Timer(2.0,self.stop_rcv)
+ q.start()
+ self.tb_rcv.wait()
+ q.cancel()
+
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+ self.assert_(not self.timeout)
+
+ def test_003(self):
+ udp_rcv = blocks.udp_source(gr.sizeof_float, '0.0.0.0', 0, eof=False)
+ rcv_port = udp_rcv.get_port()
+
+ udp_snd = blocks.udp_sink(gr.sizeof_float, '127.0.0.1', 65500)
+ udp_snd.connect('localhost', rcv_port)
+
+ n_data = 16
+ src_data = [float(x) for x in range(n_data)]
+ expected_result = tuple(src_data)
+ src = blocks.vector_source_f(src_data)
+ dst = blocks.vector_sink_f()
+
+ self.tb_snd.connect(src, udp_snd)
+ self.tb_rcv.connect(udp_rcv, dst)
+
+ self.tb_rcv.start()
+ self.tb_snd.run()
+ udp_snd.disconnect()
+ self.timeout = False
+ q = Timer(2.0,self.stop_rcv)
+ q.start()
+ self.tb_rcv.wait()
+ q.cancel()
+
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+ self.assert_(self.timeout) # source ignores EOF?
+
+ def stop_rcv(self):
+ self.timeout = True
+ self.tb_rcv.stop()
+ #print "tb_rcv stopped by Timer"
+
+if __name__ == '__main__':
+ gr_unittest.run(test_udp_sink_source, "test_udp_sink_source.xml")
+
diff --git a/gr-blocks/python/qa_vco.py b/gr-blocks/python/qa_vco.py
new file mode 100644
index 0000000000..23ff636d86
--- /dev/null
+++ b/gr-blocks/python/qa_vco.py
@@ -0,0 +1,59 @@
+#!/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
+
+def sig_source_f(samp_rate, freq, amp, N):
+ t = map(lambda x: float(x)/samp_rate, xrange(N))
+ y = map(lambda x: amp*math.cos(2.*math.pi*freq*x), t)
+ return y
+
+class test_vco(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = 200*[0,] + 200*[0.5,] + 200*[1,]
+ expected_result = 200*[1,] + \
+ sig_source_f(1, 0.125, 1, 200) + \
+ sig_source_f(1, 0.25, 1, 200)
+
+ src = blocks.vector_source_f(src_data)
+ op = blocks.vco_f(1, math.pi/2.0, 1)
+ dst = blocks.vector_sink_f()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data, 5)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_vco, "test_vco.xml")
+
diff --git a/gr-blocks/python/qa_vector_insert.py b/gr-blocks/python/qa_vector_insert.py
new file mode 100755
index 0000000000..e3c0d3102f
--- /dev/null
+++ b/gr-blocks/python/qa_vector_insert.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import math
+
+class test_vector_insert(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ period = 9177;
+ offset = 0;
+
+ src = blocks.null_source(1)
+ head = blocks.head(1, 10000000);
+ ins = blocks.vector_insert_b([1], period, offset);
+ dst = blocks.vector_sink_b()
+
+ self.tb.connect(src, head, ins, dst)
+ self.tb.run()
+ result_data = dst.data()
+
+ for i in range(10000):
+ if(i%period == offset):
+ self.assertEqual(1, result_data[i])
+ else:
+ self.assertEqual(0, result_data[i])
+
+if __name__ == '__main__':
+ gr_unittest.run(test_vector_insert, "test_vector_insert.xml")
+
diff --git a/gr-blocks/python/qa_vector_map.py b/gr-blocks/python/qa_vector_map.py
new file mode 100644
index 0000000000..54565fe443
--- /dev/null
+++ b/gr-blocks/python/qa_vector_map.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import math
+
+class test_vector_map(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_reversing(self):
+ # Chunk data in blocks of N and reverse the block contents.
+ N = 5
+ src_data = range(0, 20)
+ expected_result = []
+ for i in range(N-1, len(src_data), N):
+ for j in range(0, N):
+ expected_result.append(1.0*(i-j))
+ mapping = [list(reversed([(0, i) for i in range(0, N)]))]
+ src = blocks.vector_source_f(src_data, False, N)
+ vmap = blocks.vector_map(gr.sizeof_float, (N, ), mapping)
+ dst = blocks.vector_sink_f(N)
+ self.tb.connect(src, vmap, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+ self.assertEqual(expected_result, result_data)
+
+ def test_vector_to_streams(self):
+ # Split an input vector into N streams.
+ N = 5
+ M = 20
+ src_data = range(0, M)
+ expected_results = []
+ for n in range(0, N):
+ expected_results.append(range(n, M, N))
+ mapping = [[(0, n)] for n in range(0, N)]
+ src = blocks.vector_source_f(src_data, False, N)
+ vmap = blocks.vector_map(gr.sizeof_float, (N, ), mapping)
+ dsts = [blocks.vector_sink_f(1) for n in range(0, N)]
+ self.tb.connect(src, vmap)
+ for n in range(0, N):
+ self.tb.connect((vmap, n), dsts[n])
+ self.tb.run()
+ for n in range(0, N):
+ result_data = list(dsts[n].data())
+ self.assertEqual(expected_results[n], result_data)
+
+ def test_interleaving(self):
+ # Takes 3 streams (a, b and c)
+ # Outputs 2 streams.
+ # First (d) is interleaving of a and b.
+ # Second (e) is interleaving of a and b and c. c is taken in
+ # chunks of 2 which are reversed.
+ A = (1, 2, 3, 4, 5)
+ B = (11, 12, 13, 14, 15)
+ C = (99, 98, 97, 96, 95, 94, 93, 92, 91, 90)
+ expected_D = (1, 11, 2, 12, 3, 13, 4, 14, 5, 15)
+ expected_E = (1, 11, 98, 99, 2, 12, 96, 97, 3, 13, 94, 95,
+ 4, 14, 92, 93, 5, 15, 90, 91)
+ mapping = [[(0, 0), (1, 0)], # mapping to produce D
+ [(0, 0), (1, 0), (2, 1), (2, 0)], # mapping to produce E
+ ]
+ srcA = blocks.vector_source_f(A, False, 1)
+ srcB = blocks.vector_source_f(B, False, 1)
+ srcC = blocks.vector_source_f(C, False, 2)
+ vmap = blocks.vector_map(gr.sizeof_int, (1, 1, 2), mapping)
+ dstD = blocks.vector_sink_f(2)
+ dstE = blocks.vector_sink_f(4)
+ self.tb.connect(srcA, (vmap, 0))
+ self.tb.connect(srcB, (vmap, 1))
+ self.tb.connect(srcC, (vmap, 2))
+ self.tb.connect((vmap, 0), dstD)
+ self.tb.connect((vmap, 1), dstE)
+ self.tb.run()
+ self.assertEqual(expected_D, dstD.data())
+ self.assertEqual(expected_E, dstE.data())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_vector_map, "test_vector_map.xml")
+
diff --git a/gr-blocks/python/qa_vector_sink_source.py b/gr-blocks/python/qa_vector_sink_source.py
new file mode 100755
index 0000000000..169e6a4450
--- /dev/null
+++ b/gr-blocks/python/qa_vector_sink_source.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import math
+
+class test_vector_sink_source(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = blocks.vector_source_f(src_data)
+ dst = blocks.vector_sink_f()
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = blocks.vector_source_f(src_data, False, 2)
+ dst = blocks.vector_sink_f(2)
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_003(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+ self.assertRaises(RuntimeError, lambda : blocks.vector_source_f(src_data, False, 3))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml")
+
diff --git a/gr-blocks/python/qa_wavfile.py b/gr-blocks/python/qa_wavfile.py
new file mode 100755
index 0000000000..b40b9b7ec3
--- /dev/null
+++ b/gr-blocks/python/qa_wavfile.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+import os
+from os.path import getsize
+
+g_in_file = os.path.join(os.getenv("srcdir"), "test_16bit_1chunk.wav")
+
+class test_wavefile(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001_checkwavread(self):
+ wf = blocks.wavfile_source(g_in_file)
+ self.assertEqual(wf.sample_rate(), 8000)
+
+ def test_002_checkwavcopy(self):
+ infile = g_in_file
+ outfile = "test_out.wav"
+
+ wf_in = blocks.wavfile_source(infile)
+ wf_out = blocks.wavfile_sink(outfile,
+ wf_in.channels(),
+ wf_in.sample_rate(),
+ wf_in.bits_per_sample())
+ self.tb.connect(wf_in, wf_out)
+ self.tb.run()
+ wf_out.close()
+
+ self.assertEqual(getsize(infile), getsize(outfile))
+
+ in_f = file(infile, 'rb')
+ out_f = file(outfile, 'rb')
+
+ in_data = in_f.read()
+ out_data = out_f.read()
+ out_f.close()
+ os.remove(outfile)
+
+ self.assertEqual(in_data, out_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_wavefile, "test_wavefile.xml")
diff --git a/gr-blocks/python/test_16bit_1chunk.wav b/gr-blocks/python/test_16bit_1chunk.wav
new file mode 100644
index 0000000000..0fe12a7a13
--- /dev/null
+++ b/gr-blocks/python/test_16bit_1chunk.wav
Binary files differ
diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt
index 84ab5b660f..08e48fb69d 100644
--- a/gr-blocks/swig/CMakeLists.txt
+++ b/gr-blocks/swig/CMakeLists.txt
@@ -26,13 +26,18 @@ include(GrSwig)
set(GR_SWIG_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}/../include
${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
- ${GRUEL_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
+if(ENABLE_GR_CTRLPORT)
+ SET(GR_SWIG_FLAGS "-DGR_CTRLPORT")
+endif(ENABLE_GR_CTRLPORT)
+
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/blocks_swig_doc.i)
-set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/blocks)
+set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
set(GR_SWIG_TARGET_DEPS blocks_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-blocks)
diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i
index 52fd2b6422..f808d1e771 100644
--- a/gr-blocks/swig/blocks_swig.i
+++ b/gr-blocks/swig/blocks_swig.i
@@ -22,7 +22,7 @@
#define BLOCKS_API
-%include "gnuradio.i"
+%include "runtime_swig.i"
%include "blocks/pdu.h"
//load generated python docstrings
@@ -30,16 +30,21 @@
%include <gr_endianness.h>
+// For vector_map.
+%template() std::vector< std::vector< std::vector<size_t> > >;
+
%{
#include "blocks/add_ff.h"
#include "blocks/add_ss.h"
#include "blocks/add_ii.h"
#include "blocks/add_cc.h"
#include "blocks/add_const_ff.h"
+#include "blocks/add_const_bb.h"
#include "blocks/add_const_ss.h"
#include "blocks/add_const_ii.h"
#include "blocks/add_const_cc.h"
#include "blocks/add_const_vff.h"
+#include "blocks/add_const_vbb.h"
#include "blocks/add_const_vss.h"
#include "blocks/add_const_vii.h"
#include "blocks/add_const_vcc.h"
@@ -49,6 +54,9 @@
#include "blocks/and_const_bb.h"
#include "blocks/and_const_ss.h"
#include "blocks/and_const_ii.h"
+#include "blocks/annotator_1to1.h"
+#include "blocks/annotator_alltoall.h"
+#include "blocks/annotator_raw.h"
#include "blocks/argmax_fs.h"
#include "blocks/argmax_is.h"
#include "blocks/argmax_ss.h"
@@ -56,6 +64,7 @@
#include "blocks/burst_tagger.h"
#include "blocks/char_to_float.h"
#include "blocks/char_to_short.h"
+#include "blocks/check_lfsr_32k_s.h"
#include "blocks/complex_to_interleaved_short.h"
#include "blocks/complex_to_float.h"
#include "blocks/complex_to_real.h"
@@ -64,12 +73,19 @@
#include "blocks/complex_to_mag_squared.h"
#include "blocks/complex_to_arg.h"
#include "blocks/conjugate_cc.h"
+#include "blocks/control_loop.h"
+#include "blocks/copy.h"
#include "blocks/deinterleave.h"
#include "blocks/delay.h"
#include "blocks/divide_ff.h"
#include "blocks/divide_ss.h"
#include "blocks/divide_ii.h"
#include "blocks/divide_cc.h"
+#include "blocks/endian_swap.h"
+#include "blocks/file_descriptor_sink.h"
+#include "blocks/file_descriptor_source.h"
+#include "blocks/file_sink_base.h"
+#include "blocks/file_sink.h"
#include "blocks/file_source.h"
#include "blocks/file_meta_sink.h"
#include "blocks/file_meta_source.h"
@@ -78,6 +94,7 @@
#include "blocks/float_to_int.h"
#include "blocks/float_to_short.h"
#include "blocks/float_to_uchar.h"
+#include "blocks/head.h"
#include "blocks/int_to_float.h"
#include "blocks/integrate_ss.h"
#include "blocks/integrate_ii.h"
@@ -87,6 +104,7 @@
#include "blocks/interleaved_short_to_complex.h"
#include "blocks/keep_m_in_n.h"
#include "blocks/keep_one_in_n.h"
+#include "blocks/lfsr_32k_source_s.h"
#include "blocks/max_ff.h"
#include "blocks/max_ii.h"
#include "blocks/max_ss.h"
@@ -117,9 +135,12 @@
#include "blocks/mute_ff.h"
#include "blocks/mute_cc.h"
#include "blocks/nlog10_ff.h"
+#include "blocks/nop.h"
#include "blocks/not_bb.h"
#include "blocks/not_ss.h"
#include "blocks/not_ii.h"
+#include "blocks/null_sink.h"
+#include "blocks/null_source.h"
#include "blocks/patterned_interleaver.h"
#include "blocks/pack_k_bits_bb.h"
#include "blocks/packed_to_unpacked_bb.h"
@@ -130,6 +151,8 @@
#include "blocks/peak_detector_ib.h"
#include "blocks/peak_detector_sb.h"
#include "blocks/peak_detector2_fb.h"
+#include "blocks/plateau_detector_fb.h"
+#include "blocks/probe_rate.h"
#include "blocks/probe_signal_b.h"
#include "blocks/probe_signal_s.h"
#include "blocks/probe_signal_i.h"
@@ -145,6 +168,7 @@
#include "blocks/or_ii.h"
#include "blocks/random_pdu.h"
#include "blocks/regenerate_bb.h"
+#include "blocks/repack_bits_bb.h"
#include "blocks/repeat.h"
#include "blocks/rms_cf.h"
#include "blocks/rms_ff.h"
@@ -154,6 +178,7 @@
#include "blocks/sample_and_hold_ff.h"
#include "blocks/short_to_char.h"
#include "blocks/short_to_float.h"
+#include "blocks/skiphead.h"
#include "blocks/socket_pdu.h"
#include "blocks/stream_mux.h"
#include "blocks/stream_to_streams.h"
@@ -166,18 +191,41 @@
#include "blocks/sub_ii.h"
#include "blocks/sub_cc.h"
#include "blocks/tag_debug.h"
+#include "blocks/tagged_file_sink.h"
+#include "blocks/tagged_stream_mux.h"
#include "blocks/tagged_stream_to_pdu.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/udp_sink.h"
+#include "blocks/udp_source.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"
+#include "blocks/vco_f.h"
+#include "blocks/vector_map.h"
#include "blocks/vector_to_stream.h"
#include "blocks/vector_to_streams.h"
+#include "blocks/vector_insert_b.h"
+#include "blocks/vector_insert_s.h"
+#include "blocks/vector_insert_i.h"
+#include "blocks/vector_insert_f.h"
+#include "blocks/vector_insert_c.h"
+#include "blocks/vector_sink_b.h"
+#include "blocks/vector_sink_s.h"
+#include "blocks/vector_sink_i.h"
+#include "blocks/vector_sink_f.h"
+#include "blocks/vector_sink_c.h"
+#include "blocks/vector_source_b.h"
+#include "blocks/vector_source_s.h"
+#include "blocks/vector_source_i.h"
+#include "blocks/vector_source_f.h"
+#include "blocks/vector_source_c.h"
+#include "blocks/wavfile_sink.h"
+#include "blocks/wavfile_source.h"
#include "blocks/xor_bb.h"
#include "blocks/xor_ss.h"
#include "blocks/xor_ii.h"
@@ -188,10 +236,12 @@
%include "blocks/add_ii.h"
%include "blocks/add_cc.h"
%include "blocks/add_const_ff.h"
+%include "blocks/add_const_bb.h"
%include "blocks/add_const_ss.h"
%include "blocks/add_const_ii.h"
%include "blocks/add_const_cc.h"
%include "blocks/add_const_vff.h"
+%include "blocks/add_const_vbb.h"
%include "blocks/add_const_vss.h"
%include "blocks/add_const_vii.h"
%include "blocks/add_const_vcc.h"
@@ -201,6 +251,9 @@
%include "blocks/and_const_bb.h"
%include "blocks/and_const_ss.h"
%include "blocks/and_const_ii.h"
+%include "blocks/annotator_1to1.h"
+%include "blocks/annotator_alltoall.h"
+%include "blocks/annotator_raw.h"
%include "blocks/argmax_fs.h"
%include "blocks/argmax_is.h"
%include "blocks/argmax_ss.h"
@@ -208,6 +261,7 @@
%include "blocks/bin_statistics_f.h"
%include "blocks/burst_tagger.h"
%include "blocks/char_to_short.h"
+%include "blocks/check_lfsr_32k_s.h"
%include "blocks/complex_to_interleaved_short.h"
%include "blocks/complex_to_float.h"
%include "blocks/complex_to_real.h"
@@ -216,8 +270,14 @@
%include "blocks/complex_to_mag_squared.h"
%include "blocks/complex_to_arg.h"
%include "blocks/conjugate_cc.h"
+%include "blocks/control_loop.h"
+%include "blocks/copy.h"
%include "blocks/deinterleave.h"
%include "blocks/delay.h"
+%include "blocks/file_descriptor_sink.h"
+%include "blocks/file_descriptor_source.h"
+%include "blocks/file_sink_base.h"
+%include "blocks/file_sink.h"
%include "blocks/file_source.h"
%include "blocks/file_meta_sink.h"
%include "blocks/file_meta_source.h"
@@ -225,11 +285,13 @@
%include "blocks/divide_ss.h"
%include "blocks/divide_ii.h"
%include "blocks/divide_cc.h"
+%include "blocks/endian_swap.h"
%include "blocks/float_to_char.h"
%include "blocks/float_to_complex.h"
%include "blocks/float_to_int.h"
%include "blocks/float_to_short.h"
%include "blocks/float_to_uchar.h"
+%include "blocks/head.h"
%include "blocks/int_to_float.h"
%include "blocks/integrate_ss.h"
%include "blocks/integrate_ii.h"
@@ -239,6 +301,7 @@
%include "blocks/interleaved_short_to_complex.h"
%include "blocks/keep_m_in_n.h"
%include "blocks/keep_one_in_n.h"
+%include "blocks/lfsr_32k_source_s.h"
%include "blocks/max_ff.h"
%include "blocks/max_ii.h"
%include "blocks/max_ss.h"
@@ -269,9 +332,12 @@
%include "blocks/mute_ff.h"
%include "blocks/mute_cc.h"
%include "blocks/nlog10_ff.h"
+%include "blocks/nop.h"
%include "blocks/not_bb.h"
%include "blocks/not_ss.h"
%include "blocks/not_ii.h"
+%include "blocks/null_sink.h"
+%include "blocks/null_source.h"
%include "blocks/probe_signal_b.h"
%include "blocks/probe_signal_s.h"
%include "blocks/probe_signal_i.h"
@@ -297,7 +363,10 @@
%include "blocks/peak_detector_sb.h"
%include "blocks/peak_detector2_fb.h"
%include "blocks/random_pdu.h"
+%include "blocks/plateau_detector_fb.h"
+%include "blocks/probe_rate.h"
%include "blocks/regenerate_bb.h"
+%include "blocks/repack_bits_bb.h"
%include "blocks/repeat.h"
%include "blocks/rms_cf.h"
%include "blocks/rms_ff.h"
@@ -307,6 +376,7 @@
%include "blocks/sample_and_hold_ff.h"
%include "blocks/short_to_char.h"
%include "blocks/short_to_float.h"
+%include "blocks/skiphead.h"
%include "blocks/socket_pdu.h"
%include "blocks/stream_mux.h"
%include "blocks/stream_to_streams.h"
@@ -318,18 +388,41 @@
%include "blocks/sub_ss.h"
%include "blocks/sub_ii.h"
%include "blocks/sub_cc.h"
+%include "blocks/tagged_file_sink.h"
+%include "blocks/tagged_stream_mux.h"
%include "blocks/tagged_stream_to_pdu.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/udp_sink.h"
+%include "blocks/udp_source.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"
+%include "blocks/vco_f.h"
+%include "blocks/vector_map.h"
%include "blocks/vector_to_stream.h"
%include "blocks/vector_to_streams.h"
+%include "blocks/vector_insert_b.h"
+%include "blocks/vector_insert_s.h"
+%include "blocks/vector_insert_i.h"
+%include "blocks/vector_insert_f.h"
+%include "blocks/vector_insert_c.h"
+%include "blocks/vector_sink_b.h"
+%include "blocks/vector_sink_s.h"
+%include "blocks/vector_sink_i.h"
+%include "blocks/vector_sink_f.h"
+%include "blocks/vector_sink_c.h"
+%include "blocks/vector_source_b.h"
+%include "blocks/vector_source_s.h"
+%include "blocks/vector_source_i.h"
+%include "blocks/vector_source_f.h"
+%include "blocks/vector_source_c.h"
+%include "blocks/wavfile_sink.h"
+%include "blocks/wavfile_source.h"
%include "blocks/xor_bb.h"
%include "blocks/xor_ss.h"
%include "blocks/xor_ii.h"
@@ -339,10 +432,12 @@ GR_SWIG_BLOCK_MAGIC2(blocks, add_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, add_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, add_cc);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_cc);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vff);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vbb);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vss);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vii);
GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vcc);
@@ -352,6 +447,9 @@ GR_SWIG_BLOCK_MAGIC2(blocks, and_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, and_const_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, annotator_1to1);
+GR_SWIG_BLOCK_MAGIC2(blocks, annotator_alltoall);
+GR_SWIG_BLOCK_MAGIC2(blocks, annotator_raw);
GR_SWIG_BLOCK_MAGIC2(blocks, argmax_fs);
GR_SWIG_BLOCK_MAGIC2(blocks, argmax_is);
GR_SWIG_BLOCK_MAGIC2(blocks, argmax_ss);
@@ -359,6 +457,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, bin_statistics_f);
GR_SWIG_BLOCK_MAGIC2(blocks, burst_tagger);
GR_SWIG_BLOCK_MAGIC2(blocks, char_to_float);
GR_SWIG_BLOCK_MAGIC2(blocks, char_to_short);
+GR_SWIG_BLOCK_MAGIC2(blocks, check_lfsr_32k_s);
GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_interleaved_short);
GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_float);
GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_real);
@@ -367,12 +466,17 @@ GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag);
GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag_squared);
GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_arg);
GR_SWIG_BLOCK_MAGIC2(blocks, conjugate_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, copy);
GR_SWIG_BLOCK_MAGIC2(blocks, deinterleave);
GR_SWIG_BLOCK_MAGIC2(blocks, delay);
+GR_SWIG_BLOCK_MAGIC2(blocks, endian_swap);
GR_SWIG_BLOCK_MAGIC2(blocks, divide_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, divide_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, divide_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, divide_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, file_descriptor_sink);
+GR_SWIG_BLOCK_MAGIC2(blocks, file_descriptor_source);
+GR_SWIG_BLOCK_MAGIC2(blocks, file_sink);
GR_SWIG_BLOCK_MAGIC2(blocks, file_source);
GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_sink);
GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_source);
@@ -381,6 +485,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, float_to_complex);
GR_SWIG_BLOCK_MAGIC2(blocks, float_to_int);
GR_SWIG_BLOCK_MAGIC2(blocks, float_to_short);
GR_SWIG_BLOCK_MAGIC2(blocks, float_to_uchar);
+GR_SWIG_BLOCK_MAGIC2(blocks, head);
GR_SWIG_BLOCK_MAGIC2(blocks, int_to_float);
GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ii);
@@ -390,6 +495,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, interleave);
GR_SWIG_BLOCK_MAGIC2(blocks, interleaved_short_to_complex);
GR_SWIG_BLOCK_MAGIC2(blocks, keep_m_in_n);
GR_SWIG_BLOCK_MAGIC2(blocks, keep_one_in_n);
+GR_SWIG_BLOCK_MAGIC2(blocks, lfsr_32k_source_s);
GR_SWIG_BLOCK_MAGIC2(blocks, max_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, max_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, max_ss);
@@ -420,9 +526,12 @@ GR_SWIG_BLOCK_MAGIC2(blocks, mute_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, mute_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, mute_cc);
GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, nop);
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, null_sink);
+GR_SWIG_BLOCK_MAGIC2(blocks, null_source);
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);
@@ -432,7 +541,9 @@ GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_fb);
GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_ib);
GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector_sb);
GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb);
+GR_SWIG_BLOCK_MAGIC2(blocks, plateau_detector_fb);
GR_SWIG_BLOCK_MAGIC2(blocks, pdu_to_tagged_stream);
+GR_SWIG_BLOCK_MAGIC2(blocks, probe_rate);
GR_SWIG_BLOCK_MAGIC2(blocks, or_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ii);
@@ -448,6 +559,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vi);
GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vf);
GR_SWIG_BLOCK_MAGIC2(blocks, probe_signal_vc);
GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, repack_bits_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, repeat);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff);
@@ -457,6 +569,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char);
GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, skiphead);
GR_SWIG_BLOCK_MAGIC2(blocks, socket_pdu);
GR_SWIG_BLOCK_MAGIC2(blocks, stream_mux);
GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams);
@@ -469,18 +582,57 @@ 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, tag_debug);
+GR_SWIG_BLOCK_MAGIC2(blocks, tagged_file_sink);
+GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_mux);
GR_SWIG_BLOCK_MAGIC2(blocks, tagged_stream_to_pdu);
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, udp_sink);
+GR_SWIG_BLOCK_MAGIC2(blocks, udp_source);
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);
+GR_SWIG_BLOCK_MAGIC2(blocks, vco_f);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_map);
GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_stream);
GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_streams);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_b);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_s);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_i);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_f);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_c);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_b);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_s);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_i);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_f);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_c);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_b);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_s);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_i);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_f);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_c);
+GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_sink);
+GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_source);
GR_SWIG_BLOCK_MAGIC2(blocks, xor_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, xor_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, xor_ii);
+
+
+#ifdef GR_CTRLPORT
+
+%{
+#include "blocks/ctrlport_probe_c.h"
+#include "blocks/ctrlport_probe2_c.h"
+%}
+
+%include "blocks/ctrlport_probe_c.h"
+%include "blocks/ctrlport_probe2_c.h"
+
+GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe_c);
+GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe2_c);
+
+#endif /* GR_CTRLPORT */
diff --git a/gr-blocks/tests/CMakeLists.txt b/gr-blocks/tests/CMakeLists.txt
new file mode 100644
index 0000000000..8f2b28edfa
--- /dev/null
+++ b/gr-blocks/tests/CMakeLists.txt
@@ -0,0 +1,55 @@
+# Copyright 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.
+
+########################################################################
+include(GrMiscUtils) #check n def
+GR_CHECK_HDR_N_DEF(sys/resource.h HAVE_SYS_RESOURCE_H)
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${GR_BLOCKS_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${CPPUNIT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${Boost_LIBRARY_DIRS}
+ ${CPPUNIT_LIBRARY_DIRS}
+)
+
+include_directories(${LOG4CPP_INCLUDE_DIRS})
+link_directories(${LOG4CPP_LIBRARY_DIRS})
+
+########################################################################
+# Build benchmarks and non-registered tests
+########################################################################
+set(tests_not_run #single source per test
+ benchmark_nco.cc
+ benchmark_vco.cc
+)
+
+foreach(test_not_run_src ${tests_not_run})
+ get_filename_component(name ${test_not_run_src} NAME_WE)
+ add_executable(${name} ${test_not_run_src})
+ target_link_libraries(${name} test-gnuradio-runtime gnuradio-blocks ${LOG4CPP_LIBRARIES})
+endforeach(test_not_run_src)
+
diff --git a/gr-blocks/tests/benchmark_nco.cc b/gr-blocks/tests/benchmark_nco.cc
new file mode 100644
index 0000000000..4c2ed120db
--- /dev/null
+++ b/gr-blocks/tests/benchmark_nco.cc
@@ -0,0 +1,225 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+#include <unistd.h>
+#include <blocks/nco.h>
+#include <blocks/fxpt_nco.h>
+#include <string.h>
+
+#define ITERATIONS 20000000
+#define BLOCK_SIZE (10 * 1000) // fits in cache
+
+#define FREQ 5003.123
+
+static double
+timeval_to_double(const struct timeval *tv)
+{
+ return (double)tv->tv_sec + (double)tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark(void test (float *x, float *y), const char *implementation_name)
+{
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ float output[2*BLOCK_SIZE];
+ float *x = &output[0], *y = &output[BLOCK_SIZE];
+
+ // touch memory
+ memset(output, 0, 2*BLOCK_SIZE*sizeof(float));
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if(getrusage(RUSAGE_SELF, &rusage_start) < 0) {
+ perror("getrusage");
+ exit(1);
+ }
+#else
+ clock_start = (double)clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ test(x, y);
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if(getrusage(RUSAGE_SELF, &rusage_stop) < 0) {
+ perror("getrusage");
+ exit(1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double(&rusage_stop.ru_utime)
+ - timeval_to_double(&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double(&rusage_stop.ru_stime)
+ - timeval_to_double(&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double)clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ printf("%18s: cpu: %6.3f steps/sec: %10.3e\n",
+ implementation_name, total, ITERATIONS / total);
+}
+
+// ----------------------------------------------------------------
+// Don't compare the _vec with other functions since memory store's
+// are involved.
+
+void basic_sincos_vec(float *x, float *y)
+{
+ gr::blocks::nco<float,float> nco;
+
+ nco.set_freq(2 * M_PI / FREQ);
+
+ for(int i = 0; i < ITERATIONS/BLOCK_SIZE; i++) {
+ for(int j = 0; j < BLOCK_SIZE; j++) {
+ nco.sincos(&x[2*j+1], &x[2*j]);
+ nco.step();
+ }
+ }
+}
+
+void native_sincos_vec(float *x, float *y)
+{
+ gr::blocks::nco<float,float> nco;
+
+ nco.set_freq(2 * M_PI / FREQ);
+
+ for(int i = 0; i < ITERATIONS/BLOCK_SIZE; i++) {
+ nco.sincos((gr_complex*)x, BLOCK_SIZE);
+ }
+}
+
+void fxpt_sincos_vec(float *x, float *y)
+{
+ gr::blocks::fxpt_nco nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for(int i = 0; i < ITERATIONS/BLOCK_SIZE; i++) {
+ nco.sincos((gr_complex*)x, BLOCK_SIZE);
+ }
+}
+
+// ----------------------------------------------------------------
+
+void native_sincos(float *x, float *y)
+{
+ gr::blocks::nco<float,float> nco;
+
+ nco.set_freq(2 * M_PI / FREQ);
+
+ for(int i = 0; i < ITERATIONS; i++) {
+ nco.sincos(x, y);
+ nco.step();
+ }
+}
+
+void fxpt_sincos(float *x, float *y)
+{
+ gr::blocks::fxpt_nco nco;
+
+ nco.set_freq(2 * M_PI / FREQ);
+
+ for(int i = 0; i < ITERATIONS; i++) {
+ nco.sincos(x, y);
+ nco.step();
+ }
+}
+
+// ----------------------------------------------------------------
+
+void native_sin(float *x, float *y)
+{
+ gr::blocks::nco<float,float> nco;
+
+ nco.set_freq(2 * M_PI / FREQ);
+
+ for(int i = 0; i < ITERATIONS; i++) {
+ *x = nco.sin();
+ nco.step();
+ }
+}
+
+void fxpt_sin(float *x, float *y)
+{
+ gr::blocks::fxpt_nco nco;
+
+ nco.set_freq(2 * M_PI / FREQ);
+
+ for(int i = 0; i < ITERATIONS; i++) {
+ *x = nco.sin();
+ nco.step();
+ }
+}
+
+// ----------------------------------------------------------------
+
+void nop_fct(float *x, float *y)
+{
+}
+
+void nop_loop(float *x, float *y)
+{
+ for(int i = 0; i < ITERATIONS; i++) {
+ nop_fct(x, y);
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ benchmark(nop_loop, "nop loop");
+ benchmark(native_sin, "native sine");
+ benchmark(fxpt_sin, "fxpt sine");
+ benchmark(native_sincos, "native sin/cos");
+ benchmark(fxpt_sincos, "fxpt sin/cos");
+ benchmark(basic_sincos_vec, "basic sin/cos vec");
+ benchmark(native_sincos_vec, "native sin/cos vec");
+ benchmark(fxpt_sincos_vec, "fxpt sin/cos vec");
+}
diff --git a/gr-blocks/tests/benchmark_vco.cc b/gr-blocks/tests/benchmark_vco.cc
new file mode 100644
index 0000000000..955dc08051
--- /dev/null
+++ b/gr-blocks/tests/benchmark_vco.cc
@@ -0,0 +1,172 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2004,2005,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 <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+#include <unistd.h>
+#include <blocks/vco.h>
+#include <blocks/fxpt_vco.h>
+#include <string.h>
+
+#define ITERATIONS 5000000
+#define BLOCK_SIZE (10 * 1000) // fits in cache
+
+#define FREQ 5003.123
+#define K 4.9999999
+#define AMPLITUDE 2.444444444
+
+
+static double
+timeval_to_double(const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark(void test (float *x, const float *y), const char *implementation_name)
+{
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ float output[BLOCK_SIZE];
+ float input[BLOCK_SIZE];
+
+ // touch memory
+ memset(output, 0, BLOCK_SIZE*sizeof(float));
+ for(int i = 0; i<BLOCK_SIZE; i++)
+ input[i] = sin(double(i));
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if(getrusage (RUSAGE_SELF, &rusage_start) < 0) {
+ perror("getrusage");
+ exit(1);
+ }
+#else
+ clock_start = (double)clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ test(output, input);
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if(getrusage (RUSAGE_SELF, &rusage_stop) < 0) {
+ perror("getrusage");
+ exit(1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double(&rusage_stop.ru_utime)
+ - timeval_to_double(&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double(&rusage_stop.ru_stime)
+ - timeval_to_double(&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double)clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ printf("%18s: cpu: %6.3f steps/sec: %10.3e\n",
+ implementation_name, total, ITERATIONS / total);
+}
+
+// ----------------------------------------------------------------
+
+void basic_vco(float *output, const float *input)
+{
+ double phase = 0;
+
+ for(int j = 0; j < ITERATIONS/BLOCK_SIZE; j++) {
+ for(int i = 0; i < BLOCK_SIZE; i++) {
+ output[i] = cos(phase) * AMPLITUDE;
+ phase += input[i] * K;
+
+ while(phase > 2 * M_PI)
+ phase -= 2 * M_PI;
+
+ while(phase < -2 * M_PI)
+ phase += 2 * M_PI;
+ }
+ }
+}
+
+void native_vco(float *output, const float *input)
+{
+ gr::blocks::vco<float,float> vco;
+
+ for(int j = 0; j < ITERATIONS/BLOCK_SIZE; j++) {
+ vco.cos(output, input, BLOCK_SIZE, K, AMPLITUDE);
+ }
+}
+
+void fxpt_vco(float *output, const float *input)
+{
+ gr::blocks::fxpt_vco vco;
+
+ for(int j = 0; j < ITERATIONS/BLOCK_SIZE; j++) {
+ vco.cos(output, input, BLOCK_SIZE, K, AMPLITUDE);
+ }
+}
+
+// ----------------------------------------------------------------
+
+void nop_fct(float *x, const float *y)
+{
+}
+
+void nop_loop(float *x, const float *y)
+{
+ for(int i = 0; i < ITERATIONS; i++) {
+ nop_fct(x, y);
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ benchmark(nop_loop, "nop loop");
+ benchmark(basic_vco, "basic vco");
+ benchmark(native_vco, "native vco");
+ benchmark(fxpt_vco, "fxpt vco");
+}
diff --git a/gr-blocks/tests/nco_results b/gr-blocks/tests/nco_results
new file mode 100644
index 0000000000..5bdf5dd1cb
--- /dev/null
+++ b/gr-blocks/tests/nco_results
@@ -0,0 +1,48 @@
+================================================================
+These are on a 1.4 GHz Pentium M using g++ 3.4.1
+================================================================
+
+Default compiler options -O2
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.900 steps/sec: 1.111e+07
+ fxpt sine: cpu: 0.281 steps/sec: 3.559e+07
+ native sin/cos: cpu: 1.138 steps/sec: 8.789e+06
+ fxpt sin/cos: cpu: 0.550 steps/sec: 1.818e+07
+
+-O2 -march=pentium-m -fomit-frame-pointer
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.903 steps/sec: 1.108e+07
+ fxpt sine: cpu: 0.271 steps/sec: 3.691e+07
+ native sin/cos: cpu: 1.092 steps/sec: 9.159e+06
+ fxpt sin/cos: cpu: 0.542 steps/sec: 1.845e+07
+
+Inlined fxpt::sin & cos
+-O2 -march=pentium-m -fomit-frame-pointer
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.904 steps/sec: 1.106e+07
+ fxpt sine: cpu: 0.187 steps/sec: 5.348e+07
+ native sin/cos: cpu: 1.091 steps/sec: 9.167e+06
+ fxpt sin/cos: cpu: 0.373 steps/sec: 2.681e+07
+
+================================================================
+These are on a 1.5 GHz Athon MP 1800+
+================================================================
+
+Default compiler options: -O2
+
+ nop loop: cpu: 0.013 steps/sec: 7.693e+08
+ native sine: cpu: 0.733 steps/sec: 1.364e+07
+ fxpt sine: cpu: 0.210 steps/sec: 4.763e+07
+ native sin/cos: cpu: 1.183 steps/sec: 8.454e+06
+ fxpt sin/cos: cpu: 0.420 steps/sec: 2.381e+07
+
+-O2 -fomit-frame-pointer -march=athlon-mp
+
+ nop loop: cpu: 0.013 steps/sec: 7.693e+08
+ native sine: cpu: 0.679 steps/sec: 1.473e+07
+ fxpt sine: cpu: 0.200 steps/sec: 5.001e+07
+ native sin/cos: cpu: 1.147 steps/sec: 8.720e+06
+ fxpt sin/cos: cpu: 0.444 steps/sec: 2.253e+07