summaryrefslogtreecommitdiff
path: root/gr-blocks
diff options
context:
space:
mode:
Diffstat (limited to 'gr-blocks')
-rw-r--r--gr-blocks/examples/metadata/file_metadata_source.grc12
-rw-r--r--gr-blocks/examples/metadata/file_metadata_vector_source.grc12
-rw-r--r--gr-blocks/grc/blocks_block_tree.xml22
-rw-r--r--gr-blocks/grc/blocks_pack_k_bits_bb.xml30
-rw-r--r--gr-blocks/grc/blocks_peak_detector2_fb.xml41
-rw-r--r--gr-blocks/grc/blocks_regenerate_bb.xml32
-rw-r--r--gr-blocks/grc/blocks_stretch_ff.xml34
-rw-r--r--gr-blocks/grc/blocks_threshold_ff.xml40
-rw-r--r--gr-blocks/grc/blocks_throttle.xml67
-rw-r--r--gr-blocks/grc/blocks_transcendental.xml41
-rw-r--r--gr-blocks/grc/blocks_tuntap_pdu.xml34
-rw-r--r--gr-blocks/grc/blocks_unpack_k_bits_bb.xml25
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt9
-rw-r--r--gr-blocks/include/blocks/pack_k_bits_bb.h53
-rw-r--r--gr-blocks/include/blocks/peak_detector2_fb.h91
-rw-r--r--gr-blocks/include/blocks/regenerate_bb.h80
-rw-r--r--gr-blocks/include/blocks/stretch_ff.h59
-rw-r--r--gr-blocks/include/blocks/threshold_ff.h66
-rw-r--r--gr-blocks/include/blocks/throttle.h62
-rw-r--r--gr-blocks/include/blocks/transcendental.h56
-rw-r--r--gr-blocks/include/blocks/tuntap_pdu.h53
-rw-r--r--gr-blocks/include/blocks/unpack_k_bits_bb.h52
-rw-r--r--gr-blocks/lib/CMakeLists.txt10
-rw-r--r--gr-blocks/lib/ConfigChecks.cmake2
-rw-r--r--gr-blocks/lib/pack_k_bits_bb_impl.cc76
-rw-r--r--gr-blocks/lib/pack_k_bits_bb_impl.h48
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.cc118
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.h64
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.cc103
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.h57
-rw-r--r--gr-blocks/lib/stream_pdu_base.cc126
-rw-r--r--gr-blocks/lib/stream_pdu_base.h60
-rw-r--r--gr-blocks/lib/stretch_ff_impl.cc84
-rw-r--r--gr-blocks/lib/stretch_ff_impl.h53
-rw-r--r--gr-blocks/lib/threshold_ff_impl.cc78
-rw-r--r--gr-blocks/lib/threshold_ff_impl.h57
-rw-r--r--gr-blocks/lib/throttle_impl.cc97
-rw-r--r--gr-blocks/lib/throttle_impl.h54
-rw-r--r--gr-blocks/lib/transcendental_impl.cc150
-rw-r--r--gr-blocks/lib/transcendental_impl.h51
-rw-r--r--gr-blocks/lib/tuntap_pdu_impl.cc139
-rw-r--r--gr-blocks/lib/tuntap_pdu_impl.h51
-rw-r--r--gr-blocks/lib/unpack_k_bits_bb_impl.cc77
-rw-r--r--gr-blocks/lib/unpack_k_bits_bb_impl.h48
-rw-r--r--gr-blocks/python/qa_file_metadata.py1
-rwxr-xr-xgr-blocks/python/qa_pack_k_bits.py68
-rw-r--r--gr-blocks/python/qa_peak_detector2.py58
-rwxr-xr-xgr-blocks/python/qa_regenerate.py90
-rwxr-xr-xgr-blocks/python/qa_stream_mux.py2
-rwxr-xr-xgr-blocks/python/qa_stretch.py67
-rw-r--r--gr-blocks/python/qa_threshold.py54
-rwxr-xr-xgr-blocks/python/qa_throttle.py39
-rw-r--r--gr-blocks/python/qa_transcendental.py90
-rwxr-xr-xgr-blocks/python/qa_unpack_k_bits.py57
-rw-r--r--gr-blocks/swig/blocks_swig.i35
55 files changed, 3116 insertions, 19 deletions
diff --git a/gr-blocks/examples/metadata/file_metadata_source.grc b/gr-blocks/examples/metadata/file_metadata_source.grc
index 23757881bc..2ce73c029f 100644
--- a/gr-blocks/examples/metadata/file_metadata_source.grc
+++ b/gr-blocks/examples/metadata/file_metadata_source.grc
@@ -244,10 +244,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -318,19 +318,19 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_file_sink_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_tag_debug_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>analog_agc2_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -343,7 +343,7 @@
</connection>
<connection>
<source_block_id>blocks_file_meta_source_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/examples/metadata/file_metadata_vector_source.grc b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
index d52257e06d..2d95d4c947 100644
--- a/gr-blocks/examples/metadata/file_metadata_vector_source.grc
+++ b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
@@ -232,10 +232,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -306,13 +306,13 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_file_sink_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>gr_tag_debug_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -324,14 +324,14 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>blocks_vector_to_stream_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blocks_file_meta_source_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml
index 539a4a30f4..95918ec30d 100644
--- a/gr-blocks/grc/blocks_block_tree.xml
+++ b/gr-blocks/grc/blocks_block_tree.xml
@@ -50,6 +50,7 @@
<block>blocks_integrate_xx</block>
<block>blocks_nlog10_ff</block>
<block>blocks_rms_xx</block>
+ <block>blocks_transcendental</block>
</cat>
<cat>
<name>Boolean Operations (New) </name>
@@ -84,8 +85,6 @@
<cat>
<name>Stream Operations (New) </name>
<block>blocks_delay</block>
- <block>blocks_packed_to_unpacked_xx</block>
- <block>blocks_unpacked_to_packed_xx</block>
<block>blocks_deinterleave</block>
<block>blocks_interleave</block>
<block>blocks_keep_m_in_n</block>
@@ -99,5 +98,24 @@
<block>blocks_vector_to_stream</block>
<block>blocks_vector_to_streams</block>
<block>blocks_stream_to_vector_decimator</block>
+ <block>blocks_peak_detector2_fb</block>
+ <block>blocks_regenerate_bb</block>
+ <block>blocks_stretch_ff</block>
+ <block>blocks_threshold_ff</block>
+ </cat>
+ <cat>
+ <name>Misc Conversions (New) </name>
+ <block>blocks_packed_to_unpacked_xx</block>
+ <block>blocks_unpacked_to_packed_xx</block>
+ <block>blocks_pack_k_bits_bb</block>
+ <block>blocks_unpack_k_bits_bb</block>
+ </cat>
+ <cat>
+ <name>Misc (New) </name>
+ <block>blocks_throttle</block>
+ </cat>
+ <cat>
+ <name>Networking</name>
+ <block>blocks_tuntap_pdu</block>
</cat>
</cat>
diff --git a/gr-blocks/grc/blocks_pack_k_bits_bb.xml b/gr-blocks/grc/blocks_pack_k_bits_bb.xml
new file mode 100644
index 0000000000..5400eb4af9
--- /dev/null
+++ b/gr-blocks/grc/blocks_pack_k_bits_bb.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Pack K Bits
+###################################################
+ -->
+<block>
+ <name>Pack K Bits</name>
+ <key>blocks_pack_k_bits_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.pack_k_bits_bb($k)</make>
+ <param>
+ <name>K</name>
+ <key>k</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+
+ <doc>
+ Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros.
+ </doc>
+
+</block>
diff --git a/gr-blocks/grc/blocks_peak_detector2_fb.xml b/gr-blocks/grc/blocks_peak_detector2_fb.xml
new file mode 100644
index 0000000000..584e7a1fb3
--- /dev/null
+++ b/gr-blocks/grc/blocks_peak_detector2_fb.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Peak Detector2
+###################################################
+ -->
+<block>
+ <name>Peak Detector2</name>
+ <key>blocks_peak_detector2_fb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.peak_detector2_fb($threshold_factor_rise, $look_ahead, $alpha)</make>
+ <callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
+ <callback>set_look_ahead($look_ahead)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>TH Factor Rise</name>
+ <key>threshold_factor_rise</key>
+ <value>7</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Look Ahead</name>
+ <key>look_ahead</key>
+ <value>1000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>0.001</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_regenerate_bb.xml b/gr-blocks/grc/blocks_regenerate_bb.xml
new file mode 100644
index 0000000000..bbee53387f
--- /dev/null
+++ b/gr-blocks/grc/blocks_regenerate_bb.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Regenerate Block:
+## char in/ char out
+###################################################
+ -->
+<block>
+ <name>Regenerate</name>
+ <key>blocks_regenerate_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.regenerate_bb($period, $max_regen)</make>
+ <param>
+ <name>Period</name>
+ <key>period</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Max Regen Count</name>
+ <key>max_regen</key>
+ <value>500</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_stretch_ff.xml b/gr-blocks/grc/blocks_stretch_ff.xml
new file mode 100644
index 0000000000..00a67602b2
--- /dev/null
+++ b/gr-blocks/grc/blocks_stretch_ff.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stretch Block:
+## float in / float out
+###################################################
+ -->
+<block>
+ <name>Stretch</name>
+ <key>blocks_stretch_ff</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.stretch_ff($lo, $vlen)</make>
+ <param>
+ <name>Low</name>
+ <key>lo</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec. Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_threshold_ff.xml b/gr-blocks/grc/blocks_threshold_ff.xml
new file mode 100644
index 0000000000..0da4157fc8
--- /dev/null
+++ b/gr-blocks/grc/blocks_threshold_ff.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Threshold
+###################################################
+ -->
+<block>
+ <name>Threshold</name>
+ <key>blocks_threshold_ff</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.threshold_ff($low, $high, $init)</make>
+ <callback>set_hi($high)</callback>
+ <callback>set_lo($low)</callback>
+ <param>
+ <name>Low</name>
+ <key>low</key>
+ <value>-100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>High</name>
+ <key>high</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Initial State</name>
+ <key>init</key>
+ <value>0</value>
+ <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_throttle.xml b/gr-blocks/grc/blocks_throttle.xml
new file mode 100644
index 0000000000..8293cbde9c
--- /dev/null
+++ b/gr-blocks/grc/blocks_throttle.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Throttle
+###################################################
+ -->
+<block>
+ <name>Throttle</name>
+ <key>blocks_throttle</key>
+ <throttle>1</throttle>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.throttle($type.size*$vlen, $samples_per_second)</make>
+ <callback>set_sample_rate($samples_per_second)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <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>samples_per_second</key>
+ <value>samp_rate</value>
+ <type>real</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_transcendental.xml b/gr-blocks/grc/blocks_transcendental.xml
new file mode 100644
index 0000000000..a883a2eefc
--- /dev/null
+++ b/gr-blocks/grc/blocks_transcendental.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##transcendental functions
+###################################################
+ -->
+<block>
+ <name>Transcendental</name>
+ <key>blocks_transcendental</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.transcendental($name, "$type")</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex_double</key>
+ <opt>type:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>type:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Function Name</name>
+ <key>name</key>
+ <value>cos</value>
+ <type>string</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_tuntap_pdu.xml b/gr-blocks/grc/blocks_tuntap_pdu.xml
new file mode 100644
index 0000000000..d9a63d4a7f
--- /dev/null
+++ b/gr-blocks/grc/blocks_tuntap_pdu.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## TUNTAP PDU async message source/sink
+###################################################
+ -->
+<block>
+ <name>TUNTAP PDU</name>
+ <key>blocks_tuntap_pdu</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.tuntap_pdu($ifn, $mtu)</make>
+ <param>
+ <name>Interface Name</name>
+ <key>ifn</key>
+ <value>tun0</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>MTU</name>
+ <key>mtu</key>
+ <value>10000</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_unpack_k_bits_bb.xml b/gr-blocks/grc/blocks_unpack_k_bits_bb.xml
new file mode 100644
index 0000000000..90d7493af0
--- /dev/null
+++ b/gr-blocks/grc/blocks_unpack_k_bits_bb.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Unpack K Bits
+###################################################
+ -->
+<block>
+ <name>Unpack K Bits</name>
+ <key>blocks_unpack_k_bits_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.unpack_k_bits_bb($k)</make>
+ <param>
+ <name>K</name>
+ <key>k</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
index a6608696a1..48e399d065 100644
--- a/gr-blocks/include/blocks/CMakeLists.txt
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -125,7 +125,10 @@ install(FILES
multiply_const_cc.h
multiply_const_ff.h
nlog10_ff.h
+ pack_k_bits_bb.h
patterned_interleaver.h
+ peak_detector2_fb.h
+ regenerate_bb.h
repeat.h
rms_cf.h
rms_ff.h
@@ -136,7 +139,13 @@ install(FILES
stream_to_vector.h
streams_to_stream.h
streams_to_vector.h
+ stretch_ff.h
+ threshold_ff.h
+ throttle.h
+ transcendental.h
+ tuntap_pdu.h
uchar_to_float.h
+ unpack_k_bits_bb.h
vector_to_stream.h
vector_to_streams.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
diff --git a/gr-blocks/include/blocks/pack_k_bits_bb.h b/gr-blocks/include/blocks/pack_k_bits_bb.h
new file mode 100644
index 0000000000..5bf71c9c3e
--- /dev/null
+++ b/gr-blocks/include/blocks/pack_k_bits_bb.h
@@ -0,0 +1,53 @@
+/* -*- 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_PACK_K_BITS_BB_H
+#define INCLUDED_GR_PACK_K_BITS_BB_H
+
+#include <blocks/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Converts a stream of bytes with 1 bit in the LSB to a
+ * byte with k relevent bits.
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API pack_k_bits_bb : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::blocks::pack_k_bits_bb::sptr
+ typedef boost::shared_ptr<pack_k_bits_bb> sptr;
+
+ /*!
+ * \brief Make a pack_k_bits block.
+ * \param k number of bits to be packed.
+ */
+ static sptr make(unsigned k);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PACK_K_BITS_BB_H */
diff --git a/gr-blocks/include/blocks/peak_detector2_fb.h b/gr-blocks/include/blocks/peak_detector2_fb.h
new file mode 100644
index 0000000000..71afc3287b
--- /dev/null
+++ b/gr-blocks/include/blocks/peak_detector2_fb.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Detect the peak of a signal
+ * \ingroup level_blk
+ *
+ * If a peak is detected, this block outputs a 1, or it outputs
+ * 0's. A separate debug output may be connected, to view the
+ * internal EWMA described below.
+ *
+ * \param threshold_factor_rise The threshold factor determins
+ * when a peak is present. An EWMA average of the signal is
+ * calculated and when the value of the signal goes over
+ * threshold_factor_rise*average, we call the peak.
+ * \param look_ahead The look-ahead value is used when the
+ * threshold is found to locate the peak within this range.
+ * \param alpha The gain value of a single-pole moving average filter.
+ */
+ class BLOCKS_API peak_detector2_fb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::peak_detector2_fb::sptr
+ typedef boost::shared_ptr<peak_detector2_fb> sptr;
+
+ static sptr make(float threshold_factor_rise=7,
+ int look_ahead=1000, float alpha=0.001);
+
+ /*! \brief Set the threshold factor value for the rise time
+ * \param thr new threshold factor
+ */
+ virtual void set_threshold_factor_rise(float thr) = 0;
+
+ /*! \brief Set the look-ahead factor
+ * \param look new look-ahead factor
+ */
+ virtual void set_look_ahead(int look) = 0;
+
+ /*! \brief Set the running average alpha
+ * \param alpha new alpha for running average
+ */
+ virtual void set_alpha(int alpha) = 0;
+
+ /*! \brief Get the threshold factor value for the rise time
+ * \return threshold factor
+ */
+ virtual float threshold_factor_rise() = 0;
+
+ /*! \brief Get the look-ahead factor value
+ * \return look-ahead factor
+ */
+ virtual int look_ahead() = 0;
+
+ /*! \brief Get the alpha value of the running average
+ * \return alpha
+ */
+ virtual float alpha() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */
diff --git a/gr-blocks/include/blocks/regenerate_bb.h b/gr-blocks/include/blocks/regenerate_bb.h
new file mode 100644
index 0000000000..3063e70a7f
--- /dev/null
+++ b/gr-blocks/include/blocks/regenerate_bb.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Detect the peak of a signal and repeat every period samples
+ * \ingroup level_blk
+ *
+ * If a peak is detected, this block outputs a 1 repeated every
+ * period samples until reset by detection of another 1 on the
+ * input or stopped after max_regen regenerations have occurred.
+ *
+ * Note that if max_regen=(-1)/ULONG_MAX then the regeneration
+ * will run forever.
+ */
+ class BLOCKS_API regenerate_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::regenerate_bb::sptr
+ typedef boost::shared_ptr<regenerate_bb> sptr;
+
+ /*!
+ * \brief Make a regenerate block
+ * \param period The number of samples between regenerations
+ * \param max_regen The maximum number of regenerations to
+ * perform; if set to ULONG_MAX, it will regenerate
+ * continuously.
+ */
+ static sptr make(int period, unsigned int max_regen=500);
+
+ /*! \brief Reset the maximum regeneration count; this will reset
+ the current regen.
+ */
+ virtual void set_max_regen(unsigned int regen) = 0;
+
+ /*! \brief Reset the period of regenerations; this will reset
+ the current regen.
+ */
+ virtual void set_period(int period) = 0;
+
+ /*! \brief return the maximum regeneration count.
+ */
+ virtual unsigned int max_regen() const = 0;
+
+ /*! \brief return the regeneration period.
+ */
+ virtual int period() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_H */
diff --git a/gr-blocks/include/blocks/stretch_ff.h b/gr-blocks/include/blocks/stretch_ff.h
new file mode 100644
index 0000000000..5f98452a41
--- /dev/null
+++ b/gr-blocks/include/blocks/stretch_ff.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_STRETCH_FF_H
+#define INCLUDED_GR_STRETCH_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief adjust y-range of an input vector by mapping to range
+ * (max-of-input, stipulated-min). Primarily for spectral
+ * signature matching by normalizing spectrum dynamic ranges.
+ * \ingroup misc_blk
+ */
+ class BLOCKS_API stretch_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::stretch_ff::sptr
+ typedef boost::shared_ptr<stretch_ff> sptr;
+
+ /*!
+ * \brief Make a stretch block.
+ * \param lo Set low value for range.
+ * \param vlen vector length of input stream.
+ */
+ static sptr make(float lo, size_t vlen=1);
+
+ virtual float lo() const = 0;
+ virtual void set_lo(float lo) = 0;
+ virtual size_t vlen() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_STRETCH_FF_H */
diff --git a/gr-blocks/include/blocks/threshold_ff.h b/gr-blocks/include/blocks/threshold_ff.h
new file mode 100644
index 0000000000..900e5c5bdb
--- /dev/null
+++ b/gr-blocks/include/blocks/threshold_ff.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THRESHOLD_FF_H
+#define INCLUDED_GR_THRESHOLD_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Output a 1 or zero based on a threshold value.
+ * \ingroup misc_blk
+ *
+ * Test the incoming signal against a threshold. If the signal
+ * excedes the \p hi value, it will output a 1 until the signal
+ * falls below the \p lo value.
+ */
+ class BLOCKS_API threshold_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::threshold_ff::sptr
+ typedef boost::shared_ptr<threshold_ff> sptr;
+
+ /* \brief Create a threadshold block.
+ * \param lo Threshold input signal needs to drop below to
+ * change state to 0.
+ * \param hi Threshold input signal needs to rise above to
+ * change state to 1.
+ * \param initial_state Initial state of the block (0 or 1).
+ */
+ static sptr make(float lo, float hi, float initial_state=0);
+
+ virtual float lo () const = 0;
+ virtual void set_lo (float lo) = 0;
+ virtual float hi () const = 0;
+ virtual void set_hi (float hi) = 0;
+ virtual float last_state () const = 0;
+ virtual void set_last_state (float last_state) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THRESHOLD_FF_H */
diff --git a/gr-blocks/include/blocks/throttle.h b/gr-blocks/include/blocks/throttle.h
new file mode 100644
index 0000000000..20d8037e10
--- /dev/null
+++ b/gr-blocks/include/blocks/throttle.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THROTTLE_H
+#define INCLUDED_GR_THROTTLE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief throttle flow of samples such that the average rate does
+ * not exceed samples_per_sec.
+ * \ingroup misc_blk
+ *
+ * input: one stream of itemsize; output: one stream of itemsize
+ *
+ * N.B. this should only be used in GUI apps where there is no
+ * other rate limiting block. It is not intended nor effective at
+ * precisely controlling the rate of samples. That should be
+ * controlled by a source or sink tied to sample clock. E.g., a
+ * USRP or audio card.
+ */
+ class BLOCKS_API throttle : virtual public gr_sync_block
+ {
+ public:
+ typedef boost::shared_ptr<throttle> sptr;
+
+ static sptr make(size_t itemsize, double samples_per_sec);
+
+ //! Sets the sample rate in samples per second.
+ virtual void set_sample_rate(double rate) = 0;
+
+ //! Get the sample rate in samples per second.
+ virtual double sample_rate() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THROTTLE_H */
diff --git a/gr-blocks/include/blocks/transcendental.h b/gr-blocks/include/blocks/transcendental.h
new file mode 100644
index 0000000000..f8a0d5d805
--- /dev/null
+++ b/gr-blocks/include/blocks/transcendental.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_TRANSCENDENTAL_H
+#define INCLUDED_GR_TRANSCENDENTAL_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <string>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A block that performs various transcendental math operations.
+ *
+ * Possible function names can be found in the cmath library. IO
+ * may be either complex or real, double or single precision.
+ *
+ * Possible type strings: float, double, complex_float, complex_double
+ *
+ * output[i] = trans_fcn(input[i])
+ */
+ class BLOCKS_API transcendental : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::transcendental::sptr
+ typedef boost::shared_ptr<transcendental> sptr;
+
+ static sptr make(const std::string &name,
+ const std::string &type="float");
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TRANSCENDENTAL_H */
diff --git a/gr-blocks/include/blocks/tuntap_pdu.h b/gr-blocks/include/blocks/tuntap_pdu.h
new file mode 100644
index 0000000000..70abb0bd5b
--- /dev/null
+++ b/gr-blocks/include/blocks/tuntap_pdu.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_BLOCKS_TUNTAP_PDU_H
+#define INCLUDED_BLOCKS_TUNTAP_PDU_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Creates TUNTAP interface and translates traffic to PDUs
+ * \ingroup net_blk
+ */
+ class BLOCKS_API tuntap_pdu : virtual public gr_block
+ {
+ public:
+ // gr::blocks::tuntap_pdu::sptr
+ typedef boost::shared_ptr<tuntap_pdu> sptr;
+
+ /*!
+ * \brief Construct a TUNTAP PDU interface
+ * \param dev Device name to create
+ * \param MTU Maximum Transmission Unit size
+ */
+ static sptr make(std::string dev, int MTU=10000);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_TUNTAP_PDU_H */
diff --git a/gr-blocks/include/blocks/unpack_k_bits_bb.h b/gr-blocks/include/blocks/unpack_k_bits_bb.h
new file mode 100644
index 0000000000..b716ded1d3
--- /dev/null
+++ b/gr-blocks/include/blocks/unpack_k_bits_bb.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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_UNPACK_K_BITS_BB_H
+#define INCLUDED_GR_UNPACK_K_BITS_BB_H
+
+#include <blocks/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB.
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API unpack_k_bits_bb : virtual public gr_sync_interpolator
+ {
+ public:
+ // gr::blocks::unpack_k_bits_bb::sptr
+ typedef boost::shared_ptr<unpack_k_bits_bb> sptr;
+
+ /*!
+ * \brief Make an unpack_k_bits block.
+ * \param k number of bits to unpack.
+ */
+ static sptr make(unsigned k);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UNPACK_K_BITS_BB_H */
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 9b076f6964..28158ab593 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -164,19 +164,29 @@ list(APPEND gr_blocks_sources
multiply_const_cc_impl.cc
multiply_const_ff_impl.cc
nlog10_ff_impl.cc
+ pack_k_bits_bb_impl.cc
patterned_interleaver_impl.cc
+ peak_detector2_fb_impl.cc
+ regenerate_bb_impl.cc
repeat_impl.cc
rms_cf_impl.cc
rms_ff_impl.cc
short_to_char_impl.cc
short_to_float_impl.cc
stream_mux_impl.cc
+ stream_pdu_base.cc
stream_to_streams_impl.cc
stream_to_vector_impl.cc
streams_to_stream_impl.cc
streams_to_vector_impl.cc
+ stretch_ff_impl.cc
+ threshold_ff_impl.cc
+ throttle_impl.cc
+ transcendental_impl.cc
+ tuntap_pdu_impl.cc
uchar_array_to_float.cc
uchar_to_float_impl.cc
+ unpack_k_bits_bb_impl.cc
vector_to_stream_impl.cc
vector_to_streams_impl.cc
)
diff --git a/gr-blocks/lib/ConfigChecks.cmake b/gr-blocks/lib/ConfigChecks.cmake
index 72d6d1d8ab..7f60aed403 100644
--- a/gr-blocks/lib/ConfigChecks.cmake
+++ b/gr-blocks/lib/ConfigChecks.cmake
@@ -56,7 +56,7 @@ CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
IF(HAVE_WINDOWS_H)
ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK)
MESSAGE(STATUS "Adding windows libs to gr blocks libs...")
- LIST(APPEND gnuradio_core_libs WS2_32.lib WSock32.lib)
+ LIST(APPEND blocks_libs WS2_32.lib WSock32.lib)
ENDIF(HAVE_WINDOWS_H)
########################################################################
diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.cc b/gr-blocks/lib/pack_k_bits_bb_impl.cc
new file mode 100644
index 0000000000..2a7fcc04cb
--- /dev/null
+++ b/gr-blocks/lib/pack_k_bits_bb_impl.cc
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pack_k_bits_bb_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+namespace gr {
+ namespace blocks {
+
+ pack_k_bits_bb::sptr
+ pack_k_bits_bb::make(unsigned k)
+ {
+ return gnuradio::get_initial_sptr
+ (new pack_k_bits_bb_impl(k));
+ }
+
+ pack_k_bits_bb_impl::pack_k_bits_bb_impl(unsigned k)
+ : gr_sync_decimator("pack_k_bits_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ k),
+ d_k(k)
+ {
+ if(d_k == 0)
+ throw std::out_of_range("interpolation must be > 0");
+ }
+
+ pack_k_bits_bb_impl::~pack_k_bits_bb_impl()
+ {
+ }
+
+ int
+ pack_k_bits_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = 0x00;
+ for(unsigned int j = 0; j < d_k; j++) {
+ out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1);
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.h b/gr-blocks/lib/pack_k_bits_bb_impl.h
new file mode 100644
index 0000000000..668d438a46
--- /dev/null
+++ b/gr-blocks/lib/pack_k_bits_bb_impl.h
@@ -0,0 +1,48 @@
+/* -*- 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_PACK_K_BITS_BB_IMPL_H
+#define INCLUDED_GR_PACK_K_BITS_BB_IMPL_H
+
+#include <blocks/pack_k_bits_bb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class pack_k_bits_bb_impl : public pack_k_bits_bb
+ {
+ private:
+ unsigned d_k; // number of relevent bits to pack from k input bytes
+
+ public:
+ pack_k_bits_bb_impl(unsigned k);
+ ~pack_k_bits_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PACK_K_BITS_BB_IMPL_H */
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.cc b/gr-blocks/lib/peak_detector2_fb_impl.cc
new file mode 100644
index 0000000000..0d375c3bad
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.cc
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "peak_detector2_fb_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ peak_detector2_fb::sptr
+ peak_detector2_fb::make(float threshold_factor_rise,
+ int look_ahead, float alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new peak_detector2_fb_impl(threshold_factor_rise,
+ look_ahead, alpha));
+ }
+
+ peak_detector2_fb_impl::peak_detector2_fb_impl(float threshold_factor_rise,
+ int look_ahead, float alpha)
+ : gr_sync_block("peak_detector2_fb",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature2(1, 2, sizeof(char), sizeof(float))),
+ d_threshold_factor_rise(threshold_factor_rise),
+ d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false)
+ {
+ }
+
+ peak_detector2_fb_impl::~peak_detector2_fb_impl()
+ {
+ }
+
+ int
+ peak_detector2_fb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *iptr = (float *)input_items[0];
+ char *optr = (char *)output_items[0];
+
+ assert(noutput_items >= 2);
+
+ memset(optr, 0, noutput_items*sizeof(char));
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(!d_found) {
+ // Have not yet detected presence of peak
+ if(iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) {
+ d_found = true;
+ d_look_ahead_remaining = d_look_ahead;
+ d_peak_val = -(float)INFINITY;
+ }
+ else {
+ d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
+ }
+ }
+ else {
+ // Detected presence of peak
+ if(iptr[i] > d_peak_val) {
+ d_peak_val = iptr[i];
+ d_peak_ind = i;
+ }
+ else if(d_look_ahead_remaining <= 0) {
+ optr[d_peak_ind] = 1;
+ d_found = false;
+ d_avg = iptr[i];
+ }
+
+ // Have not yet located peak, loop and keep searching.
+ d_look_ahead_remaining--;
+ }
+
+ // Every iteration of the loop, write debugging signal out if
+ // connected:
+ if(output_items.size() == 2) {
+ float *sigout = (float *)output_items[1];
+ sigout[i] = d_avg;
+ }
+ } // loop
+
+ if(!d_found)
+ return noutput_items;
+
+ // else if detected presence, keep searching during the next call to work.
+ int tmp = d_peak_ind;
+ d_peak_ind = 1;
+
+ return tmp - 1;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.h b/gr-blocks/lib/peak_detector2_fb_impl.h
new file mode 100644
index 0000000000..f03dd36a8d
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H
+
+#include <blocks/peak_detector2_fb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class peak_detector2_fb_impl : public peak_detector2_fb
+ {
+ private:
+ float d_threshold_factor_rise;
+ int d_look_ahead;
+ int d_look_ahead_remaining;
+ int d_peak_ind;
+ float d_peak_val;
+ float d_alpha;
+ float d_avg;
+ bool d_found;
+
+ public:
+ peak_detector2_fb_impl(float threshold_factor_rise,
+ int look_ahead, float alpha);
+ ~peak_detector2_fb_impl();
+
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
+ void set_look_ahead(int look) { d_look_ahead = look; }
+ void set_alpha(int alpha) { d_alpha = alpha; }
+
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+ int look_ahead() { return d_look_ahead; }
+ float alpha() { return d_alpha; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H */
diff --git a/gr-blocks/lib/regenerate_bb_impl.cc b/gr-blocks/lib/regenerate_bb_impl.cc
new file mode 100644
index 0000000000..4472efb6d4
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.cc
@@ -0,0 +1,103 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "regenerate_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ regenerate_bb::sptr
+ regenerate_bb::make(int period, unsigned int max_regen)
+ {
+ return gnuradio::get_initial_sptr
+ (new regenerate_bb_impl(period, max_regen));
+ }
+
+ regenerate_bb_impl::regenerate_bb_impl(int period, unsigned int max_regen)
+ : gr_sync_block("regenerate_bb",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(char))),
+ d_period(period),
+ d_countdown(0),
+ d_max_regen(max_regen),
+ d_regen_count(max_regen)
+ {
+ }
+
+ regenerate_bb_impl::~regenerate_bb_impl()
+ {
+ }
+
+ void
+ regenerate_bb_impl::set_max_regen(unsigned int regen)
+ {
+ d_max_regen = regen;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ void
+ regenerate_bb_impl::set_period(int period)
+ {
+ d_period = period;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ int
+ regenerate_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *iptr = (const char *)input_items[0];
+ char *optr = (char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ optr[i] = 0;
+
+ if(d_regen_count < d_max_regen) {
+ d_countdown--;
+
+ if(d_countdown == 0) {
+ optr[i] = 1;
+ d_countdown = d_period;
+ d_regen_count++;
+ }
+ }
+
+ if(iptr[i] == 1) {
+ d_countdown = d_period;
+ optr[i] = 1;
+ d_regen_count = 0;
+ }
+
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/regenerate_bb_impl.h b/gr-blocks/lib/regenerate_bb_impl.h
new file mode 100644
index 0000000000..bcfa18391f
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_IMPL_H
+
+#include <blocks/regenerate_bb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class regenerate_bb_impl : public regenerate_bb
+ {
+ private:
+ int d_period;
+ int d_countdown;
+ unsigned int d_max_regen;
+ unsigned int d_regen_count;
+
+ public:
+ regenerate_bb_impl(int period, unsigned int max_regen=500);
+ ~regenerate_bb_impl();
+
+ void set_max_regen(unsigned int regen);
+ void set_period(int period);
+
+ unsigned int max_regen() const { return d_max_regen; };
+ int period() const { return d_period; };
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_IMPL_H */
diff --git a/gr-blocks/lib/stream_pdu_base.cc b/gr-blocks/lib/stream_pdu_base.cc
new file mode 100644
index 0000000000..14e76149a0
--- /dev/null
+++ b/gr-blocks/lib/stream_pdu_base.cc
@@ -0,0 +1,126 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+#include <gr_pdu.h>
+#include <gr_basic_block.h>
+#include "stream_pdu_base.h"
+#include <boost/format.hpp>
+
+static const long timeout_us = 100*1000; //100ms
+
+namespace gr {
+ namespace blocks {
+
+ stream_pdu_base::stream_pdu_base(int MTU)
+ : d_fd(-1),
+ d_started(false),
+ d_finished(false)
+ {
+ // reserve space for rx buffer
+ d_rxbuf.resize(MTU,0);
+ }
+
+ stream_pdu_base::~stream_pdu_base()
+ {
+ stop_rxthread();
+ }
+
+ void
+ stream_pdu_base::start_rxthread(gr_basic_block *blk, pmt::pmt_t port)
+ {
+ d_blk = blk;
+ d_port = port;
+ d_thread = gruel::thread(boost::bind(&stream_pdu_base::run, this));
+ d_started = true;
+ }
+
+ void
+ stream_pdu_base::stop_rxthread()
+ {
+ d_finished = true;
+
+ if (d_started) {
+ d_thread.interrupt();
+ d_thread.join();
+ }
+ }
+
+ void
+ stream_pdu_base::run()
+ {
+ while(!d_finished) {
+ if (!wait_ready())
+ continue;
+
+ const int result = read(d_fd, &d_rxbuf[0], d_rxbuf.size());
+ if (result <= 0)
+ throw std::runtime_error("stream_pdu_base, bad socket read!");
+
+ pmt::pmt_t vector = pmt::init_u8vector(result, &d_rxbuf[0]);
+ pmt::pmt_t pdu = pmt::cons(pmt::PMT_NIL, vector);
+
+ d_blk->message_port_pub(d_port, pdu);
+ }
+ }
+
+ bool
+ stream_pdu_base::wait_ready()
+ {
+ //setup timeval for timeout
+ timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = timeout_us;
+
+ //setup rset for timeout
+ fd_set rset;
+ FD_ZERO(&rset);
+ FD_SET(d_fd, &rset);
+
+ //call select with timeout on receive socket
+ return ::select(d_fd+1, &rset, NULL, NULL, &tv) > 0;
+ }
+
+ void
+ stream_pdu_base::send(pmt::pmt_t msg)
+ {
+ pmt::pmt_t vector = pmt::cdr(msg);
+ size_t offset(0);
+ size_t itemsize(::gr_pdu_itemsize(type_from_pmt(vector)));
+ int len(pmt::length(vector)*itemsize);
+
+ const int rv = write(d_fd, pmt::uniform_vector_elements(vector, offset), len);
+ if (rv != len) {
+ std::cerr << boost::format("WARNING: gr_stream_pdu_base::send(pdu) write failed! (d_fd=%d, len=%d, rv=%d)")
+ % d_fd % len % rv << std::endl;
+ }
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stream_pdu_base.h b/gr-blocks/lib/stream_pdu_base.h
new file mode 100644
index 0000000000..66eaaf0c04
--- /dev/null
+++ b/gr-blocks/lib/stream_pdu_base.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_STREAM_PDU_BASE_H
+#define INCLUDED_STREAM_PDU_BASE_H
+
+#include <gruel/thread.h>
+#include <gruel/pmt.h>
+
+class gr_basic_block;
+
+namespace gr {
+ namespace blocks {
+
+ class stream_pdu_base
+ {
+ public:
+ stream_pdu_base(int MTU=10000);
+ ~stream_pdu_base();
+
+ protected:
+ int d_fd;
+ bool d_started;
+ bool d_finished;
+ std::vector<uint8_t> d_rxbuf;
+ gruel::thread d_thread;
+
+ pmt::pmt_t d_port;
+ gr_basic_block *d_blk;
+
+ void run();
+ void send(pmt::pmt_t msg);
+ bool wait_ready();
+ void start_rxthread(gr_basic_block *blk, pmt::pmt_t rxport);
+ void stop_rxthread();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_STREAM_PDU_BASE_H */
diff --git a/gr-blocks/lib/stretch_ff_impl.cc b/gr-blocks/lib/stretch_ff_impl.cc
new file mode 100644
index 0000000000..90bbc7ee5a
--- /dev/null
+++ b/gr-blocks/lib/stretch_ff_impl.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "stretch_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ stretch_ff::sptr
+ stretch_ff::make(float lo, size_t vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new stretch_ff_impl(lo, vlen));
+ }
+
+ stretch_ff_impl::stretch_ff_impl(float lo, size_t vlen)
+ : gr_sync_block("stretch_ff",
+ gr_make_io_signature(1, 1, vlen * sizeof(float)),
+ gr_make_io_signature(1, 1, vlen * sizeof(float))),
+ d_lo(lo), d_vlen(vlen)
+ {
+ }
+
+ stretch_ff_impl::~stretch_ff_impl()
+ {
+ }
+
+ int
+ stretch_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int count = 0; count < noutput_items; count++) {
+ float vmax = in[0] - d_lo;
+
+ for(unsigned int i = 1; i < d_vlen; i++) {
+ float vtmp = in[i] - d_lo;
+ if(vtmp > vmax)
+ vmax = vtmp;
+ }
+
+ if(vmax != 0.0)
+ for(unsigned int i = 0; i < d_vlen; i++)
+ out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax);
+ else
+ for(unsigned int i = 0; i < d_vlen; i++)
+ out[i] = in[i];
+
+ in += d_vlen;
+ out += d_vlen;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stretch_ff_impl.h b/gr-blocks/lib/stretch_ff_impl.h
new file mode 100644
index 0000000000..af69d835a5
--- /dev/null
+++ b/gr-blocks/lib/stretch_ff_impl.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_STRETCH_FF_IMPL_H
+#define INCLUDED_GR_STRETCH_FF_IMPL_H
+
+#include <blocks/stretch_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class stretch_ff_impl : public stretch_ff
+ {
+ private:
+ float d_lo; // the constant
+ size_t d_vlen;
+
+ public:
+ stretch_ff_impl(float lo, size_t vlen);
+ ~stretch_ff_impl();
+
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ size_t vlen() const { return d_vlen; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_STRETCH_FF_IMPL_H */
diff --git a/gr-blocks/lib/threshold_ff_impl.cc b/gr-blocks/lib/threshold_ff_impl.cc
new file mode 100644
index 0000000000..477f2b1c89
--- /dev/null
+++ b/gr-blocks/lib/threshold_ff_impl.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "threshold_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ threshold_ff::sptr
+ threshold_ff::make(float lo, float hi, float initial_state)
+ {
+ return gnuradio::get_initial_sptr
+ (new threshold_ff_impl(lo, hi, initial_state));
+ }
+
+ threshold_ff_impl::threshold_ff_impl(float lo, float hi,
+ float initial_state)
+ : gr_sync_block("threshold_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_lo(lo), d_hi(hi), d_last_state(initial_state)
+ {
+ }
+
+ threshold_ff_impl::~threshold_ff_impl()
+ {
+ }
+
+ int
+ threshold_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(in[i] > d_hi) {
+ out[i] = 1.0;
+ d_last_state = 1.0;
+ }
+ else if(in[i] < d_lo) {
+ out[i] = 0.0;
+ d_last_state = 0.0;
+ }
+ else
+ out[i] = d_last_state;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/threshold_ff_impl.h b/gr-blocks/lib/threshold_ff_impl.h
new file mode 100644
index 0000000000..41afaa52aa
--- /dev/null
+++ b/gr-blocks/lib/threshold_ff_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THRESHOLD_FF_IMPL_H
+#define INCLUDED_GR_THRESHOLD_FF_IMPL_H
+
+#include <blocks/threshold_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class threshold_ff_impl : public threshold_ff
+ {
+ private:
+ float d_lo, d_hi; // the constant
+ float d_last_state;
+
+ public:
+ threshold_ff_impl(float lo, float hi,
+ float initial_state=0);
+ ~threshold_ff_impl();
+
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ float hi() const { return d_hi; }
+ void set_hi(float hi) { d_hi = hi; }
+ float last_state() const { return d_last_state; }
+ void set_last_state(float last_state) { d_last_state = last_state; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THRESHOLD_FF_IMPL_H */
diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc
new file mode 100644
index 0000000000..49743e3f26
--- /dev/null
+++ b/gr-blocks/lib/throttle_impl.cc
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "throttle_impl.h"
+#include <gr_io_signature.h>
+#include <cstring>
+#include <boost/thread/thread.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ throttle::sptr
+ throttle::make(size_t itemsize, double samples_per_sec)
+ {
+ return gnuradio::get_initial_sptr
+ (new throttle_impl(itemsize, samples_per_sec));
+ }
+
+ throttle_impl::throttle_impl(size_t itemsize,
+ double samples_per_second)
+ : gr_sync_block("throttle",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize)
+ {
+ set_sample_rate(samples_per_second);
+ }
+
+ throttle_impl::~throttle_impl()
+ {
+ }
+
+ void
+ throttle_impl::set_sample_rate(double rate)
+ {
+ //changing the sample rate performs a reset of state params
+ d_start = boost::get_system_time();
+ d_total_samples = 0;
+ d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second();
+ d_samps_per_us = rate/1e6;
+ }
+
+ double
+ throttle_impl::sample_rate() const
+ {
+ return d_samps_per_us * 1e6;
+ }
+
+ int
+ throttle_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ //calculate the expected number of samples to have passed through
+ boost::system_time now = boost::get_system_time();
+ boost::int64_t ticks = (now - d_start).ticks();
+ uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks);
+
+ //if the expected samples was less, we need to throttle back
+ if(d_total_samples > expected_samps) {
+ boost::this_thread::sleep(boost::posix_time::microseconds
+ (long((d_total_samples - expected_samps)/d_samps_per_us)));
+ }
+
+ //copy all samples output[i] <= input[i]
+ const char *in = (const char *)input_items[0];
+ char *out = (char *)output_items[0];
+ std::memcpy(out, in, noutput_items * d_itemsize);
+ d_total_samples += noutput_items;
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/throttle_impl.h b/gr-blocks/lib/throttle_impl.h
new file mode 100644
index 0000000000..86dbef2ac9
--- /dev/null
+++ b/gr-blocks/lib/throttle_impl.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_THROTTLE_IMPL_H
+#define INCLUDED_GR_THROTTLE_IMPL_H
+
+#include <blocks/throttle.h>
+
+namespace gr {
+ namespace blocks {
+
+ class throttle_impl : public throttle
+ {
+ private:
+ boost::system_time d_start;
+ size_t d_itemsize;
+ uint64_t d_total_samples;
+ double d_samps_per_tick, d_samps_per_us;
+
+ public:
+ throttle_impl(size_t itemsize, double samples_per_sec);
+ ~throttle_impl();
+
+ void set_sample_rate(double rate);
+ double sample_rate() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THROTTLE_IMPL_H */
diff --git a/gr-blocks/lib/transcendental_impl.cc b/gr-blocks/lib/transcendental_impl.cc
new file mode 100644
index 0000000000..725899ca85
--- /dev/null
+++ b/gr-blocks/lib/transcendental_impl.cc
@@ -0,0 +1,150 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "transcendental_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <complex> //complex math
+#include <cmath> //real math
+#include <map>
+
+namespace gr {
+ namespace blocks {
+
+ /***********************************************************************
+ * work function creation and registration
+ **********************************************************************/
+ struct map_val_type
+ {
+ work_fcn_type work_fcn;
+ size_t io_size;
+ };
+ typedef std::map<std::string, map_val_type> map_type;
+
+ //construct map on first use idiom
+ static map_type &
+ get_map(void)
+ {
+ static map_type map;
+ return map;
+ }
+
+ //static initialization of this object registers a function
+ struct transcendental_registrant
+ {
+ transcendental_registrant(const std::string &key,
+ const work_fcn_type &work_fcn,
+ const size_t io_size)
+ {
+ map_val_type val;
+ val.work_fcn = work_fcn;
+ val.io_size = io_size;
+ get_map()[key] = val;
+ }
+ };
+
+ //macro to create a work function and register it
+#define REGISTER_FUNCTION(__fcn__, __type__, __key__) \
+ static int __key__ ## _work( \
+ int noutput_items, \
+ gr_vector_const_void_star &input_items, \
+ gr_vector_void_star &output_items) \
+ { \
+ const __type__ *in = (const __type__ *) input_items[0]; \
+ __type__ *out = (__type__ *) output_items[0]; \
+ for (size_t i = 0; i < size_t(noutput_items); i++){ \
+ out[i] = std::__fcn__(in[i]); \
+ } \
+ return noutput_items; \
+ } \
+ transcendental_registrant __key__ ## _registrant(#__key__, &__key__ ## _work, sizeof(__type__));
+
+ //register work functions for real types
+#define REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, float, __fcn__ ## _float) \
+ REGISTER_FUNCTION(__fcn__, double, __fcn__ ## _double)
+
+ //register work functions for complex types
+#define REGISTER_COMPLEX_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, std::complex<float>, __fcn__ ## _complex_float) \
+ REGISTER_FUNCTION(__fcn__, std::complex<double>, __fcn__ ## _complex_double)
+
+ //register both complex and real
+#define REGISTER_FUNCTIONS(__fcn__) \
+ REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_COMPLEX_FUNCTIONS(__fcn__)
+
+ //create and register transcendental work functions
+ REGISTER_FUNCTIONS(cos)
+ REGISTER_FUNCTIONS(sin)
+ REGISTER_FUNCTIONS(tan)
+ REGISTER_REAL_FUNCTIONS(acos)
+ REGISTER_REAL_FUNCTIONS(asin)
+ REGISTER_REAL_FUNCTIONS(atan)
+ REGISTER_FUNCTIONS(cosh)
+ REGISTER_FUNCTIONS(sinh)
+ REGISTER_FUNCTIONS(tanh)
+ REGISTER_FUNCTIONS(exp)
+ REGISTER_FUNCTIONS(log)
+ REGISTER_FUNCTIONS(log10)
+ REGISTER_FUNCTIONS(sqrt)
+
+
+ transcendental::sptr
+ transcendental::make(const std::string &name,
+ const std::string &type)
+ {
+ //search for an entry in the map
+ const std::string key = name + "_" + type;
+ const bool has_key = get_map().count(key) != 0;
+ if(!has_key)
+ throw std::runtime_error("could not find transcendental function for " + key);
+
+ //make a new block with found work function
+ return gnuradio::get_initial_sptr
+ (new transcendental_impl(get_map()[key].work_fcn, get_map()[key].io_size));
+ }
+
+ transcendental_impl::transcendental_impl(const work_fcn_type &work_fcn,
+ const size_t io_size)
+ : gr_sync_block("transcendental",
+ gr_make_io_signature(1, 1, io_size),
+ gr_make_io_signature(1, 1, io_size)),
+ _work_fcn(work_fcn)
+ {
+ // NOP
+ }
+
+ transcendental_impl::~transcendental_impl()
+ {
+ }
+
+ int
+ transcendental_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ return _work_fcn(noutput_items, input_items, output_items);
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/transcendental_impl.h b/gr-blocks/lib/transcendental_impl.h
new file mode 100644
index 0000000000..47055551e4
--- /dev/null
+++ b/gr-blocks/lib/transcendental_impl.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_TRANSCENDENTAL_IMPL_H
+#define INCLUDED_GR_TRANSCENDENTAL_IMPL_H
+
+#include <blocks/transcendental.h>
+
+namespace gr {
+ namespace blocks {
+
+ typedef int(*work_fcn_type)(int, gr_vector_const_void_star &, gr_vector_void_star &);
+
+ class transcendental_impl : public transcendental
+ {
+ private:
+ const work_fcn_type &_work_fcn;
+
+ public:
+ transcendental_impl(const work_fcn_type &work_fcn,
+ const size_t io_size);
+ ~transcendental_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TRANSCENDENTAL_IMPL_H */
diff --git a/gr-blocks/lib/tuntap_pdu_impl.cc b/gr-blocks/lib/tuntap_pdu_impl.cc
new file mode 100644
index 0000000000..1970a92b69
--- /dev/null
+++ b/gr-blocks/lib/tuntap_pdu_impl.cc
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tuntap_pdu_impl.h"
+#include <gr_io_signature.h>
+#include <gr_pdu.h>
+#include <boost/format.hpp>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+#include <sys/ioctl.h>
+#include <arpa/inet.h>
+#include <linux/if.h>
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ tuntap_pdu::sptr
+ tuntap_pdu::make(std::string dev, int MTU)
+ {
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+ return gnuradio::get_initial_sptr(new tuntap_pdu_impl(dev, MTU));
+#else
+ throw std::runtime_error("tuntap_pdu not implemented on this platform");
+#endif
+ }
+
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+ tuntap_pdu_impl::tuntap_pdu_impl(std::string dev, int MTU)
+ : gr_block("tuntap_pdu",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (0, 0, 0)),
+ stream_pdu_base(MTU),
+ d_dev(dev)
+ {
+ // make the tuntap
+ char dev_cstr[1024];
+ memset(dev_cstr, 0x00, 1024);
+ strncpy(dev_cstr, dev.c_str(), std::min(sizeof(dev_cstr), dev.size()));
+
+ d_fd = tun_alloc(dev_cstr);
+ if (d_fd <= 0)
+ throw std::runtime_error("gr::tuntap_pdu::make: tun_alloc failed (are you running as root?)");
+
+ std::cout << boost::format(
+ "Allocated virtual ethernet interface: %s\n"
+ "You must now use ifconfig to set its IP address. E.g.,\n"
+ " $ sudo ifconfig %s 192.168.200.1\n"
+ "Be sure to use a different address in the same subnet for each machine.\n"
+ ) % dev % dev << std::endl;
+
+ // set up output message port
+ message_port_register_out(PDU_PORT_ID);
+ start_rxthread(this, PDU_PORT_ID);
+
+ // set up input message port
+ message_port_register_in(PDU_PORT_ID);
+ set_msg_handler(PDU_PORT_ID, boost::bind(&tuntap_pdu_impl::send, this, _1));
+ }
+
+ int
+ tuntap_pdu_impl::tun_alloc(char *dev, int flags)
+ {
+ struct ifreq ifr;
+ int fd, err;
+ const char *clonedev = "/dev/net/tun";
+
+ /* Arguments taken by the function:
+ *
+ * char *dev: the name of an interface (or '\0'). MUST have enough
+ * space to hold the interface name if '\0' is passed
+ * int flags: interface flags (eg, IFF_TUN etc.)
+ */
+
+ /* open the clone device */
+ if ((fd = open(clonedev, O_RDWR)) < 0)
+ return fd;
+
+ /* preparation of the struct ifr, of type "struct ifreq" */
+ memset(&ifr, 0, sizeof(ifr));
+
+ ifr.ifr_flags = flags; /* IFF_TUN or IFF_TAP, plus maybe IFF_NO_PI */
+
+ /* if a device name was specified, put it in the structure; otherwise,
+ * the kernel will try to allocate the "next" device of the
+ * specified type
+ */
+ if (*dev)
+ strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+
+ /* try to create the device */
+ if ((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0) {
+ close(fd);
+ return err;
+ }
+
+ /* if the operation was successful, write back the name of the
+ * interface to the variable "dev", so the caller can know
+ * it. Note that the caller MUST reserve space in *dev (see calling
+ * code below)
+ */
+ strcpy(dev, ifr.ifr_name);
+
+ /* this is the special file descriptor that the caller will use to talk
+ * with the virtual interface
+ */
+ return fd;
+ }
+#endif
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/tuntap_pdu_impl.h b/gr-blocks/lib/tuntap_pdu_impl.h
new file mode 100644
index 0000000000..396d9d51c8
--- /dev/null
+++ b/gr-blocks/lib/tuntap_pdu_impl.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H
+#define INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H
+
+#include <blocks/tuntap_pdu.h>
+#include "stream_pdu_base.h"
+
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+#include <linux/if_tun.h>
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ class tuntap_pdu_impl : public tuntap_pdu, public stream_pdu_base
+ {
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+ private:
+ std::string d_dev;
+ int tun_alloc(char *dev, int flags = IFF_TAP | IFF_NO_PI);
+
+ public:
+ tuntap_pdu_impl(std::string dev, int MTU);
+#endif
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_TUNTAP_PDU_IMPL_H */
diff --git a/gr-blocks/lib/unpack_k_bits_bb_impl.cc b/gr-blocks/lib/unpack_k_bits_bb_impl.cc
new file mode 100644
index 0000000000..367100be84
--- /dev/null
+++ b/gr-blocks/lib/unpack_k_bits_bb_impl.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "unpack_k_bits_bb_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+namespace gr {
+ namespace blocks {
+
+ unpack_k_bits_bb::sptr
+ unpack_k_bits_bb::make(unsigned k)
+ {
+ return gnuradio::get_initial_sptr
+ (new unpack_k_bits_bb_impl(k));
+ }
+
+ unpack_k_bits_bb_impl::unpack_k_bits_bb_impl(unsigned k)
+ : gr_sync_interpolator("unpack_k_bits_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ k),
+ d_k(k)
+ {
+ if(d_k == 0)
+ throw std::out_of_range("interpolation must be > 0");
+ }
+
+ unpack_k_bits_bb_impl::~unpack_k_bits_bb_impl()
+ {
+ }
+
+ int
+ unpack_k_bits_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ int n = 0;
+ for(unsigned int i = 0; i < noutput_items/d_k; i++) {
+ unsigned int t = in[i];
+ for(int j = d_k - 1; j >= 0; j--)
+ out[n++] = (t >> j) & 0x01;
+ }
+
+ assert(n == noutput_items);
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/unpack_k_bits_bb_impl.h b/gr-blocks/lib/unpack_k_bits_bb_impl.h
new file mode 100644
index 0000000000..c72d16ebf8
--- /dev/null
+++ b/gr-blocks/lib/unpack_k_bits_bb_impl.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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_UNPACK_K_BITS_BB_IMPL_H
+#define INCLUDED_GR_UNPACK_K_BITS_BB_IMPL_H
+
+#include <blocks/unpack_k_bits_bb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class unpack_k_bits_bb_impl : public unpack_k_bits_bb
+ {
+ private:
+ unsigned d_k; // number of relevent bits to unpack into k output bytes
+
+ public:
+ unpack_k_bits_bb_impl(unsigned k);
+ ~unpack_k_bits_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UNPACK_K_BITS_BB_IMPL_H */
diff --git a/gr-blocks/python/qa_file_metadata.py b/gr-blocks/python/qa_file_metadata.py
index 69974d6dad..c2319a800e 100644
--- a/gr-blocks/python/qa_file_metadata.py
+++ b/gr-blocks/python/qa_file_metadata.py
@@ -35,6 +35,7 @@ def sig_source_c(samp_rate, freq, amp, N):
class test_file_metadata(gr_unittest.TestCase):
def setUp(self):
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
self.tb = gr.top_block()
def tearDown(self):
diff --git a/gr-blocks/python/qa_pack_k_bits.py b/gr-blocks/python/qa_pack_k_bits.py
new file mode 100755
index 0000000000..cd55d2f200
--- /dev/null
+++ b/gr-blocks/python/qa_pack_k_bits.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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 random
+
+class test_pack(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ 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)
+ op = blocks.pack_k_bits_bb(1)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ 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)
+ op = blocks.pack_k_bits_bb(2)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ #self.assertEqual(expected_results, dst.data())
+ self.assertEqual(expected_results, dst.data())
+
+ def test_003(self):
+ src_data = expected_results = map(lambda x: random.randint(0,3), range(10));
+ src = gr.vector_source_b( src_data );
+ pack = blocks.pack_k_bits_bb(2);
+ unpack = blocks.unpack_k_bits_bb(2);
+ snk = gr.vector_sink_b();
+ self.tb.connect(src,unpack,pack,snk);
+ self.tb.run()
+ self.assertEqual(list(expected_results), list(snk.data()));
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pack, "test_pack.xml")
+
diff --git a/gr-blocks/python/qa_peak_detector2.py b/gr-blocks/python/qa_peak_detector2.py
new file mode 100644
index 0000000000..4b864e4d70
--- /dev/null
+++ b/gr-blocks/python/qa_peak_detector2.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2010,2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_peak_detector2(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_regen1(self):
+ tb = self.tb
+
+ data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
+
+ expected_result = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+
+ src = gr.vector_source_f(data, False)
+ regen = blocks.peak_detector2_fb()
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run()
+
+ dst_data = dst.data()
+ print dst_data
+
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_peak_detector2, "test_peak_detector2.xml")
diff --git a/gr-blocks/python/qa_regenerate.py b/gr-blocks/python/qa_regenerate.py
new file mode 100755
index 0000000000..a57eeba2bb
--- /dev/null
+++ b/gr-blocks/python/qa_regenerate.py
@@ -0,0 +1,90 @@
+#!/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_regenerate(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_regen1(self):
+ tb = self.tb
+
+ data = [0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+
+ expected_result = (0, 0, 0,
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 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)
+ regen = blocks.regenerate_bb(5, 2)
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertEqual(expected_result, dst_data)
+
+ def test_regen2(self):
+ tb = self.tb
+
+ data = 200*[0,]
+ data[9] = 1
+ data[99] = 1
+
+ expected_result = 200*[0,]
+ expected_result[9] = 1
+ expected_result[19] = 1
+ expected_result[29] = 1
+ expected_result[39] = 1
+
+ expected_result[99] = 1
+ expected_result[109] = 1
+ expected_result[119] = 1
+ expected_result[129] = 1
+
+ src = gr.vector_source_b(data, False)
+ regen = blocks.regenerate_bb(10, 3)
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run ()
+
+ dst_data = dst.data()
+
+ self.assertEqual(tuple(expected_result), dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_regenerate, "test_regenerate.xml")
diff --git a/gr-blocks/python/qa_stream_mux.py b/gr-blocks/python/qa_stream_mux.py
index f21a9bbbc9..657bd3d63f 100755
--- a/gr-blocks/python/qa_stream_mux.py
+++ b/gr-blocks/python/qa_stream_mux.py
@@ -22,10 +22,12 @@
from gnuradio import gr, gr_unittest
import blocks_swig
+import os
class test_stream_mux (gr_unittest.TestCase):
def setUp (self):
+ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
self.tb = gr.top_block ()
def tearDown (self):
diff --git a/gr-blocks/python/qa_stretch.py b/gr-blocks/python/qa_stretch.py
new file mode 100755
index 0000000000..078b404dbf
--- /dev/null
+++ b/gr-blocks/python/qa_stretch.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_stretch(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_stretch_01(self):
+ tb = self.tb
+
+ data = 10*[1,]
+ data0 = map(lambda x: x/20.0, data)
+ data1 = map(lambda x: x/10.0, data)
+
+ expected_result0 = 10*[0.05,]
+ expected_result1 = 10*[0.1,]
+
+ src0 = gr.vector_source_f(data0, False)
+ src1 = gr.vector_source_f(data1, False)
+ inter = blocks.streams_to_vector(gr.sizeof_float, 2)
+ op = blocks.stretch_ff(0.1, 2)
+ deinter = blocks.vector_to_streams(gr.sizeof_float, 2)
+ dst0 = gr.vector_sink_f()
+ dst1 = gr.vector_sink_f()
+
+ tb.connect(src0, (inter,0))
+ tb.connect(src1, (inter,1))
+ tb.connect(inter, op)
+ tb.connect(op, deinter)
+ tb.connect((deinter,0), dst0)
+ tb.connect((deinter,1), dst1)
+ tb.run()
+
+ dst0_data = dst0.data()
+ dst1_data = dst1.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result0, dst0_data, 4)
+ self.assertFloatTuplesAlmostEqual(expected_result1, dst1_data, 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_stretch, "test_stretch.xml")
diff --git a/gr-blocks/python/qa_threshold.py b/gr-blocks/python/qa_threshold.py
new file mode 100644
index 0000000000..f91af739ad
--- /dev/null
+++ b/gr-blocks/python/qa_threshold.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_threshold(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ tb = self.tb
+
+ data = [0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2]
+
+ expected_result = (0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1)
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.threshold_ff(1, 1)
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_threshold, "test_threshold.xml")
diff --git a/gr-blocks/python/qa_throttle.py b/gr-blocks/python/qa_throttle.py
new file mode 100755
index 0000000000..5d462f2c9f
--- /dev/null
+++ b/gr-blocks/python/qa_throttle.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_throttle(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ # Test that we can make the block
+ op = blocks.throttle(gr.sizeof_gr_complex, 1)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_throttle, "test_throttle.xml")
diff --git a/gr-blocks/python/qa_transcendental.py b/gr-blocks/python/qa_transcendental.py
new file mode 100644
index 0000000000..8174f79630
--- /dev/null
+++ b/gr-blocks/python/qa_transcendental.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import math
+
+class test_transcendental(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ tb = self.tb
+
+ data = 100*[0,]
+ expected_result = 100*[1,]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("cos", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+ def test_02(self):
+ tb = self.tb
+
+ data = 100*[3,]
+ expected_result = 100*[math.log10(3),]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("log10", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+ def test_03(self):
+ tb = self.tb
+
+ data = 100*[3,]
+ expected_result = 100*[math.tanh(3),]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("tanh", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_transcendental, "test_transcendental.xml")
diff --git a/gr-blocks/python/qa_unpack_k_bits.py b/gr-blocks/python/qa_unpack_k_bits.py
new file mode 100755
index 0000000000..e038d5a03a
--- /dev/null
+++ b/gr-blocks/python/qa_unpack_k_bits.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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 random
+
+class test_unpack(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ 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)
+ op = blocks.unpack_k_bits_bb(1)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ 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)
+ op = blocks.unpack_k_bits_bb(2)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_unpack, "test_unpack.xml")
+
diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i
index b229e55638..bd57da5348 100644
--- a/gr-blocks/swig/blocks_swig.i
+++ b/gr-blocks/swig/blocks_swig.i
@@ -99,12 +99,15 @@
#include "blocks/not_ss.h"
#include "blocks/not_ii.h"
#include "blocks/patterned_interleaver.h"
+#include "blocks/pack_k_bits_bb.h"
#include "blocks/packed_to_unpacked_bb.h"
#include "blocks/packed_to_unpacked_ss.h"
#include "blocks/packed_to_unpacked_ii.h"
+#include "blocks/peak_detector2_fb.h"
#include "blocks/or_bb.h"
#include "blocks/or_ss.h"
#include "blocks/or_ii.h"
+#include "blocks/regenerate_bb.h"
#include "blocks/repeat.h"
#include "blocks/rms_cf.h"
#include "blocks/rms_ff.h"
@@ -115,11 +118,17 @@
#include "blocks/stream_to_vector.h"
#include "blocks/streams_to_stream.h"
#include "blocks/streams_to_vector.h"
+#include "blocks/stretch_ff.h"
#include "blocks/sub_ff.h"
#include "blocks/sub_ss.h"
#include "blocks/sub_ii.h"
#include "blocks/sub_cc.h"
+#include "blocks/threshold_ff.h"
+#include "blocks/throttle.h"
+#include "blocks/transcendental.h"
+#include "blocks/tuntap_pdu.h"
#include "blocks/uchar_to_float.h"
+#include "blocks/unpack_k_bits_bb.h"
#include "blocks/unpacked_to_packed_bb.h"
#include "blocks/unpacked_to_packed_ss.h"
#include "blocks/unpacked_to_packed_ii.h"
@@ -198,13 +207,16 @@
%include "blocks/not_bb.h"
%include "blocks/not_ss.h"
%include "blocks/not_ii.h"
-%include "blocks/patterned_interleaver.h"
-%include "blocks/packed_to_unpacked_bb.h"
-%include "blocks/packed_to_unpacked_ss.h"
-%include "blocks/packed_to_unpacked_ii.h"
%include "blocks/or_bb.h"
%include "blocks/or_ss.h"
%include "blocks/or_ii.h"
+%include "blocks/pack_k_bits_bb.h"
+%include "blocks/packed_to_unpacked_bb.h"
+%include "blocks/packed_to_unpacked_ss.h"
+%include "blocks/packed_to_unpacked_ii.h"
+%include "blocks/patterned_interleaver.h"
+%include "blocks/peak_detector2_fb.h"
+%include "blocks/regenerate_bb.h"
%include "blocks/repeat.h"
%include "blocks/rms_cf.h"
%include "blocks/rms_ff.h"
@@ -215,11 +227,17 @@
%include "blocks/stream_to_vector.h"
%include "blocks/streams_to_stream.h"
%include "blocks/streams_to_vector.h"
+%include "blocks/stretch_ff.h"
%include "blocks/sub_ff.h"
%include "blocks/sub_ss.h"
%include "blocks/sub_ii.h"
%include "blocks/sub_cc.h"
+%include "blocks/threshold_ff.h"
+%include "blocks/throttle.h"
+%include "blocks/transcendental.h"
+%include "blocks/tuntap_pdu.h"
%include "blocks/uchar_to_float.h"
+%include "blocks/unpack_k_bits_bb.h"
%include "blocks/unpacked_to_packed_bb.h"
%include "blocks/unpacked_to_packed_ss.h"
%include "blocks/unpacked_to_packed_ii.h"
@@ -298,12 +316,15 @@ GR_SWIG_BLOCK_MAGIC2(blocks, not_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, not_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, not_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver);
+GR_SWIG_BLOCK_MAGIC2(blocks, pack_k_bits_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb);
GR_SWIG_BLOCK_MAGIC2(blocks, or_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, repeat);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff);
@@ -314,11 +335,17 @@ GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams);
GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_vector);
GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_stream);
GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_vector);
+GR_SWIG_BLOCK_MAGIC2(blocks, stretch_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, threshold_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, throttle);
+GR_SWIG_BLOCK_MAGIC2(blocks, transcendental);
+GR_SWIG_BLOCK_MAGIC2(blocks, tuntap_pdu);
GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, unpack_k_bits_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii);