GNU Radio 3.6.2 C++ API
gr_shd_smini_source.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_SOURCE_H
23 #define INCLUDED_GR_SHD_SMINI_SOURCE_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_source;
30 
32  const shd::device_addr_t &device_addr,
33  const shd::io_type_t &io_type,
34  size_t num_channels
35 );
36 
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,
47  size_t mboard = 0) = 0;
48 
49  /*!
50  * Set the sample rate for the smini device.
51  * \param rate a new rate in Sps
52  */
53  virtual void set_samp_rate(double rate) = 0;
54 
55  /*!
56  * Get the sample rate for the smini device.
57  * This is the actual sample rate and may differ from the rate set.
58  * \return the actual rate in Sps
59  */
60  virtual double get_samp_rate(void) = 0;
61 
62  /*!
63  * Tune the smini device to the desired center frequency.
64  * \param tune_request the tune request instructions
65  * \param chan the channel index 0 to N-1
66  * \return a tune result with the actual frequencies
67  */
68  virtual shd::tune_result_t set_center_freq(
69  const shd::tune_request_t tune_request,
70  size_t chan = 0
71  ) = 0;
72 
73  /*!
74  * Tune the smini device to the desired center frequency.
75  * This is a wrapper around set center freq so that in this case,
76  * the user can pass a single frequency in the call through swig.
77  * \param freq the desired frequency in Hz
78  * \param chan the channel index 0 to N-1
79  * \return a tune result with the actual frequencies
80  */
81  shd::tune_result_t set_center_freq(double freq, size_t chan = 0){
82  return set_center_freq(shd::tune_request_t(freq), chan);
83  }
84 
85  /*!
86  * Get the center frequency.
87  * \param chan the channel index 0 to N-1
88  * \return the frequency in Hz
89  */
90  virtual double get_center_freq(size_t chan = 0) = 0;
91 
92  /*!
93  * Get the tunable frequency range.
94  * \param chan the channel index 0 to N-1
95  * \return the frequency range in Hz
96  */
97  virtual shd::freq_range_t get_freq_range(size_t chan = 0) = 0;
98 
99  /*!
100  * Set the gain for the dboard.
101  * \param gain the gain in dB
102  * \param chan the channel index 0 to N-1
103  */
104  virtual void set_gain(double gain, size_t chan = 0) = 0;
105 
106  /*!
107  * Set the named gain on the dboard.
108  * \param gain the gain in dB
109  * \param name the name of the gain stage
110  * \param chan the channel index 0 to N-1
111  */
112  virtual void set_gain(double gain, const std::string &name,
113  size_t chan = 0) = 0;
114 
115  /*!
116  * Get the actual dboard gain setting.
117  * \param chan the channel index 0 to N-1
118  * \return the actual gain in dB
119  */
120  virtual double get_gain(size_t chan = 0) = 0;
121 
122  /*!
123  * Get the actual dboard gain setting of named stage.
124  * \param name the name of the gain stage
125  * \param chan the channel index 0 to N-1
126  * \return the actual gain in dB
127  */
128  virtual double get_gain(const std::string &name,
129  size_t chan = 0) = 0;
130 
131  /*!
132  * Get the actual dboard gain setting of named stage.
133  * \param chan the channel index 0 to N-1
134  * \return the actual gain in dB
135  */
136  virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0;
137 
138  /*!
139  * Get the settable gain range.
140  * \param chan the channel index 0 to N-1
141  * \return the gain range in dB
142  */
143  virtual shd::gain_range_t get_gain_range(size_t chan = 0) = 0;
144 
145  /*!
146  * Get the settable gain range.
147  * \param name the name of the gain stage
148  * \param chan the channel index 0 to N-1
149  * \return the gain range in dB
150  */
151  virtual shd::gain_range_t get_gain_range(const std::string &name,
152  size_t chan = 0) = 0;
153 
154  /*!
155  * Set the antenna to use.
156  * \param ant the antenna string
157  * \param chan the channel index 0 to N-1
158  */
159  virtual void set_antenna(const std::string &ant,
160  size_t chan = 0) = 0;
161 
162  /*!
163  * Get the antenna in use.
164  * \param chan the channel index 0 to N-1
165  * \return the antenna string
166  */
167  virtual std::string get_antenna(size_t chan = 0) = 0;
168 
169  /*!
170  * Get a list of possible antennas.
171  * \param chan the channel index 0 to N-1
172  * \return a vector of antenna strings
173  */
174  virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
175 
176  /*!
177  * Set the subdevice bandpass filter.
178  * \param bandwidth the filter bandwidth in Hz
179  * \param chan the channel index 0 to N-1
180  */
181  virtual void set_bandwidth(double bandwidth,
182  size_t chan = 0) = 0;
183 
184  /*!
185  * Get a daughterboard sensor value.
186  * \param name the name of the sensor
187  * \param chan the channel index 0 to N-1
188  * \return a sensor value object
189  */
190  virtual shd::sensor_value_t get_dboard_sensor(const std::string &name,
191  size_t chan = 0) = 0;
192 
193  /*!
194  * Get a list of possible daughterboard sensor names.
195  * \param chan the channel index 0 to N-1
196  * \return a vector of sensor names
197  */
198  virtual std::vector<std::string> get_dboard_sensor_names(size_t chan = 0) = 0;
199 
200  /*!
201  * Get a motherboard sensor value.
202  * \param name the name of the sensor
203  * \param mboard the motherboard index 0 to M-1
204  * \return a sensor value object
205  */
206  virtual shd::sensor_value_t get_mboard_sensor(const std::string &name,
207  size_t mboard = 0) = 0;
208 
209  /*!
210  * Get a list of possible motherboard sensor names.
211  * \param mboard the motherboard index 0 to M-1
212  * \return a vector of sensor names
213  */
214  virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
215 
216  /*!
217  * Set the clock configuration.
218  * \param clock_config the new configuration
219  * \param mboard the motherboard index 0 to M-1
220  */
221  virtual void set_clock_config(const shd::clock_config_t &clock_config,
222  size_t mboard = 0) = 0;
223 
224  /*!
225  * Get the master clock rate.
226  * \param mboard the motherboard index 0 to M-1
227  * \return the clock rate in Hz
228  */
229  virtual double get_clock_rate(size_t mboard = 0) = 0;
230 
231  /*!
232  * Set the master clock rate.
233  * \param rate the new rate in Hz
234  * \param mboard the motherboard index 0 to M-1
235  */
236  virtual void set_clock_rate(double rate,
237  size_t mboard = 0) = 0;
238 
239  /*!
240  * Get the current time registers.
241  * \param mboard the motherboard index 0 to M-1
242  * \return the current smini time
243  */
244  virtual shd::time_spec_t get_time_now(size_t mboard = 0) = 0;
245 
246  /*!
247  * Get the time when the last pps pulse occured.
248  * \param mboard the motherboard index 0 to M-1
249  * \return the current smini time
250  */
251  virtual shd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
252 
253  /*!
254  * Sets the time registers immediately.
255  * \param time_spec the new time
256  * \param mboard the motherboard index 0 to M-1
257  */
258  virtual void set_time_now(const shd::time_spec_t &time_spec,
259  size_t mboard = 0) = 0;
260 
261  /*!
262  * Set the time registers at the next pps.
263  * \param time_spec the new time
264  */
265  virtual void set_time_next_pps(const shd::time_spec_t &time_spec) = 0;
266 
267  /*!
268  * Sync the time registers with an unknown pps edge.
269  * \param time_spec the new time
270  */
271  virtual void set_time_unknown_pps(const shd::time_spec_t &time_spec) = 0;
272 
273  /*!
274  * Get access to the underlying shd dboard iface object.
275  * \return the dboard_iface object
276  */
277  virtual shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0;
278 
279  /*!
280  * Get access to the underlying shd device object.
281  * \return the multi smini device object
282  */
283  virtual shd::xmini::multi_xmini::sptr get_device(void) = 0;
284 };
285 
286 #endif /* INCLUDED_GR_SHD_SMINI_SOURCE_H */