From a0721d79e49637ec3d2c4319e408a2d00d4c6877 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 19 Nov 2020 15:14:27 +0100 Subject: python: Improve access to device_addr_t This makes two changes: - Add device_addr_t as a type that the Python property tree access can handle - Add a to_dict() call to device_addr_t (in Python) that will return a regular dictionary from a device_addr_t for a more Pythonic access. --- host/lib/property_tree_python.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'host/lib/property_tree_python.cpp') diff --git a/host/lib/property_tree_python.cpp b/host/lib/property_tree_python.cpp index 0b7f18aa2..d1c242e01 100644 --- a/host/lib/property_tree_python.cpp +++ b/host/lib/property_tree_python.cpp @@ -6,6 +6,7 @@ #include "property_tree_python.hpp" #include +#include #include #include #include @@ -39,6 +40,7 @@ void export_property_tree(py::module& m) export_property(m, "double"); export_property(m, "str"); export_property(m, "bool"); + export_property(m, "device_addr"); py::class_(m, "property_tree") .def("subtree", &property_tree::subtree, py::arg("path")) @@ -56,6 +58,9 @@ void export_property_tree(py::module& m) .def("access_bool", &property_tree::access, py::return_value_policy::reference) + .def("access_device_addr", + &property_tree::access, + py::return_value_policy::reference) // End of types ; } -- cgit v1.2.3