GNU Radio 3.6.5 C++ API

plateau_detector_fb.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2012-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 
00024 #ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H
00025 #define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H
00026 
00027 #include <blocks/api.h>
00028 #include <gr_sync_block.h>
00029 
00030 namespace gr {
00031   namespace blocks {
00032 
00033     /*!
00034      * \brief Detects a plateau and marks the middle.
00035      * \ingroup peak_detectors_blk
00036      *
00037      * \details
00038      * Detect a plateau of a-priori known height. Input is a stream of floats,
00039      * the output is a stream of bytes. Whenever a plateau is detected, the
00040      * middle of that plateau is marked with a '1' on the output stream (all
00041      * other samples are left at zero).
00042      *
00043      * You can use this in a Schmidl & Cox synchronisation algorithm to interpret
00044      * the output of the normalized correlator. Just pass the length of the cyclic
00045      * prefix (in samples) as the max_len parameter).
00046      *
00047      * Unlike the peak detectors, you must the now the absolute height of the plateau.
00048      * Whenever the amplitude exceeds the given threshold, it starts assuming the
00049      * presence of a plateau.
00050      *
00051      * An implicit hysteresis is provided by the fact that after detecting one plateau,
00052      * it waits at least max_len samples before the next plateau can be detected.
00053      */
00054     class BLOCKS_API plateau_detector_fb : virtual public gr_sync_block
00055     {
00056     public:
00057        typedef boost::shared_ptr<plateau_detector_fb> sptr;
00058 
00059        /*!
00060         * \param max_len Maximum length of the plateau
00061         * \param threshold Anything above this value is considered a plateau
00062         */
00063        static sptr make(int max_len, float threshold=0.9);
00064     };
00065 
00066   } // namespace blocks
00067 } // namespace gr
00068 
00069 #endif /* INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H */
00070