summaryrefslogtreecommitdiff
path: root/gr-digital
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-08-14 22:28:47 -0400
committerTom Rondeau <trondeau@vt.edu>2012-08-17 21:17:34 -0400
commit76a6f912706313fdc256b09aa17eeaf275e1fbc4 (patch)
treecb9712b03fc576126dca834b4aaa1e5e53538d5a /gr-digital
parentc537cf7d85f59db21c98ac859bc08fbe55031314 (diff)
swig: adds a macro to allow us to specify different factory functions besides 'make' for a block.
digital: converted cpmmod to new style. gmskmod inherits directly from cpmmod with just preset args. Defining another factory function, make_gmks_bc, here to make this all handled internally.
Diffstat (limited to 'gr-digital')
-rw-r--r--gr-digital/include/digital/CMakeLists.txt3
-rw-r--r--gr-digital/include/digital/cpmmod_bc.h118
-rw-r--r--gr-digital/include/digital_cpmmod_bc.h97
-rw-r--r--gr-digital/include/digital_gmskmod_bc.h64
-rw-r--r--gr-digital/lib/CMakeLists.txt3
-rw-r--r--gr-digital/lib/cpmmod_bc_impl.cc125
-rw-r--r--gr-digital/lib/cpmmod_bc_impl.h69
-rw-r--r--gr-digital/lib/digital_cpmmod_bc.cc69
-rw-r--r--gr-digital/lib/digital_gmskmod_bc.cc45
-rwxr-xr-xgr-digital/python/qa_cpm.py12
-rw-r--r--gr-digital/swig/digital_cpmmod_bc.i40
-rw-r--r--gr-digital/swig/digital_gmskmod_bc.i39
-rw-r--r--gr-digital/swig/digital_swig.i7
13 files changed, 327 insertions, 364 deletions
diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt
index eb2dedc334..d22f5ad372 100644
--- a/gr-digital/include/digital/CMakeLists.txt
+++ b/gr-digital/include/digital/CMakeLists.txt
@@ -86,7 +86,7 @@ install(FILES
clock_recovery_mm_cc.h
clock_recovery_mm_ff.h
cma_equalizer_cc.h
-# cpmmod_bc.h
+ cpmmod_bc.h
constellation_receiver_cb.h
constellation_decoder_cb.h
correlate_access_code_bb.h
@@ -100,7 +100,6 @@ install(FILES
fll_band_edge_cc.h
glfsr_source_b.h
glfsr_source_f.h
-# gmskmod_bc.h
kurtotic_equalizer_cc.h
lms_dd_equalizer_cc.h
map_bb.h
diff --git a/gr-digital/include/digital/cpmmod_bc.h b/gr-digital/include/digital/cpmmod_bc.h
new file mode 100644
index 0000000000..3bcc1c655d
--- /dev/null
+++ b/gr-digital/include/digital/cpmmod_bc.h
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_DIGITAL_CPMMOD_BC_H
+#define INCLUDED_DIGITAL_CPMMOD_BC_H
+
+#include <digital/api.h>
+#include <gr_hier_block2.h>
+#include <gr_cpm.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Generic CPM modulator
+ *
+ * \ingroup modulation_blk
+ * \ingroup digital
+ *
+ * Examples:
+ * - Setting h = 0.5, L = 1, type = LREC yields MSK.
+ * - Setting h = 0.5, type = GAUSSIAN and beta = 0.3 yields GMSK
+ * as used in GSM.
+ *
+ * The input of this block are symbols from an M-ary alphabet
+ * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the
+ * valid inputs are +/-1.
+ * The modulator will silently accept any other inputs, though.
+ * The output is the phase-modulated signal.
+ */
+ class DIGITAL_API cpmmod_bc : virtual public gr_hier_block2
+ {
+ public:
+ // gr::digital::cpmmod_bc::sptr
+ typedef boost::shared_ptr<cpmmod_bc> sptr;
+
+ /*!
+ * Make CPM modulator block.
+ *
+ * \param type The modulation type. Can be one of LREC, LRC, LSRC, TFM
+ * or GAUSSIAN. See gr_cpm::phase_response() for a
+ * detailed description.
+ * \param h The modulation index. \f$ h \cdot \pi\f$ is the maximum
+ * phase change that can occur between two symbols, i.e., if
+ * you only send ones, the phase will increase by \f$ h \cdot
+ * \pi\f$ every \p samples_per_sym samples. Set this to 0.5
+ * for Minimum Shift Keying variants.
+ * \param samples_per_sym Samples per symbol.
+ * \param L The length of the phase duration in symbols. For L=1, this
+ * yields full- response CPM symbols, for L > 1,
+ * partial-response.
+ * \param beta For LSRC, this is the rolloff factor. For Gaussian
+ * pulses, this is the 3 dB time-bandwidth product.
+ */
+ static sptr make(gr_cpm::cpm_type type, float h,
+ unsigned samples_per_sym,
+ unsigned L, double beta=0.3);
+
+ /*!
+ * Make GMSK modulator block.
+ *
+ * The type is GAUSSIAN and the modulation index for GMSK is
+ * 0.5. This are populated automatically by this factory
+ * function.
+ *
+ * \param samples_per_sym Samples per symbol.
+ * \param L The length of the phase duration in symbols. For L=1, this
+ * yields full- response CPM symbols, for L > 1,
+ * partial-response.
+ * \param beta For LSRC, this is the rolloff factor. For Gaussian
+ * pulses, this is the 3 dB time-bandwidth product.
+ */
+ static sptr make_gmskmod_bc(unsigned samples_per_sym=2,
+ unsigned L=4, double beta=0.3);
+
+ //! Return the phase response FIR taps
+ virtual std::vector<float> taps() const = 0;
+
+ //! Return the type of CPM modulator
+ virtual unsigned type() const = 0;
+
+ //! Return the modulation index of the modulator.
+ virtual float index() const = 0;
+
+ //! Return the number of samples per symbol
+ virtual unsigned samples_per_sym() const = 0;
+
+ //! Return the length of the phase duration (in symbols)
+ virtual unsigned length() const = 0;
+
+ //! Return the value of beta for the modulator
+ virtual double beta() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CPMMOD_BC_H */
+
diff --git a/gr-digital/include/digital_cpmmod_bc.h b/gr-digital/include/digital_cpmmod_bc.h
deleted file mode 100644
index 55837230cb..0000000000
--- a/gr-digital/include/digital_cpmmod_bc.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 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.
- */
-
-#ifndef INCLUDED_DIGITAL_CPMMOD_BC_H
-#define INCLUDED_DIGITAL_CPMMOD_BC_H
-
-#include <digital_api.h>
-#include <gr_hier_block2.h>
-#include <gr_char_to_float.h>
-#include <gr_frequency_modulator_fc.h>
-#include <gr_cpm.h>
-#include <filter/interp_fir_filter_fff.h>
-
-class digital_cpmmod_bc;
-typedef boost::shared_ptr<digital_cpmmod_bc> digital_cpmmod_bc_sptr;
-
-
-DIGITAL_API digital_cpmmod_bc_sptr
-digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta=0.3);
-
-/*!
- * \brief Generic CPM modulator
- *
- * \ingroup modulation_blk
- * \ingroup digital
- *
- * \param type The modulation type. Can be one of LREC, LRC, LSRC, TFM
- * or GAUSSIAN. See gr_cpm::phase_response() for a
- * detailed description.
- * \param h The modulation index. \f$ h \cdot \pi\f$ is the maximum
- * phase change that can occur between two symbols, i.e., if
- * you only send ones, the phase will increase by \f$ h \cdot
- * \pi\f$ every \p samples_per_sym samples. Set this to 0.5
- * for Minimum Shift Keying variants.
- * \param samples_per_sym Samples per symbol.
- * \param L The length of the phase duration in symbols. For L=1, this
- * yields full- response CPM symbols, for L > 1,
- * partial-response.
- * \param beta For LSRC, this is the rolloff factor. For Gaussian
- * pulses, this is the 3 dB time-bandwidth product.
- *
- * Examples:
- * - Setting h = 0.5, L = 1, type = LREC yields MSK.
- * - Setting h = 0.5, type = GAUSSIAN and beta = 0.3 yields GMSK
- * as used in GSM.
- *
- * The input of this block are symbols from an M-ary alphabet
- * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the
- * valid inputs are +/-1.
- * The modulator will silently accept any other inputs, though.
- * The output is the phase-modulated signal.
- */
-class DIGITAL_API digital_cpmmod_bc : public gr_hier_block2
-{
- friend DIGITAL_API digital_cpmmod_bc_sptr
- digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta);
-
- std::vector<float> d_taps;
- gr_char_to_float_sptr d_char_to_float;
- gr::filter::interp_fir_filter_fff::sptr d_pulse_shaper;
- gr_frequency_modulator_fc_sptr d_fm;
-
-protected:
- digital_cpmmod_bc(gr_cpm::cpm_type type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta);
-
-public:
- //! Return the phase response FIR taps
- std::vector<float> get_taps() { return d_taps; };
-};
-
-#endif /* INCLUDED_DIGITAL_CPMMOD_BC_H */
-
diff --git a/gr-digital/include/digital_gmskmod_bc.h b/gr-digital/include/digital_gmskmod_bc.h
deleted file mode 100644
index b47f35879f..0000000000
--- a/gr-digital/include/digital_gmskmod_bc.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_GMSKMOD_BC_H
-#define INCLUDED_DIGITAL_GMSKMOD_BC_H
-
-#include <digital_api.h>
-#include <digital_cpmmod_bc.h>
-
-class digital_gmskmod_bc;
-typedef boost::shared_ptr<digital_gmskmod_bc> digital_gmskmod_bc_sptr;
-
-
-DIGITAL_API digital_gmskmod_bc_sptr
-digital_make_gmskmod_bc(unsigned samples_per_sym=2,
- double bt=0.3, unsigned L=4);
-
-/*!
- * \brief GMSK modulator
- *
- * \ingroup modulation_blk
- * \ingroup digital
- *
- * \param samples_per_sym Samples per symbol.
- * \param bt The 3 dB time-bandwidth product.
- * \param L The length of the phase duration in symbols. The Gaussian
- * pulse is truncated after L symbols.
- *
- * The input of this block are symbols from an M-ary alphabet
- * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the
- * valid inputs are +/-1.
- * The modulator will silently accept any other inputs, though.
- * The output is the phase-modulated signal.
- */
-class DIGITAL_API digital_gmskmod_bc : public digital_cpmmod_bc
-{
- friend DIGITAL_API digital_gmskmod_bc_sptr
- digital_make_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L);
- digital_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L);
-};
-
-#endif /* INCLUDED_DIGITAL_GMSKMOD_BC_H */
-
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index cdbe4b83b4..58ff70ef89 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -117,7 +117,7 @@ list(APPEND digital_sources
correlate_access_code_bb_impl.cc
correlate_access_code_tag_bb_impl.cc
costas_loop_cc_impl.cc
- #cpmmod_bc_impl.cc
+ cpmmod_bc_impl.cc
descrambler_bb_impl.cc
diff_decoder_bb_impl.cc
diff_encoder_bb_impl.cc
@@ -126,7 +126,6 @@ list(APPEND digital_sources
framer_sink_1_impl.cc
glfsr_source_b_impl.cc
glfsr_source_f_impl.cc
- #gmskmod_bc_impl.cc
kurtotic_equalizer_cc_impl.cc
lms_dd_equalizer_cc_impl.cc
map_bb_impl.cc
diff --git a/gr-digital/lib/cpmmod_bc_impl.cc b/gr-digital/lib/cpmmod_bc_impl.cc
new file mode 100644
index 0000000000..8737f2e0b6
--- /dev/null
+++ b/gr-digital/lib/cpmmod_bc_impl.cc
@@ -0,0 +1,125 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2012 Free Software Foundation, Inc.
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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 "cpmmod_bc_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ cpmmod_bc::sptr
+ cpmmod_bc::make(gr_cpm::cpm_type type, float h,
+ unsigned samples_per_sym,
+ unsigned L, double beta)
+ {
+ return gnuradio::get_initial_sptr
+ (new cpmmod_bc_impl("cpmmod_bc",
+ (gr_cpm::cpm_type)type,
+ h, samples_per_sym,
+ L, beta));
+ }
+
+ cpmmod_bc::sptr
+ cpmmod_bc::make_gmskmod_bc(unsigned samples_per_sym,
+ unsigned L, double beta)
+ {
+ return gnuradio::get_initial_sptr
+ (new cpmmod_bc_impl("gmskmod_bc",
+ gr_cpm::GAUSSIAN, 0.5,
+ samples_per_sym,
+ L, beta));
+ }
+
+ cpmmod_bc_impl::cpmmod_bc_impl(const std::string &name,
+ gr_cpm::cpm_type type, float h,
+ unsigned samples_per_sym,
+ unsigned L, double beta)
+ : gr_hier_block2(name,
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature2(1, 1, sizeof(gr_complex), sizeof(float))),
+ d_type(type), d_index(h), d_sps(samples_per_sym), d_length(L), d_beta(beta),
+ d_taps(gr_cpm::phase_response(type, samples_per_sym, L, beta)),
+ d_char_to_float(gr_make_char_to_float()),
+ d_pulse_shaper(gr::filter::interp_fir_filter_fff::make(samples_per_sym, d_taps)),
+ d_fm(gr_make_frequency_modulator_fc(M_PI * h))
+ {
+ switch(type) {
+ case gr_cpm::LRC:
+ case gr_cpm::LSRC:
+ case gr_cpm::LREC:
+ case gr_cpm::TFM:
+ case gr_cpm::GAUSSIAN:
+ break;
+
+ default:
+ throw std::invalid_argument("cpmmod_bc_impl: invalid CPM type");
+ }
+
+ connect(self(), 0, d_char_to_float, 0);
+ connect(d_char_to_float, 0, d_pulse_shaper, 0);
+ connect(d_pulse_shaper, 0, d_fm, 0);
+ connect(d_fm, 0, self(), 0);
+ }
+
+ cpmmod_bc_impl::~cpmmod_bc_impl()
+ {
+ }
+
+ std::vector<float>
+ cpmmod_bc_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ unsigned
+ cpmmod_bc_impl::type() const
+ {
+ return d_type;
+ }
+
+ float
+ cpmmod_bc_impl::index() const
+ {
+ return d_index;
+ }
+
+ unsigned
+ cpmmod_bc_impl::samples_per_sym() const
+ {
+ return d_sps;
+ }
+
+ unsigned
+ cpmmod_bc_impl::length() const
+ {
+ return d_length;
+ }
+
+ double cpmmod_bc_impl::beta() const
+ {
+ return d_beta;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/cpmmod_bc_impl.h b/gr-digital/lib/cpmmod_bc_impl.h
new file mode 100644
index 0000000000..2b052e6a3f
--- /dev/null
+++ b/gr-digital/lib/cpmmod_bc_impl.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H
+#define INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H
+
+#include <digital/cpmmod_bc.h>
+#include <gr_char_to_float.h>
+#include <gr_frequency_modulator_fc.h>
+#include <gr_cpm.h>
+#include <filter/interp_fir_filter_fff.h>
+
+namespace gr {
+ namespace digital {
+
+ class cpmmod_bc_impl : public cpmmod_bc
+ {
+ private:
+ unsigned d_type;
+ float d_index;
+ unsigned d_sps;
+ unsigned d_length;
+ double d_beta;
+
+ protected:
+ std::vector<float> d_taps;
+ gr_char_to_float_sptr d_char_to_float;
+ gr::filter::interp_fir_filter_fff::sptr d_pulse_shaper;
+ gr_frequency_modulator_fc_sptr d_fm;
+
+ public:
+ cpmmod_bc_impl(const std::string &name,
+ gr_cpm::cpm_type type, float h,
+ unsigned samples_per_sym,
+ unsigned L, double beta=0.3);
+ ~cpmmod_bc_impl();
+
+ std::vector<float> taps() const;
+ unsigned type() const;
+ float index() const;
+ unsigned samples_per_sym() const;
+ unsigned length() const;
+ double beta() const;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H */
+
diff --git a/gr-digital/lib/digital_cpmmod_bc.cc b/gr-digital/lib/digital_cpmmod_bc.cc
deleted file mode 100644
index 35695ae34d..0000000000
--- a/gr-digital/lib/digital_cpmmod_bc.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010,2012 Free Software Foundation, Inc.
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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 <digital_cpmmod_bc.h>
-#include <gr_io_signature.h>
-
-
-// Shared pointer constructor
-digital_cpmmod_bc_sptr
-digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta)
-{
- return gnuradio::get_initial_sptr(new digital_cpmmod_bc((gr_cpm::cpm_type)type,
- h, samples_per_sym,
- L, beta));
-}
-
-
-digital_cpmmod_bc::digital_cpmmod_bc(gr_cpm::cpm_type type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta)
- : gr_hier_block2("digital_cpmmod_bc",
- gr_make_io_signature(1, 1, sizeof(char)),
- gr_make_io_signature2(1, 1, sizeof(gr_complex), sizeof(float))),
- d_taps(gr_cpm::phase_response(type, samples_per_sym, L, beta)),
- d_char_to_float(gr_make_char_to_float()),
- d_pulse_shaper(gr::filter::interp_fir_filter_fff::make(samples_per_sym, d_taps)),
- d_fm(gr_make_frequency_modulator_fc(M_PI * h))
-{
- switch (type) {
- case gr_cpm::LRC:
- case gr_cpm::LSRC:
- case gr_cpm::LREC:
- case gr_cpm::TFM:
- case gr_cpm::GAUSSIAN:
- break;
-
- default:
- throw std::invalid_argument("invalid CPM type");
- }
-
- connect(self(), 0, d_char_to_float, 0);
- connect(d_char_to_float, 0, d_pulse_shaper, 0);
- connect(d_pulse_shaper, 0, d_fm, 0);
- connect(d_fm, 0, self(), 0);
-}
-
diff --git a/gr-digital/lib/digital_gmskmod_bc.cc b/gr-digital/lib/digital_gmskmod_bc.cc
deleted file mode 100644
index 146293d824..0000000000
--- a/gr-digital/lib/digital_gmskmod_bc.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_gmskmod_bc.h>
-#include <gr_io_signature.h>
-
-// Shared pointer constructor
-digital_gmskmod_bc_sptr
-digital_make_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L)
-{
- return gnuradio::get_initial_sptr
- (new digital_gmskmod_bc(samples_per_sym, bt, L));
-}
-
-
-digital_gmskmod_bc::digital_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L)
- : digital_cpmmod_bc(gr_cpm::GAUSSIAN, 0.5, samples_per_sym, L, bt)
-{
-}
-
diff --git a/gr-digital/python/qa_cpm.py b/gr-digital/python/qa_cpm.py
index 12a84c76c2..2221d16b6f 100755
--- a/gr-digital/python/qa_cpm.py
+++ b/gr-digital/python/qa_cpm.py
@@ -21,15 +21,15 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
import numpy
class test_cpm(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def do_check_phase_shift(self, type, name):
@@ -37,7 +37,7 @@ class test_cpm(gr_unittest.TestCase):
L = 1
in_bits = (1,) * 20
src = gr.vector_source_b(in_bits, False)
- cpm = digital_swig.cpmmod_bc(type, 0.5, sps, L)
+ cpm = digital.cpmmod_bc(type, 0.5, sps, L)
arg = gr.complex_to_arg()
sink = gr.vector_sink_f()
@@ -68,7 +68,7 @@ class test_cpm(gr_unittest.TestCase):
bt = 0.3
in_bits = (1,) * 20
src = gr.vector_source_b(in_bits, False)
- gmsk = digital_swig.gmskmod_bc(sps, bt, L)
+ gmsk = digital.gmskmod_bc(sps, L, bt)
arg = gr.complex_to_arg()
sink = gr.vector_sink_f()
diff --git a/gr-digital/swig/digital_cpmmod_bc.i b/gr-digital/swig/digital_cpmmod_bc.i
deleted file mode 100644
index fa7c50da75..0000000000
--- a/gr-digital/swig/digital_cpmmod_bc.i
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital, cpmmod_bc)
-
-digital_cpmmod_bc_sptr
-digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta=0.3);
-
-class digital_cpmmod_bc : public gr_hier_block2
-{
- private:
- digital_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta);
-
- public:
- std::vector<float> get_taps();
-};
-
diff --git a/gr-digital/swig/digital_gmskmod_bc.i b/gr-digital/swig/digital_gmskmod_bc.i
deleted file mode 100644
index ad7b82237e..0000000000
--- a/gr-digital/swig/digital_gmskmod_bc.i
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital, gmskmod_bc)
-
-digital_gmskmod_bc_sptr
-digital_make_gmskmod_bc(unsigned samples_per_sym=2,
- double bt=0.3, unsigned L=4);
-
-class digital_gmskmod_bc : public gr_hier_block2
-{
- private:
- digital_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- double beta, unsigned L);
-
- public:
- std::vector<float> get_taps();
-};
-
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index 3c7c129077..1e29280167 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -35,6 +35,8 @@
//%include <gri_control_loop.i>
+%include "gr_cpm.h"
+
// Used in the constellation objects
%template(unsigned_int_vector) std::vector<unsigned int>;
@@ -57,6 +59,7 @@
#include "digital/correlate_access_code_bb.h"
#include "digital/correlate_access_code_tag_bb.h"
#include "digital/costas_loop_cc.h"
+#include "digital/cpmmod_bc.h"
#include "digital/crc32.h"
#include "digital/descrambler_bb.h"
#include "digital/diff_decoder_bb.h"
@@ -99,6 +102,7 @@
%include "digital/correlate_access_code_bb.h"
%include "digital/correlate_access_code_tag_bb.h"
%include "digital/costas_loop_cc.h"
+%include "digital/cpmmod_bc.h"
%include "digital/crc32.h"
%include "digital/descrambler_bb.h"
%include "digital/diff_decoder_bb.h"
@@ -138,6 +142,7 @@ GR_SWIG_BLOCK_MAGIC2(digital, constellation_decoder_cb);
GR_SWIG_BLOCK_MAGIC2(digital, correlate_access_code_bb);
GR_SWIG_BLOCK_MAGIC2(digital, correlate_access_code_tag_bb);
GR_SWIG_BLOCK_MAGIC2(digital, costas_loop_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, cpmmod_bc);
GR_SWIG_BLOCK_MAGIC2(digital, descrambler_bb);
GR_SWIG_BLOCK_MAGIC2(digital, diff_decoder_bb);
GR_SWIG_BLOCK_MAGIC2(digital, diff_encoder_bb);
@@ -160,5 +165,7 @@ GR_SWIG_BLOCK_MAGIC2(digital, probe_mpsk_snr_est_c);
GR_SWIG_BLOCK_MAGIC2(digital, scrambler_bb);
GR_SWIG_BLOCK_MAGIC2(digital, simple_framer);
+GR_SWIG_BLOCK_MAGIC_FACTORY(digital, cpmmod_bc, gmskmod_bc);
+
// Properly package up constellation objects
%include "constellation.i"