1 /* -*- c++ -*- */ 2 /* 3 * Copyright 2011,2012 Free Software Foundation, Inc. 4 * 5 * This file is part of GNU Radio 6 * 7 * GNU Radio is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3, or (at your option) 10 * any later version. 11 * 12 * GNU Radio is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with GNU Radio; see the file COPYING. If not, write to 19 * the Free Software Foundation, Inc., 51 Franklin Street, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H 24 #define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H 25 26 #include <gnuradio/digital/api.h> 27 #include <gnuradio/digital/mpsk_snr_est_cc.h> 28 #include <gnuradio/sync_block.h> 29 30 namespace gr { 31 namespace digital { 32 33 class mpsk_snr_est_cc_impl : public mpsk_snr_est_cc 34 { 35 private: 36 snr_est_type_t d_type; 37 int d_nsamples, d_count; 38 double d_alpha; 39 mpsk_snr_est* d_snr_est; 40 41 // d_key is the tag name, 'snr', d_me is the block name + unique ID 42 pmt::pmt_t d_key, d_me; 43 44 public: 45 mpsk_snr_est_cc_impl(snr_est_type_t type, 46 int tag_nsamples = 10000, 47 double alpha = 0.001); 48 ~mpsk_snr_est_cc_impl(); 49 50 int work(int noutput_items, 51 gr_vector_const_void_star& input_items, 52 gr_vector_void_star& output_items); 53 54 //! Return the estimated signal-to-noise ratio in decibels 55 double snr(); 56 57 //! Return the type of estimator in use 58 snr_est_type_t type() const; 59 60 //! Return how many samples between SNR tags 61 int tag_nsample() const; 62 63 //! Get the running-average coefficient 64 double alpha() const; 65 66 //! Set type of estimator to use 67 void set_type(snr_est_type_t t); 68 69 //! Set the number of samples between SNR tags 70 void set_tag_nsample(int n); 71 72 //! Set the running-average coefficient 73 void set_alpha(double alpha); 74 }; 75 76 } /* namespace digital */ 77 } /* namespace gr */ 78 79 #endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H */ 80