gr-baz Package
baz_hopper.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007,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_HOPPER_H
29 #define INCLUDED_BAZ_HOPPER_H
30 
31 #include <gnuradio/block.h>
32 #include <boost/thread.hpp>
33 
34 #include <vector>
35 
36 #include <uhd/usrp/multi_usrp.hpp>
37 #include <uhd/types/time_spec.hpp>
38 
39 #include <gnuradio/uhd/usrp_source.h>
40 
42 typedef boost::shared_ptr<baz_hopper> baz_hopper_sptr;
43 
44 BAZ_API baz_hopper_sptr baz_make_hopper(
45  size_t item_size,
46  int sample_rate,
47  int chunk_length,
48  int drop_length,
49  std::vector<std::vector<double> > freqs,
50  ::gr::basic_block_sptr source,
51  bool verbose = false
52 );
53 
54 /*!
55  * \brief hop
56  * \ingroup misc_blk
57  */
58 class BAZ_API baz_hopper : public gr::block
59 {
60  friend BAZ_API baz_hopper_sptr baz_make_hopper(
61  size_t item_size,
62  int sample_rate,
63  int chunk_length,
64  int drop_length,
65  std::vector<std::vector<double> > freqs,
66  ::gr::basic_block_sptr source,
67  bool verbose
68  );
69 
70  baz_hopper(
71  size_t item_size,
72  int sample_rate,
73  int chunk_length,
74  int drop_length,
75  std::vector<std::vector<double> > freqs,
76  ::gr::basic_block_sptr source,
77  bool verbose = false
78  );
79 
80  //boost::mutex d_mutex;
81  size_t d_item_size;
82  int d_sample_rate;
83  int d_chunk_length, d_drop_length;
84  std::vector<std::vector<double> > d_freqs;
85  bool d_verbose;
86  uint64_t d_last_time_seconds;
87  double d_last_time_fractional_seconds;
88  uint64_t d_time_offset;
89  ::gr::uhd::usrp_source::sptr d_usrp_src;
90  ::uhd::usrp::multi_usrp::sptr d_dev;
91  bool d_seen_time;
92  std::deque<uint64_t> d_scheduled;
93  std::map<uint64_t,uint64_t> d_dest;
94  int d_chunk_counter;
95  uhd::time_spec_t d_last_hop;
96  std::vector<std::pair<double,int> > d_freq_dest;
97  int d_freq_idx;
98  int d_zero_counter;
99  bool d_reset;
100  uint64_t d_skip;
101 
102 public:
103  ~baz_hopper();
104 
105  //int delay () const { return d_delay; }
106  //void set_delay (int delay);
107 
108  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
109  int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
110 };
111 
112 #endif // INCLUDED_BAZ_HOPPER_H
class BAZ_API baz_hopper
Definition: baz_hopper.h:41
hop
Definition: baz_hopper.h:58
BAZ_API baz_hopper_sptr baz_make_hopper(size_t item_size, int sample_rate, int chunk_length, int drop_length, std::vector< std::vector< double > > freqs, ::gr::basic_block_sptr source, bool verbose=false)
#define BAZ_API
Definition: config.h:8