USRP Hardware Driver and USRP Manual: antenna_iface.hpp Source File

| USRP Hardware Driver and USRP Manual Version: 4.9.0.makepkg-0-g9ec1f582 UHD and USRP Manual |

Loading...
Searching...
No Matches
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>
10#include <uhd/rfnoc/rf_control/core_iface.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
21 class UHD_API antenna_iface
22{
23public:
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
50 class UHD_API enumerated_antenna : public antenna_iface
51{
52public:
53 using prop_path = std::function<fs_path(const size_t chan)>;
54
62 enumerated_antenna(uhd::property_tree::sptr tree,
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
73private:
74 // The property tree & node used to implement the API
75 uhd::property_tree::sptr _tree;
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
85 class UHD_API antenna_radio_control_mixin : virtual public core_iface
86{
87public:
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
97protected:
98 antenna_iface::sptr _rx_antenna;
99 antenna_iface::sptr _tx_antenna;
100};
101
102}}} // namespace uhd::rfnoc::rf_control
uhd::property_tree::sptr
std::shared_ptr< property_tree > sptr
Definition property_tree.hpp:224
uhd::rfnoc::rf_control::antenna_iface
Definition antenna_iface.hpp:22
uhd::rfnoc::rf_control::antenna_iface::set_antenna
virtual void set_antenna(const std::string &ant, const size_t chan)=0
uhd::rfnoc::rf_control::antenna_iface::sptr
std::shared_ptr< antenna_iface > sptr
Definition antenna_iface.hpp:24
uhd::rfnoc::rf_control::antenna_iface::get_antennas
virtual std::vector< std::string > get_antennas(const size_t chan) const =0
uhd::rfnoc::rf_control::antenna_iface::~antenna_iface
virtual ~antenna_iface()=default
uhd::rfnoc::rf_control::antenna_iface::get_antenna
virtual std::string get_antenna(const size_t chan) const =0
uhd::rfnoc::rf_control::antenna_radio_control_mixin
Definition antenna_iface.hpp:86
uhd::rfnoc::rf_control::antenna_radio_control_mixin::_tx_antenna
antenna_iface::sptr _tx_antenna
Definition antenna_iface.hpp:99
uhd::rfnoc::rf_control::antenna_radio_control_mixin::~antenna_radio_control_mixin
virtual ~antenna_radio_control_mixin()=default
uhd::rfnoc::rf_control::antenna_radio_control_mixin::get_tx_antennas
std::vector< std::string > get_tx_antennas(const size_t chan) const override
uhd::rfnoc::rf_control::antenna_radio_control_mixin::get_tx_antenna
std::string get_tx_antenna(const size_t chan) const override
uhd::rfnoc::rf_control::antenna_radio_control_mixin::get_rx_antenna
std::string get_rx_antenna(const size_t chan) const override
uhd::rfnoc::rf_control::antenna_radio_control_mixin::set_tx_antenna
void set_tx_antenna(const std::string &ant, const size_t chan) override
uhd::rfnoc::rf_control::antenna_radio_control_mixin::set_rx_antenna
void set_rx_antenna(const std::string &ant, const size_t chan) override
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_radio_control_mixin::get_rx_antennas
std::vector< std::string > get_rx_antennas(const size_t chan) const override
uhd::rfnoc::rf_control::core_iface
Definition core_iface.hpp:26
uhd::rfnoc::rf_control::enumerated_antenna::~enumerated_antenna
virtual ~enumerated_antenna()=default
uhd::rfnoc::rf_control::enumerated_antenna::get_antenna
std::string get_antenna(const size_t chan) const override
uhd::rfnoc::rf_control::enumerated_antenna::enumerated_antenna
enumerated_antenna(uhd::property_tree::sptr tree, prop_path prop_path_generator, const std::vector< std::string > &possible_antennas, const std::unordered_map< std::string, std::string > &compat_map)
uhd::rfnoc::rf_control::enumerated_antenna::set_antenna
void set_antenna(const std::string &ant, const size_t chan) override
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::enumerated_antenna::get_antennas
std::vector< std::string > get_antennas(const size_t chan) const override
UHD_API
#define UHD_API
Definition config.h:87
core_iface.hpp
uhd::rfnoc::rf_control
Definition antenna_iface.hpp:17
uhd::rfnoc
Definition actions.hpp:24
uhd
Definition build_info.hpp:12
property_tree.hpp
uhd::fs_path
Definition property_tree.hpp:207