Skip to content

Commit db4f7cc

Browse files
committed
Added "dai.DeviceInfo.desc" API compatibility
1 parent 917d189 commit db4f7cc

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ else()
131131
endif()
132132
message(STATUS "Mypy available, creating and checking stubs. Running with generate_stubs.py ${TARGET_NAME} ${bindings_directory}")
133133
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND
134-
${CMAKE_COMMAND} -E env
134+
${CMAKE_COMMAND} -E env
135135
# PATH (dlls)
136136
"PATH=${HUNTER_INSTALL_PREFIX}/bin${SYS_PATH_SEPARATOR}$ENV{PATH}"
137137
# Python path (to find compiled module)

src/XLinkBindings.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#include "XLinkBindings.hpp"
22

3+
// std
4+
#include <cmath>
5+
#include <cstring>
6+
7+
// depthai
38
#include "depthai/xlink/XLinkConnection.hpp"
49
#include "depthai/xlink/XLinkStream.hpp"
510

6-
#include <cmath>
7-
#include <cstring>
811

912
void XLinkBindings::bind(pybind11::module &m, void *pCallstack)
1013
{
@@ -60,6 +63,16 @@ void XLinkBindings::bind(pybind11::module &m, void *pCallstack)
6063
.def_readwrite("platform", &DeviceInfo::platform)
6164
.def_readwrite("status", &DeviceInfo::status)
6265
.def("__repr__", &DeviceInfo::toString)
66+
// deprecated
67+
.def_property("desc", [](py::object& self) {
68+
// Issue an deprecation warning
69+
PyErr_WarnEx(PyExc_DeprecationWarning, "desc field is deprecated, use name/mxid and others instead.", 1);
70+
return self;
71+
},[](DeviceInfo& i, DeviceInfo di){
72+
// Issue an deprecation warning
73+
PyErr_WarnEx(PyExc_DeprecationWarning, "desc field is deprecated, use name/mxid and others instead.", 1);
74+
i = di;
75+
})
6376
;
6477

6578
deviceDesc

0 commit comments

Comments
 (0)