Loading...
Searching...
No Matches
antenna_iface.hpp
Go to the documentation of this file.
//
// Copyright 2021 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/property_tree.hpp>
#include <uhd/rfnoc/rf_control/core_iface.hpp>
#include <unordered_map>
#include <functional>
#include <memory>
#include <string>
#include <vector>
namespace uhd { namespace rfnoc { namespace rf_control {
class UHD_API antenna_iface
{
public:
using sptr = std::shared_ptr<antenna_iface>;
virtual ~antenna_iface() = default;
virtual std::vector<std::string> get_antennas(const size_t chan) const = 0;
virtual void set_antenna(const std::string& ant, const size_t chan) = 0;
virtual std::string get_antenna(const size_t chan) const = 0;
};
class UHD_API enumerated_antenna : public antenna_iface
{
public:
using prop_path = std::function<fs_path(const size_t chan)>;
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);
virtual ~enumerated_antenna() = default;
std::vector<std::string> get_antennas(const size_t chan) const override;
void set_antenna(const std::string& ant, const size_t chan) override;
std::string get_antenna(const size_t chan) const override;
private:
// The property tree & node used to implement the API
uhd::property_tree::sptr _tree;
prop_path _prop_path_generator;
std::vector<std::string> _possible_antennas;
const std::unordered_map<std::string, std::string>& _compat_map;
};
class UHD_API antenna_radio_control_mixin : virtual public core_iface
{
public:
virtual ~antenna_radio_control_mixin() = default;
std::string get_tx_antenna(const size_t chan) const override;
std::vector<std::string> get_tx_antennas(const size_t chan) const override;
void set_tx_antenna(const std::string& ant, const size_t chan) override;
std::string get_rx_antenna(const size_t chan) const override;
std::vector<std::string> get_rx_antennas(const size_t chan) const override;
void set_rx_antenna(const std::string& ant, const size_t chan) override;
protected:
antenna_iface::sptr _rx_antenna;
antenna_iface::sptr _tx_antenna;
};
}}} // 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