GNU Radio 3.5.3.2 C++ API
gr_shd_smini_sink.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Free Software Foundation, Inc.
3  *
4  * This file is part of GNU Radio
5  *
6  * GNU Radio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * GNU Radio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GNU Radio; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef INCLUDED_GR_SHD_SMINI_SINK_H
23 #define INCLUDED_GR_SHD_SMINI_SINK_H
24 
25 #include <gr_shd_api.h>
26 #include <gr_sync_block.h>
27 #include <shd/xmini/multi_xmini.hpp>
28 
29 class shd_smini_sink;
30 
32  const shd::device_addr_t &device_addr,
33  const shd::io_type_t &io_type,
34  size_t num_channels
35 );
36 
37 class GR_SHD_API shd_smini_sink : virtual public gr_sync_block
38 {
39  public:
40 
41  /*!
42  * Set the subdevice specification.
43  * \param spec the subdev spec markup string
44  * \param mboard the motherboard index 0 to M-1
45  */
46  virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0;
47 
48  /*!
49  * Set the sample rate for the smini device.
50  * \param rate a new rate in Sps
51  */
52  virtual void set_samp_rate(double rate) = 0;
53 
54  /*!
55  * Get the sample rate for the smini device.
56  * This is the actual sample rate and may differ from the rate set.
57  * \return the actual rate in Sps
58  */
59  virtual double get_samp_rate(void) = 0;
60 
61  /*!
62  * Tune the smini device to the desired center frequency.
63  * \param tune_request the tune request instructions
64  * \param chan the channel index 0 to N-1
65  * \return a tune result with the actual frequencies
66  */
67  virtual shd::tune_result_t set_center_freq(
68  const shd::tune_request_t tune_request, size_t chan = 0
69  ) = 0;
70 
71  /*!
72  * Tune the smini device to the desired center frequency.
73  * This is a wrapper around set center freq so that in this case,
74  * the user can pass a single frequency in the call through swig.
75  * \param freq the desired frequency in Hz
76  * \param chan the channel index 0 to N-1
77  * \return a tune result with the actual frequencies
78  */
79  shd::tune_result_t set_center_freq(double freq, size_t chan = 0){
80  return set_center_freq(shd::tune_request_t(freq), chan);
81  }
82 
83  /*!
84  * Get the center frequency.
85  * \param chan the channel index 0 to N-1
86  * \return the frequency in Hz
87  */
88  virtual double get_center_freq(size_t chan = 0) = 0;
89 
90  /*!
91  * Get the tunable frequency range.
92  * \param chan the channel index 0 to N-1
93  * \return the frequency range in Hz
94  */
95  virtual shd::freq_range_t get_freq_range(size_t chan = 0) = 0;
96 
97  /*!
98  * Set the gain for the dboard.
99  * \param gain the gain in dB
100  * \param chan the channel index 0 to N-1
101  */
102  virtual void set_gain(double gain, size_t chan = 0) = 0;
103 
104  /*!
105  * Set the named gain on the dboard.
106  * \param gain the gain in dB
107  * \param name the name of the gain stage
108  * \param chan the channel index 0 to N-1
109  */
110  virtual void set_gain(double gain, const std::string &name,
111  size_t chan = 0) = 0;
112 
113  /*!
114  * Get the actual dboard gain setting.
115  * \param chan the channel index 0 to N-1
116  * \return the actual gain in dB
117  */
118  virtual double get_gain(size_t chan = 0) = 0;
119 
120  /*!
121  * Get the actual dboard gain setting of named stage.
122  * \param name the name of the gain stage
123  * \param chan the channel index 0 to N-1
124  * \return the actual gain in dB
125  */
126  virtual double get_gain(const std::string &name,
127  size_t chan = 0) = 0;
128 
129  /*!
130  * Get the actual dboard gain setting of named stage.
131  * \param chan the channel index 0 to N-1
132  * \return the actual gain in dB
133  */
134  virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0;
135 
136  /*!
137  * Get the settable gain range.
138  * \param chan the channel index 0 to N-1
139  * \return the gain range in dB
140  */
141  virtual shd::gain_range_t get_gain_range(size_t chan = 0) = 0;
142 
143  /*!
144  * Get the settable gain range.
145  * \param name the name of the gain stage
146  * \param chan the channel index 0 to N-1
147  * \return the gain range in dB
148  */
149  virtual shd::gain_range_t get_gain_range(const std::string &name,
150  size_t chan = 0) = 0;
151 
152  /*!
153  * Set the antenna to use.
154  * \param ant the antenna string
155  * \param chan the channel index 0 to N-1
156  */
157  virtual void set_antenna(const std::string &ant,
158  size_t chan = 0) = 0;
159 
160  /*!
161  * Get the antenna in use.
162  * \param chan the channel index 0 to N-1
163  * \return the antenna string
164  */
165  virtual std::string get_antenna(size_t chan = 0) = 0;
166 
167  /*!
168  * Get a list of possible antennas.
169  * \param chan the channel index 0 to N-1
170  * \return a vector of antenna strings
171  */
172  virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
173 
174  /*!
175  * Set the subdevice bandpass filter.
176  * \param chan the channel index 0 to N-1
177  * \param bandwidth the filter bandwidth in Hz
178  */
179  virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0;
180 
181  /*!
182  * Get a daughterboard sensor value.
183  * \param name the name of the sensor
184  * \param chan the channel index 0 to N-1
185  * \return a sensor value object
186  */
187  virtual shd::sensor_value_t get_dboard_sensor(const std::string &name,
188  size_t chan = 0) = 0;
189 
190  /*!
191  * Get a list of possible daughterboard sensor names.
192  * \param chan the channel index 0 to N-1
193  * \return a vector of sensor names
194  */
195  virtual std::vector<std::string> get_dboard_sensor_names(size_t chan = 0) = 0;
196 
197  /*!
198  * Get a motherboard sensor value.
199  * \param name the name of the sensor
200  * \param mboard the motherboard index 0 to M-1
201  * \return a sensor value object
202  */
203  virtual shd::sensor_value_t get_mboard_sensor(const std::string &name,
204  size_t mboard = 0) = 0;
205 
206  /*!
207  * Get a list of possible motherboard sensor names.
208  * \param mboard the motherboard index 0 to M-1
209  * \return a vector of sensor names
210  */
211  virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
212 
213  /*!
214  * Set the clock configuration.
215  * \param clock_config the new configuration
216  * \param mboard the motherboard index 0 to M-1
217  */
218  virtual void set_clock_config(const shd::clock_config_t &clock_config,
219  size_t mboard = 0) = 0;
220 
221  /*!
222  * Get the master clock rate.
223  * \param mboard the motherboard index 0 to M-1
224  * \return the clock rate in Hz
225  */
226  virtual double get_clock_rate(size_t mboard = 0) = 0;
227 
228  /*!
229  * Set the master clock rate.
230  * \param rate the new rate in Hz
231  * \param mboard the motherboard index 0 to M-1
232  */
233  virtual void set_clock_rate(double rate, size_t mboard = 0) = 0;
234 
235  /*!
236  * Get the current time registers.
237  * \param mboard the motherboard index 0 to M-1
238  * \return the current smini time
239  */
240  virtual shd::time_spec_t get_time_now(size_t mboard = 0) = 0;
241 
242  /*!
243  * Get the time when the last pps pulse occured.
244  * \param mboard the motherboard index 0 to M-1
245  * \return the current smini time
246  */
247  virtual shd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
248 
249  /*!
250  * Sets the time registers immediately.
251  * \param time_spec the new time
252  * \param mboard the motherboard index 0 to M-1
253  */
254  virtual void set_time_now(const shd::time_spec_t &time_spec,
255  size_t mboard = 0) = 0;
256 
257  /*!
258  * Set the time registers at the next pps.
259  * \param time_spec the new time
260  */
261  virtual void set_time_next_pps(const shd::time_spec_t &time_spec) = 0;
262 
263  /*!
264  * Sync the time registers with an unknown pps edge.
265  * \param time_spec the new time
266  */
267  virtual void set_time_unknown_pps(const shd::time_spec_t &time_spec) = 0;
268 
269  /*!
270  * Get access to the underlying shd dboard iface object.
271  * \return the dboard_iface object
272  */
273  virtual shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0;
274 
275  /*!
276  * Get access to the underlying shd device object.
277  * \return the multi smini device object
278  */
279  virtual shd::xmini::multi_xmini::sptr get_device(void) = 0;
280 };
281 
282 #endif /* INCLUDED_GR_SHD_SMINI_SINK_H */