USRP Hardware Driver and USRP Manual  Version: 4.4.0.HEAD-0-g5fac246b
UHD and USRP Manual
antenna_iface.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2021 Ettus Research, a National Instruments Brand
3 //
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 //
6 
7 #pragma once
8 
9 #include <uhd/property_tree.hpp>
11 #include <unordered_map>
12 #include <functional>
13 #include <memory>
14 #include <string>
15 #include <vector>
16 
17 namespace uhd { namespace rfnoc { namespace rf_control {
18 
22 {
23 public:
24  using sptr = std::shared_ptr<antenna_iface>;
25 
26  virtual ~antenna_iface() = default;
27 
32  virtual std::vector<std::string> get_antennas(const size_t chan) const = 0;
33 
38  virtual void set_antenna(const std::string& ant, const size_t chan) = 0;
39 
44  virtual std::string get_antenna(const size_t chan) const = 0;
45 };
46 
51 {
52 public:
53  using prop_path = std::function<fs_path(const size_t chan)>;
54 
63  prop_path prop_path_generator,
64  const std::vector<std::string>& possible_antennas,
65  const std::unordered_map<std::string, std::string>& compat_map);
66 
67  virtual ~enumerated_antenna() = default;
68 
69  std::vector<std::string> get_antennas(const size_t chan) const override;
70  void set_antenna(const std::string& ant, const size_t chan) override;
71  std::string get_antenna(const size_t chan) const override;
72 
73 private:
74  // The property tree & node used to implement the API
76  prop_path _prop_path_generator;
77 
78  std::vector<std::string> _possible_antennas;
79  const std::unordered_map<std::string, std::string>& _compat_map;
80 };
81 
86 {
87 public:
88  virtual ~antenna_radio_control_mixin() = default;
89 
90  std::string get_tx_antenna(const size_t chan) const override;
91  std::vector<std::string> get_tx_antennas(const size_t chan) const override;
92  void set_tx_antenna(const std::string& ant, const size_t chan) override;
93  std::string get_rx_antenna(const size_t chan) const override;
94  std::vector<std::string> get_rx_antennas(const size_t chan) const override;
95  void set_rx_antenna(const std::string& ant, const size_t chan) override;
96 
97 protected:
100 };
101 
102 }}} // namespace uhd::rfnoc::rf_control
uhd::rfnoc::rf_control::antenna_radio_control_mixin
Definition: antenna_iface.hpp:85
core_iface.hpp
property_tree.hpp
UHD_API
#define UHD_API
Definition: config.h:87
uhd::property_tree::sptr
std::shared_ptr< property_tree > sptr
Definition: property_tree.hpp:222
uhd::rfnoc::rf_control::enumerated_antenna::prop_path
std::function< fs_path(const size_t chan)> prop_path
Definition: antenna_iface.hpp:53
uhd::rfnoc::rf_control::antenna_iface
Definition: antenna_iface.hpp:21
uhd::rfnoc::rf_control::core_iface
Definition: core_iface.hpp:25
uhd::rfnoc::rf_control::enumerated_antenna
Definition: antenna_iface.hpp:50
uhd::rfnoc::rf_control::antenna_radio_control_mixin::_tx_antenna
antenna_iface::sptr _tx_antenna
Definition: antenna_iface.hpp:99
uhd
Definition: build_info.hpp:12
uhd::fs_path
Definition: property_tree.hpp:204
uhd::rfnoc::rf_control::antenna_radio_control_mixin::_rx_antenna
antenna_iface::sptr _rx_antenna
Definition: antenna_iface.hpp:98
uhd::rfnoc::rf_control::antenna_iface::sptr
std::shared_ptr< antenna_iface > sptr
Definition: antenna_iface.hpp:24