aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd.h1
-rw-r--r--host/include/uhd/types/CMakeLists.txt1
-rw-r--r--host/include/uhd/types/device_addrs.h87
-rw-r--r--host/include/uhd/usrp/usrp.h11
-rw-r--r--host/include/uhd/usrp_clock/usrp_clock.h19
5 files changed, 115 insertions, 4 deletions
diff --git a/host/include/uhd.h b/host/include/uhd.h
index 0ecafa88a..1f8f9e896 100644
--- a/host/include/uhd.h
+++ b/host/include/uhd.h
@@ -21,6 +21,7 @@
#include <uhd/config.h>
#include <uhd/error.h>
+#include <uhd/types/device_addrs.h>
#include <uhd/types/metadata.h>
#include <uhd/types/ranges.h>
#include <uhd/types/sensors.h>
diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt
index 140b5c710..07a752806 100644
--- a/host/include/uhd/types/CMakeLists.txt
+++ b/host/include/uhd/types/CMakeLists.txt
@@ -45,6 +45,7 @@ UHD_INSTALL(FILES
IF(ENABLE_C_API)
UHD_INSTALL(FILES
+ device_addrs.h
metadata.h
ranges.h
sensors.h
diff --git a/host/include/uhd/types/device_addrs.h b/host/include/uhd/types/device_addrs.h
new file mode 100644
index 000000000..3acc7f179
--- /dev/null
+++ b/host/include/uhd/types/device_addrs.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2015 Ettus Research
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INCLUDED_UHD_TYPES_DEVICE_ADDRS_H
+#define INCLUDED_UHD_TYPES_DEVICE_ADDRS_H
+
+#include <uhd/config.h>
+#include <uhd/error.h>
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+#include <uhd/types/device_addr.hpp>
+#include <string>
+
+struct uhd_device_addrs_t {
+ uhd::device_addrs_t device_addrs_cpp;
+ std::string last_error;
+};
+
+extern "C" {
+#else
+struct uhd_device_addrs_t;
+#endif
+
+//! C-level interface for interacting with a list of device addresses
+/*!
+ * See uhd::device_addrs_t for more information.
+ */
+typedef struct uhd_device_addrs_t* uhd_device_addrs_handle;
+
+//! Instantiate a device_addrs handle.
+UHD_API uhd_error uhd_device_addrs_make(
+ uhd_device_addrs_handle *h
+);
+
+//! Safely destroy a device_addrs handle.
+UHD_API uhd_error uhd_device_addrs_free(
+ uhd_device_addrs_handle *h
+);
+
+//! Add a device address to the list in string form
+UHD_API uhd_error uhd_device_addrs_push_back(
+ uhd_device_addrs_handle h,
+ const char* value
+);
+
+//! Get the device information (in string form) at the given index
+UHD_API uhd_error uhd_device_addrs_at(
+ uhd_device_addrs_handle h,
+ size_t index,
+ char* value_out,
+ size_t strbuffer_len
+);
+
+//! Get the number of device addresses in this list
+UHD_API uhd_error uhd_device_addrs_size(
+ uhd_device_addrs_handle h,
+ size_t *size_out
+);
+
+//! Get the last error reported by the underlying object
+UHD_API uhd_error uhd_device_addrs_last_error(
+ uhd_device_addrs_handle h,
+ char* error_out,
+ size_t strbuffer_len
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* INCLUDED_UHD_TYPES_DEVICE_ADDRS_H */
diff --git a/host/include/uhd/usrp/usrp.h b/host/include/uhd/usrp/usrp.h
index e828628c7..99a06b6e1 100644
--- a/host/include/uhd/usrp/usrp.h
+++ b/host/include/uhd/usrp/usrp.h
@@ -20,6 +20,7 @@
#include <uhd/config.h>
#include <uhd/error.h>
+#include <uhd/types/device_addrs.h>
#include <uhd/types/metadata.h>
#include <uhd/types/ranges.h>
#include <uhd/types/sensors.h>
@@ -291,6 +292,16 @@ typedef struct uhd_usrp* uhd_usrp_handle;
extern "C" {
#endif
+//! Find all connected USRP devices.
+/*!
+ * See uhd::device::find() for more details.
+ */
+UHD_API uhd_error uhd_usrp_find(
+ uhd_device_addrs_handle h,
+ const char* args,
+ size_t *num_found
+);
+
//! Create a USRP handle.
/*!
* \param h the handle
diff --git a/host/include/uhd/usrp_clock/usrp_clock.h b/host/include/uhd/usrp_clock/usrp_clock.h
index 2f5a1db29..4a9eb871e 100644
--- a/host/include/uhd/usrp_clock/usrp_clock.h
+++ b/host/include/uhd/usrp_clock/usrp_clock.h
@@ -20,6 +20,7 @@
#include <uhd/config.h>
#include <uhd/error.h>
+#include <uhd/types/device_addrs.h>
#include <uhd/types/sensors.h>
#include <stdlib.h>
@@ -47,8 +48,18 @@ typedef struct uhd_usrp_clock* uhd_usrp_clock_handle;
extern "C" {
#endif
-/*! Create a USRP Clock handle.
- *
+//! Find all connected clock devices.
+/*!
+ * See uhd::device::find() for more details.
+ */
+UHD_API uhd_error uhd_usrp_clock_find(
+ uhd_device_addrs_handle h,
+ const char* args,
+ size_t *num_found
+);
+
+//! Create a clock handle.
+/*!
* \param h The handle
* \param args Device args (e.g. "addr=192.168.10.3")
*/
@@ -57,8 +68,8 @@ UHD_API uhd_error uhd_usrp_clock_make(
const char *args
);
-/*! Safely destroy the USRP_CLOCK object underlying the handle.
- *
+//! Safely destroy the clock object underlying the handle.
+/*!
* Note: After calling this, usage of h may cause segmentation faults.
* However, multiple calling of uhd_usrp_free() is safe.
*/