GNU Radio's LFAST Package
costas4_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2017 ghostop14.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_LFAST_costas4_IMPL_H
22 #define INCLUDED_LFAST_costas4_IMPL_H
23 
24 #include <lfast/costas4.h>
25 
26 namespace gr {
27  namespace lfast {
28 
29  class costas4_impl : public costas4
30  {
31  private:
32  int d_order;
33  float d_error;
34  float d_noise;
35  bool d_genSignalPDUs;
36 
37  float
38  phase_detector_2(gr_complex sample) const
39  {
40  return (sample.real()*sample.imag());
41  }
42 
43  float
44  phase_detector_4(gr_complex sample) const
45  {
46  return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
47  (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
48  }
49 
50 
51  float (costas4_impl::*d_phase_detector)(gr_complex sample) const;
52 
53  public:
54  costas4_impl(float loop_bw, int order, bool genPDUs);
55  ~costas4_impl();
56 
57  float error() const;
58 
59  void handleMsgIn(pmt::pmt_t msg);
60 
61  // void printSineError();
62 
63  void handle_set_noise(pmt::pmt_t msg);
64 
65  void setup_rpc();
66 
67  // Where all the action really happens
68  int work(int noutput_items,
69  gr_vector_const_void_star &input_items,
70  gr_vector_void_star &output_items);
71  int work_original(int noutput_items,
72  gr_vector_const_void_star &input_items,
73  gr_vector_void_star &output_items);
74  int work_test(int noutput_items,
75  gr_vector_const_void_star &input_items,
76  gr_vector_void_star &output_items);
77  };
78 
79  } // namespace lfast
80 } // namespace gr
81 
82 #endif /* INCLUDED_LFAST_costas4_IMPL_H */
83 
<+description of block+>
Definition: costas4.h:37
void handleMsgIn(pmt::pmt_t msg)
float error() const
void handle_set_noise(pmt::pmt_t msg)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
int work_test(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Definition: costas4_impl.h:29
int work_original(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
costas4_impl(float loop_bw, int order, bool genPDUs)