From b9f9ca2d0fd43f2a55e4ed5301070585cbb1be3c Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 6 Aug 2020 20:55:35 +0200 Subject: uhd: Add APIs for getting the available power range The previously added APIs for getting/setting power reference levels was missing an option to read back the currently available power levels (minimum and maximum power levels). This adds getters for TX and RX power ranges to multi_usrp and radio_control. The power API is thus now more similar to the gain API, which always had getters for gain ranges. --- host/lib/rfnoc/radio_control_impl.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'host/lib/rfnoc') diff --git a/host/lib/rfnoc/radio_control_impl.cpp b/host/lib/rfnoc/radio_control_impl.cpp index 23a885a83..61937e080 100644 --- a/host/lib/rfnoc/radio_control_impl.cpp +++ b/host/lib/rfnoc/radio_control_impl.cpp @@ -636,6 +636,24 @@ std::vector radio_control_impl::get_tx_power_ref_keys(const size_t return {_tx_pwr_mgr.at(chan)->get_key(), _tx_pwr_mgr.at(chan)->get_serial()}; } +uhd::meta_range_t radio_control_impl::get_rx_power_range(const size_t chan) +{ + if (_rx_pwr_mgr.empty()) { + throw uhd::not_implemented_error( + "get_rx_power_range() is not supported on this radio!"); + } + return _rx_pwr_mgr.at(chan)->get_power_range(); +} + +uhd::meta_range_t radio_control_impl::get_tx_power_range(const size_t chan) +{ + if (_tx_pwr_mgr.empty()) { + throw uhd::not_implemented_error( + "get_tx_power_range() is not supported on this radio!"); + } + return _tx_pwr_mgr.at(chan)->get_power_range(); +} + /****************************************************************************** * LO Default API -- cgit v1.2.3