From 96a2061a59c913bc48f50ba89471519809c7629a Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 21 Nov 2017 15:14:31 -0800 Subject: mg: ad9371: Add shortcut for RPC requests --- .../dboard/magnesium/magnesium_ad9371_iface.cpp | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp') diff --git a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp index e6ad6ab57..9a91a316a 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp @@ -51,12 +51,7 @@ double magnesium_ad9371_iface::set_frequency( ) { // Note: This sets the frequency for both channels (1 and 2). auto which = _get_which(dir, chan); - UHD_LOG_TRACE(_L, - "Calling " << _rpc_prefix << "set_freq on " - << which << " with " << freq); - auto actual_freq = - _rpcc->request_with_token(_rpc_prefix + "set_freq", - which, freq, false); + auto actual_freq = request("set_freq", which, freq, false); UHD_LOG_TRACE(_L, _rpc_prefix << "set_freq returned " << actual_freq); return actual_freq; @@ -68,8 +63,7 @@ double magnesium_ad9371_iface::set_gain( const direction_t dir ) { auto which = _get_which(dir, chan); - UHD_LOG_TRACE(_L, "Calling " << _rpc_prefix << "set_gain on " << which << " with " << gain); - auto retval = _rpcc->request_with_token(_rpc_prefix + "set_gain", which, gain); + auto retval = request("set_gain", which, gain); UHD_LOG_TRACE(_L, _rpc_prefix << "set_gain returned " << retval); return retval; @@ -89,8 +83,7 @@ double magnesium_ad9371_iface::get_frequency( const direction_t dir ) { auto which = _get_which(dir, chan); - UHD_LOG_TRACE(_L, "calling " << _rpc_prefix << "get_freq on " << which); - auto retval = _rpcc->request_with_token(_rpc_prefix + "get_freq", which); + auto retval = request("get_freq", which); UHD_LOG_TRACE(_L, _rpc_prefix << "get_freq returned " << retval); return retval; } @@ -98,8 +91,7 @@ double magnesium_ad9371_iface::get_frequency( double magnesium_ad9371_iface::get_gain(const size_t chan, const direction_t dir) { auto which = _get_which(dir, chan); - UHD_LOG_TRACE(_L, "calling " << _rpc_prefix << "get_gain on " << which); - auto retval = _rpcc->request_with_token(_rpc_prefix + "get_gain", which); + auto retval = request("get_gain", which); UHD_LOG_TRACE(_L, _rpc_prefix << "get_gain returned " << retval); return retval; } @@ -117,10 +109,7 @@ std::string magnesium_ad9371_iface::set_lo_source( ) { // There is only one LO for 2 channels. Using channel 0 for 'which' auto which = _get_which(dir, 0); - UHD_LOG_TRACE(_L, "calling " << _rpc_prefix << "set_lo_source " - << which << "with " << source); - auto retval = _rpcc->request_with_token( - _rpc_prefix + "set_lo_source", which, source); + auto retval = request("set_lo_source", which, source); UHD_LOG_TRACE(_L, _rpc_prefix << "set_lo_source returned " << retval); return retval; } @@ -129,10 +118,8 @@ std::string magnesium_ad9371_iface::get_lo_source( const uhd::direction_t dir ) { // There is only one LO for 2 channels. Using channel 0 for 'which' - auto which = _get_which(dir,0); - UHD_LOG_TRACE(_L, "calling " << _rpc_prefix << "get_lo_source " << which); - auto retval = _rpcc->request_with_token( - _rpc_prefix + "get_lo_source", which); + auto which = _get_which(dir, 0); + auto retval = request("get_lo_source", which); UHD_LOG_TRACE(_L, _rpc_prefix << "get_lo_source returned " << retval); return retval; } -- cgit v1.2.3