diff options
-rw-r--r-- | gr-uhd/python/uhd/__init__.py | 23 | ||||
-rw-r--r-- | gr-uhd/python/uhd/bindings/uhd_types_python.cc | 16 | ||||
-rw-r--r-- | gr-uhd/python/uhd/bindings/usrp_block_python.cc | 3 |
3 files changed, 14 insertions, 28 deletions
diff --git a/gr-uhd/python/uhd/__init__.py b/gr-uhd/python/uhd/__init__.py index 85a8f2c142..f03dd60808 100644 --- a/gr-uhd/python/uhd/__init__.py +++ b/gr-uhd/python/uhd/__init__.py @@ -13,9 +13,6 @@ Used to send and receive data between the Ettus Research, LLC product line. ''' -from __future__ import absolute_import -from __future__ import unicode_literals - import uhd # TODO: verify uhd python is installed as a dependency for gr-uhd with python ######################################################################## @@ -46,26 +43,6 @@ def _prepare_uhd_python(): for key, val in list(kwargs.items()): setattr(self, key, val) setattr(uhd_python, 'tune_request_t', tune_request_t) - #make the streamer args take **kwargs on init - class stream_args_t(uhd_python.stream_args_t): - def __init__(self, *args, **kwargs): - # UHD Python API doesn't have default args for stream_args_t - # If empty args, then append empty str's - while len(args) < 2: - args += ("",) - super(stream_args_t, self).__init__(*args) - for key, val in list(kwargs.items()): - #for some reason, I can't assign a list in the constructor - #but what I can do is append the elements individually - if key == 'channels': - for v in val: self.channels.append(v) - elif key == 'args': - self.args = uhd_python.device_addr_t(val) - else: setattr(self, key, val) - - # FIXME: stream_args_t.channels.append does not work due to copy operation of STL vectors - setattr(uhd_python, 'stream_args_t', stream_args_t) - #handle general things on all uhd_python attributes #Install the __str__ and __repr__ handlers if applicable #Create aliases for uhd swig attributes to avoid the "_t" diff --git a/gr-uhd/python/uhd/bindings/uhd_types_python.cc b/gr-uhd/python/uhd/bindings/uhd_types_python.cc index 3be7aa84ca..13f92c7483 100644 --- a/gr-uhd/python/uhd/bindings/uhd_types_python.cc +++ b/gr-uhd/python/uhd/bindings/uhd_types_python.cc @@ -7,8 +7,6 @@ * */ -/* This file is automatically generated using bindtool */ - #include <pybind11/complex.h> #include <pybind11/operators.h> #include <pybind11/pybind11.h> @@ -42,7 +40,19 @@ void bind_uhd_types(py::module& m) using stream_args_t = ::uhd::stream_args_t; py::class_<stream_args_t>(m, "stream_args_t") - .def(py::init<const std::string&, const std::string&>()) + .def(py::init([](const std::string& cpu, + const std::string& otw, + const ::uhd::device_addr_t& args, + const std::vector<size_t>& channels) { + auto s = ::uhd::stream_args_t(cpu, otw); + s.args = args; + s.channels = channels; + return s; + }), + py::arg("cpu_format") = "", + py::arg("otw_format") = "", + py::arg("args") = ::uhd::device_addr_t(""), + py::arg("channels") = std::vector<size_t>()) // Properties .def_readwrite("cpu_format", &stream_args_t::cpu_format) .def_readwrite("otw_format", &stream_args_t::otw_format) diff --git a/gr-uhd/python/uhd/bindings/usrp_block_python.cc b/gr-uhd/python/uhd/bindings/usrp_block_python.cc index 7d25ce1a34..d816a1668d 100644 --- a/gr-uhd/python/uhd/bindings/usrp_block_python.cc +++ b/gr-uhd/python/uhd/bindings/usrp_block_python.cc @@ -7,8 +7,6 @@ * */ -/* This file is automatically generated using bindtool */ - #include <pybind11/complex.h> #include <pybind11/pybind11.h> #include <pybind11/stl.h> @@ -24,6 +22,7 @@ void bind_usrp_block(py::module& m) using usrp_block = ::gr::uhd::usrp_block; + m.attr("ALL_MBOARDS") = py::int_(::uhd::usrp::multi_usrp::ALL_MBOARDS); py::class_<usrp_block, gr::sync_block, |