gr-baz Package
baz_radar_detector.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2013 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 /*
24  * gr-baz by Balint Seeber (http://spench.net/contact)
25  * Information, documentation & samples: http://wiki.spench.net/wiki/gr-baz
26  */
27 
28 #ifndef INCLUDED_BAZ_RADAR_DETECTOR_H
29 #define INCLUDED_BAZ_RADAR_DETECTOR_H
30 
31 #include <gnuradio/block.h>
32 #include <gnuradio/msg_queue.h>
33 
35 
36 /*
37  * We use boost::shared_ptr's instead of raw pointers for all access
38  * to gr_blocks (and many other data structures). The shared_ptr gets
39  * us transparent reference counting, which greatly simplifies storage
40  * management issues. This is especially helpful in our hybrid
41  * C++ / Python system.
42  *
43  * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
44  *
45  * As a convention, the _sptr suffix indicates a boost::shared_ptr
46  */
47 typedef boost::shared_ptr<baz_radar_detector> baz_radar_detector_sptr;
48 
49 /*!
50  * \brief Return a shared_ptr to a new instance of baz_radar_detector.
51  *
52  * To avoid accidental use of raw pointers, baz_radar_detector's
53  * constructor is private. baz_make_block_status is the public
54  * interface for creating new instances.
55  */
56 BAZ_API baz_radar_detector_sptr baz_make_radar_detector (int sample_rate, gr::msg_queue::sptr msgq);
57 
58 /*!
59  * \brief radar_detector a stream of floats.
60  * \ingroup block
61  *
62  * This uses the preferred technique: subclassing gr_sync_block.
63  */
64 class BAZ_API baz_radar_detector : public gr::block
65 {
66 private:
67  // The friend declaration allows baz_make_block_status to
68  // access the private constructor.
69  friend BAZ_API baz_radar_detector_sptr baz_make_radar_detector (int sample_rate, gr::msg_queue::sptr msgq);
70 
71  baz_radar_detector (int sample_rate, gr::msg_queue::sptr msgq); // private constructor
72 
73  int d_sample_rate;
74  gr::msg_queue::sptr d_msgq;
75  float d_base_level;
76  float d_threshold;
77  bool d_in_burst;
78  float d_first;
79  uint64_t d_burst_start, d_burst_flat_start;
80  double d_sum, d_max;
81  int d_skip;
82  float d_pulse_plateau;
83  float d_last;
84  double d_flat_sum;
85  bool d_in_plateau;
86  int d_flat_sum_count;
87 public:
89  uint32_t tsf;
90  uint8_t rssi;
91  uint8_t width; // 0 for WiFi frame
92  uint8_t type; // 0: WiFi frame (no error), 1: RADAR PHY error
93  uint8_t subtype; // For type 0: 0; type 1: rs_rate
94  };
95 public:
96  ~baz_radar_detector (); // public destructor
97 
98  void set_base_level(float level);
99  void set_threshold(float threshold);
100  void set_pulse_plateau(float level);
101  bool set_param(const std::string& param, float value);
102  void skip(int skip);
103 
104  int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
105 };
106 
107 #endif /* INCLUDED_BAZ_RADAR_DETECTOR_H */
uint8_t rssi
Definition: baz_radar_detector.h:90
uint8_t subtype
Definition: baz_radar_detector.h:93
BAZ_API baz_radar_detector_sptr baz_make_radar_detector(int sample_rate, gr::msg_queue::sptr msgq)
Return a shared_ptr to a new instance of baz_radar_detector.
uint8_t width
Definition: baz_radar_detector.h:91
radar_detector a stream of floats.This uses the preferred technique: subclassing gr_sync_block.
Definition: baz_radar_detector.h:64
uint32_t tsf
Definition: baz_radar_detector.h:89
Definition: baz_radar_detector.h:88
#define BAZ_API
Definition: config.h:8
class BAZ_API baz_radar_detector
Definition: baz_radar_detector.h:34
uint8_t type
Definition: baz_radar_detector.h:92