// // Copyright 2021 Ettus Research, a National Instruments Brand // // SPDX-License-Identifier: GPL-3.0-or-later // #include #include #include #include #include #include #include namespace uhd { namespace rfnoc { namespace rf_control { enumerated_antenna::enumerated_antenna(uhd::property_tree::sptr tree, prop_path prop_path_generator, const std::vector& possible_antennas, const std::unordered_map& compat_map) : _tree(tree) , _prop_path_generator(prop_path_generator) , _possible_antennas(possible_antennas) , _compat_map(compat_map) { } std::vector enumerated_antenna::get_antennas(const size_t) const { return _possible_antennas; } void enumerated_antenna::set_antenna(const std::string& ant, const size_t chan) { if (!_compat_map.count(ant)) { assert_has(_possible_antennas, ant, "antenna"); } auto path = _prop_path_generator(chan); _tree->access(path).set(ant); } std::string enumerated_antenna::get_antenna(const size_t chan) const { auto path = _prop_path_generator(chan); return _tree->access(path).get(); } std::string antenna_radio_control_mixin::get_tx_antenna(const size_t chan) const { return _tx_antenna->get_antenna(chan); } std::vector antenna_radio_control_mixin::get_tx_antennas( const size_t chan) const { return _tx_antenna->get_antennas(chan); } void antenna_radio_control_mixin::set_tx_antenna( const std::string& ant, const size_t chan) { _tx_antenna->set_antenna(ant, chan); } std::string antenna_radio_control_mixin::get_rx_antenna(const size_t chan) const { return _rx_antenna->get_antenna(chan); } std::vector antenna_radio_control_mixin::get_rx_antennas( const size_t chan) const { return _rx_antenna->get_antennas(chan); } void antenna_radio_control_mixin::set_rx_antenna( const std::string& ant, const size_t chan) { _rx_antenna->set_antenna(ant, chan); } }}} // namespace uhd::rfnoc::rf_control