diff options
Diffstat (limited to 'gr-uhd/include/gnuradio/uhd')
-rw-r--r-- | gr-uhd/include/gnuradio/uhd/uhd_types.h | 46 | ||||
-rw-r--r-- | gr-uhd/include/gnuradio/uhd/usrp_sink.h | 8 | ||||
-rw-r--r-- | gr-uhd/include/gnuradio/uhd/usrp_source.h | 10 |
3 files changed, 64 insertions, 0 deletions
diff --git a/gr-uhd/include/gnuradio/uhd/uhd_types.h b/gr-uhd/include/gnuradio/uhd/uhd_types.h new file mode 100644 index 0000000000..0179274540 --- /dev/null +++ b/gr-uhd/include/gnuradio/uhd/uhd_types.h @@ -0,0 +1,46 @@ +/* -*- c++ -*- */ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* Wrappers for UHD types that exposed in the API of gr-uhd blocks */ +#ifndef INCLUDED_GR_UHD_TYPES_H +#define INCLUDED_GR_UHD_TYPES_H + +#include <uhd/stream.hpp> +#include <uhd/types/filters.hpp> +#include <uhd/types/ranges.hpp> +#include <uhd/types/sensors.hpp> +#include <uhd/types/stream_cmd.hpp> +#include <uhd/types/tune_request.hpp> +#include <uhd/types/tune_result.hpp> +#include <uhd/types/wb_iface.hpp> + +namespace gr { +namespace uhd { + +// typedef device_addr_t ::uhd::device_addr_t +class stream_args_t : public ::uhd::stream_args_t +{ + +public: + stream_args_t(const std::string& cpu = "", + const std::string& otw = "", + const ::uhd::device_addr_t& args = ::uhd::device_addr_t(), + const std::vector<size_t> channels = std::vector<size_t>()) + : ::uhd::stream_args_t(cpu, otw) + { + this->args = args; + this->channels = channels; + } +}; +} // namespace uhd +} // namespace gr + + +#endif
\ No newline at end of file diff --git a/gr-uhd/include/gnuradio/uhd/usrp_sink.h b/gr-uhd/include/gnuradio/uhd/usrp_sink.h index 504856c6e7..03002b9174 100644 --- a/gr-uhd/include/gnuradio/uhd/usrp_sink.h +++ b/gr-uhd/include/gnuradio/uhd/usrp_sink.h @@ -101,6 +101,14 @@ public: const ::uhd::stream_args_t& stream_args, const std::string& tsb_tag_name = ""); + // Also accept a string for the device_addr + static sptr make(const std::string& device_addr_str, + const ::uhd::stream_args_t& stream_args, + const std::string& tsb_tag_name = "") + { + return make(::uhd::device_addr_t(device_addr_str), stream_args, tsb_tag_name); + } + /*! * Set the start time for outgoing samples. * To control when samples are transmitted, diff --git a/gr-uhd/include/gnuradio/uhd/usrp_source.h b/gr-uhd/include/gnuradio/uhd/usrp_source.h index 8165a7edb9..bd08f08641 100644 --- a/gr-uhd/include/gnuradio/uhd/usrp_source.h +++ b/gr-uhd/include/gnuradio/uhd/usrp_source.h @@ -58,6 +58,16 @@ public: const ::uhd::stream_args_t& stream_args, const bool issue_stream_cmd_on_start = true); + static sptr make(const std::string& device_addr_str, + const ::uhd::stream_args_t& stream_args, + const bool issue_stream_cmd_on_start = true) + { + return make(::uhd::device_addr_t(device_addr_str), + stream_args, + issue_stream_cmd_on_start); + } + + /*! * Set the start time for incoming samples. * To control when samples are received, |