UHD 003.001.002

include/uhd/usrp/multi_usrp.hpp

Go to the documentation of this file.
00001 //
00002 // Copyright 2010-2011 Ettus Research LLC
00003 //
00004 // This program is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #ifndef INCLUDED_UHD_USRP_MULTI_USRP_HPP
00019 #define INCLUDED_UHD_USRP_MULTI_USRP_HPP
00020 
00021 #include <uhd/config.hpp>
00022 #include <uhd/device.hpp>
00023 #include <uhd/types/ranges.hpp>
00024 #include <uhd/types/stream_cmd.hpp>
00025 #include <uhd/types/clock_config.hpp>
00026 #include <uhd/types/tune_request.hpp>
00027 #include <uhd/types/tune_result.hpp>
00028 #include <uhd/types/sensors.hpp>
00029 #include <uhd/usrp/subdev_spec.hpp>
00030 #include <uhd/usrp/dboard_iface.hpp>
00031 #include <uhd/usrp/mboard_iface.hpp>
00032 #include <boost/shared_ptr.hpp>
00033 #include <boost/utility.hpp>
00034 #include <vector>
00035 
00036 namespace uhd{ namespace usrp{
00037 
00084 class UHD_API multi_usrp : boost::noncopyable{
00085 public:
00086     typedef boost::shared_ptr<multi_usrp> sptr;
00087 
00089     static const size_t ALL_MBOARDS = size_t(~0);
00090 
00092     static const size_t ALL_CHANS = size_t(~0);
00093 
00095     static const std::string ALL_GAINS;
00096 
00102     static sptr make(const device_addr_t &dev_addr);
00103 
00109     virtual device::sptr get_device(void) = 0;
00110 
00111     /*******************************************************************
00112      * Mboard methods
00113      ******************************************************************/
00114 
00125     virtual void set_master_clock_rate(double rate, size_t mboard = ALL_MBOARDS) = 0;
00126 
00132     virtual double get_master_clock_rate(size_t mboard = 0) = 0;
00133 
00138     virtual std::string get_pp_string(void) = 0;
00139 
00145     virtual std::string get_mboard_name(size_t mboard = 0) = 0;
00146 
00152     virtual time_spec_t get_time_now(size_t mboard = 0) = 0;
00153 
00159     virtual time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
00160 
00172     virtual void set_time_now(const time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0;
00173 
00185     virtual void set_time_next_pps(const time_spec_t &time_spec) = 0;
00186 
00202     virtual void set_time_unknown_pps(const time_spec_t &time_spec) = 0;
00203 
00210     virtual bool get_time_synchronized(void) = 0;
00211 
00224     virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd, size_t chan = ALL_CHANS) = 0;
00225 
00233     virtual void set_clock_config(const clock_config_t &clock_config, size_t mboard = ALL_MBOARDS) = 0;
00234 
00238     virtual size_t get_num_mboards(void) = 0;
00239 
00246     virtual sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard = 0) = 0;
00247 
00253     virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
00254     
00259     virtual mboard_iface::sptr get_mboard_iface(size_t mboard) = 0;
00260 
00261     /*******************************************************************
00262      * RX methods
00263      ******************************************************************/
00272     virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0;
00273 
00279     virtual uhd::usrp::subdev_spec_t get_rx_subdev_spec(size_t mboard = 0) = 0;
00280 
00286     virtual size_t get_rx_num_channels(void) = 0;
00287 
00293     virtual std::string get_rx_subdev_name(size_t chan = 0) = 0;
00294 
00300     virtual void set_rx_rate(double rate, size_t chan = ALL_CHANS) = 0;
00301 
00307     virtual double get_rx_rate(size_t chan = 0) = 0;
00308 
00315     virtual tune_result_t set_rx_freq(
00316         const tune_request_t &tune_request, size_t chan = 0
00317     ) = 0;
00318 
00324     virtual double get_rx_freq(size_t chan = 0) = 0;
00325 
00331     virtual freq_range_t get_rx_freq_range(size_t chan = 0) = 0;
00332 
00340     virtual void set_rx_gain(double gain, const std::string &name, size_t chan = 0) = 0;
00341 
00343     void set_rx_gain(double gain, size_t chan = 0){
00344         return this->set_rx_gain(gain, ALL_GAINS, chan);
00345     }
00346 
00354     virtual double get_rx_gain(const std::string &name, size_t chan = 0) = 0;
00355 
00357     double get_rx_gain(size_t chan = 0){
00358         return this->get_rx_gain(ALL_GAINS, chan);
00359     }
00360 
00368     virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan = 0) = 0;
00369 
00371     gain_range_t get_rx_gain_range(size_t chan = 0){
00372         return this->get_rx_gain_range(ALL_GAINS, chan);
00373     }
00374 
00381     virtual std::vector<std::string> get_rx_gain_names(size_t chan = 0) = 0;
00382 
00388     virtual void set_rx_antenna(const std::string &ant, size_t chan = 0) = 0;
00389 
00395     virtual std::string get_rx_antenna(size_t chan = 0) = 0;
00396 
00402     virtual std::vector<std::string> get_rx_antennas(size_t chan = 0) = 0;
00403 
00409     UHD_DEPRECATED bool get_rx_lo_locked(size_t chan = 0){
00410         return this->get_rx_sensor("lo_locked", chan).to_bool();
00411     }
00412 
00418     virtual void set_rx_bandwidth(double bandwidth, size_t chan = 0) = 0;
00419 
00425     virtual double get_rx_bandwidth(size_t chan = 0) = 0;
00426 
00433     UHD_DEPRECATED double read_rssi(size_t chan = 0){
00434         return this->get_rx_sensor("rssi", chan).to_real();
00435     }
00436 
00444     virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0;
00445 
00452     virtual sensor_value_t get_rx_sensor(const std::string &name, size_t chan = 0) = 0;
00453 
00459     virtual std::vector<std::string> get_rx_sensor_names(size_t chan = 0) = 0;
00460 
00461     /*******************************************************************
00462      * TX methods
00463      ******************************************************************/
00472     virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0;
00473 
00479     virtual uhd::usrp::subdev_spec_t get_tx_subdev_spec(size_t mboard = 0) = 0;
00480 
00486     virtual size_t get_tx_num_channels(void) = 0;
00487 
00493     virtual std::string get_tx_subdev_name(size_t chan = 0) = 0;
00494 
00500     virtual void set_tx_rate(double rate, size_t chan = ALL_CHANS) = 0;
00501 
00507     virtual double get_tx_rate(size_t chan = 0) = 0;
00508 
00515     virtual tune_result_t set_tx_freq(
00516         const tune_request_t &tune_request, size_t chan = 0
00517     ) = 0;
00518 
00524     virtual double get_tx_freq(size_t chan = 0) = 0;
00525 
00531     virtual freq_range_t get_tx_freq_range(size_t chan = 0) = 0;
00532 
00540     virtual void set_tx_gain(double gain, const std::string &name, size_t chan = 0) = 0;
00541 
00543     void set_tx_gain(double gain, size_t chan = 0){
00544         return this->set_tx_gain(gain, ALL_GAINS, chan);
00545     }
00546 
00554     virtual double get_tx_gain(const std::string &name, size_t chan = 0) = 0;
00555 
00557     double get_tx_gain(size_t chan = 0){
00558         return this->get_tx_gain(ALL_GAINS, chan);
00559     }
00560 
00568     virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan = 0) = 0;
00569 
00571     gain_range_t get_tx_gain_range(size_t chan = 0){
00572         return this->get_tx_gain_range(ALL_GAINS, chan);
00573     }
00574 
00581     virtual std::vector<std::string> get_tx_gain_names(size_t chan = 0) = 0;
00582 
00588     virtual void set_tx_antenna(const std::string &ant, size_t chan = 0) = 0;
00589 
00595     virtual std::string get_tx_antenna(size_t chan = 0) = 0;
00596 
00602     virtual std::vector<std::string> get_tx_antennas(size_t chan = 0) = 0;
00603 
00609     UHD_DEPRECATED bool get_tx_lo_locked(size_t chan = 0){
00610         return this->get_tx_sensor("lo_locked", chan).to_bool();
00611     }
00612 
00618     virtual void set_tx_bandwidth(double bandwidth, size_t chan = 0) = 0;
00619 
00625     virtual double get_tx_bandwidth(size_t chan = 0) = 0;
00626 
00634     virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0;
00635 
00642     virtual sensor_value_t get_tx_sensor(const std::string &name, size_t chan = 0) = 0;
00643 
00649     virtual std::vector<std::string> get_tx_sensor_names(size_t chan = 0) = 0;
00650 };
00651 
00652 }}
00653 
00654 #endif /* INCLUDED_UHD_USRP_MULTI_USRP_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines