summaryrefslogtreecommitdiff
path: root/gr-digital/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/lib')
-rw-r--r--gr-digital/lib/CMakeLists.txt4
-rw-r--r--gr-digital/lib/scale_tags_impl.cc84
-rw-r--r--gr-digital/lib/scale_tags_impl.h51
-rw-r--r--gr-digital/lib/tagged_stream_check_impl.cc112
-rw-r--r--gr-digital/lib/tagged_stream_check_impl.h53
-rw-r--r--gr-digital/lib/ts_insert_zeros_cc_impl.cc130
-rw-r--r--gr-digital/lib/ts_insert_zeros_cc_impl.h54
7 files changed, 1 insertions, 487 deletions
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index 7e83b86021..d0a9132250 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -167,12 +167,10 @@ list(APPEND digital_sources
pn_correlator_cc_impl.cc
probe_density_b_impl.cc
probe_mpsk_snr_est_c_impl.cc
- scale_tags_impl.cc
scrambler_bb_impl.cc
simple_correlator_impl.cc
simple_framer_impl.cc
- tagged_stream_check_impl.cc
- ts_insert_zeros_cc_impl.cc
+ header_payload_demux_impl.cc
)
#Add Windows DLL resource file if using MSVC
diff --git a/gr-digital/lib/scale_tags_impl.cc b/gr-digital/lib/scale_tags_impl.cc
deleted file mode 100644
index 33d1002381..0000000000
--- a/gr-digital/lib/scale_tags_impl.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- c++ -*- */
-/* Copyright 2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include "scale_tags_impl.h"
-
-namespace gr {
- namespace digital {
-
- scale_tags::sptr
- scale_tags::make(size_t itemsize, const std::string& tagname, float scale_factor)
- {
- return gnuradio::get_initial_sptr (new scale_tags_impl(itemsize, tagname, scale_factor));
- }
-
- /*
- * The private constructor
- */
- scale_tags_impl::scale_tags_impl(size_t itemsize, const std::string& tagname, float scale_factor)
- : gr_sync_block("scale_tags",
- gr_make_io_signature(1, 1, itemsize),
- gr_make_io_signature(1, 1, itemsize)),
- d_itemsize(itemsize),
- d_tagname(tagname),
- d_scale_factor(scale_factor)
- {
- set_tag_propagation_policy(TPP_DONT);
- }
-
- /*
- * Our virtual destructor.
- */
- scale_tags_impl::~scale_tags_impl()
- {
- }
-
- int
- scale_tags_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const char *in = (const char *) input_items[0];
- char *out = (char *) output_items[0];
- std::vector<gr_tag_t> tags;
- this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+noutput_items);
- //const size_t ninput_items = noutput_items; //assumption for sync block, this can change
- for (unsigned int j = 0; j < tags.size(); j++) {
- long value = pmt::to_long(tags[j].value);
- if (pmt::symbol_to_string(tags[j].key) == d_tagname) {
- value = long(value*d_scale_factor);
- }
- this->add_item_tag(0, tags[j].offset, tags[j].key, pmt::from_long(value));
- }
- memcpy((void *) out, (const void *) in, noutput_items*d_itemsize);
-
- // Tell runtime system how many output items we produced.
- return noutput_items;
- }
-
- } /* namespace digital */
-} /* namespace gr */
-
diff --git a/gr-digital/lib/scale_tags_impl.h b/gr-digital/lib/scale_tags_impl.h
deleted file mode 100644
index 667cda36eb..0000000000
--- a/gr-digital/lib/scale_tags_impl.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/* Copyright 2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_SCALE_TAGS_IMPL_H
-#define INCLUDED_DIGITAL_SCALE_TAGS_IMPL_H
-
-#include <digital/scale_tags.h>
-
-namespace gr {
- namespace digital {
-
- class scale_tags_impl : public scale_tags
- {
- private:
- size_t d_itemsize;
- std::string d_tagname;
- float d_scale_factor;
-
- public:
- scale_tags_impl(size_t itemsize, const std::string&, float scale_factor);
- ~scale_tags_impl();
-
- // Where all the action really happens
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } // namespace digital
-} // namespace gr
-
-#endif /* INCLUDED_DIGITAL_SCALE_TAGS_IMPL_H */
-
diff --git a/gr-digital/lib/tagged_stream_check_impl.cc b/gr-digital/lib/tagged_stream_check_impl.cc
deleted file mode 100644
index 625645804f..0000000000
--- a/gr-digital/lib/tagged_stream_check_impl.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 <+YOU OR YOUR COMPANY+>.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include "tagged_stream_check_impl.h"
-#include <iostream>
-#include <vector>
-#include <algorithm>
-#include <string>
-#include <sstream>
-
-namespace gr {
- namespace digital {
-
- bool sort_tag_by_offset(gr_tag_t const & L, gr_tag_t const & R) {
- return L.offset < R.offset;
- }
-
- tagged_stream_check::sptr
- tagged_stream_check::make(size_t itemsize, const std::string &lengthtagname)
- {
- return gnuradio::get_initial_sptr (new tagged_stream_check_impl(itemsize, lengthtagname));
- }
-
- /*
- * The private constructor
- */
- tagged_stream_check_impl::tagged_stream_check_impl(size_t itemsize, const std::string &lengthtagname)
- : gr_sync_block("tagged_stream_check",
- gr_make_io_signature(1, 1, itemsize),
- gr_make_io_signature(1, 1, itemsize)),
- d_lengthtagname(lengthtagname), d_itemsize(itemsize)
- {
- d_expected_offset = 0;
- d_last_offset = 0;
- }
-
- /*
- * Our virtual destructor.
- */
- tagged_stream_check_impl::~tagged_stream_check_impl()
- {
- }
-
- int
- tagged_stream_check_impl::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- char *out = (char *) output_items[0];
- const char *in = (const char*) input_items[0];
- // Find all the length tags
- std::vector<gr_tag_t> tags;
- std::vector<gr_tag_t> lengthtags;
- this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+noutput_items);
- for (unsigned int j = 0; j < tags.size(); j++) {
- if (pmt::symbol_to_string(tags[j].key) == d_lengthtagname) {
- lengthtags.push_back(tags[j]);
- }
- }
- // If there are no lengthtags then check that we weren't expecting one.
- if (lengthtags.size() == 0) {
- if (d_expected_offset < nitems_read(0)+noutput_items) {
- std::ostringstream ss;
- ss << "ERROR: "<<this->unique_id()<<" Expected a lengthtag at offset="<<d_expected_offset<<" but didn't find it";
- std::cout << ss.str() << std::endl;
- }
- }
- // Sort them and make sure the lengthtags are in the proper places.
- sort(lengthtags.begin(), lengthtags.end(), sort_tag_by_offset);
- for (unsigned int j = 0; j < lengthtags.size(); j++) {
- if (lengthtags[j].offset != d_expected_offset) {
- std::cout << "****************************" << std::endl;
- std::cout << "ERROR: "<<this->unique_id()<<" offset: " << lengthtags[j].offset << " The last tag had a length of " << d_expected_offset - d_last_offset << " but we got a length of " << lengthtags[j].offset - d_last_offset << std::endl;
- }
- long packet_length = pmt::to_long(lengthtags[j].value);
- std::cout << "INFO: "<<this->unique_id()<<" offset: " << lengthtags[j].offset << std::endl;
- d_expected_offset = lengthtags[j].offset + packet_length;
- d_last_offset = lengthtags[j].offset;
- }
- memcpy((void *) out, (const void *) in, noutput_items*d_itemsize);
- std::ostringstream ss;
- ss << "checker: Produced data from " << nitems_read(0) << " to " << nitems_read(0) + noutput_items;
- std::cout << ss.str() << std::endl;
- return noutput_items;
- }
-
-
- } /* namespace digital */
-} /* namespace gr */
-
diff --git a/gr-digital/lib/tagged_stream_check_impl.h b/gr-digital/lib/tagged_stream_check_impl.h
deleted file mode 100644
index 0b0dfe5b1a..0000000000
--- a/gr-digital/lib/tagged_stream_check_impl.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 <+YOU OR YOUR COMPANY+>.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_TAGGED_STREAM_CHECK_IMPL_H
-#define INCLUDED_DIGITAL_TAGGED_STREAM_CHECK_IMPL_H
-
-#include <digital/tagged_stream_check.h>
-#include <vector>
-
-namespace gr {
- namespace digital {
-
- class tagged_stream_check_impl : public tagged_stream_check
- {
- private:
- const std::string d_lengthtagname;
- size_t d_itemsize;
- uint64_t d_expected_offset;
- uint64_t d_last_offset;
-
- public:
- tagged_stream_check_impl(size_t itemsize, const std::string &lengthtagname);
- ~tagged_stream_check_impl();
-
- // Where all the action really happens
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- };
-
- } // namespace digital
-} // namespace gr
-
-#endif
-
diff --git a/gr-digital/lib/ts_insert_zeros_cc_impl.cc b/gr-digital/lib/ts_insert_zeros_cc_impl.cc
deleted file mode 100644
index 1a78851c18..0000000000
--- a/gr-digital/lib/ts_insert_zeros_cc_impl.cc
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 <+YOU OR YOUR COMPANY+>.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include "ts_insert_zeros_cc_impl.h"
-#include <iostream>
-#include <vector>
-#include <algorithm>
-#include <string>
-#include <sstream>
-
-namespace gr {
- namespace digital {
-
- ts_insert_zeros_cc::sptr
- ts_insert_zeros_cc::make(const std::string &lengthtagname)
- {
- return gnuradio::get_initial_sptr (new ts_insert_zeros_cc_impl(lengthtagname));
- }
-
- /*
- * The private constructor
- */
- ts_insert_zeros_cc_impl::ts_insert_zeros_cc_impl(const std::string &lengthtagname)
- : gr_block("ts_insert_zeros_cc",
- gr_make_io_signature(1, 1, sizeof(gr_complex)),
- gr_make_io_signature(1, 1, sizeof(gr_complex))),
- d_lengthtagname(lengthtagname)
- {
- }
-
- /*
- * Our virtual destructor.
- */
- ts_insert_zeros_cc_impl::~ts_insert_zeros_cc_impl()
- {
- }
-
- void
- ts_insert_zeros_cc_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
- {
- ninput_items_required[0] = 0;
- }
-
- int
- ts_insert_zeros_cc_impl::general_work (
- int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items
- )
- {
- gr_complex *out = (gr_complex *) output_items[0];
- const gr_complex*in = (const gr_complex*) input_items[0];
-
- if (ninput_items[0]) {
- // Check if we have an entire packet.
- long packet_length = 0;
- std::vector<gr_tag_t> tags;
- // Get any tags associated with the first item on the input.
- this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+1);
- for (unsigned int j = 0; j < tags.size(); j++) {
- if (pmt::symbol_to_string(tags[j].key) == d_lengthtagname) {
- packet_length = pmt::to_long(tags[j].value);
- }
- }
- if (!packet_length) {
- throw std::runtime_error("no tag");
- }
- if (ninput_items[0] < packet_length ) {
- // We don't have enough input to produce a packet.
- // Produces zeros instead.
- } else {
- // We have enough input.
- if (noutput_items < packet_length) {
- // But we don't have enough output space.
- // We don't want to produce zeros, so return.
- set_output_multiple(packet_length);
- return 0;
- } else {
- // And we have enough output space.
- // Produce the packet.
- std::vector<gr_tag_t> tags;
- this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+packet_length);
- for (unsigned int j = 0; j < tags.size(); j++) {
- const uint64_t offset = tags[j].offset - nitems_read(0) + nitems_written(0);
- this->add_item_tag(0, offset, tags[j].key, tags[j].value);
- }
- if (noutput_items < packet_length) {
- throw std::runtime_error("Not enough room in the output buffer.");
- }
- memcpy(out, in, packet_length*sizeof(gr_complex));
- consume(0, packet_length);
- return packet_length;
- }
- }
- }
- // We're just producing zeros.
- // Either we have no input data, or not an entire packet yet.
- for (int i=0; i<noutput_items; i++) {
- out[i] = 0;
- }
- return noutput_items;
- }
-
-
- } /* namespace digital */
-} /* namespace gr */
-
diff --git a/gr-digital/lib/ts_insert_zeros_cc_impl.h b/gr-digital/lib/ts_insert_zeros_cc_impl.h
deleted file mode 100644
index 4bdfbfe9fd..0000000000
--- a/gr-digital/lib/ts_insert_zeros_cc_impl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 <+YOU OR YOUR COMPANY+>.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_TS_INSERT_ZEROS_CC_IMPL_H
-#define INCLUDED_DIGITAL_TS_INSERT_ZEROS_CC_IMPL_H
-
-#include <digital/ts_insert_zeros_cc.h>
-#include <vector>
-
-namespace gr {
- namespace digital {
-
- class ts_insert_zeros_cc_impl : public ts_insert_zeros_cc
- {
- private:
- const std::string d_lengthtagname;
-
- public:
- ts_insert_zeros_cc_impl(const std::string &lengthtagname);
- ~ts_insert_zeros_cc_impl();
-
- void forecast(int noutput_items, gr_vector_int &ninput_items_required);
-
- // Where all the action really happens
- int general_work(
- int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items
- );
- };
-
- } // namespace digital
-} // namespace gr
-
-#endif
-