3 * Copyright 2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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)
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.
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.
23 #ifndef INCLUDED_GR_BIN_STATISTICS_F_H
24 #define INCLUDED_GR_BIN_STATISTICS_F_H
27 #include <gr_sync_block.h>
29 #include <gr_message.h>
30 #include <gr_msg_queue.h>
32 class gr_bin_statistics_f;
33 typedef boost::shared_ptr<gr_bin_statistics_f> gr_bin_statistics_f_sptr;
36 gr_bin_statistics_f_sptr
37 gr_make_bin_statistics_f(unsigned int vlen, // vector length
38 gr_msg_queue_sptr msgq,
39 gr_feval_dd *tune, // callback
40 size_t tune_delay, // samples
41 size_t dwell_delay); // samples
44 * \brief control scanning and record frequency domain statistics
47 class gr_bin_statistics_f : public gr_sync_block
49 friend gr_bin_statistics_f_sptr
50 gr_make_bin_statistics_f(unsigned int vlen, // vector length
51 gr_msg_queue_sptr msgq,
52 gr_feval_dd *tune, // callback
53 size_t tune_delay, // samples
54 size_t dwell_delay); // samples
56 enum state_t { ST_INIT, ST_TUNE_DELAY, ST_DWELL_DELAY };
59 gr_msg_queue_sptr d_msgq;
66 size_t d_delay; // nsamples remaining to state transition
68 gr_bin_statistics_f(unsigned int vlen,
69 gr_msg_queue_sptr msgq,
75 void enter_tune_delay();
76 void enter_dwell_delay();
77 void leave_dwell_delay();
80 std::vector<float> d_max; // per bin maxima
82 size_t vlen() const { return d_vlen; }
83 double center_freq() const { return d_center_freq; }
84 gr_msg_queue_sptr msgq() const { return d_msgq; }
86 virtual void reset_stats();
87 virtual void accrue_stats(const float *input);
88 virtual void send_stats();
91 ~gr_bin_statistics_f();
93 int work(int noutput_items,
94 gr_vector_const_void_star &input_items,
95 gr_vector_void_star &output_items);