GNU Radio 3.5.1 C++ API
gr_shd_smini_source.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_SOURCE_H
00023 #define INCLUDED_GR_SHD_SMINI_SOURCE_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_source;
00030 
00031 GR_SHD_API boost::shared_ptr<shd_smini_source> shd_make_smini_source(
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_source : 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,
00047                                size_t mboard = 0) = 0;
00048   
00049   /*!
00050    * Set the sample rate for the smini device.
00051    * \param rate a new rate in Sps
00052    */
00053   virtual void set_samp_rate(double rate) = 0;
00054 
00055   /*!
00056    * Get the sample rate for the smini device.
00057    * This is the actual sample rate and may differ from the rate set.
00058    * \return the actual rate in Sps
00059    */
00060   virtual double get_samp_rate(void) = 0;
00061   
00062   /*!
00063    * Tune the smini device to the desired center frequency.
00064    * \param tune_request the tune request instructions
00065    * \param chan the channel index 0 to N-1
00066    * \return a tune result with the actual frequencies
00067    */
00068   virtual shd::tune_result_t set_center_freq(
00069         const shd::tune_request_t tune_request,
00070         size_t chan = 0
00071     ) = 0;
00072   
00073   /*!
00074    * Tune the smini device to the desired center frequency.
00075    * This is a wrapper around set center freq so that in this case,
00076    * the user can pass a single frequency in the call through swig.
00077    * \param freq the desired frequency in Hz
00078    * \param chan the channel index 0 to N-1
00079    * \return a tune result with the actual frequencies
00080    */
00081   shd::tune_result_t set_center_freq(double freq, size_t chan = 0){
00082     return set_center_freq(shd::tune_request_t(freq), chan);
00083   }
00084   
00085   /*!
00086    * Get the center frequency.
00087    * \param chan the channel index 0 to N-1
00088    * \return the frequency in Hz
00089    */
00090   virtual double get_center_freq(size_t chan = 0) = 0;
00091   
00092   /*!
00093    * Get the tunable frequency range.
00094    * \param chan the channel index 0 to N-1
00095    * \return the frequency range in Hz
00096    */
00097   virtual shd::freq_range_t get_freq_range(size_t chan = 0) = 0;
00098   
00099   /*!
00100    * Set the gain for the dboard.
00101    * \param gain the gain in dB
00102    * \param chan the channel index 0 to N-1
00103    */
00104   virtual void set_gain(double gain, size_t chan = 0) = 0;
00105   
00106   /*!
00107    * Set the named gain on the dboard.
00108    * \param gain the gain in dB
00109    * \param name the name of the gain stage
00110    * \param chan the channel index 0 to N-1
00111    */
00112   virtual void set_gain(double gain, const std::string &name,
00113                         size_t chan = 0) = 0;
00114   
00115   /*!
00116    * Get the actual dboard gain setting.
00117    * \param chan the channel index 0 to N-1
00118    * \return the actual gain in dB
00119    */
00120   virtual double get_gain(size_t chan = 0) = 0;
00121   
00122   /*!
00123    * Get the actual dboard gain setting of named stage.
00124    * \param name the name of the gain stage
00125    * \param chan the channel index 0 to N-1
00126    * \return the actual gain in dB
00127    */
00128   virtual double get_gain(const std::string &name,
00129                           size_t chan = 0) = 0;
00130   
00131   /*!
00132    * Get the actual dboard gain setting of named stage.
00133    * \param chan the channel index 0 to N-1
00134    * \return the actual gain in dB
00135    */
00136   virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0;
00137   
00138   /*!
00139    * Get the settable gain range.
00140    * \param chan the channel index 0 to N-1
00141    * \return the gain range in dB
00142    */
00143   virtual shd::gain_range_t get_gain_range(size_t chan = 0) = 0;
00144   
00145   /*!
00146    * Get the settable gain range.
00147    * \param name the name of the gain stage
00148    * \param chan the channel index 0 to N-1
00149    * \return the gain range in dB
00150    */
00151   virtual shd::gain_range_t get_gain_range(const std::string &name,
00152                                            size_t chan = 0) = 0;
00153   
00154   /*!
00155    * Set the antenna to use.
00156    * \param ant the antenna string
00157    * \param chan the channel index 0 to N-1
00158    */
00159   virtual void set_antenna(const std::string &ant,
00160                            size_t chan = 0) = 0;
00161   
00162   /*!
00163    * Get the antenna in use.
00164    * \param chan the channel index 0 to N-1
00165    * \return the antenna string
00166    */
00167   virtual std::string get_antenna(size_t chan = 0) = 0;
00168   
00169   /*!
00170    * Get a list of possible antennas.
00171    * \param chan the channel index 0 to N-1
00172    * \return a vector of antenna strings
00173    */
00174   virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
00175   
00176   /*!
00177    * Set the subdevice bandpass filter.
00178    * \param bandwidth the filter bandwidth in Hz
00179    * \param chan the channel index 0 to N-1
00180    */
00181   virtual void set_bandwidth(double bandwidth,
00182                              size_t chan = 0) = 0;
00183   
00184   /*!
00185    * Get a daughterboard sensor value.
00186    * \param name the name of the sensor
00187    * \param chan the channel index 0 to N-1
00188    * \return a sensor value object
00189    */
00190   virtual shd::sensor_value_t get_dboard_sensor(const std::string &name,
00191                                                 size_t chan = 0) = 0;
00192   
00193   /*!
00194    * Get a list of possible daughterboard sensor names.
00195    * \param chan the channel index 0 to N-1
00196    * \return a vector of sensor names
00197    */
00198   virtual std::vector<std::string> get_dboard_sensor_names(size_t chan = 0) = 0;
00199   
00200   /*!
00201    * Get a motherboard sensor value.
00202    * \param name the name of the sensor
00203    * \param mboard the motherboard index 0 to M-1
00204    * \return a sensor value object
00205    */
00206   virtual shd::sensor_value_t get_mboard_sensor(const std::string &name,
00207                                                 size_t mboard = 0) = 0;
00208   
00209   /*!
00210    * Get a list of possible motherboard sensor names.
00211    * \param mboard the motherboard index 0 to M-1
00212    * \return a vector of sensor names
00213    */
00214   virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
00215   
00216   /*!
00217    * Set the clock configuration.
00218    * \param clock_config the new configuration
00219    * \param mboard the motherboard index 0 to M-1
00220    */
00221   virtual void set_clock_config(const shd::clock_config_t &clock_config,
00222                                 size_t mboard = 0) = 0;
00223   
00224   /*!
00225    * Get the master clock rate.
00226    * \param mboard the motherboard index 0 to M-1
00227    * \return the clock rate in Hz
00228    */
00229   virtual double get_clock_rate(size_t mboard = 0) = 0;
00230   
00231   /*!
00232    * Set the master clock rate.
00233    * \param rate the new rate in Hz
00234    * \param mboard the motherboard index 0 to M-1
00235    */
00236   virtual void set_clock_rate(double rate,
00237                               size_t mboard = 0) = 0;
00238 
00239   /*!
00240    * Get the current time registers.
00241    * \param mboard the motherboard index 0 to M-1
00242    * \return the current smini time
00243    */
00244   virtual shd::time_spec_t get_time_now(size_t mboard = 0) = 0;
00245   
00246   /*!
00247    * Get the time when the last pps pulse occured.
00248    * \param mboard the motherboard index 0 to M-1
00249    * \return the current smini time
00250    */
00251   virtual shd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
00252   
00253   /*!
00254    * Sets the time registers immediately.
00255    * \param time_spec the new time
00256    * \param mboard the motherboard index 0 to M-1
00257    */
00258   virtual void set_time_now(const shd::time_spec_t &time_spec,
00259                             size_t mboard = 0) = 0;
00260 
00261   /*!
00262    * Set the time registers at the next pps.
00263    * \param time_spec the new time
00264    */
00265   virtual void set_time_next_pps(const shd::time_spec_t &time_spec) = 0;
00266   
00267   /*!
00268    * Sync the time registers with an unknown pps edge.
00269    * \param time_spec the new time
00270    */
00271   virtual void set_time_unknown_pps(const shd::time_spec_t &time_spec) = 0;
00272   
00273   /*!
00274    * Get access to the underlying shd dboard iface object.
00275    * \return the dboard_iface object
00276    */
00277   virtual shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0;
00278   
00279   /*!
00280    * Get access to the underlying shd device object.
00281    * \return the multi smini device object
00282    */
00283   virtual shd::xmini::multi_xmini::sptr get_device(void) = 0;
00284 };
00285 
00286 #endif /* INCLUDED_GR_SHD_SMINI_SOURCE_H */