GNU Radio 3.7.1 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2006,2013 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef INCLUDED_GR_BIN_STATISTICS_F_H 00024 #define INCLUDED_GR_BIN_STATISTICS_F_H 00025 00026 #include <gnuradio/blocks/api.h> 00027 #include <gnuradio/sync_block.h> 00028 #include <gnuradio/msg_queue.h> 00029 #include <gnuradio/feval.h> 00030 00031 namespace gr { 00032 namespace blocks { 00033 00034 /*! 00035 * \brief control scanning and record frequency domain statistics 00036 * \ingroup misc_blk 00037 */ 00038 class BLOCKS_API bin_statistics_f : virtual public sync_block 00039 { 00040 protected: 00041 std::vector<float> d_max; // per bin maxima 00042 00043 virtual size_t vlen() const = 0; 00044 virtual double center_freq() const = 0; 00045 virtual gr::msg_queue::sptr msgq() const = 0; 00046 00047 virtual void reset_stats() = 0; 00048 virtual void accrue_stats(const float *input) = 0; 00049 virtual void send_stats() = 0; 00050 00051 public: 00052 // gr::blocks::bin_statistics_f::sptr 00053 typedef boost::shared_ptr<bin_statistics_f> sptr; 00054 00055 /*! 00056 * Build a bin statistics block. See qa_bin_statistics.py and 00057 * gr-uhd/examples/python/usrp_spectrum_sense.py for examples of 00058 * its use, specifically how to use the callback function. 00059 * 00060 * \param vlen vector length 00061 * \param msgq message queue 00062 * \param tune a feval_dd callback function 00063 * \param tune_delay number of samples for the tune delay 00064 * \param dwell_delay number of samples for the dwell delay 00065 */ 00066 static sptr make(unsigned int vlen, // vector length 00067 gr::msg_queue::sptr msgq, 00068 feval_dd *tune, // callback 00069 size_t tune_delay, // samples 00070 size_t dwell_delay); // samples 00071 }; 00072 00073 } /* namespace blocks */ 00074 } /* namespace gr */ 00075 00076 #endif /* INCLUDED_GR_BIN_STATISTICS_F_H */