diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2021-01-06 11:34:05 -0600 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-01-11 12:23:24 -0600 |
commit | c9b35e3b7107ab82c0e3978b7cbfd76ba98e2407 (patch) | |
tree | 3e161a882f8005baf04b3a802dc7636a579643e2 /host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp | |
parent | 7f765f4f2be719473ee329c00f7125a785057deb (diff) | |
download | uhd-c9b35e3b7107ab82c0e3978b7cbfd76ba98e2407.tar.gz uhd-c9b35e3b7107ab82c0e3978b7cbfd76ba98e2407.tar.bz2 uhd-c9b35e3b7107ab82c0e3978b7cbfd76ba98e2407.zip |
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.
Diffstat (limited to 'host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp')
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp | 17 |
1 files changed, 12 insertions, 5 deletions
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 <uhd/rfnoc/mb_controller.hpp> +#include <uhdlib/usrp/common/rpc.hpp> #include <uhdlib/utils/rpc.hpp> #include <memory> @@ -23,12 +24,18 @@ class mpmd_mb_controller : public mb_controller public: using sptr = std::shared_ptr<mpmd_mb_controller>; - 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<typename T> + std::shared_ptr<T> dynamic_cast_rpc_as() + { + return std::dynamic_pointer_cast<T>(_rpc); } /************************************************************************** @@ -42,7 +49,7 @@ public: public: using sptr = std::shared_ptr<mpmd_timekeeper>; - 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; |