diff options
author | Paul David <paul.david@ettus.com> | 2017-05-02 14:10:05 -0400 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-06-20 19:02:32 -0500 |
commit | e74cf7635ba3360b5b7002a2f7317941f65ffa16 (patch) | |
tree | 46b63039f31c5aedf26773b4b626b2a7932999db /host/lib/usrp/subdev_spec_python.hpp | |
parent | 22e24497a510c174e6de7718ad918a423d1973dd (diff) | |
download | uhd-e74cf7635ba3360b5b7002a2f7317941f65ffa16.tar.gz uhd-e74cf7635ba3360b5b7002a2f7317941f65ffa16.tar.bz2 uhd-e74cf7635ba3360b5b7002a2f7317941f65ffa16.zip |
python: Separating exposed Python data structures
- Separating exposed Python data structures into logical sections
- Exposes all of the multi_usrp API
- Adds a layer of Python for documentation and adding helper methods
- Adds improvements and fixes to the MultiUSRP object
- Includes additional exposed data structures (like time_spec_t, etc.)
- Add code to release the Python GIL during long C++ calls
Diffstat (limited to 'host/lib/usrp/subdev_spec_python.hpp')
-rw-r--r-- | host/lib/usrp/subdev_spec_python.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/host/lib/usrp/subdev_spec_python.hpp b/host/lib/usrp/subdev_spec_python.hpp new file mode 100644 index 000000000..ed91099f9 --- /dev/null +++ b/host/lib/usrp/subdev_spec_python.hpp @@ -0,0 +1,37 @@ +// +// Copyright 2017-2018 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_UHD_USRP_SUBDEV_SPEC_PYTHON_HPP +#define INCLUDED_UHD_USRP_SUBDEV_SPEC_PYTHON_HPP + +#include <uhd/usrp/subdev_spec.hpp> + +void export_subdev_spec() +{ + using subdev_spec_pair_t = uhd::usrp::subdev_spec_pair_t; + using subdev_spec_t = uhd::usrp::subdev_spec_t; + + bp::class_<subdev_spec_pair_t> + ("subdev_spec_pair", bp::init<const std::string&, const std::string &>()) + + // Properties + .add_property("db_name", &subdev_spec_pair_t::db_name) + .add_property("sd_name", &subdev_spec_pair_t::sd_name) + ; + + bp::class_<std::vector<subdev_spec_pair_t> >("subdev_spec_vector") + .def(bp::vector_indexing_suite<std::vector<subdev_spec_pair_t> >()); + + bp::class_<subdev_spec_t, bp::bases<std::vector<subdev_spec_pair_t> > > + ("subdev_spec", bp::init<const std::string &>()) + + // Methods + .def("__str__", &subdev_spec_t::to_pp_string) + .def("to_string", &subdev_spec_t::to_string) + ; +} + +#endif /* INCLUDED_UHD_USRP_SUBDEV_SPEC_PYTHON_HPP */ |