GNU Radio 3.5.1 C++ API
gr_shd_smini_sink.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011 Free Software Foundation, Inc.
00003  * 
00004  * This file is part of GNU Radio
00005  * 
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  * 
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_GR_SHD_SMINI_SINK_H
00023 #define INCLUDED_GR_SHD_SMINI_SINK_H
00024 
00025 #include <gr_shd_api.h>
00026 #include <gr_sync_block.h>
00027 #include <shd/xmini/multi_xmini.hpp>
00028 
00029 class shd_smini_sink;
00030 
00031 GR_SHD_API boost::shared_ptr<shd_smini_sink> shd_make_smini_sink(
00032     const shd::device_addr_t &device_addr,
00033     const shd::io_type_t &io_type,
00034     size_t num_channels
00035 );
00036 
00037 class GR_SHD_API shd_smini_sink : virtual public gr_sync_block 
00038 {
00039  public:
00040   
00041   /*!
00042    * Set the subdevice specification.
00043    * \param spec the subdev spec markup string
00044    * \param mboard the motherboard index 0 to M-1
00045    */
00046   virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0;
00047   
00048   /*!
00049    * Set the sample rate for the smini device.
00050    * \param rate a new rate in Sps
00051    */
00052   virtual void set_samp_rate(double rate) = 0;
00053   
00054   /*!
00055    * Get the sample rate for the smini device.
00056    * This is the actual sample rate and may differ from the rate set.
00057    * \return the actual rate in Sps
00058    */
00059   virtual double get_samp_rate(void) = 0;
00060   
00061   /*!
00062    * Tune the smini device to the desired center frequency.
00063    * \param tune_request the tune request instructions
00064    * \param chan the channel index 0 to N-1
00065    * \return a tune result with the actual frequencies
00066    */
00067   virtual shd::tune_result_t set_center_freq(
00068         const shd::tune_request_t tune_request, size_t chan = 0
00069   ) = 0;
00070 
00071   /*!
00072    * Tune the smini device to the desired center frequency.
00073    * This is a wrapper around set center freq so that in this case,
00074    * the user can pass a single frequency in the call through swig.
00075    * \param freq the desired frequency in Hz
00076    * \param chan the channel index 0 to N-1
00077    * \return a tune result with the actual frequencies
00078    */
00079   shd::tune_result_t set_center_freq(double freq, size_t chan = 0){
00080     return set_center_freq(shd::tune_request_t(freq), chan);
00081   }
00082 
00083   /*!
00084    * Get the center frequency.
00085    * \param chan the channel index 0 to N-1
00086    * \return the frequency in Hz
00087    */
00088   virtual double get_center_freq(size_t chan = 0) = 0;
00089   
00090   /*!
00091    * Get the tunable frequency range.
00092    * \param chan the channel index 0 to N-1
00093    * \return the frequency range in Hz
00094    */
00095   virtual shd::freq_range_t get_freq_range(size_t chan = 0) = 0;
00096   
00097   /*!
00098    * Set the gain for the dboard.
00099    * \param gain the gain in dB
00100    * \param chan the channel index 0 to N-1
00101    */
00102   virtual void set_gain(double gain, size_t chan = 0) = 0;
00103 
00104   /*!
00105    * Set the named gain on the dboard.
00106    * \param gain the gain in dB
00107    * \param name the name of the gain stage
00108    * \param chan the channel index 0 to N-1
00109    */
00110   virtual void set_gain(double gain, const std::string &name,
00111                         size_t chan = 0) = 0;
00112 
00113   /*!
00114    * Get the actual dboard gain setting.
00115    * \param chan the channel index 0 to N-1
00116    * \return the actual gain in dB
00117    */
00118   virtual double get_gain(size_t chan = 0) = 0;
00119   
00120   /*!
00121    * Get the actual dboard gain setting of named stage.
00122    * \param name the name of the gain stage
00123    * \param chan the channel index 0 to N-1
00124    * \return the actual gain in dB
00125    */
00126   virtual double get_gain(const std::string &name,
00127                           size_t chan = 0) = 0;
00128 
00129   /*!
00130    * Get the actual dboard gain setting of named stage.
00131    * \param chan the channel index 0 to N-1
00132    * \return the actual gain in dB
00133    */
00134   virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0;
00135   
00136   /*!
00137    * Get the settable gain range.
00138    * \param chan the channel index 0 to N-1
00139    * \return the gain range in dB
00140    */
00141   virtual shd::gain_range_t get_gain_range(size_t chan = 0) = 0;
00142 
00143   /*!
00144    * Get the settable gain range.
00145    * \param name the name of the gain stage
00146    * \param chan the channel index 0 to N-1
00147    * \return the gain range in dB
00148    */
00149   virtual shd::gain_range_t get_gain_range(const std::string &name,
00150                                            size_t chan = 0) = 0;
00151   
00152   /*!
00153    * Set the antenna to use.
00154    * \param ant the antenna string
00155    * \param chan the channel index 0 to N-1
00156    */
00157   virtual void set_antenna(const std::string &ant,
00158                            size_t chan = 0) = 0;
00159   
00160   /*!
00161    * Get the antenna in use.
00162    * \param chan the channel index 0 to N-1
00163    * \return the antenna string
00164    */
00165   virtual std::string get_antenna(size_t chan = 0) = 0;
00166   
00167   /*!
00168    * Get a list of possible antennas.
00169    * \param chan the channel index 0 to N-1
00170    * \return a vector of antenna strings
00171    */
00172   virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
00173   
00174   /*!
00175    * Set the subdevice bandpass filter.
00176    * \param chan the channel index 0 to N-1
00177    * \param bandwidth the filter bandwidth in Hz
00178    */
00179   virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0;
00180 
00181   /*!
00182    * Get a daughterboard sensor value.
00183    * \param name the name of the sensor
00184    * \param chan the channel index 0 to N-1
00185    * \return a sensor value object
00186    */
00187   virtual shd::sensor_value_t get_dboard_sensor(const std::string &name,
00188                                                 size_t chan = 0) = 0;
00189   
00190   /*!
00191    * Get a list of possible daughterboard sensor names.
00192    * \param chan the channel index 0 to N-1
00193    * \return a vector of sensor names
00194    */
00195   virtual std::vector<std::string> get_dboard_sensor_names(size_t chan = 0) = 0;
00196   
00197   /*!
00198    * Get a motherboard sensor value.
00199    * \param name the name of the sensor
00200    * \param mboard the motherboard index 0 to M-1
00201    * \return a sensor value object
00202    */
00203   virtual shd::sensor_value_t get_mboard_sensor(const std::string &name,
00204                                                 size_t mboard = 0) = 0;
00205 
00206   /*!
00207    * Get a list of possible motherboard sensor names.
00208    * \param mboard the motherboard index 0 to M-1
00209    * \return a vector of sensor names
00210    */
00211   virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
00212 
00213   /*!
00214    * Set the clock configuration.
00215    * \param clock_config the new configuration
00216    * \param mboard the motherboard index 0 to M-1
00217    */
00218   virtual void set_clock_config(const shd::clock_config_t &clock_config,
00219                                 size_t mboard = 0) = 0;
00220 
00221   /*!
00222    * Get the master clock rate.
00223    * \param mboard the motherboard index 0 to M-1
00224    * \return the clock rate in Hz
00225    */
00226   virtual double get_clock_rate(size_t mboard = 0) = 0;
00227   
00228   /*!
00229    * Set the master clock rate.
00230    * \param rate the new rate in Hz
00231    * \param mboard the motherboard index 0 to M-1
00232    */
00233   virtual void set_clock_rate(double rate, size_t mboard = 0) = 0;
00234   
00235   /*!
00236    * Get the current time registers.
00237    * \param mboard the motherboard index 0 to M-1
00238    * \return the current smini time
00239    */
00240   virtual shd::time_spec_t get_time_now(size_t mboard = 0) = 0;
00241   
00242   /*!
00243    * Get the time when the last pps pulse occured.
00244    * \param mboard the motherboard index 0 to M-1
00245    * \return the current smini time
00246    */
00247   virtual shd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
00248   
00249   /*!
00250    * Sets the time registers immediately.
00251    * \param time_spec the new time
00252    * \param mboard the motherboard index 0 to M-1
00253    */
00254   virtual void set_time_now(const shd::time_spec_t &time_spec,
00255                             size_t mboard = 0) = 0;
00256 
00257   /*!
00258    * Set the time registers at the next pps.
00259    * \param time_spec the new time
00260    */
00261   virtual void set_time_next_pps(const shd::time_spec_t &time_spec) = 0;
00262   
00263   /*!
00264    * Sync the time registers with an unknown pps edge.
00265    * \param time_spec the new time
00266    */
00267   virtual void set_time_unknown_pps(const shd::time_spec_t &time_spec) = 0;
00268   
00269   /*!
00270    * Get access to the underlying shd dboard iface object.
00271    * \return the dboard_iface object
00272    */
00273   virtual shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0;
00274   
00275   /*!
00276    * Get access to the underlying shd device object.
00277    * \return the multi smini device object
00278    */
00279   virtual shd::xmini::multi_xmini::sptr get_device(void) = 0;
00280 };
00281 
00282 #endif /* INCLUDED_GR_SHD_SMINI_SINK_H */