diff options
Diffstat (limited to 'gr-blocks/include/gnuradio')
134 files changed, 8590 insertions, 0 deletions
diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt new file mode 100644 index 0000000000..13e1ac71b8 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt @@ -0,0 +1,219 @@ +# 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. + +######################################################################## +# generate helper scripts to expand templated files +######################################################################## +include(GrPython) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " +#!${PYTHON_EXECUTABLE} + +import sys, os, re +sys.path.append('${GR_RUNTIME_PYTHONPATH}') +os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' +os.chdir('${CMAKE_CURRENT_BINARY_DIR}') + +if __name__ == '__main__': + import build_utils + root, inp = sys.argv[1:3] + for sig in sys.argv[3:]: + name = re.sub ('X+', sig, root) + d = build_utils.standard_dict(name, sig, 'blocks') + build_utils.expand_template(d, inp) + +") + +macro(expand_h root) + #make a list of all the generated files + unset(expanded_files_h) + foreach(sig ${ARGN}) + string(REGEX REPLACE "X+" ${sig} name ${root}) + list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) + endforeach(sig) + + #create a command to generate the files + add_custom_command( + OUTPUT ${expanded_files_h} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}.h.t ${ARGN} + ) + + #install rules for the generated h files + list(APPEND generated_includes ${expanded_files_h}) +endmacro(expand_h) + +######################################################################## +# Invoke macro to generate various sources +######################################################################## +expand_h(add_XX ss ii cc) +expand_h(add_const_XX bb ss ii ff cc) +expand_h(add_const_vXX bb ss ii ff cc) +expand_h(and_XX bb ss ii) +expand_h(and_const_XX bb ss ii) +expand_h(argmax_XX fs is ss) +expand_h(divide_XX ss ii ff cc) +expand_h(integrate_XX ss ii ff cc) +expand_h(max_XX ff ii ss) +expand_h(moving_average_XX ss ii ff cc) +expand_h(multiply_XX ss ii) +expand_h(multiply_const_XX ss ii) +expand_h(multiply_const_vXX ss ii ff cc) +expand_h(mute_XX ss ii ff cc) +expand_h(not_XX bb ss ii) +expand_h(or_XX bb ss ii) +expand_h(peak_detector_XX fb ib sb) +expand_h(probe_signal_X b s i f c) +expand_h(probe_signal_vX b s i f c) +expand_h(sample_and_hold_XX bb ss ii ff) +expand_h(sub_XX ss ii ff cc) +expand_h(xor_XX bb ss ii) +expand_h(packed_to_unpacked_XX bb ss ii) +expand_h(unpacked_to_packed_XX bb ss ii) +expand_h(vector_insert_X b s i f c) +expand_h(vector_sink_X b s i f c) +expand_h(vector_source_X b s i f c) + +add_custom_target(blocks_generated_includes DEPENDS + ${generated_includes} +) + +######################################################################## +# Install header files +######################################################################## +install(FILES + ${generated_includes} + api.h + control_loop.h + count_bits.h + file_sink_base.h + lfsr_15_1_0.h + lfsr_32k.h + log2_const.h + rotator.h + wavfile.h + add_ff.h + annotator_1to1.h + annotator_alltoall.h + annotator_raw.h + bin_statistics_f.h + burst_tagger.h + char_to_float.h + char_to_short.h + check_lfsr_32k_s.h + complex_to_interleaved_short.h + complex_to_float.h + complex_to_imag.h + complex_to_real.h + complex_to_mag.h + complex_to_mag_squared.h + complex_to_arg.h + conjugate_cc.h + copy.h + deinterleave.h + delay.h + endian_swap.h + file_descriptor_sink.h + file_descriptor_source.h + file_sink.h + file_source.h + file_meta_sink.h + file_meta_source.h + float_to_char.h + float_to_complex.h + float_to_int.h + float_to_short.h + float_to_uchar.h + head.h + int_to_float.h + interleave.h + interleaved_short_to_complex.h + keep_m_in_n.h + keep_one_in_n.h + lfsr_32k_source_s.h + message_debug.h + message_sink.h + message_source.h + message_strobe.h + message_burst_source.h + multiply_cc.h + multiply_ff.h + multiply_conjugate_cc.h + multiply_const_cc.h + multiply_const_ff.h + nlog10_ff.h + nop.h + null_sink.h + null_source.h + pack_k_bits_bb.h + patterned_interleaver.h + pdu.h + pdu_to_tagged_stream.h + peak_detector2_fb.h + random_pdu.h + plateau_detector_fb.h + probe_rate.h + regenerate_bb.h + repack_bits_bb.h + repeat.h + rms_cf.h + rms_ff.h + short_to_char.h + short_to_float.h + skiphead.h + socket_pdu.h + stream_mux.h + stream_to_streams.h + stream_to_vector.h + streams_to_stream.h + streams_to_vector.h + stretch_ff.h + tag_debug.h + tag_gate.h + tagged_file_sink.h + tagged_stream_mux.h + tagged_stream_to_pdu.h + threshold_ff.h + throttle.h + transcendental.h + tuntap_pdu.h + uchar_to_float.h + udp_sink.h + udp_source.h + unpack_k_bits_bb.h + vco_f.h + vector_map.h + vector_to_stream.h + vector_to_streams.h + wavfile_sink.h + wavfile_source.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks + COMPONENT "blocks_devel" +) + +if(ENABLE_GR_CTRLPORT) +install(FILES + ctrlport_probe_c.h + ctrlport_probe2_c.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks + COMPONENT "blocks_devel" +) +endif(ENABLE_GR_CTRLPORT) diff --git a/gr-blocks/include/gnuradio/blocks/add_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_XX.h.t new file mode 100644 index 0000000000..08e9646af6 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_XX.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = sum (input_0, input_1, ...) + * \ingroup math_operators_blk + * + * \details + * Add across all input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t new file mode 100644 index 0000000000..3e783213a8 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * \brief Create an instance of @NAME@ + * \param k additive constant + */ + static sptr make(@O_TYPE@ k); + + /*! + * \brief Return additive constant + */ + virtual @O_TYPE@ k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(@O_TYPE@ k) = 0; + }; + + } +} + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t new file mode 100644 index 0000000000..ea6c35695e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2010,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant vector + * \ingroup math_operators_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * \brief Create an instance of @NAME@ + * \param k additive constant vector + */ + static sptr make(std::vector<@O_TYPE@> k); + + /*! + * \brief Return additive constant vector + */ + virtual std::vector<@O_TYPE@> k() const = 0; + + /*! + * \brief Set additive constant vector + */ + virtual void set_k(std::vector<@O_TYPE@> k) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/add_ff.h b/gr-blocks/include/gnuradio/blocks/add_ff.h new file mode 100644 index 0000000000..fd2420ce09 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_ff.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_ADD_FF_H +#define INCLUDED_BLOCKS_ADD_FF_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = sum (input_0, input_1, ...) + * \ingroup math_operators_blk + * + * \details + * Add across all input streams. + */ + class BLOCKS_API add_ff : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::add_ff::sptr + typedef boost::shared_ptr<add_ff> sptr; + + /*! + * \brief Add streams of float values + * \param vlen Vector length + * \ingroup math_blk + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_ADD_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/and_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_XX.h.t new file mode 100644 index 0000000000..820daefdbf --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/and_XX.h.t @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input_0 & input_1 & , ... & input_N) + * \ingroup boolean_operators_blk + * + * bitwise boolean and across all input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t new file mode 100644 index 0000000000..a4c83a4eab --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output_N = input_N & value + * \ingroup boolean_operators_blk + * + * bitwise boolean and of const to the data stream. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * \brief Create an instance of @NAME@ + * \param k AND constant + */ + static sptr make(@O_TYPE@ k); + + /*! + * \brief Return AND constant + */ + virtual @O_TYPE@ k() const = 0; + + /*! + * \brief Set AND constant + */ + virtual void set_k(@O_TYPE@ k) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/annotator_1to1.h b/gr-blocks/include/gnuradio/blocks/annotator_1to1.h new file mode 100644 index 0000000000..a452da2e7e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/annotator_1to1.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H +#define INCLUDED_GR_ANNOTATOR_1TO1_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. + * \ingroup debug_tools_blk + * + * \details + * This block creates tags to be sent downstream every 10,000 + * items it sees. The tags contain the name and ID of the + * instantiated block, use "seq" as a key, and have a counter that + * increments by 1 for every tag produced that is used as the + * tag's value. The tags are propagated using the 1-to-1 policy. + * + * It also stores a copy of all tags it sees flow past it. These + * tags can be recalled externally with the data() member. + * + * Warning: This block is only meant for testing and showing how to use the + * tags. + */ + class BLOCKS_API annotator_1to1 : virtual public sync_block + { + public: + // gr::gnuradio/blocks::annotator_1to1::sptr + typedef boost::shared_ptr<annotator_1to1> sptr; + + static sptr make(int when, size_t sizeof_stream_item); + + virtual std::vector<tag_t> data() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_1TO1_H */ diff --git a/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h b/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h new file mode 100644 index 0000000000..004aa54dd3 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/annotator_alltoall.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H +#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. + * \ingroup debug_tools_blk + * + * \details + * This block creates tags to be sent downstream every 10,000 + * items it sees. The tags contain the name and ID of the + * instantiated block, use "seq" as a key, and have a counter that + * increments by 1 for every tag produced that is used as the + * tag's value. The tags are propagated using the all-to-all + * policy. + * + * It also stores a copy of all tags it sees flow past it. These + * tags can be recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ + class BLOCKS_API annotator_alltoall : virtual public sync_block + { + public: + // gr::gnuradio/blocks::annotator_alltoall::sptr + typedef boost::shared_ptr<annotator_alltoall> sptr; + + static sptr make(int when, size_t sizeof_stream_item); + + virtual std::vector<tag_t> data() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_ALLTOALL_H */ diff --git a/gr-blocks/include/gnuradio/blocks/annotator_raw.h b/gr-blocks/include/gnuradio/blocks/annotator_raw.h new file mode 100644 index 0000000000..70c4254436 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/annotator_raw.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_RAW_H +#define INCLUDED_GR_ANNOTATOR_RAW_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/tags.h> + +namespace gr { + namespace blocks { + + /*! + * \brief raw stream annotator testing block. + * \ingroup debug_tools_blk + * + * \details + * This block creates arbitrary tags to be sent downstream gnuradio/blocks + * to be sent are set manually via accessor methods and are sent + * only once. + * + * This block is intended for testing of tag related gnuradio/blocks + */ + class BLOCKS_API annotator_raw : virtual public sync_block + { + public: + // gr::gnuradio/blocks::annotator_raw::sptr + typedef boost::shared_ptr<annotator_raw> sptr; + + static sptr make(size_t sizeof_stream_item); + + // insert a tag to be added + virtual void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_RAW_H */ diff --git a/gr-blocks/include/gnuradio/blocks/api.h b/gr-blocks/include/gnuradio/blocks/api.h new file mode 100644 index 0000000000..fd4e605b56 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_API_H +#define INCLUDED_BLOCKS_API_H + +#include <gnuradio/attributes.h> + +#ifdef gnuradio_blocks_EXPORTS +# define BLOCKS_API __GR_ATTR_EXPORT +#else +# define BLOCKS_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_BLOCKS_API_H */ diff --git a/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t b/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t new file mode 100644 index 0000000000..71468726ec --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t @@ -0,0 +1,61 @@ +/* -*- 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Compares vectors from multiple streams and determines + * the index in the vector and stream number where the maximum + * value occurred. + * \ingroup math_operators_blk + * + * \details + * Data is passed in as a vector of length \p vlen from multiple + * input sources. It will look through these streams of \p vlen + * data items and output two streams. + * Stream 0 will contain the index value in the vector where + * the maximum value occurred. + * Stream 1 will contain the number of the input stream that + * held the maximum value. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h b/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h new file mode 100644 index 0000000000..1d8661e0a2 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/bin_statistics_f.h @@ -0,0 +1,76 @@ +/* -*- 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_BIN_STATISTICS_F_H +#define INCLUDED_GR_BIN_STATISTICS_F_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> +#include <gnuradio/feval.h> + +namespace gr { + namespace blocks { + + /*! + * \brief control scanning and record frequency domain statistics + * \ingroup misc_blk + */ + class BLOCKS_API bin_statistics_f : virtual public sync_block + { + protected: + std::vector<float> d_max; // per bin maxima + + virtual size_t vlen() const = 0; + virtual double center_freq() const = 0; + virtual gr::msg_queue::sptr msgq() const = 0; + + virtual void reset_stats() = 0; + virtual void accrue_stats(const float *input) = 0; + virtual void send_stats() = 0; + + public: + // gr::gnuradio/blocks::bin_statistics_f::sptr + typedef boost::shared_ptr<bin_statistics_f> sptr; + + /*! + * Build a bin statistics block. See qa_bin_statistics.py and + * gr-uhd/examples/python/usrp_spectrum_sense.py for examples of + * its use, specifically how to use the callback function. + * + * \param vlen vector length + * \param msgq message queue + * \param tune a feval_dd callback function + * \param tune_delay number of samples for the tune delay + * \param dwell_delay number of samples for the dwell delay + */ + static sptr make(unsigned int vlen, // vector length + gr::msg_queue::sptr msgq, + feval_dd *tune, // callback + size_t tune_delay, // samples + size_t dwell_delay); // samples + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_BIN_STATISTICS_F_H */ diff --git a/gr-blocks/include/gnuradio/blocks/burst_tagger.h b/gr-blocks/include/gnuradio/blocks/burst_tagger.h new file mode 100644 index 0000000000..e10938980e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/burst_tagger.h @@ -0,0 +1,76 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_BURST_TAGGER_H +#define INCLUDED_GR_BURST_TAGGER_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Sets a burst on/off tag based on the value of the trigger input. + * \ingroup peak_detectors_blk + * \ingroup stream_tag_tools_blk + * + * \details + * This block takes two inputs, a signal stream on the input + * stream 0 and a trigger stream of shorts on input stream 1. If + * the trigger stream goes above 0, a tag with the key "burst" + * will be transmitted as a pmt::PMT_T. When the trigger signal + * falls below 0, the "burst" tag will be transmitted as + * pmt::PMT_F. + * + * The signal on stream 0 is retransmitted to output stream 0. + */ + class BLOCKS_API burst_tagger : virtual public sync_block + { + public: + // gr::gnuradio/blocks::burst_tagger::sptr + typedef boost::shared_ptr<burst_tagger> sptr; + + /*! + * Build a burst tagger gnuradio/blocks. + * + * \param itemsize itemsize of the signal stream on input 0. + */ + static sptr make(size_t itemsize); + + /*! + * For the true burst tag, change the key name to \p key and a + * new value of \p value. + */ + virtual void set_true_tag(const std::string &key, bool value) = 0; + + /*! + * For the false burst tag, change the key name to \p key and a + * new value of \p value. + */ + virtual void set_false_tag(const std::string &key, bool value) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_BURST_TAGGER_H */ diff --git a/gr-blocks/include/gnuradio/blocks/char_to_float.h b/gr-blocks/include/gnuradio/blocks/char_to_float.h new file mode 100644 index 0000000000..71861adf16 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/char_to_float.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_CHAR_TO_FLOAT_H +#define INCLUDED_BLOCKS_CHAR_TO_FLOAT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of chars to a stream of float + * \ingroup type_converters_blk + */ + class BLOCKS_API char_to_float : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::char_to_float_ff::sptr + typedef boost::shared_ptr<char_to_float> sptr; + + /*! + * Build a chars to float stream converter block. + * + * \param vlen vector length of data streams. + * \param scale a scalar divider to change the output signal scale. + */ + static sptr make(size_t vlen=1, float scale=1.0); + + /*! + * Get the scalar divider value. + */ + virtual float scale() const = 0; + + /*! + * Set the scalar divider value. + */ + virtual void set_scale(float scale) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_CHAR_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/char_to_short.h b/gr-blocks/include/gnuradio/blocks/char_to_short.h new file mode 100644 index 0000000000..62800b216a --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/char_to_short.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_CHAR_TO_SHORT_H +#define INCLUDED_BLOCKS_CHAR_TO_SHORT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of chars to a stream of short + * \ingroup type_converters_blk + */ + class BLOCKS_API char_to_short : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::char_to_short_ff::sptr + typedef boost::shared_ptr<char_to_short> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_CHAR_TO_SHORT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h b/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.h new file mode 100644 index 0000000000..86714d93fa --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/check_lfsr_32k_s.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_CHECK_LFSR_32K_S_H +#define INCLUDED_GR_CHECK_LFSR_32K_S_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief sink that checks if its input stream consists of a lfsr_32k sequence. + * \ingroup misc_blk + * + * \details + * This sink is typically used along with + * gr::blocks::lfsr_32k_source_s to test the USRP using its + * digital loopback mode. + */ + class BLOCKS_API check_lfsr_32k_s : virtual public sync_block + { + public: + // gr::gnuradio/blocks::check_lfsr_32k_s::sptr + typedef boost::shared_ptr<check_lfsr_32k_s> sptr; + + static sptr make(); + + virtual long ntotal () const = 0; + virtual long nright () const = 0; + virtual long runlength () const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_CHECK_LFSR_32K_S_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_arg.h b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h new file mode 100644 index 0000000000..63e2a37cb9 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_COMPLEX_TO_ARG_H +#define INCLUDED_BLOCKS_COMPLEX_TO_ARG_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief complex in, arg out (float) + * \ingroup type_converters_blk + */ + class BLOCKS_API complex_to_arg : virtual public sync_block + { + public: + // gr::gnuradio/blocks::complex_to_arg_ff::sptr + typedef boost::shared_ptr<complex_to_arg> sptr; + + /*! + * Build a complex to arg block. + * + * \param vlen vector len (default 1) + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_COMPLEX_TO_ARG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_float.h b/gr-blocks/include/gnuradio/blocks/complex_to_float.h new file mode 100644 index 0000000000..341d2e2d9e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/complex_to_float.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H +#define INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief convert a stream of gr_complex to 1 or 2 streams of float + * \ingroup type_converters_blk + */ + class BLOCKS_API complex_to_float : virtual public sync_block + { + public: + // gr::gnuradio/blocks::complex_to_float_ff::sptr + typedef boost::shared_ptr<complex_to_float> sptr; + + /*! + * Build a complex to float block. + * + * \param vlen vector len (default 1) + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_imag.h b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h new file mode 100644 index 0000000000..7a8d200639 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H +#define INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief complex in, imag out (float) + * \ingroup type_converters_blk + */ + class BLOCKS_API complex_to_imag : virtual public sync_block + { + public: + // gr::gnuradio/blocks::complex_to_imag_ff::sptr + typedef boost::shared_ptr<complex_to_imag> sptr; + + /*! + * Build a complex to imaginary part block. + * + * \param vlen vector len (default 1) + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h new file mode 100644 index 0000000000..8be4f86622 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H +#define INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of complex to a stream of interleaved shorts + * \ingroup type_converters_blk + */ + class BLOCKS_API complex_to_interleaved_short : virtual public sync_interpolator + { + public: + // gr::gnuradio/blocks::complex_to_interleaved_short::sptr + typedef boost::shared_ptr<complex_to_interleaved_short> sptr; + + /*! + * Build a complex to interleaved shorts block. + */ + static sptr make(); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_mag.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h new file mode 100644 index 0000000000..fcb1fe66ca --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_COMPLEX_TO_MAG_H +#define INCLUDED_BLOCKS_COMPLEX_TO_MAG_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief complex in, magnitude out (float) + * \ingroup type_converters_blk + */ + class BLOCKS_API complex_to_mag : virtual public sync_block + { + public: + // gr::gnuradio/blocks::complex_to_mag_ff::sptr + typedef boost::shared_ptr<complex_to_mag> sptr; + + /*! + * Build a complex to magnitude block. + * + * \param vlen vector len (default 1) + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h new file mode 100644 index 0000000000..662505039c --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H +#define INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief complex in, magnitude squared out (float) + * \ingroup type_converters_blk + */ + class BLOCKS_API complex_to_mag_squared : virtual public sync_block + { + public: + // gr::gnuradio/blocks::complex_to_mag_squared_ff::sptr + typedef boost::shared_ptr<complex_to_mag_squared> sptr; + + /*! + * Build a complex to magnitude squared block. + * + * \param vlen vector len (default 1) + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H */ diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_real.h b/gr-blocks/include/gnuradio/blocks/complex_to_real.h new file mode 100644 index 0000000000..7efefcddd3 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/complex_to_real.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_COMPLEX_TO_REAL_H +#define INCLUDED_BLOCKS_COMPLEX_TO_REAL_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief complex in, real out (float) + * \ingroup type_converters_blk + */ + class BLOCKS_API complex_to_real : virtual public sync_block + { + public: + // gr::gnuradio/blocks::complex_to_real_ff::sptr + typedef boost::shared_ptr<complex_to_real> sptr; + + /*! + * Build a complex to real part block. + * + * \param vlen vector len (default 1) + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_COMPLEX_TO_REAL_H */ diff --git a/gr-blocks/include/gnuradio/blocks/conjugate_cc.h b/gr-blocks/include/gnuradio/blocks/conjugate_cc.h new file mode 100644 index 0000000000..7e4440c713 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/conjugate_cc.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_CONJUGATE_CC_H +#define INCLUDED_BLOCKS_CONJUGATE_CC_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = complex conjugate of input + * \ingroup math_operators_blk + */ + class BLOCKS_API conjugate_cc : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::conjugate_cc_ff::sptr + typedef boost::shared_ptr<conjugate_cc> sptr; + + static sptr make(); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_CONJUGATE_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/control_loop.h b/gr-blocks/include/gnuradio/blocks/control_loop.h new file mode 100644 index 0000000000..d53c81cbac --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/control_loop.h @@ -0,0 +1,234 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef GR_BLOCKS_CONTROL_LOOP +#define GR_BLOCKS_CONTROL_LOOP + +#include <gnuradio/blocks/api.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API control_loop + { + protected: + float d_phase, d_freq; + float d_max_freq, d_min_freq; + float d_damping, d_loop_bw; + float d_alpha, d_beta; + + public: + control_loop(void) {} + control_loop(float loop_bw, float max_freq, float min_freq); + virtual ~control_loop(); + + /*! \brief update the system gains from the loop bandwidth and damping factor + * + * This function updates the system gains based on the loop + * bandwidth and damping factor of the system. These two + * factors can be set separately through their own set + * functions. + */ + void update_gains(); + + /*! \brief Advance the control loop based on the current gain + * settings and the inputted error signal. + */ + void advance_loop(float error); + + /*! \brief Keep the phase between -2pi and 2pi + * + * This function keeps the phase between -2pi and 2pi. If the + * phase is greater than 2pi by d, it wraps around to be -2pi+d; + * similarly if it is less than -2pi by d, it wraps around to + * 2pi-d. + * + * This function should be called after advance_loop to keep the + * phase in a good operating region. It is set as a separate + * method in case another way is desired as this is fairly + * heavy-handed. + */ + void phase_wrap(); + + /*! \brief Keep the frequency between d_min_freq and d_max_freq + * + * This function keeps the frequency between d_min_freq and + * d_max_freq. If the frequency is greater than d_max_freq, it + * is set to d_max_freq. If the frequency is less than + * d_min_freq, it is set to d_min_freq. + * + * This function should be called after advance_loop to keep the + * frequency in the specified region. It is set as a separate + * method in case another way is desired as this is fairly + * heavy-handed. + */ + void frequency_limit(); + + /******************************************************************* + * SET FUNCTIONS + *******************************************************************/ + + /*! + * \brief Set the loop bandwidth + * + * Set the loop filter's bandwidth to \p bw. This should be + * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be + * a positive number. + * + * When a new damping factor is set, the gains, alpha and beta, + * of the loop are recalculated by a call to update_gains(). + * + * \param bw (float) new bandwidth + */ + virtual void set_loop_bandwidth(float bw); + + /*! + * \brief Set the loop damping factor + * + * Set the loop filter's damping factor to \p df. The damping + * factor should be sqrt(2)/2.0 for critically damped systems. + * Set it to anything else only if you know what you are + * doing. It must be a number between 0 and 1. + * + * When a new damping factor is set, the gains, alpha and beta, + * of the loop are recalculated by a call to update_gains(). + * + * \param df (float) new damping factor + */ + void set_damping_factor(float df); + + /*! + * \brief Set the loop gain alpha + * + * Set's the loop filter's alpha gain parameter. + * + * This value should really only be set by adjusting the loop + * bandwidth and damping factor. + * + * \param alpha (float) new alpha gain + * + */ + void set_alpha(float alpha); + + /*! + * \brief Set the loop gain beta + * + * Set's the loop filter's beta gain parameter. + * + * This value should really only be set by adjusting the loop + * bandwidth and damping factor. + * + * \param beta (float) new beta gain + */ + void set_beta(float beta); + + /*! + * \brief Set the control loop's frequency. + * + * Set's the control loop's frequency. While this is normally + * updated by the inner loop of the algorithm, it could be + * useful to manually initialize, set, or reset this under + * certain circumstances. + * + * \param freq (float) new frequency + */ + void set_frequency(float freq); + + /*! + * \brief Set the control loop's phase. + * + * Set's the control loop's phase. While this is normally + * updated by the inner loop of the algorithm, it could be + * useful to manually initialize, set, or reset this under + * certain circumstances. + * + * \param phase (float) new phase + */ + void set_phase(float phase); + + /*! + * \brief Set the control loop's maximum frequency. + * + * Set the maximum frequency the control loop can track. + * + * \param freq (float) new max frequency + */ + void set_max_freq(float freq); + + /*! + * \brief Set the control loop's minimum frequency. + * + * Set the minimum frequency the control loop can track. + * + * \param freq (float) new min frequency + */ + void set_min_freq(float freq); + + /******************************************************************* + * GET FUNCTIONS + *******************************************************************/ + + /*! + * \brief Returns the loop bandwidth + */ + float get_loop_bandwidth() const; + + /*! + * \brief Returns the loop damping factor + */ + float get_damping_factor() const; + + /*! + * \brief Returns the loop gain alpha + */ + float get_alpha() const; + + /*! + * \brief Returns the loop gain beta + */ + float get_beta() const; + + /*! + * \brief Get the control loop's frequency estimate + */ + float get_frequency() const; + + /*! + * \brief Get the control loop's phase estimate + */ + float get_phase() const; + + /*! + * \brief Get the control loop's maximum frequency. + */ + float get_max_freq() const; + + /*! + * \brief Get the control loop's minimum frequency. + */ + float get_min_freq() const; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* GR_BLOCKS_CONTROL_LOOP */ diff --git a/gr-blocks/include/gnuradio/blocks/copy.h b/gr-blocks/include/gnuradio/blocks/copy.h new file mode 100644 index 0000000000..f960d4fba7 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/copy.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_COPY_H +#define INCLUDED_GR_COPY_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output[i] = input[i] + * \ingroup misc_blk + * + * \details + * When enabled (default), this block copies its input to its + * output. When disabled, this block drops its input on the floor. + */ + class BLOCKS_API copy : virtual public block + { + public: + // gr::gnuradio/blocks::copy::sptr + typedef boost::shared_ptr<copy> sptr; + + static sptr make(size_t itemsize); + + virtual void set_enabled(bool enable) = 0; + virtual bool enabled() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_COPY_H */ diff --git a/gr-blocks/include/gnuradio/blocks/count_bits.h b/gr-blocks/include/gnuradio/blocks/count_bits.h new file mode 100644 index 0000000000..88f56f7221 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/count_bits.h @@ -0,0 +1,46 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef _GR_COUNT_BITS_H_ +#define _GR_COUNT_BITS_H_ + +#include <gnuradio/blocks/api.h> + +namespace gr { + namespace blocks { + + //! return number of set bits in the low 8 bits of x + BLOCKS_API unsigned int count_bits8(unsigned int x); + + //! return number of set bits in the low 16 bits of x + BLOCKS_API unsigned int count_bits16(unsigned int x); + + //! return number of set bits in the low 32 bits of x + BLOCKS_API unsigned int count_bits32(unsigned int x); + + //! return number of set bits in a 64-bit word + BLOCKS_API unsigned int count_bits64(unsigned long long int x); + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* _GR_COUNT_BITS_H_ */ diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h new file mode 100644 index 0000000000..c15635bc2c --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe2_c.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_CTRLPORT_PROBE2_C_H +#define INCLUDED_CTRLPORT_PROBE2_C_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block holds + * the latest \p len number of complex samples so that every query + * by a ControlPort client will get the same length vector. + */ + class BLOCKS_API ctrlport_probe2_c : virtual public sync_block + { + public: + // gr::gnuradio/blocks::ctrlport_probe2_c::sptr + typedef boost::shared_ptr<ctrlport_probe2_c> sptr; + + /*! + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + * \param len Number of samples to transmit. + */ + static sptr make(const std::string &id, const std::string &desc, int len); + + virtual std::vector<gr_complex> get() = 0; + + virtual void set_length(int len) = 0; + virtual int length() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_CTRLPORT_PROBE2_C_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h b/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h new file mode 100644 index 0000000000..88eed7e5d7 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/ctrlport_probe_c.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_CTRLPORT_PROBE_C_H +#define INCLUDED_CTRLPORT_PROBE_C_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/rpcregisterhelpers.h> +#include <boost/thread/shared_mutex.hpp> + +namespace gr { + namespace blocks { + + /*! + * \brief A ControlPort probe to export vectors of signals. + * \ingroup measurement_tools_blk + * \ingroup controlport_blk + * + * \details + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block simply + * sends the current vector held in the work function when the + * queried by a ControlPort client. + */ + class BLOCKS_API ctrlport_probe_c : virtual public sync_block + { + public: + // gr::gnuradio/blocks::ctrlport_probe_c::sptr + typedef boost::shared_ptr<ctrlport_probe_c> sptr; + + /*! + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + */ + static sptr make(const std::string &id, const std::string &desc); + + virtual std::vector<gr_complex> get() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/deinterleave.h b/gr-blocks/include/gnuradio/blocks/deinterleave.h new file mode 100644 index 0000000000..e9e7ebd58a --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/deinterleave.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_DEINTERLEAVE_H +#define INCLUDED_BLOCKS_DEINTERLEAVE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief deinterleave a single input into N outputs + * \ingroup stream_operators_blk + */ + class BLOCKS_API deinterleave : virtual public sync_decimator + { + public: + // gr::gnuradio/blocks::deinterleave::sptr + typedef boost::shared_ptr<deinterleave> sptr; + + /*! + * Make a deinterleave block. + * + * \param itemsize stream itemsize + */ + static sptr make(size_t itemsize); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_DEINTERLEAVE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/delay.h b/gr-blocks/include/gnuradio/blocks/delay.h new file mode 100644 index 0000000000..8fc5bb3028 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/delay.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_BLOCKS_DELAY_H +#define INCLUDED_BLOCKS_DELAY_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief delay the input by a certain number of samples + * \ingroup misc_blk + */ + class BLOCKS_API delay : virtual public block + { + public: + // gr::gnuradio/blocks::delay::sptr + typedef boost::shared_ptr<delay> sptr; + + /*! + * \brief Make a delay block. + * \param itemsize size of the data items. + * \param delay number of samples to delay stream. + */ + static sptr make(size_t itemsize, int delay); + + virtual int dly() const = 0; + virtual void set_dly(int d) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_DELAY_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/divide_XX.h.t b/gr-blocks/include/gnuradio/blocks/divide_XX.h.t new file mode 100644 index 0000000000..25e7941f72 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/divide_XX.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input_0 / input_1 / input_x ...) + * \ingroup math_operators_blk + * + * \details + * Divide across all input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/endian_swap.h b/gr-blocks/include/gnuradio/blocks/endian_swap.h new file mode 100644 index 0000000000..841fc3c4b8 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/endian_swap.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ENDIAN_SWAP_H +#define INCLUDED_GR_ENDIAN_SWAP_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of items into thier byte swapped version + * \ingroup stream_operators_blk + */ + class BLOCKS_API endian_swap : virtual public sync_block + { + public: + // gr::gnuradio/blocks::endian_swap::sptr + typedef boost::shared_ptr<endian_swap> sptr; + + /*! + * Make an endian swap block. + * + * \param item_size_bytes number of bytes per item, 1=no-op, + * 2=uint16_t, 4=uint32_t, 8=uint64_t + */ + static sptr make(size_t item_size_bytes=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ENDIAN_SWAP_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h b/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h new file mode 100644 index 0000000000..9a3cf2edad --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/file_descriptor_sink.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_FILE_DESCRIPTOR_SINK_H +#define INCLUDED_GR_FILE_DESCRIPTOR_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Write stream to file descriptor. + * \ingroup file_operators_blk + */ + class BLOCKS_API file_descriptor_sink : virtual public sync_block + { + public: + // gr::gnuradio/blocks::file_descriptor_sink::sptr + typedef boost::shared_ptr<file_descriptor_sink> sptr; + + /*! + * Build a file descriptor sink block. + * + * \param itemsize item size of the incoming data stream. + * \param fd file descriptor (as an integer). + */ + static sptr make(size_t itemsize, int fd); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h b/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h new file mode 100644 index 0000000000..24e6028892 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/file_descriptor_source.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H +#define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + + +namespace gr { + namespace blocks { + + /*! + * \brief Read stream from file descriptor. + * \ingroup file_operators_blk + */ + class BLOCKS_API file_descriptor_source : virtual public sync_block + { + protected: + virtual int read_items(char *buf, int nitems) = 0; + virtual int handle_residue(char *buf, int nbytes_read) = 0; + virtual void flush_residue() = 0; + + public: + // gr::gnuradio/blocks::file_descriptor_source::sptr + typedef boost::shared_ptr<file_descriptor_source> sptr; + + /*! + * Build a file descriptor source block. + * + * \param itemsize item size of the incoming data stream. + * \param fd file descriptor (as an integer). + * \param repeat repeat the data stream continuously. + */ + static sptr make(size_t itemsize, int fd, bool repeat); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_meta_sink.h b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h new file mode 100644 index 0000000000..10230008a3 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h @@ -0,0 +1,112 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FILE_META_SINK_H +#define INCLUDED_BLOCKS_FILE_META_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + const char METADATA_VERSION = 0; + const size_t METADATA_HEADER_SIZE = 149; + + enum gr_file_types { + GR_FILE_BYTE=0, + GR_FILE_CHAR=0, + GR_FILE_SHORT=1, + GR_FILE_INT, + GR_FILE_LONG, + GR_FILE_LONG_LONG, + GR_FILE_FLOAT, + GR_FILE_DOUBLE, + }; + + /*! + * \brief Write stream to file with meta-data headers. + * \ingroup file_operators_blk + * + * \details + * These files represent data as binary information in between + * meta-data headers. The headers contain information about the + * type of data and properties of the data in the next segment of + * samples. The information includes: + * + * rx_rate (double): sample rate of data. + * rx_time (uint64_t, double): time stamp of first sample in segment. + * size (uint32_t): item size in bytes. + * type (gr_file_types as int32_t): data type. + * cplx (bool): Is data complex? + * strt (uint64_t): Starting byte of data in this segment. + * bytes (uint64_t): Size in bytes of data in this segment. + * + * Tags can be sent to the file to update the information, which + * will create a new header. Headers are found by searching from + * the first header (at position 0 in the file) and reading where + * the data segment starts plus the data segment size. Following + * will either be a new header or EOF. + */ + class BLOCKS_API file_meta_sink : virtual public sync_block + { + public: + // gr::gnuradio/blocks::file_meta_sink::sptr + typedef boost::shared_ptr<file_meta_sink> sptr; + + /*! + * \brief Create a meta-data file sink. + * + * \param itemsize (size_t): Size of data type. + * \param filename (string): Name of file to write data to. + * \param samp_rate (double): Sample rate of data. If sample rate will be + * set by a tag, such as rx_tag from a UHD source, this is + * basically ignored. + * \param relative_rate (double): Rate chance from source of sample + * rate tag to sink. + * \param type (gr_file_types): Data type (int, float, etc.) + * \param complex (bool): If data stream is complex + * \param max_segment_size (size_t): Length of a single segment + * before the header is repeated (in items). + * \param extra_dict (string): a serialized PMT dictionary of extra + * information. Currently not supported. + * \param detached_header (bool): Set to true to store the header + * info in a separate file (named filename.hdr) + */ + static sptr make(size_t itemsize, const std::string &filename, + double samp_rate=1, double relative_rate=1, + gr_file_types type=GR_FILE_FLOAT, bool complex=true, + size_t max_segment_size=1000000, + const std::string &extra_dict="", + bool detached_header=false); + + virtual bool open(const std::string &filename) = 0; + virtual void close() = 0; + virtual void do_update() = 0; + + virtual void set_unbuffered(bool unbuffered) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FILE_META_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_meta_source.h b/gr-blocks/include/gnuradio/blocks/file_meta_source.h new file mode 100644 index 0000000000..38b6a43d86 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/file_meta_source.h @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_H +#define INCLUDED_BLOCKS_FILE_META_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Reads stream from file with meta-data headers. Headers + * are parsed into tags. + * \ingroup file_operators_blk + * + * \details + * The information in the metadata headers includes: + * + * rx_rate (double): sample rate of data. + * rx_time (uint64_t, double): time stamp of first sample in segment. + * size (uint32_t): item size in bytes. + * type (gr_file_types as int32_t): data type. + * cplx (bool): Is data complex? + * strt (uint64_t): Starting byte of data in this segment. + * bytes (uint64_t): Size in bytes of data in this segment. + * + * Any item inside of the extra header dictionary is ready out and + * made into a stream tag. + */ + class BLOCKS_API file_meta_source : virtual public sync_block + { + public: + // gr::gnuradio/blocks::file_meta_source::sptr + typedef boost::shared_ptr<file_meta_source> sptr; + + /*! + * \brief Create a meta-data file source. + * + * \param filename (string): Name of file to write data to. + * \param repeat (bool): Repeats file when EOF is found. + * \param detached_header (bool): Set to true if header + * info is stored in a separate file (usually named filename.hdr) + * \param hdr_filename (string): Name of detached header file if used. + * Defaults to 'filename.hdr' if detached_header is true but this + * field is an empty string. + */ + static sptr make(const std::string &filename, + bool repeat=false, + bool detached_header=false, + const std::string &hdr_filename=""); + + virtual bool open(const std::string &filename, + const std::string &hdr_filename="") = 0; + virtual void close() = 0; + virtual void do_update() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FILE_META_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_sink.h b/gr-blocks/include/gnuradio/blocks/file_sink.h new file mode 100644 index 0000000000..7ea2889835 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/file_sink.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2007,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_FILE_SINK_H +#define INCLUDED_GR_FILE_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/file_sink_base.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Write stream to file. + * \ingroup file_operators_blk + */ + class BLOCKS_API file_sink : virtual public sync_block, + virtual public file_sink_base + { + public: + // gr::gnuradio/blocks::file_sink::sptr + typedef boost::shared_ptr<file_sink> sptr; + + /*! + * \brief Make a file sink. + * \param itemsize size of the input data items. + * \param filename name of the file to open and write output to. + */ + static sptr make(size_t itemsize, const char *filename); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_FILE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_sink_base.h b/gr-blocks/include/gnuradio/blocks/file_sink_base.h new file mode 100644 index 0000000000..812da6dfae --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/file_sink_base.h @@ -0,0 +1,80 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2007,2008,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_FILE_SINK_BASE_H +#define INCLUDED_GR_FILE_SINK_BASE_H + +#include <gnuradio/blocks/api.h> +#include <boost/thread.hpp> +#include <cstdio> + +namespace gr { + namespace blocks { + + /*! + * \brief Common base class for file sinks + */ + class BLOCKS_API file_sink_base + { + protected: + FILE *d_fp; // current FILE pointer + FILE *d_new_fp; // new FILE pointer + bool d_updated; // is there a new FILE pointer? + bool d_is_binary; + boost::mutex d_mutex; + bool d_unbuffered; + + protected: + file_sink_base(const char *filename, bool is_binary); + + public: + file_sink_base() {} + ~file_sink_base(); + + /*! + * \brief Open filename and begin output to it. + */ + bool open(const char *filename); + + /*! + * \brief Close current output file. + * + * Closes current output file and ignores any output until + * open is called to connect to another file. + */ + void close(); + + /*! + * \brief if we've had an update, do it now. + */ + void do_update(); + + /*! + * \brief turn on unbuffered writes for slower outputs + */ + void set_unbuffered(bool unbuffered); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_FILE_SINK_BASE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/file_source.h b/gr-blocks/include/gnuradio/blocks/file_source.h new file mode 100644 index 0000000000..3ed2747c3e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/file_source.h @@ -0,0 +1,85 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FILE_SOURCE_H +#define INCLUDED_BLOCKS_FILE_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Read stream from file + * \ingroup file_operators_blk + */ + class BLOCKS_API file_source : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::file_source::sptr + typedef boost::shared_ptr<file_source> sptr; + + /*! + * \brief Create a file source. + * + * Opens \p filename as a source of items into a flowgraph. The + * data is expected to be in binary format, item after item. The + * \p itemsize of the block determines the conversion from bits + * to items. + * + * If \p repeat is turned on, the file will repeat the file after + * it's reached the end. + * + * \param itemsize the size of each item in the file, in bytes + * \param filename name of the file to source from + * \param repeat repeat file from start + */ + static sptr make(size_t itemsize, const char *filename, bool repeat = false); + + /*! + * \brief seek file to \p seek_point relative to \p whence + * + * \param seek_point sample offset in file + * \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek) + */ + virtual bool seek(long seek_point, int whence) = 0; + + /*! + * \brief Opens a new file. + * + * \param filename name of the file to source from + * \param repeat repeat file from start + */ + virtual void open(const char *filename, bool repeat) = 0; + + /*! + * \brief Close the file handle. + */ + virtual void close() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FILE_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_char.h b/gr-blocks/include/gnuradio/blocks/float_to_char.h new file mode 100644 index 0000000000..5933606088 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/float_to_char.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FLOAT_TO_CHAR_H +#define INCLUDED_BLOCKS_FLOAT_TO_CHAR_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of floats to a stream of char + * \ingroup type_converters_blk + */ + class BLOCKS_API float_to_char : virtual public sync_block + { + public: + // gr::gnuradio/blocks::float_to_char_ff::sptr + typedef boost::shared_ptr<float_to_char> sptr; + + /*! + * Build a float to char block. + * + * \param vlen vector length of data streams. + * \param scale a scalar multiplier to change the output signal scale. + */ + static sptr make(size_t vlen=1, float scale=1.0); + + /*! + * Get the scalar multiplier value. + */ + virtual float scale() const = 0; + + /*! + * Set the scalar multiplier value. + */ + virtual void set_scale(float scale) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FLOAT_TO_CHAR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_complex.h b/gr-blocks/include/gnuradio/blocks/float_to_complex.h new file mode 100644 index 0000000000..c8a97f1fb7 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/float_to_complex.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H +#define INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief one or two floats in, complex out + * \ingroup type_converters_blk + */ + class BLOCKS_API float_to_complex : virtual public sync_block + { + public: + // gr::gnuradio/blocks::float_to_complex_ff::sptr + typedef boost::shared_ptr<float_to_complex> sptr; + + /*! + * Build a float to complex block. + * + * \param vlen vector len (default 1) + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_int.h b/gr-blocks/include/gnuradio/blocks/float_to_int.h new file mode 100644 index 0000000000..0d82b7e5c5 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/float_to_int.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FLOAT_TO_INT_H +#define INCLUDED_BLOCKS_FLOAT_TO_INT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of floats to a stream of ints. + * \ingroup type_converters_blk + */ + class BLOCKS_API float_to_int : virtual public sync_block + { + public: + // gr::gnuradio/blocks::float_to_int_ff::sptr + typedef boost::shared_ptr<float_to_int> sptr; + + /*! + * Build a float to int block. + * + * \param vlen vector length of data streams. + * \param scale a scalar multiplier to change the output signal scale. + */ + static sptr make(size_t vlen=1, float scale=1.0); + + /*! + * Get the scalar multiplier value. + */ + virtual float scale() const = 0; + + /*! + * Set the scalar multiplier value. + */ + virtual void set_scale(float scale) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FLOAT_TO_INT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_short.h b/gr-blocks/include/gnuradio/blocks/float_to_short.h new file mode 100644 index 0000000000..ad62189dd2 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/float_to_short.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FLOAT_TO_SHORT_H +#define INCLUDED_BLOCKS_FLOAT_TO_SHORT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of floats to a stream of shorts + * \ingroup type_converters_blk + */ + class BLOCKS_API float_to_short : virtual public sync_block + { + public: + // gr::gnuradio/blocks::float_to_short_ff::sptr + typedef boost::shared_ptr<float_to_short> sptr; + + /*! + * Build a float to short block. + * + * \param vlen vector length of data streams. + * \param scale a scalar multiplier to change the output signal scale. + */ + static sptr make(size_t vlen=1, float scale=1.0); + + /*! + * Get the scalar multiplier value. + */ + virtual float scale() const = 0; + + /*! + * Set the scalar multiplier value. + */ + virtual void set_scale(float scale) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FLOAT_TO_SHORT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/float_to_uchar.h b/gr-blocks/include/gnuradio/blocks/float_to_uchar.h new file mode 100644 index 0000000000..3a34079bc1 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/float_to_uchar.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H +#define INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of floats to a stream of unsigned chars + * \ingroup type_converters_blk + */ + class BLOCKS_API float_to_uchar : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::float_to_uchar_ff::sptr + typedef boost::shared_ptr<float_to_uchar> sptr; + + /*! + * Build a float to uchar block. + */ + static sptr make(); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/head.h b/gr-blocks/include/gnuradio/blocks/head.h new file mode 100644 index 0000000000..f4a870908a --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/head.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_HEAD_H +#define INCLUDED_GR_HEAD_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief copies the first N items to the output then signals done + * \ingroup misc_blk + * + * \details + * Useful for building test cases + */ + class BLOCKS_API head : virtual public sync_block + { + public: + // gr::gnuradio/blocks::head::sptr + typedef boost::shared_ptr<head> sptr; + + static sptr make(size_t sizeof_stream_item, + uint64_t nitems); + + virtual void reset() = 0; + virtual void set_length(int nitems) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_HEAD_H */ diff --git a/gr-blocks/include/gnuradio/blocks/int_to_float.h b/gr-blocks/include/gnuradio/blocks/int_to_float.h new file mode 100644 index 0000000000..6813449a95 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/int_to_float.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_INT_TO_FLOAT_H +#define INCLUDED_BLOCKS_INT_TO_FLOAT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of ints to a stream of floats. + * \ingroup type_converters_blk + */ + class BLOCKS_API int_to_float : virtual public sync_block + { + public: + // gr::gnuradio/blocks::int_to_float_ff::sptr + typedef boost::shared_ptr<int_to_float> sptr; + + /*! + * Build an int to float block. + * + * \param vlen vector length of data streams. + * \param scale a scalar divider to change the output signal scale. + */ + static sptr make(size_t vlen=1, float scale=1.0); + + /*! + * Get the scalar divider value. + */ + virtual float scale() const = 0; + + /*! + * Set the scalar divider value. + */ + virtual void set_scale(float scale) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_INT_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/integrate_XX.h.t b/gr-blocks/include/gnuradio/blocks/integrate_XX.h.t new file mode 100644 index 0000000000..343ab1ef6c --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/integrate_XX.h.t @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Integrate successive samples and decimate + * \ingroup math_operators_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_decimator + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(int decim); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/interleave.h b/gr-blocks/include/gnuradio/blocks/interleave.h new file mode 100644 index 0000000000..a2aa2fc6c2 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/interleave.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_INTERLEAVE_H +#define INCLUDED_BLOCKS_INTERLEAVE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief interleave N inputs into a single output + * \ingroup stream_operators_blk + */ + class BLOCKS_API interleave : virtual public sync_interpolator + { + public: + // gr::gnuradio/blocks::interleave::sptr + typedef boost::shared_ptr<interleave> sptr; + + /*! + * Make a stream interleave block. + * + * \param itemsize stream itemsize + */ + static sptr make(size_t itemsize); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_INTERLEAVE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h b/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h new file mode 100644 index 0000000000..38caaf7ffa --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/interleaved_short_to_complex.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H +#define INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of interleaved shorts to a stream of complex + * \ingroup type_converters_blk + */ + class BLOCKS_API interleaved_short_to_complex : virtual public sync_decimator + { + public: + // gr::gnuradio/blocks::interleaved_short_to_complex::sptr + typedef boost::shared_ptr<interleaved_short_to_complex> sptr; + + /*! + * Build an interleaved short to complex block. + */ + static sptr make(bool vector_input=false); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h b/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h new file mode 100644 index 0000000000..4a1de48331 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/keep_m_in_n.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_KEEP_M_IN_N_H +#define INCLUDED_BLOCKS_KEEP_M_IN_N_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief decimate a stream, keeping \p m items out of every \p n. + * \ingroup stream_operators_blk + */ + class BLOCKS_API keep_m_in_n : virtual public block + { + public: + + // gr::gnuradio/blocks::keep_m_in_n::sptr + typedef boost::shared_ptr<keep_m_in_n> sptr; + + /*! + * Make a keep m in n block. + * + * \param itemsize stream itemsize + * \param m number of items to take in block of \p n items + * \param n block size in items + * \param offset initial item offset into the stream + */ + static sptr make(size_t itemsize, int m, int n, int offset); + + virtual void set_m(int m) = 0; + virtual void set_n(int n) = 0; + virtual void set_offset(int offset) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_KEEP_M_IN_N_H */ diff --git a/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h b/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h new file mode 100644 index 0000000000..bc63bf9383 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/keep_one_in_n.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_KEEP_ONE_IN_N_H +#define INCLUDED_BLOCKS_KEEP_ONE_IN_N_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief decimate a stream, keeping one item out of every \p n. + * \ingroup stream_operators_blk + */ + class BLOCKS_API keep_one_in_n : virtual public block + { + public: + + // gr::gnuradio/blocks::keep_one_in_n::sptr + typedef boost::shared_ptr<keep_one_in_n> sptr; + + /*! + * Make a keep one in n block. + * + * \param itemsize stream itemsize + * \param n block size in items + */ + static sptr make(size_t itemsize, int n); + + virtual void set_n(int n) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_KEEP_ONE_IN_N_H */ diff --git a/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h b/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h new file mode 100644 index 0000000000..2ebfe08319 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/lfsr_15_1_0.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GRI_LFSR_15_1_0_H +#define INCLUDED_GRI_LFSR_15_1_0_H + +#include <gnuradio/blocks/api.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1 + * \ingroup misc + * + * \details + * Generates a maximal length pseudo-random sequence of length + * 2^15 - 1 bits. + */ + class BLOCKS_API lfsr_15_1_0 + { + private: + unsigned long d_sr; // shift register + + public: + lfsr_15_1_0() { reset(); } + + void reset() { d_sr = 0x7fff; } + + int next_bit() + { + d_sr = ((((d_sr >> 1) ^ d_sr) & 0x1) << 14) | (d_sr >> 1); + return d_sr & 0x1; + } + + int next_byte () + { + int v = 0; + for(int i = 0; i < 8; i++) { + v >>= 1; + if(next_bit ()) + v |= 0x80; + } + return v; + } + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GRI_LFSR_15_1_0_H */ diff --git a/gr-blocks/include/gnuradio/blocks/lfsr_32k.h b/gr-blocks/include/gnuradio/blocks/lfsr_32k.h new file mode 100644 index 0000000000..502efebc5d --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/lfsr_32k.h @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GRI_LFSR_32k_H +#define INCLUDED_GRI_LFSR_32k_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/lfsr_15_1_0.h> + +namespace gr { + namespace blocks { + + /*! + * \brief generate pseudo-random sequence of length 32768 bits. + * \ingroup misc + * + * \details + * This is based on gri_lfsr_15_1_0 with an extra 0 added at the + * end of the sequence. + */ + class BLOCKS_API lfsr_32k + { + private: + lfsr_15_1_0 d_lfsr; + unsigned int d_count; + + public: + lfsr_32k() { reset (); } + + void reset() + { + d_lfsr.reset(); + d_count = 0; + } + + int next_bit() + { + if(d_count == 32767) { + d_count = 0; + return 0; + } + d_count++; + return d_lfsr.next_bit(); + } + + int next_byte() + { + int v = 0; + for(int i = 0; i < 8; i++) { + v >>= 1; + if(next_bit ()) + v |= 0x80; + } + return v; + } + + int next_short() + { + int v = 0; + for(int i = 0; i < 16; i++) { + v >>= 1; + if(next_bit ()) + v |= 0x8000; + } + return v; + } + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GRI_LFSR_32k_H */ diff --git a/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h b/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h new file mode 100644 index 0000000000..619e9a424d --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/lfsr_32k_source_s.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_H +#define INCLUDED_GR_LFSR_32K_SOURCE_S_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/lfsr_32k.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts) + * \ingroup misc_blk + * + * \details + * This source is typically used along with gr::blocks::check_lfsr_32k_s to + * test the USRP using its digital loopback mode. + */ + class BLOCKS_API lfsr_32k_source_s : virtual public sync_block + { + public: + // gr::gnuradio/blocks::lfsr_32k_source_s::sptr + typedef boost::shared_ptr<lfsr_32k_source_s> sptr; + + /*! + * \brief Make a LFSR 32k source block. + */ + static sptr make(); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_LFSR_32K_SOURCE_S_H */ diff --git a/gr-blocks/include/gnuradio/blocks/log2_const.h b/gr-blocks/include/gnuradio/blocks/log2_const.h new file mode 100644 index 0000000000..c2526e76ed --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/log2_const.h @@ -0,0 +1,53 @@ +/* -*- 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. + */ + + +/* + * a bit of template hackery... + */ +#ifndef INCLUDED_BLOCKS_LOG2_CONST_H +#define INCLUDED_BLOCKS_LOG2_CONST_H + +#include <gnuradio/blocks/api.h> +#include <assert.h> + +namespace gr { + namespace blocks { + + template<unsigned int k> static inline int log2_const() { assert(0); return 0; } + + template<> inline int log2_const<1>() { return 0; } + template<> inline int log2_const<2>() { return 1; } + template<> inline int log2_const<4>() { return 2; } + template<> inline int log2_const<8>() { return 3; } + template<> inline int log2_const<16>() { return 4; } + template<> inline int log2_const<32>() { return 5; } + template<> inline int log2_const<64>() { return 6; } + template<> inline int log2_const<128>() { return 7; } + template<> inline int log2_const<256>() { return 8; } + template<> inline int log2_const<512>() { return 9; } + template<> inline int log2_const<1024>(){ return 10; } + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_LOG2_CONST_H */ diff --git a/gr-blocks/include/gnuradio/blocks/max_XX.h.t b/gr-blocks/include/gnuradio/blocks/max_XX.h.t new file mode 100644 index 0000000000..44b3ad4878 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/max_XX.h.t @@ -0,0 +1,59 @@ +/* -*- 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Compares vectors from multiple streams and determines + * the maximum value from each vector over all streams. + * \ingroup math_operators_blk + * + * \details + * Data is passed in as a vector of length \p vlen from multiple + * input sources. It will look through these streams of \p vlen + * data items and output two streams. + * Stream 0 will contain the index value in the vector where + * the maximum value occurred. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ + diff --git a/gr-blocks/include/gnuradio/blocks/message_burst_source.h b/gr-blocks/include/gnuradio/blocks/message_burst_source.h new file mode 100644 index 0000000000..0e7527cbe0 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/message_burst_source.h @@ -0,0 +1,52 @@ +/* -*- 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_MESSAGE_BURST_SOURCE_H +#define INCLUDED_GR_MESSAGE_BURST_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Turn received messages into a stream and tag them for UHD to send. + * \ingroup message_tools_blk + */ + class BLOCKS_API message_burst_source : virtual public sync_block + { + public: + // gr::gnuradio/blocks::message_source::sptr + typedef boost::shared_ptr<message_burst_source> sptr; + + static sptr make(size_t itemsize, int msgq_limit); + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq); + + virtual gr::msg_queue::sptr msgq() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_MESSAGE_BURST_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_debug.h b/gr-blocks/include/gnuradio/blocks/message_debug.h new file mode 100644 index 0000000000..cc9612542c --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/message_debug.h @@ -0,0 +1,88 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,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_MESSAGE_DEBUG_H +#define INCLUDED_GR_MESSAGE_DEBUG_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Debug block for the message passing system. + * \ingroup message_tools_blk + * \ingroup measurement_tools_blk + * \ingroup debug_tools_blk + * + * \details + * The message debug block is used to capture and print or store + * messages as they are received. Any block that generates a + * message may connect that message port to one or more of the + * three message input ports of this debug block. The message + * ports are: + * + * \li print: prints the message directly to standard out. + * \li store: stores the message in an internal vector. May be + * access using the get_message function. + * \li print_pdu: specifically designed to handle formatted PDUs + * (see pdu.h). + */ + class BLOCKS_API message_debug : virtual public block + { + public: + // gr::gnuradio/blocks::message_debug::sptr + typedef boost::shared_ptr<message_debug> sptr; + + /*! + * \brief Build the message debug block. It takes no parameters + * and has three message ports: print, store, and + * print_pdu. + */ + static sptr make(); + + /*! + * \brief Reports the number of messages received by this block. + */ + virtual int num_messages() = 0; + + /*! + * \brief Get a message (as a PMT) from the message vector at index \p i. + * + * Messages passed to the 'store' port will be stored in a + * vector. This function retrieves those messages by index. They + * are index in order of when they were received (all messages + * are just pushed onto the back of a vector). This is mostly + * useful in debugging message passing graphs and in QA code. + * + * \param i The index in the vector for the message to retrieve. + * + * \return a message at index \p i as a pmt_t. + */ + virtual pmt::pmt_t get_message(int i) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_MESSAGE_DEBUG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_sink.h b/gr-blocks/include/gnuradio/blocks/message_sink.h new file mode 100644 index 0000000000..60eaa84497 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/message_sink.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_MESSAGE_SINK_H +#define INCLUDED_GR_MESSAGE_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Gather received items into messages and insert into msgq + * \ingroup message_tools_blk + */ + class BLOCKS_API message_sink : virtual public sync_block + { + public: + // gr::gnuradio/blocks::message_sink::sptr + typedef boost::shared_ptr<message_sink> sptr; + + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, bool dont_block); + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, bool dont_block, + const std::string& lengthtagname); + + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_MESSAGE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_source.h b/gr-blocks/include/gnuradio/blocks/message_source.h new file mode 100644 index 0000000000..af21d7333f --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/message_source.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_MESSAGE_SOURCE_H +#define INCLUDED_GR_MESSAGE_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/msg_queue.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Turn received messages into a stream + * \ingroup message_tools_blk + */ + class BLOCKS_API message_source : virtual public sync_block + { + public: + // gr::gnuradio/blocks::message_source::sptr + typedef boost::shared_ptr<message_source> sptr; + + static sptr make(size_t itemsize, int msgq_limit=0); + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq); + static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, + const std::string& lengthtagname); + + virtual gr::msg_queue::sptr msgq() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_MESSAGE_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_strobe.h b/gr-blocks/include/gnuradio/blocks/message_strobe.h new file mode 100644 index 0000000000..07b6833b43 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/message_strobe.h @@ -0,0 +1,82 @@ +/* -*- 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_MESSAGE_STROBE_H +#define INCLUDED_GR_MESSAGE_STROBE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Send message at defined interval + * \ingroup message_tools_blk + * + * \details + * Takes a PMT message and sends it out every \p period_ms + * milliseconds. Useful for testing/debugging the message system. + */ + class BLOCKS_API message_strobe : virtual public block + { + public: + // gr::gnuradio/blocks::message_strobe::sptr + typedef boost::shared_ptr<message_strobe> sptr; + + /*! + * Make a message stobe block to send message \p msg every \p + * period_ms milliseconds. + * + * \param msg The message to send as a PMT. + * \param period_ms the time period in milliseconds in which to + * send \p msg. + */ + static sptr make(pmt::pmt_t msg, float period_ms); + + /*! + * Reset the message being sent. + * \param msg The message to send as a PMT. + */ + virtual void set_msg(pmt::pmt_t msg) = 0; + + /*! + * Get the value of the message being sent. + */ + virtual pmt::pmt_t msg() const = 0; + + /*! + * Reset the sending interval. + * \param period_ms the time period in milliseconds. + */ + virtual void set_period(float period_ms) = 0; + + /*! + * Get the time interval of the strobe. + */ + virtual float period() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_MESSAGE_STROBE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t b/gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t new file mode 100644 index 0000000000..37472f70d7 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/moving_average_XX.h.t @@ -0,0 +1,84 @@ +/* -*- 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output is the moving sum of the last N samples, scaled by the scale factor + * \ingroup level_controllers_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * Create a moving average block. + * + * \param length Number of samples to use in the average. + * \param scale scale factor for the result. + * \param max_iter limits how long we go without flushing the accumulator + * This is necessary to avoid numerical instability for float and complex. + */ + static sptr make(int length, @O_TYPE@ scale, + int max_iter = 4096); + + /*! + * Get the length used in the avaraging calculation. + */ + virtual int length() const = 0; + + /*! + * Get the scale factor being used. + */ + virtual @O_TYPE@ scale() const = 0; + + /*! + * Set both the length and the scale factor together. + */ + virtual void set_length_and_scale(int length, @O_TYPE@ scale) = 0; + + /*! + * Set the length. + */ + virtual void set_length(int length) = 0; + + /*! + * Set the scale factor. + */ + virtual void set_scale(@O_TYPE@ scale) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_XX.h.t new file mode 100644 index 0000000000..1071b5b5c5 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_XX.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004, 2009, 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = prod (input_0, input_1, ...) + * \ingroup math_operators_blk + * + * \details + * Multiply across all input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_cc.h new file mode 100644 index 0000000000..c6116b6452 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_cc.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_MULTIPLY_CC_H +#define INCLUDED_GR_MULTIPLY_CC_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = prod (input_0, input_1, ...) + * \ingroup math_operators_blk + * + * \details + * Multiply across all input streams. + */ + class BLOCKS_API multiply_cc : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::multiply_cc::sptr + typedef boost::shared_ptr<multiply_cc> sptr; + + /*! + * \brief Multiply streams of complex values + * \param vlen Vector length + * \ingroup math_blk + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_MULTIPLY_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h new file mode 100644 index 0000000000..43101bf441 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_conjugate_cc.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H +#define INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Multiplies stream 0 by the complex conjugate of stream 1. + * \ingroup math_operators_blk + */ + class BLOCKS_API multiply_conjugate_cc : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::multiply_conjugate_cc::sptr + typedef boost::shared_ptr<multiply_conjugate_cc> sptr; + + /*! + * \brief Multiplies a streams by the conjugate of a second stream + * \param vlen Vector length + * \ingroup math_blk + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t new file mode 100644 index 0000000000..d1bc76c3b3 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_XX.h.t @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input * constant + * \ingroup math_operators_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * \brief Create an instance of @NAME@ + * \param k multiplicative constant + */ + static sptr make(@O_TYPE@ k); + + /*! + * \brief Return multiplicative constant + */ + virtual @O_TYPE@ k() const = 0; + + /*! + * \brief Set multiplicative constant + */ + virtual void set_k(@O_TYPE@ k) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h new file mode 100644 index 0000000000..d24c1135c3 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef INCLUDED_MULTIPLY_CONST_CC_H +#define INCLUDED_MULTIPLY_CONST_CC_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input * complex constant + * \ingroup math_operators_blk + */ + class BLOCKS_API multiply_const_cc : virtual public sync_block + { + + public: + + // gr::gnuradio/blocks::multiply_const_cc::sptr + typedef boost::shared_ptr<multiply_const_cc> sptr; + + /*! + * \brief Create an instance of multiply_const_cc + * \param k complex multiplicative constant + * \param vlen Vector length of incoming stream + */ + static sptr make(gr_complex k, size_t vlen=1); + + /*! + * \brief Return complex multiplicative constant + */ + virtual gr_complex k() const = 0; + + /*! + * \brief Set complex multiplicative constant + */ + virtual void set_k(gr_complex k) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_MULTIPLY_CONST_CC_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h b/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h new file mode 100644 index 0000000000..0fc81dc38f --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_ff.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef INCLUDED_MULTIPLY_CONST_FF_H +#define INCLUDED_MULTIPLY_CONST_FF_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input * real constant + * \ingroup math_operators_blk + */ + class BLOCKS_API multiply_const_ff : virtual public sync_block + { + + public: + + // gr::gnuradio/blocks::multiply_const_ff::sptr + typedef boost::shared_ptr<multiply_const_ff> sptr; + + /*! + * \brief Create an instance of multiply_const_ff + * \param k real multiplicative constant + * \param vlen Vector length of incoming stream + */ + static sptr make(float k, size_t vlen=1); + + /*! + * \brief Return real multiplicative constant + */ + virtual float k() const = 0; + + /*! + * \brief Set real multiplicative constant + */ + virtual void set_k(float k) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_MULTIPLY_CONST_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t new file mode 100644 index 0000000000..ed180dba33 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_const_vXX.h.t @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2010,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input * constant vector (element-wise) + * \ingroup math_operators_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * \brief Create an instance of @NAME@ + * \param k multiplicative constant vector + */ + static sptr make(std::vector<@O_TYPE@> k); + + /*! + * \brief Return multiplicative constant vector + */ + virtual std::vector<@O_TYPE@> k() const = 0; + + /*! + * \brief Set multiplicative constant vector + */ + virtual void set_k(std::vector<@O_TYPE@> k) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/multiply_ff.h b/gr-blocks/include/gnuradio/blocks/multiply_ff.h new file mode 100644 index 0000000000..b7ee6ca430 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/multiply_ff.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_MULTIPLY_FF_H +#define INCLUDED_GR_MULTIPLY_FF_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = prod (input_0, input_1, ...) + * \ingroup math_operators_blk + * + * \details + * Multiply across all input streams. + */ + class BLOCKS_API multiply_ff : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::multiply_ff::sptr + typedef boost::shared_ptr<multiply_ff> sptr; + + /*! + * \brief Multiply streams of float values + * \param vlen Vector length + * \ingroup math_blk + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_MULTIPLY_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/mute_XX.h.t b/gr-blocks/include/gnuradio/blocks/mute_XX.h.t new file mode 100644 index 0000000000..ab246c54b5 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/mute_XX.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input or zero if muted. + * \ingroup level_controllers_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(bool mute=false); + + virtual bool mute() const = 0; + virtual void set_mute(bool mute=false) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ + diff --git a/gr-blocks/include/gnuradio/blocks/nlog10_ff.h b/gr-blocks/include/gnuradio/blocks/nlog10_ff.h new file mode 100644 index 0000000000..642cf987bd --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/nlog10_ff.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_NLOG10_FF_H +#define INCLUDED_BLOCKS_NLOG10_FF_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = n*log10(input) + k + * \ingroup math_operators_blk + */ + class BLOCKS_API nlog10_ff : virtual public sync_block + { + public: + + // gr::gnuradio/blocks::nlog10_ff::sptr + typedef boost::shared_ptr<nlog10_ff> sptr; + + /*! + * \brief Make an instance of an nlog10_ff block. + * \param n Scalar multiplicative constant + * \param vlen Input vector length + * \param k Scalar additive constant + */ + static sptr make(float n=1.0, size_t vlen=1, float k=0.0); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_NLOG10_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/nop.h b/gr-blocks/include/gnuradio/blocks/nop.h new file mode 100644 index 0000000000..20ca0532a9 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/nop.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NOP_H +#define INCLUDED_GR_NOP_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief Does nothing. Used for testing only. + * \ingroup misc_blk + */ + class BLOCKS_API nop : virtual public block + { + public: + // gr::gnuradio/blocks::nop::sptr + typedef boost::shared_ptr<nop> sptr; + + /*! + * Build a nop block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + + virtual int nmsgs_received() const = 0; + + virtual int ctrlport_test() const = 0; + virtual void set_ctrlport_test(int x) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NOP_H */ diff --git a/gr-blocks/include/gnuradio/blocks/not_XX.h.t b/gr-blocks/include/gnuradio/blocks/not_XX.h.t new file mode 100644 index 0000000000..2c32237ce5 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/not_XX.h.t @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = ~input + * \ingroup boolean_operators_blk + * + * bitwise boolean not of input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/null_sink.h b/gr-blocks/include/gnuradio/blocks/null_sink.h new file mode 100644 index 0000000000..840d58aade --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/null_sink.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NULL_SINK_H +#define INCLUDED_GR_NULL_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief Bit bucket. Use as a termination point when a sink is + * required and we don't want to do anything real. + * \ingroup misc_blk + */ + class BLOCKS_API null_sink : virtual public sync_block + { + public: + // gr::gnuradio/blocks::null_sink::sptr + typedef boost::shared_ptr<null_sink> sptr; + + /*! + * Build a null sink block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NULL_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/null_source.h b/gr-blocks/include/gnuradio/blocks/null_source.h new file mode 100644 index 0000000000..387c649f45 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/null_source.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NULL_SOURCE_H +#define INCLUDED_GR_NULL_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief A source of zeros used mainly for testing. + * \ingroup misc_blk + */ + class BLOCKS_API null_source : virtual public sync_block + { + public: + // gr::gnuradio/blocks::null_source::sptr + typedef boost::shared_ptr<null_source> sptr; + + /*! + * Build a null source block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NULL_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/or_XX.h.t b/gr-blocks/include/gnuradio/blocks/or_XX.h.t new file mode 100644 index 0000000000..d485f04962 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/or_XX.h.t @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input_0 | input_1 | , ... | input_N) + * \ingroup boolean_operators_blk + * + * Bitwise boolean or across all input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h b/gr-blocks/include/gnuradio/blocks/pack_k_bits_bb.h new file mode 100644 index 0000000000..584ea6361e --- /dev/null +++ b/gr-blocks/include/gnuradio/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 <gnuradio/blocks/api.h> +#include <gnuradio/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 byte_operators_blk + */ + class BLOCKS_API pack_k_bits_bb : virtual public sync_decimator + { + public: + // gr::gnuradio/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/gnuradio/blocks/packed_to_unpacked_XX.h.t b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked_XX.h.t new file mode 100644 index 0000000000..98b7df2658 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/packed_to_unpacked_XX.h.t @@ -0,0 +1,74 @@ +/* -*- 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> +#include <gnuradio/endianness.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert a stream of packed bytes or shorts to stream of unpacked bytes or shorts. + * \ingroup byte_operators_blk + * + * \details + * input: stream of @I_TYPE@; output: stream of @O_TYPE@ + * + * This is the inverse of gr::blocks::unpacked_to_packed_XX. + * + * The bits in the bytes or shorts input stream are grouped into + * chunks of \p bits_per_chunk bits and each resulting chunk is + * written right- justified to the output stream of bytes or + * shorts. All b or 16 bits of the each input bytes or short are + * processed. The right thing is done if bits_per_chunk is not a + * power of two. + * + * The combination of gr::blocks::packed_to_unpacked_XX_ followed by + * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the + * general case of mapping from a stream of bytes or shorts into + * arbitrary float or complex symbols. + * + * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, + * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, + * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. + * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. + */ + class BLOCKS_API @NAME@ : virtual public block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(unsigned int bits_per_chunk, + endianness_t endianness); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h b/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h new file mode 100644 index 0000000000..ad3d1e9c8e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/patterned_interleaver.h @@ -0,0 +1,54 @@ +/* -*- 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_PATTERNED_INTERLEAVER_H +#define INCLUDED_BLOCKS_PATTERNED_INTERLEAVER_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Interleave items based on the provided vector \p pattern. + * \ingroup stream_operators_blk + */ + class BLOCKS_API patterned_interleaver : virtual public block + { + public: + typedef boost::shared_ptr<patterned_interleaver> sptr; + + /*! + * Make a patterned interleaver block. + * + * \param itemsize stream itemsize + * \param pattern vector that represents the interleaving pattern + */ + static sptr make(size_t itemsize, std::vector<int> pattern); + }; + + } +} + +#endif /* INCLUDED_BLOCKS_PATTERNED_INTERLEAVER_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/pdu.h b/gr-blocks/include/gnuradio/blocks/pdu.h new file mode 100644 index 0000000000..decc5e17d0 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/pdu.h @@ -0,0 +1,48 @@ +/* -*- 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_PDU_H +#define INCLUDED_BLOCKS_PDU_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/gr_complex.h> +#include <pmt/pmt.h> + +#define PDU_PORT_ID pmt::mp("pdus") +#define PDU_LENGTH_TAG pmt::mp("pdu_length") + +namespace gr { + namespace blocks { + namespace pdu { + + enum vector_type { byte_t, float_t, complex_t }; + + BLOCKS_API size_t itemsize(vector_type type); + BLOCKS_API bool type_matches(vector_type type, pmt::pmt_t v); + BLOCKS_API pmt::pmt_t make_pdu_vector(vector_type type, const uint8_t* buf, size_t items); + BLOCKS_API vector_type type_from_pmt(pmt::pmt_t vector); + + } /* namespace pdu */ + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h b/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.h new file mode 100644 index 0000000000..758d7412db --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/pdu_to_tagged_stream.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_PDU_TO_TAGGED_STREAM_H +#define INCLUDED_BLOCKS_PDU_TO_TAGGED_STREAM_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/pdu.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Turns received PDUs into a tagged stream of items + * \ingroup message_tools_blk + */ + class BLOCKS_API pdu_to_tagged_stream : virtual public sync_block + { + public: + // gr::gnuradio/blocks::pdu_to_tagged_stream::sptr + typedef boost::shared_ptr<pdu_to_tagged_stream> sptr; + + /*! + * \brief Construct a pdu_to_tagged_stream block + * \param type PDU type of pdu::vector_type + */ + static sptr make(pdu::vector_type type); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_PDU_TO_TAGGED_STREAM_H */ diff --git a/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h b/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h new file mode 100644 index 0000000000..84b8a74a72 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/peak_detector2_fb.h @@ -0,0 +1,95 @@ +/* -*- 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 <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Detect the peak of a signal + * \ingroup peak_detectors_blk + * + * \details + * 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. + */ + class BLOCKS_API peak_detector2_fb : virtual public sync_block + { + public: + // gr::gnuradio/blocks::peak_detector2_fb::sptr + typedef boost::shared_ptr<peak_detector2_fb> sptr; + + /*! + * Build a peak detector block with float in, byte out. + * + * \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. + */ + 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/gnuradio/blocks/peak_detector_XX.h.t b/gr-blocks/include/gnuradio/blocks/peak_detector_XX.h.t new file mode 100644 index 0000000000..6bf14320a0 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/peak_detector_XX.h.t @@ -0,0 +1,118 @@ +/* -*- 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Detect the peak of a signal + * \ingroup peak_detectors_blk + * + * \details + * If a peak is detected, this block outputs a 1, + * or it outputs 0's. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * Make a peak detector block. + * + * \param threshold_factor_rise The threshold factor determins + * when a peak has started. An average of the signal is + * calculated and when the value of the signal goes over + * threshold_factor_rise*average, we start looking for a + * peak. + * \param threshold_factor_fall The threshold factor determins + * when a peak has ended. An average of the signal is + * calculated and when the value of the signal goes + * bellow threshold_factor_fall*average, we stop looking + * for a peak. + * \param look_ahead The look-ahead value is used when the + * threshold is found to look if there another peak + * within this step range. If there is a larger value, + * we set that as the peak and look ahead again. This is + * continued until the highest point is found with This + * look-ahead range. + * \param alpha The gain value of a moving average filter + */ + static sptr make(float threshold_factor_rise = 0.25, + float threshold_factor_fall = 0.40, + int look_ahead = 10, + 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 threshold factor value for the fall time + * \param thr new threshold factor + */ + virtual void set_threshold_factor_fall(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 threshold factor value for the fall time + * \return threshold factor + */ + virtual float threshold_factor_fall() = 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 /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h b/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h new file mode 100644 index 0000000000..3f5ea189e9 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/plateau_detector_fb.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H +#define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Detects a plateau and marks the middle. + * \ingroup peak_detectors_blk + * + * \details + * Detect a plateau of a-priori known height. Input is a stream of floats, + * the output is a stream of bytes. Whenever a plateau is detected, the + * middle of that plateau is marked with a '1' on the output stream (all + * other samples are left at zero). + * + * You can use this in a Schmidl & Cox synchronisation algorithm to interpret + * the output of the normalized correlator. Just pass the length of the cyclic + * prefix (in samples) as the max_len parameter). + * + * Unlike the peak detectors, you must the now the absolute height of the plateau. + * Whenever the amplitude exceeds the given threshold, it starts assuming the + * presence of a plateau. + * + * An implicit hysteresis is provided by the fact that after detecting one plateau, + * it waits at least max_len samples before the next plateau can be detected. + */ + class BLOCKS_API plateau_detector_fb : virtual public sync_block + { + public: + typedef boost::shared_ptr<plateau_detector_fb> sptr; + + /*! + * \param max_len Maximum length of the plateau + * \param threshold Anything above this value is considered a plateau + */ + static sptr make(int max_len, float threshold=0.9); + }; + + } // namespace blocks +} // namespace gr + +#endif /* INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/probe_rate.h b/gr-blocks/include/gnuradio/blocks/probe_rate.h new file mode 100644 index 0000000000..7789de1925 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/probe_rate.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_PROBE_RATE_H +#define INCLUDED_BLOCKS_PROBE_RATE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief throughput measurement + * \ingroup measurement_tools_blk + */ + class BLOCKS_API probe_rate : virtual public sync_block + { + public: + // gr::gnuradio/blocks::probe_rate::sptr + typedef boost::shared_ptr<probe_rate> sptr; + + /*! + * \brief Make a throughput measurement block + * \param itemsize size of each stream item + * \param update_rate_ms minimum update time in milliseconds + * \param alpha gain for running average filter + */ + static sptr make(size_t itemsize, double update_rate_ms = 500.0, double alpha = 0.0001); + + virtual void set_alpha(double alpha) = 0; + + virtual double rate() = 0; + + virtual bool start() = 0; + virtual bool stop() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_PROBE_RATE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t b/gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t new file mode 100644 index 0000000000..5398411a73 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/probe_signal_X.h.t @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Sink that allows a sample to be grabbed from Python. + * \ingroup measurement_tools_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(); + + virtual @TYPE@ level() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t b/gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t new file mode 100644 index 0000000000..05e0137953 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/probe_signal_vX.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <vector> +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Sink that allows a vector of samples to be grabbed from Python. + * \ingroup sink_blk + * \ingroup measurement_tools_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t size); + + virtual std::vector<@TYPE@> level() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/random_pdu.h b/gr-blocks/include/gnuradio/blocks/random_pdu.h new file mode 100644 index 0000000000..6ffdd86a9e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/random_pdu.h @@ -0,0 +1,52 @@ +/* -*- 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_RANDOM_PDU_H +#define INCLUDED_BLOCKS_RANDOM_PDU_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Sends a random PDU at intervals + * \ingroup message_tools_blk + * \ingroup debug_tools_blk + */ + class BLOCKS_API random_pdu : virtual public block + { + public: + // gr::gnuradio/blocks::random_pdu::sptr + typedef boost::shared_ptr<random_pdu> sptr; + + /*! + * \brief Construct a random PDU generator + */ + static sptr make(int mintime, int maxtime); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_RANDOM_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/regenerate_bb.h b/gr-blocks/include/gnuradio/blocks/regenerate_bb.h new file mode 100644 index 0000000000..0ff8b4c9d1 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/regenerate_bb.h @@ -0,0 +1,81 @@ +/* -*- 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 <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Detect the peak of a signal and repeat every period samples + * \ingroup stream_operators_blk + * + * \details + * 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 sync_block + { + public: + // gr::gnuradio/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/gnuradio/blocks/repack_bits_bb.h b/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h new file mode 100644 index 0000000000..c594966e6e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/repack_bits_bb.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_REPACK_BITS_BB_H +#define INCLUDED_BLOCKS_REPACK_BITS_BB_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/tagged_stream_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Pack \p k bits from the input stream onto \p l bits of the output stream. + * \ingroup byte_operators_blk + * + * \details + * No bits are lost here; any value for k and l (within [1, 8]) is allowed. + * On every fresh input byte, it starts reading on the LSB, and starts copying + * to the LSB as well. + * + * If a packet length tag is given, this block assumes a tagged stream. + * In this case, the tag with the packet length is updated accordingly. + * Also, the number of input bits is padded with zeros if the number of input + * bits is not an integer multiple of \p l, or bits are truncated from the input + * if \p align_output is set to true. + */ + class BLOCKS_API repack_bits_bb : virtual public tagged_stream_block + { + public: + typedef boost::shared_ptr<repack_bits_bb> sptr; + + /*! + * \param k Number of relevant bits on the input stream + * \param l Number of relevant bits on the output stream + * \param len_tag_key If not empty, this is the key for the length tag. + * \param align_output If len_tag_key is given, this controls if the input + * or the output is aligned. + */ + static sptr make(int k, int l=8, const std::string &len_tag_key="", bool align_output=false); + }; + + } // namespace blocks +} // namespace gr + +#endif /* INCLUDED_BLOCKS_REPACK_BITS_BB_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/repeat.h b/gr-blocks/include/gnuradio/blocks/repeat.h new file mode 100644 index 0000000000..50a3daf38f --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/repeat.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_REPEAT_H +#define INCLUDED_BLOCKS_REPEAT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief repeat each input \p repeat times + * \ingroup stream_operators_blk + */ + class BLOCKS_API repeat : virtual public sync_interpolator + { + public: + // gr::gnuradio/blocks::repeat::sptr + typedef boost::shared_ptr<repeat> sptr; + + /*! + * Make a repeat block. + * + * \param itemsize stream itemsize + * \param repeat number of times to repeat the input + */ + static sptr make(size_t itemsize, int repeat); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_REPEAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/rms_cf.h b/gr-blocks/include/gnuradio/blocks/rms_cf.h new file mode 100644 index 0000000000..f10a19521a --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/rms_cf.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_RMS_CF_H +#define INCLUDED_BLOCKS_RMS_CF_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief RMS average power + * \ingroup math_operators_blk + */ + class BLOCKS_API rms_cf : virtual public sync_block + { + public: + // gr::gnuradio/blocks::rms_cf::sptr + typedef boost::shared_ptr<rms_cf> sptr; + + /*! + * \brief Make an RMS calc. block. + * \param alpha gain for running average filter. + */ + static sptr make(double alpha = 0.0001); + + virtual void set_alpha(double alpha) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_RMS_CF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/rms_ff.h b/gr-blocks/include/gnuradio/blocks/rms_ff.h new file mode 100644 index 0000000000..60b0c50f9d --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/rms_ff.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_RMS_FF_H +#define INCLUDED_BLOCKS_RMS_FF_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief RMS average power + * \ingroup math_operators_blk + */ + class BLOCKS_API rms_ff : virtual public sync_block + { + public: + // gr::gnuradio/blocks::rms_ff::sptr + typedef boost::shared_ptr<rms_ff> sptr; + + /*! + * \brief Make an RMS calc. block. + * \param alpha gain for running average filter. + */ + static sptr make(double alpha = 0.0001); + + virtual void set_alpha(double alpha) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_RMS_FF_H */ diff --git a/gr-blocks/include/gnuradio/blocks/rotator.h b/gr-blocks/include/gnuradio/blocks/rotator.h new file mode 100644 index 0000000000..975bfc62aa --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/rotator.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2008,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef _GR_ROTATOR_H_ +#define _GR_ROTATOR_H_ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/gr_complex.h> + +namespace gr { + namespace blocks { + + class rotator + { + private: + gr_complex d_phase; + gr_complex d_phase_incr; + unsigned int d_counter; + + public: + rotator() : d_phase(1), d_phase_incr(1), d_counter(0) + { } + + void set_phase(gr_complex phase) { d_phase = phase / abs(phase); } + void set_phase_incr(gr_complex incr) { d_phase_incr = incr / abs(incr); } + + gr_complex rotate(gr_complex in) + { + d_counter++; + + gr_complex z = in * d_phase; // rotate in by phase + d_phase *= d_phase_incr; // incr our phase (complex mult == add phases) + + if((d_counter % 512) == 0) + d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation + + return z; + } + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* _GR_ROTATOR_H_ */ diff --git a/gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t b/gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t new file mode 100644 index 0000000000..2f15b2490f --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/sample_and_hold_XX.h.t @@ -0,0 +1,54 @@ +/* -*- 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief sample and hold circuit + * \ingroup level_controllers_blk + * + * \details + * Samples the data stream (input stream 0) and holds the value if + * the control signal is 1 (intput stream 1). + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/short_to_char.h b/gr-blocks/include/gnuradio/blocks/short_to_char.h new file mode 100644 index 0000000000..f6073ea46f --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/short_to_char.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_SHORT_TO_CHAR_H +#define INCLUDED_BLOCKS_SHORT_TO_CHAR_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of shorts to a stream of chars. + * \ingroup type_converters_blk + */ + class BLOCKS_API short_to_char : virtual public sync_block + { + public: + // gr::gnuradio/blocks::short_to_char_ff::sptr + typedef boost::shared_ptr<short_to_char> sptr; + + /*! + * Build a short to char block. + * + * \param vlen vector length of data streams. + */ + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_SHORT_TO_CHAR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/short_to_float.h b/gr-blocks/include/gnuradio/blocks/short_to_float.h new file mode 100644 index 0000000000..7d5c2caac9 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/short_to_float.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_SHORT_TO_FLOAT_H +#define INCLUDED_BLOCKS_SHORT_TO_FLOAT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of shorts to a stream of floats + * \ingroup type_converters_blk + */ + class BLOCKS_API short_to_float : virtual public sync_block + { + public: + // gr::gnuradio/blocks::short_to_float_ff::sptr + typedef boost::shared_ptr<short_to_float> sptr; + + /*! + * Build a short to float block. + * + * \param vlen vector length of data streams. + * \param scale a scalar divider to change the output signal scale. + */ + static sptr make(size_t vlen=1, float scale=1.0); + + /*! + * Get the scalar divider value. + */ + virtual float scale() const = 0; + + /*! + * Set the scalar divider value. + */ + virtual void set_scale(float scale) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_SHORT_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/skiphead.h b/gr-blocks/include/gnuradio/blocks/skiphead.h new file mode 100644 index 0000000000..1d3a019d72 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/skiphead.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_SKIPHEAD_H +#define INCLUDED_GR_SKIPHEAD_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief skips the first N items, from then on copies items to the output + * \ingroup misc_blk + * + * \details + * Useful for building test cases and sources which have metadata + * or junk at the start + */ + class BLOCKS_API skiphead : virtual public block + { + public: + // gr::gnuradio/blocks::skiphead::sptr + typedef boost::shared_ptr<skiphead> sptr; + + static sptr make(size_t itemsize, + uint64_t nitems_to_skip); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gr-blocks/include/gnuradio/blocks/socket_pdu.h b/gr-blocks/include/gnuradio/blocks/socket_pdu.h new file mode 100644 index 0000000000..906d1aba0b --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/socket_pdu.h @@ -0,0 +1,55 @@ +/* -*- 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_SOCKET_PDU_H +#define INCLUDED_BLOCKS_SOCKET_PDU_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Creates socket interface and translates traffic to PDUs + * \ingroup networking_tools_blk + */ + class BLOCKS_API socket_pdu : virtual public block + { + public: + // gr::gnuradio/blocks::socket_pdu::sptr + typedef boost::shared_ptr<socket_pdu> sptr; + + /*! + * \brief Construct a SOCKET PDU interface + * \param type "TCP_SERVER", "TCP_CLIENT", "UDP_SERVER", or "UDP_CLIENT" + * \param addr network address to use + * \param port network port to use + * \param MTU maximum transmission unit + */ + static sptr make(std::string type, std::string addr, std::string port, int MTU=10000); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_SOCKET_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stream_mux.h b/gr-blocks/include/gnuradio/blocks/stream_mux.h new file mode 100644 index 0000000000..67f5874c3a --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/stream_mux.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_STREAM_MUX_H +#define INCLUDED_BLOCKS_STREAM_MUX_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> +#include <vector> + +namespace gr { + namespace blocks { + + /*! + * \brief Stream muxing block to multiplex many streams into + * one with a specified format. + * \ingroup stream_operators_blk + * + * \details + * Muxes N streams together producing an output stream that + * contains N0 items from the first stream, N1 items from the second, + * etc. and repeats: + * + * [N0, N1, N2, ..., Nm, N0, N1, ...] + */ + class BLOCKS_API stream_mux : virtual public block + { + public: + + // gr::gnuradio/blocks::stream_mux::sptr + typedef boost::shared_ptr<stream_mux> sptr; + + /*! + * \brief Creates a stream muxing block to multiplex many streams into + * one with a specified format. + * + * \param itemsize the item size of the stream + * \param lengths a vector (list/tuple) specifying the number of + * items from each stream the mux together. + * Warning: this requires that at least as many items + * per stream are available or the system will wait + * indefinitely for the items. + * + */ + static sptr make(size_t itemsize, const std::vector<int> &lengths); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_STREAM_MUX_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stream_to_streams.h b/gr-blocks/include/gnuradio/blocks/stream_to_streams.h new file mode 100644 index 0000000000..cef660c3ba --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/stream_to_streams.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_STREAM_TO_STREAMS_H +#define INCLUDED_BLOCKS_STREAM_TO_STREAMS_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief convert a stream of items into a N streams of items + * \ingroup stream_operators_blk + * + * \details + * Converts a stream of N items into N streams of 1 item. + * Repeat ad infinitum. + */ + class BLOCKS_API stream_to_streams : virtual public sync_decimator + { + public: + // gr::gnuradio/blocks::stream_to_streams::sptr + typedef boost::shared_ptr<stream_to_streams> sptr; + + /*! + * Make a stream-to-streams block. + * + * \param itemsize the item size of the stream + * \param nstreams number of streams to split input into + */ + static sptr make(size_t itemsize, size_t nstreams); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_STREAM_TO_STREAMS_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stream_to_vector.h b/gr-blocks/include/gnuradio/blocks/stream_to_vector.h new file mode 100644 index 0000000000..d059693945 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/stream_to_vector.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_STREAM_TO_VECTOR_H +#define INCLUDED_BLOCKS_STREAM_TO_VECTOR_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_decimator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief convert a stream of items into a stream of gnuradio/blocks containing nitems_per_block + * \ingroup stream_operators_blk + */ + class BLOCKS_API stream_to_vector : virtual public sync_decimator + { + public: + // gr::gnuradio/blocks::stream_to_vector::sptr + typedef boost::shared_ptr<stream_to_vector> sptr; + + /*! + * Make a stream-to-vector block. + * + * \param itemsize the item size of the stream + * \param nitems_per_block number of items to but into each vector (vector size) + */ + static sptr make(size_t itemsize, size_t nitems_per_block); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_STREAM_TO_VECTOR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/streams_to_stream.h b/gr-blocks/include/gnuradio/blocks/streams_to_stream.h new file mode 100644 index 0000000000..ba6d04a38e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/streams_to_stream.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_STREAMS_TO_STREAM_H +#define INCLUDED_BLOCKS_STREAMS_TO_STREAM_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert N streams of 1 item into a 1 stream of N items + * \ingroup stream_operators_blk + * + * \details + * Convert N streams of 1 item into 1 stream of N items. + * Repeat ad infinitum. + */ + class BLOCKS_API streams_to_stream : virtual public sync_interpolator + { + public: + // gr::gnuradio/blocks::streams_to_stream::sptr + typedef boost::shared_ptr<streams_to_stream> sptr; + + /*! + * Make a streams-to-stream block. + * + * \param itemsize the item size of the stream + * \param nstreams number of streams to combine + */ + static sptr make(size_t itemsize, size_t nstreams); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_STREAMS_TO_STREAM_H */ diff --git a/gr-blocks/include/gnuradio/blocks/streams_to_vector.h b/gr-blocks/include/gnuradio/blocks/streams_to_vector.h new file mode 100644 index 0000000000..5954bdf07f --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/streams_to_vector.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H +#define INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief convert N streams of items to 1 stream of vector length N + * \ingroup stream_operators_blk + */ + class BLOCKS_API streams_to_vector : virtual public sync_block + { + public: + // gr::gnuradio/blocks::streams_to_vector::sptr + typedef boost::shared_ptr<streams_to_vector> sptr; + + /*! + * Make a stream-to-vector block. + * + * \param itemsize the item size of the stream + * \param nstreams number of streams to combine into a vector (vector size) + */ + static sptr make(size_t itemsize, size_t nstreams); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H */ diff --git a/gr-blocks/include/gnuradio/blocks/stretch_ff.h b/gr-blocks/include/gnuradio/blocks/stretch_ff.h new file mode 100644 index 0000000000..86f366935e --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/stretch_ff.h @@ -0,0 +1,60 @@ +/* -*- 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 <gnuradio/blocks/api.h> +#include <gnuradio/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 stream_operators_blk + */ + class BLOCKS_API stretch_ff : virtual public sync_block + { + public: + // gr::gnuradio/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/gnuradio/blocks/sub_XX.h.t b/gr-blocks/include/gnuradio/blocks/sub_XX.h.t new file mode 100644 index 0000000000..ecc55fc865 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/sub_XX.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input_0 - input_1 - ...) + * \ingroup math_operators_blk + * + * \details + * Subtract across all input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/tag_debug.h b/gr-blocks/include/gnuradio/blocks/tag_debug.h new file mode 100644 index 0000000000..88dfb1b726 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/tag_debug.h @@ -0,0 +1,83 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_TAG_DEBUG_H +#define INCLUDED_GR_TAG_DEBUG_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Bit bucket that prints out any tag received. + * \ingroup measurement_tools_blk + * \ingroup stream_tag_tools_blk + * \ingroup debug_tools_blk + * + * \details + * This block collects all tags sent to it on all input ports and + * displays them to stdout in a formatted way. The \p name + * parameter is used to identify which debug sink generated the + * tag, so when connecting a block to this debug sink, an + * appropriate name is something that identifies the input block. + * + * This block otherwise acts as a NULL sink in that items from the + * input stream are ignored. It is designed to be able to attach + * to any block and watch all tags streaming out of that block for + * debugging purposes. + * + * The tags from the last call to this work function are stored + * and can be retrieved using the function 'current_tags'. + */ + class BLOCKS_API tag_debug : virtual public sync_block + { + public: + // gr::gnuradio/blocks::tag_debug::sptr + typedef boost::shared_ptr<tag_debug> sptr; + + /*! + * Build a tag debug block + * + * \param sizeof_stream_item size of the items in the incoming stream. + * \param name name to identify which debug sink generated the info. + */ + static sptr make(size_t sizeof_stream_item, + const std::string &name); + + /*! + * \brief Returns a vector of tag_t items as of the last call to + * work. + */ + virtual std::vector<tag_t> current_tags() = 0; + + /*! + * \brief Set the display of tags to stdout on/off. + */ + virtual void set_display(bool d) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_TAG_DEBUG_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tag_gate.h b/gr-blocks/include/gnuradio/blocks/tag_gate.h new file mode 100644 index 0000000000..5363301192 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/tag_gate.h @@ -0,0 +1,56 @@ +/* -*- 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_TAG_GATE_H +#define INCLUDED_BLOCKS_TAG_GATE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Control tag propagation. + * \ingroup blocks + * + * Use this block to stop tags from propagating. + */ + class BLOCKS_API tag_gate : virtual public gr::sync_block + { + public: + typedef boost::shared_ptr<tag_gate> sptr; + + virtual void set_propagation(bool propagate_tags) = 0; + + /*! + * \param item_size Item size + * \param propagate_tags Set this to true to allow tags to pass through this block. + */ + static sptr make(size_t item_size, bool propagate_tags=false); + }; + + } // namespace blocks +} // namespace gr + +#endif /* INCLUDED_BLOCKS_TAG_GATE_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h b/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h new file mode 100644 index 0000000000..287ecb8246 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/tagged_file_sink.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_TAGGED_FILE_SINK_H +#define INCLUDED_GR_TAGGED_FILE_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief A file sink that uses tags to save files. + * \ingroup file_operators_blk + * \ingroup stream_tag_tools_blk + * + * \details + * The sink uses a tag with the key 'burst' to trigger the saving + * of the burst data to a new file. If the value of this tag is + * True, it will open a new file and start writing all incoming + * data to it. If the tag is False, it will close the file (if + * already opened). The file names are based on the time when the + * burst tag was seen. If there is an 'rx_time' tag (standard with + * UHD sources), that is used as the time. If no 'rx_time' tag is + * found, the new time is calculated based off the sample rate of + * the block. + */ + class BLOCKS_API tagged_file_sink : virtual public sync_block + { + public: + // gr::gnuradio/blocks::tagged_file_sink::sptr + typedef boost::shared_ptr<tagged_file_sink> sptr; + + /*! + * \brief Build a tagged_file_sink block. + * + * \param itemsize The item size of the input data stream. + * \param samp_rate The sample rate used to determine the time + * difference between bursts + */ + static sptr make(size_t itemsize, double samp_rate); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h new file mode 100644 index 0000000000..73a02f9e1d --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_mux.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_TAGGED_STREAM_MUX_H +#define INCLUDED_TAGGED_STREAM_MUX_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/tagged_stream_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Combines tagged streams. + * \ingroup stream_operators_blk + * + * \details + * Takes N streams as input. Each stream is tagged with packet lengths. + * Packets are output sequentially from each input stream. + * + * The output signal has a new length tag, which is the sum of all + * individual length tags. The old length tags are discarded. + * + * All other tags are propagated as expected, i.e. they stay associated + * with the same input item. + */ + class BLOCKS_API tagged_stream_mux : virtual public tagged_stream_block + { + public: + typedef boost::shared_ptr<tagged_stream_mux> sptr; + + /*! + * Make a tagged stream mux block. + * + * \param itemsize Items size (number of bytes per item) + * \param lengthtagname Length tag key + */ + static sptr make(size_t itemsize, const std::string &lengthtagname); + }; + + } // namespace blocks +} // namespace gr + +#endif /* INCLUDED_TAGGED_STREAM_MUX_H */ + diff --git a/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h b/gr-blocks/include/gnuradio/blocks/tagged_stream_to_pdu.h new file mode 100644 index 0000000000..9b0f24a535 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/tagged_stream_to_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_TAGGED_STREAM_TO_PDU_H +#define INCLUDED_BLOCKS_TAGGED_STREAM_TO_PDU_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/blocks/pdu.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Turns received stream data and tags into PDUs + * \ingroup message_tools_blk + */ + class BLOCKS_API tagged_stream_to_pdu : virtual public sync_block + { + public: + // gr::gnuradio/blocks::tagged_stream_to_pdu::sptr + typedef boost::shared_ptr<tagged_stream_to_pdu> sptr; + + /*! + * \brief Construct a tagged_stream_to_pdu block + * \param type PDU type of pdu::vector_type + */ + static sptr make(pdu::vector_type type); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_TAGGED_STREAM_TO_PDU_H */ diff --git a/gr-blocks/include/gnuradio/blocks/threshold_ff.h b/gr-blocks/include/gnuradio/blocks/threshold_ff.h new file mode 100644 index 0000000000..253041b83a --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/threshold_ff.h @@ -0,0 +1,67 @@ +/* -*- 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 <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Output a 1 or zero based on a threshold value. + * \ingroup level_controllers_blk + * + * \details + * 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 sync_block + { + public: + // gr::gnuradio/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/gnuradio/blocks/throttle.h b/gr-blocks/include/gnuradio/blocks/throttle.h new file mode 100644 index 0000000000..662582e0ba --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/throttle.h @@ -0,0 +1,63 @@ +/* -*- 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 <gnuradio/blocks/api.h> +#include <gnuradio/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 + * + * \details + * 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 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/gnuradio/blocks/transcendental.h b/gr-blocks/include/gnuradio/blocks/transcendental.h new file mode 100644 index 0000000000..9d7a1e70e2 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/transcendental.h @@ -0,0 +1,58 @@ +/* -*- 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 <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> +#include <string> + +namespace gr { + namespace blocks { + + /*! + * \brief A block that performs various transcendental math operations. + * \ingroup math_operators_blk + * + * \details + * 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 sync_block + { + public: + // gr::gnuradio/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/gnuradio/blocks/tuntap_pdu.h b/gr-blocks/include/gnuradio/blocks/tuntap_pdu.h new file mode 100644 index 0000000000..53d9371bc4 --- /dev/null +++ b/gr-blocks/include/gnuradio/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 <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Creates TUNTAP interface and translates traffic to PDUs + * \ingroup networking_tools_blk + */ + class BLOCKS_API tuntap_pdu : virtual public block + { + public: + // gr::gnuradio/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/gnuradio/blocks/uchar_to_float.h b/gr-blocks/include/gnuradio/blocks/uchar_to_float.h new file mode 100644 index 0000000000..a978a76958 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/uchar_to_float.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H +#define INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of unsigned chars to a stream of floats + * \ingroup type_converters_blk + */ + class BLOCKS_API uchar_to_float : virtual public sync_block + { + public: + // gr::gnuradio/blocks::uchar_to_float_ff::sptr + typedef boost::shared_ptr<uchar_to_float> sptr; + + /*! + * Build a uchar to float block. + */ + static sptr make(); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H */ diff --git a/gr-blocks/include/gnuradio/blocks/udp_sink.h b/gr-blocks/include/gnuradio/blocks/udp_sink.h new file mode 100644 index 0000000000..d9360938e2 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/udp_sink.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007-2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_UDP_SINK_H +#define INCLUDED_GR_UDP_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Write stream to an UDP socket. + * \ingroup networking_tools_blk + */ + class BLOCKS_API udp_sink : virtual public sync_block + { + public: + // gr::gnuradio/blocks::udp_sink::sptr + typedef boost::shared_ptr<udp_sink> sptr; + + /*! + * \brief UDP Sink Constructor + * + * \param itemsize The size (in bytes) of the item datatype + * \param host The name or IP address of the receiving host; use + * NULL or None for no connection + * \param port Destination port to connect to on receiving host + * \param payload_size UDP payload size by default set to + * 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header)) + * \param eof Send zero-length packet on disconnect + */ + static sptr make(size_t itemsize, + const std::string &host, int port, + int payload_size=1472, bool eof=true); + + /*! \brief return the PAYLOAD_SIZE of the socket */ + virtual int payload_size() = 0; + + /*! \brief Change the connection to a new destination + * + * \param host The name or IP address of the receiving host; use + * NULL or None to break the connection without closing + * \param port Destination port to connect to on receiving host + * + * Calls disconnect() to terminate any current connection first. + */ + virtual void connect(const std::string &host, int port) = 0; + + /*! \brief Send zero-length packet (if eof is requested) then stop sending + * + * Zero-byte packets can be interpreted as EOF by gr_udp_source. + * Note that disconnect occurs automatically when the sink is + * destroyed, but not when its top_block stops.*/ + virtual void disconnect() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_UDP_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/udp_source.h b/gr-blocks/include/gnuradio/blocks/udp_source.h new file mode 100644 index 0000000000..e5534bc328 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/udp_source.h @@ -0,0 +1,84 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007-2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_UDP_SOURCE_H +#define INCLUDED_GR_UDP_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Read stream from an UDP socket. + * \ingroup networking_tools_blk + */ + class BLOCKS_API udp_source : virtual public sync_block + { + public: + // gr::gnuradio/blocks::udp_source::sptr + typedef boost::shared_ptr<udp_source> sptr; + + /*! + * \brief UDP Source Constructor + * + * \param itemsize The size (in bytes) of the item datatype + * \param host The name or IP address of the receiving host; can be + * NULL, None, or "0.0.0.0" to allow reading from any + * interface on the host + * \param port The port number on which to receive data; use 0 to + * have the system assign an unused port number + * \param payload_size UDP payload size by default set to 1472 = + * (1500 MTU - (8 byte UDP header) - (20 byte IP header)) + * \param eof Interpret zero-length packet as EOF (default: true) + */ + static sptr make(size_t itemsize, + const std::string &host, int port, + int payload_size=1472, + bool eof=true); + + /*! \brief Change the connection to a new destination + * + * \param host The name or IP address of the receiving host; use + * NULL or None to break the connection without closing + * \param port Destination port to connect to on receiving host + * + * Calls disconnect() to terminate any current connection first. + */ + virtual void connect(const std::string &host, int port) = 0; + + /*! \brief Cut the connection if we have one set up. + */ + virtual void disconnect() = 0; + + /*! \brief return the PAYLOAD_SIZE of the socket */ + virtual int payload_size() = 0; + + /*! \brief return the port number of the socket */ + virtual int get_port() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_UDP_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h b/gr-blocks/include/gnuradio/blocks/unpack_k_bits_bb.h new file mode 100644 index 0000000000..942973f60d --- /dev/null +++ b/gr-blocks/include/gnuradio/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 <gnuradio/blocks/api.h> +#include <gnuradio/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 byte_operators_blk + */ + class BLOCKS_API unpack_k_bits_bb : virtual public sync_interpolator + { + public: + // gr::gnuradio/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/include/gnuradio/blocks/unpacked_to_packed_XX.h.t b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed_XX.h.t new file mode 100644 index 0000000000..194d79e0d2 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/unpacked_to_packed_XX.h.t @@ -0,0 +1,73 @@ +/* -*- 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> +#include <gnuradio/endianness.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert a stream of unpacked bytes or shorts into a stream of packed bytes or shorts. + * \ingroup byte_operators_blk + * + * \details + * input: stream of @I_TYPE@; output: stream of @O_TYPE@ + * + * This is the inverse of gr::blocks::packed_to_unpacked_XX. + * + * The low \p bits_per_chunk bits are extracted from each input + * byte or short. These bits are then packed densely into the + * output bytes or shorts, such that all 8 or 16 bits of the + * output bytes or shorts are filled with valid input bits. The + * right thing is done if bits_per_chunk is not a power of two. + * + * The combination of gr::blocks::packed_to_unpacked_XX followed by + * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the + * general case of mapping from a stream of bytes or shorts into + * arbitrary float or complex symbols. + * + * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, + * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, + * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. + * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. + */ + class BLOCKS_API @NAME@ : virtual public block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(unsigned int bits_per_chunk, + endianness_t endianness); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/vco_f.h b/gr-blocks/include/gnuradio/blocks/vco_f.h new file mode 100644 index 0000000000..c0fe5cd51c --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/vco_f.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_VCO_F_H +#define INCLUDED_GR_VCO_F_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief VCO - Voltage controlled oscillator + * \ingroup modulators_blk + * \ingroup waveform_generators_blk + * + * \details + * input: float stream of control voltages; output: float oscillator output + */ + class BLOCKS_API vco_f : virtual public sync_block + { + public: + // gr::gnuradio/blocks::vco_f::sptr + typedef boost::shared_ptr<vco_f> sptr; + + /*! + * \brief VCO - Voltage controlled oscillator + * + * \param sampling_rate sampling rate (Hz) + * \param sensitivity units are radians/sec/volt + * \param amplitude output amplitude + */ + static sptr make(double sampling_rate, double sensitivity, double amplitude); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_VCO_F_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t new file mode 100644 index 0000000000..8b26b0b9b0 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/vector_insert_X.h.t @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief source of @TYPE@'s that gets its data from a vector + * \ingroup stream_operators_blk + */ + class BLOCKS_API @NAME@ : virtual public block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + /*! + * Make vector insert block. + * + * \param data vector of data to insert + * \param periodicity number of samples between when to send \p data + * \param offset initial item offset of first insert + */ + static sptr make(const std::vector<@TYPE@> &data, + int periodicity, int offset=0); + + virtual void rewind() = 0; + virtual void set_data(const std::vector<@TYPE@> &data) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_map.h b/gr-blocks/include/gnuradio/blocks/vector_map.h new file mode 100644 index 0000000000..d26b0c56f9 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/vector_map.h @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_VECTOR_MAP_H +#define INCLUDED_GR_VECTOR_MAP_H + +#include <gnuradio/blocks/api.h> +#include <vector> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Maps elements from a set of input vectors to a set of output vectors. + * \ingroup stream_operators_blk + * + * \details + * If in[i] is the input vector in the i'th stream then the output + * vector in the j'th stream is: + * + * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]] + * + * That is mapping is of the form (out_stream1_mapping, + * out_stream2_mapping, ...) and out_stream1_mapping is of the + * form (element1_mapping, element2_mapping, ...) and + * element1_mapping is of the form (in_stream, in_element). + */ + class BLOCKS_API vector_map : virtual public sync_block + { + public: + // gr::gnuradio/blocks::vector_map::sptr + typedef boost::shared_ptr<vector_map> sptr; + + /*! + * Build a vector map block. + * + * \param item_size (integer) size of vector elements + * \param in_vlens (vector of integers) number of elements in each + * input vector + * \param mapping (vector of vectors of vectors of integers) how to + * map elements from input to output vectors + */ + static sptr make(size_t item_size, std::vector<size_t> in_vlens, + std::vector< std::vector< std::vector<size_t> > > mapping); + + virtual void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_VECTOR_MAP_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t new file mode 100644 index 0000000000..527ebf7dff --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/vector_sink_X.h.t @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief @TYPE@ sink that writes to a vector + * \ingroup debug_tools_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(int vlen = 1); + + virtual void reset() = 0; + virtual std::vector<@TYPE@> data() const = 0; + virtual std::vector<tag_t> tags() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_source_X.h.t b/gr-blocks/include/gnuradio/blocks/vector_source_X.h.t new file mode 100644 index 0000000000..7ff18ad083 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/vector_source_X.h.t @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief source of @TYPE@'s that gets its data from a vector + * \ingroup misc_blk + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(const std::vector<@TYPE@> &data, + bool repeat=false, int vlen=1, + const std::vector<tag_t> &tags=std::vector<tag_t>()); + + virtual void rewind() = 0; + virtual void set_data(const std::vector<@TYPE@> &data, + const std::vector<tag_t> &tags=std::vector<tag_t>()) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_to_stream.h b/gr-blocks/include/gnuradio/blocks/vector_to_stream.h new file mode 100644 index 0000000000..3b08bd08b5 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/vector_to_stream.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_VECTOR_TO_STREAM_H +#define INCLUDED_BLOCKS_VECTOR_TO_STREAM_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_interpolator.h> + +namespace gr { + namespace blocks { + + /*! + * \brief convert a stream of gnuradio/blocks of nitems_per_block items into a stream of items + * \ingroup stream_operators_blk + */ + class BLOCKS_API vector_to_stream : virtual public sync_interpolator + { + public: + // gr::gnuradio/blocks::vector_to_stream::sptr + typedef boost::shared_ptr<vector_to_stream> sptr; + + /*! + * Make vector-to-stream block + * + * \param itemsize the item size of the stream + * \param nitems_per_block number of items per vector (vector size) + */ + static sptr make(size_t itemsize, size_t nitems_per_block); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_VECTOR_TO_STREAM_H */ diff --git a/gr-blocks/include/gnuradio/blocks/vector_to_streams.h b/gr-blocks/include/gnuradio/blocks/vector_to_streams.h new file mode 100644 index 0000000000..ce10ed3155 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/vector_to_streams.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H +#define INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert 1 stream of vectors of length N to N streams of items + * \ingroup stream_operators_blk + */ + class BLOCKS_API vector_to_streams : virtual public sync_block + { + public: + // gr::gnuradio/blocks::vector_to_streams::sptr + typedef boost::shared_ptr<vector_to_streams> sptr; + + /*! + * Make vector-to-streams block + * + * \param itemsize the item size of the stream + * \param nstreams number of items per vector (vector size and + * number of streams produced) + */ + static sptr make(size_t itemsize, size_t nstreams); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H */ diff --git a/gr-blocks/include/gnuradio/blocks/wavfile.h b/gr-blocks/include/gnuradio/blocks/wavfile.h new file mode 100644 index 0000000000..f0c8a4c1e7 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/wavfile.h @@ -0,0 +1,104 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// This file stores all the RIFF file type knowledge for the wavfile_* +// gnuradio/blocks. + +#include <gnuradio/blocks/api.h> +#include <cstdio> + +namespace gr { + namespace blocks { + + /*! + * \brief Read signal information from a given WAV file. + * + * \param[in] fp File pointer to an opened, empty file. + * \param[out] sample_rate Stores the sample rate [S/s] + * \param[out] nchans Number of channels + * \param[out] bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding o + * 8 or 16 bit samples, respectively) + * \param[out] first_sample_pos Number of the first byte containing a sample. Use this + * with fseek() to jump from the end of the file to the + * first sample when in repeat mode. + * \param[out] samples_per_chan Number of samples per channel + * \return True on a successful read, false if the file could not be read or is + * not a valid WAV file. + */ + bool + wavheader_parse(FILE *fp, + unsigned int &sample_rate, + int &nchans, + int &bytes_per_sample, + int &first_sample_pos, + unsigned int &samples_per_chan); + + /*! + * \brief Read one sample from an open WAV file at the current position. + * + * \details + * Takes care of endianness. + */ + short int + wav_read_sample(FILE *fp, int bytes_per_sample); + + + /*! + * \brief Write a valid RIFF file header + * + * Note: Some header values are kept blank because they're usually + * not known a-priori (file and chunk lengths). Use + * gri_wavheader_complete() to fill these in. + */ + bool + wavheader_write(FILE *fp, + unsigned int sample_rate, + int nchans, + int bytes_per_sample); + + /*! + * \brief Write one sample to an open WAV file at the current position. + * + * \details + * Takes care of endianness. + */ + void + wav_write_sample(FILE *fp, short int sample, int bytes_per_sample); + + + /*! + * \brief Complete a WAV header + * + * \details + * Note: The stream position is changed during this function. If + * anything needs to be written to the WAV file after calling this + * function (which shouldn't happen), you need to fseek() to the + * end of the file (or whereever). + * + * \param[in] fp File pointer to an open WAV file with a blank header + * \param[in] byte_count Length of all samples written to the file in bytes. + */ + bool + wavheader_complete(FILE *fp, unsigned int byte_count); + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/include/gnuradio/blocks/wavfile_sink.h b/gr-blocks/include/gnuradio/blocks/wavfile_sink.h new file mode 100644 index 0000000000..97550bfa98 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/wavfile_sink.h @@ -0,0 +1,87 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_WAVFILE_SINK_H +#define INCLUDED_GR_WAVFILE_SINK_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Write stream to a Microsoft PCM (.wav) file. + * \ingroup audio_blk + * + * \details + * Values must be floats within [-1;1]. + * Check gr_make_wavfile_sink() for extra info. + */ + class BLOCKS_API wavfile_sink : virtual public sync_block + { + public: + // gr::gnuradio/blocks::wavfile_sink::sptr + typedef boost::shared_ptr<wavfile_sink> sptr; + + /* + * \param filename The .wav file to be opened + * \param n_channels Number of channels (2 = stereo or I/Q output) + * \param sample_rate Sample rate [S/s] + * \param bits_per_sample 16 or 8 bit, default is 16 + */ + static sptr make(const char *filename, + int n_channels, + unsigned int sample_rate, + int bits_per_sample = 16); + + /*! + * \brief Opens a new file and writes a WAV header. Thread-safe. + */ + virtual bool open(const char* filename) = 0; + + /*! + * \brief Closes the currently active file and completes the WAV + * header. Thread-safe. + */ + virtual void close() = 0; + + /*! + * \brief Set the sample rate. This will not affect the WAV file + * currently opened. Any following open() calls will use this new + * sample rate. + */ + virtual void set_sample_rate(unsigned int sample_rate) = 0; + + /*! + * \brief Set bits per sample. This will not affect the WAV file + * currently opened (see set_sample_rate()). If the value is + * neither 8 nor 16, the call is ignored and the current value + * is kept. + */ + virtual void set_bits_per_sample(int bits_per_sample) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_WAVFILE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/wavfile_source.h b/gr-blocks/include/gnuradio/blocks/wavfile_source.h new file mode 100644 index 0000000000..b8fe4988f1 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/wavfile_source.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_WAVFILE_SOURCE_H +#define INCLUDED_GR_WAVFILE_SOURCE_H + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Read stream from a Microsoft PCM (.wav) file, output floats + * \ingroup audio_blk + * + * \details + * Unless otherwise called, values are within [-1;1]. + * Check gr_make_wavfile_source() for extra info. + */ + class BLOCKS_API wavfile_source : virtual public sync_block + { + public: + // gr::gnuradio/blocks::wavfile_source::sptr + typedef boost::shared_ptr<wavfile_source> sptr; + + static sptr make(const char *filename, bool repeat = false); + + /*! + * \brief Read the sample rate as specified in the wav file header + */ + virtual unsigned int sample_rate() const = 0; + + /*! + * \brief Return the number of bits per sample as specified in + * the wav file header. Only 8 or 16 bit are supported here. + */ + virtual int bits_per_sample() const = 0; + + /*! + * \brief Return the number of channels in the wav file as + * specified in the wav file header. This is also the max number + * of outputs you can have. + */ + virtual int channels() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_WAVFILE_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/xor_XX.h.t b/gr-blocks/include/gnuradio/blocks/xor_XX.h.t new file mode 100644 index 0000000000..fa32192e76 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/xor_XX.h.t @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input_0 ^ input_1 ^ , ... ^ input_N) + * \ingroup boolean_operators_blk + * + * Bitwise boolean xor across all input streams. + */ + class BLOCKS_API @NAME@ : virtual public sync_block + { + public: + + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(size_t vlen=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ |