diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-06-09 16:30:26 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-06-10 12:46:33 -0500 |
commit | 470e11a1f8a2f8f4b5cef39f7bf77d83c71966d8 (patch) | |
tree | 6b067d85a547443fa7cc7a633da882a2fda65ebe | |
parent | 985e69109283fb84036cf3ea28d86af4f5ab7052 (diff) | |
download | uhd-470e11a1f8a2f8f4b5cef39f7bf77d83c71966d8.tar.gz uhd-470e11a1f8a2f8f4b5cef39f7bf77d83c71966d8.tar.bz2 uhd-470e11a1f8a2f8f4b5cef39f7bf77d83c71966d8.zip |
filter API: Fix Python bindings and multi_usrp calls
This fixes the following issues:
- The Python bindings did not declare parents for the various filter
object classes properly. This meant that set_?x_filter wouldn't work,
because the user would pass a specific type (e.g., analog_filter_lp),
but the class would not recognize it as a filter_info_base.
- In multi_usrp.cpp, filter names are also property tree paths to make
them unique. However, the setters and getters for filters would then
prepend the FE path again, thus breaking those calls.
-rw-r--r-- | host/lib/types/filters_python.hpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/host/lib/types/filters_python.hpp b/host/lib/types/filters_python.hpp index 76b2c3a49..7210faa21 100644 --- a/host/lib/types/filters_python.hpp +++ b/host/lib/types/filters_python.hpp @@ -31,13 +31,14 @@ void export_filters(py::module& m) .def("get_type", &filter_info_base::get_type) .def("__str__", &filter_info_base::to_pp_string); - py::class_<analog_filter_base, analog_filter_base::sptr>(m, "analog_filter_base") + py::class_<analog_filter_base, filter_info_base, analog_filter_base::sptr>( + m, "analog_filter_base") .def(py::init<filter_info_type, bool, size_t, std::string>()) // Methods .def("get_analog_type", &analog_filter_base::get_analog_type); - py::class_<analog_filter_lp, std::shared_ptr<analog_filter_lp>>(m, "analog_filter_lp") + py::class_<analog_filter_lp, analog_filter_base, std::shared_ptr<analog_filter_lp>>(m, "analog_filter_lp") .def( py::init<filter_info_type, bool, size_t, const std::string, double, double>()) diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index c41b31083..04d054b60 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1905,8 +1905,7 @@ public: throw uhd::runtime_error("Attempting to get non-existing filter: " + name); } - return _tree->access<filter_info_base::sptr>(rx_rf_fe_root(chan) / name / "value") - .get(); + return _tree->access<filter_info_base::sptr>(fs_path(name) / "value").get(); } void set_rx_filter( @@ -1919,8 +1918,7 @@ public: throw uhd::runtime_error("Attempting to set non-existing filter: " + name); } - _tree->access<filter_info_base::sptr>(rx_rf_fe_root(chan) / name / "value") - .set(filter); + _tree->access<filter_info_base::sptr>(fs_path(name) / "value").set(filter); } std::vector<std::string> get_tx_filter_names(const size_t chan) |