aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mpmd/mpmd_impl.hpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-09 12:13:44 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2018-02-07 15:46:43 -0800
commit14babab1bd54e1ecd9de9153db58a655833a0e4a (patch)
tree6661ac0563acb94a11d1e7fee508b54d43c227f4 /host/lib/usrp/mpmd/mpmd_impl.hpp
parent852bf3aa10613e80a8b9434b2d69f967b53a2d97 (diff)
downloaduhd-14babab1bd54e1ecd9de9153db58a655833a0e4a.tar.gz
uhd-14babab1bd54e1ecd9de9153db58a655833a0e4a.tar.bz2
uhd-14babab1bd54e1ecd9de9153db58a655833a0e4a.zip
mpmd: Let 'find' via broadcast check for reachability
In particular, when running uhd_find_devices, this will limit the devices to ones that can actually be reached via CHDR. There is a new key, find_all, which allows finding all devices even those not reachable from UHD. Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
Diffstat (limited to 'host/lib/usrp/mpmd/mpmd_impl.hpp')
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.hpp b/host/lib/usrp/mpmd/mpmd_impl.hpp
index f24f6d3fc..c935a8b8e 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.hpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.hpp
@@ -15,6 +15,7 @@
#include <uhd/types/dict.hpp>
#include <uhd/utils/tasks.hpp>
#include <uhd/transport/muxed_zero_copy_if.hpp>
+#include <boost/optional.hpp>
#include <map>
#include <memory>
@@ -29,6 +30,16 @@ class mpmd_mboard_impl
using uptr = std::unique_ptr<mpmd_mboard_impl>;
using dev_info = std::map<std::string, std::string>;
+ /*** Static helper *******************************************************/
+ /*! Will run some checks to determine if this device can be reached from
+ * the current UHD session
+ *
+ * \param device_addr Device args. Must contain an mgmt_addr.
+ */
+ static boost::optional<device_addr_t> is_device_reachable(
+ const device_addr_t& device_addr
+ );
+
/*** Structors ***********************************************************/
/*! Ctor: Claim device or throw an exception on failure.
*
@@ -159,6 +170,9 @@ class mpmd_mboard_impl
class mpmd_impl : public uhd::usrp::device3_impl
{
public:
+ //! Device arg key which will allow finding all devices, even those not
+ // reachable via CHDR.
+ static const std::string MPM_FINDALL_KEY;
//! Port on which the discovery process is listening (default value, it is
// user-overridable)
static const size_t MPM_DISCOVERY_PORT;
@@ -177,6 +191,9 @@ public:
static const std::string MPM_ECHO_CMD;
//! This is the RPC command that will return the last known error from MPM.
static const std::string MPM_RPC_GET_LAST_ERROR_CMD;
+ //! The preamble for any response on the discovery port. Can be used to
+ // verify that the response is actually an MPM device.
+ static constexpr char MPM_DISC_RESPONSE_PREAMBLE[] = "USRP-MPM";
/**************************************************************************
* Structors