From c9b35e3b7107ab82c0e3978b7cbfd76ba98e2407 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Wed, 6 Jan 2021 11:34:05 -0600 Subject: Create C++ wrappers for MPM RPC calls This gives us type-safety, as well as allowing us to create unit tests for RFNoC radio_controls without having to create actual RPC servers and clients in the unit tests. This change also fixes a bug in mpmd_mb_controller::set_sync_source, where it was calling the wrong MPM function. --- .../include/uhdlib/usrp/common/mpmd_mb_controller.hpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp') diff --git a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp index 7285eb254..acdd361e4 100644 --- a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp +++ b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include @@ -23,12 +24,18 @@ class mpmd_mb_controller : public mb_controller public: using sptr = std::shared_ptr; - mpmd_mb_controller(uhd::rpc_client::sptr rpcc, uhd::device_addr_t device_info); + mpmd_mb_controller(uhd::usrp::mpmd_rpc_iface::sptr rpcc, uhd::device_addr_t device_info); //! Return reference to the RPC client uhd::rpc_client::sptr get_rpc_client() { - return _rpc; + return _rpc->get_raw_rpc_client(); + } + + template + std::shared_ptr dynamic_cast_rpc_as() + { + return std::dynamic_pointer_cast(_rpc); } /************************************************************************** @@ -42,7 +49,7 @@ public: public: using sptr = std::shared_ptr; - mpmd_timekeeper(const size_t tk_idx, uhd::rpc_client::sptr rpc_client) + mpmd_timekeeper(const size_t tk_idx, uhd::usrp::mpmd_rpc_iface::sptr rpc_client) : _tk_idx(tk_idx), _rpc(rpc_client) { // nop @@ -62,7 +69,7 @@ public: private: const size_t _tk_idx; - uhd::rpc_client::sptr _rpc; + uhd::usrp::mpmd_rpc_iface::sptr _rpc; }; /************************************************************************** @@ -94,7 +101,7 @@ private: * Attributes *************************************************************************/ //! Reference to RPC interface - mutable uhd::rpc_client::sptr _rpc; + mutable uhd::usrp::mpmd_rpc_iface::sptr _rpc; uhd::device_addr_t _device_info; -- cgit v1.2.3