Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/DeviceBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
// Non blocking constructor
py::gil_scoped_release release;
return std::make_unique<DeviceBase>(version, deviceInfo, usb2Mode);
}), py::arg("version"), py::arg("deviceDesc"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 15))
}), py::arg("version"), py::arg("devInfo"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 15))
.def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, std::string pathToCmd){
// Non blocking constructor
py::gil_scoped_release release;
return std::make_unique<DeviceBase>(version, deviceInfo, pathToCmd);
}), py::arg("version"), py::arg("deviceDesc"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 16))
}), py::arg("version"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 16))

.def("isPipelineRunning", [](DeviceBase& d) { py::gil_scoped_release release; return d.isPipelineRunning(); }, DOC(dai, DeviceBase, isPipelineRunning))
.def("startPipeline", [](DeviceBase& d){
Expand Down Expand Up @@ -198,6 +198,8 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
.def("getMxId", [](DeviceBase& d) { py::gil_scoped_release release; return d.getMxId(); }, DOC(dai, DeviceBase, getMxId))
.def("readCalibration", [](DeviceBase& d) { py::gil_scoped_release release; return d.readCalibration(); }, DOC(dai, DeviceBase, readCalibration))
.def("flashCalibration", [](DeviceBase& d, CalibrationHandler calibrationDataHandler) { py::gil_scoped_release release; return d.flashCalibration(calibrationDataHandler); }, py::arg("calibrationDataHandler"), DOC(dai, DeviceBase, flashCalibration))
.def("setXLinkChunkSize", [](DeviceBase& d, int s) { py::gil_scoped_release release; d.setXLinkChunkSize(s); }, py::arg("sizeBytes"), DOC(dai, DeviceBase, setXLinkChunkSize))
.def("getXLinkChunkSize", [](DeviceBase& d) { py::gil_scoped_release release; return d.getXLinkChunkSize(); }, DOC(dai, DeviceBase, getXLinkChunkSize))
;


Expand All @@ -222,6 +224,27 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
return std::make_unique<Device>(pipeline, deviceInfo, pathToCmd);
}), py::arg("pipeline"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, Device, Device, 7))

// Device constructor - OpenVINO version
.def(py::init([](OpenVINO::Version version){ return deviceConstructorHelper<Device>(version); }), py::arg("version") = Pipeline::DEFAULT_OPENVINO_VERSION, DOC(dai, DeviceBase, DeviceBase, 10))
.def(py::init([](OpenVINO::Version version, bool usb2Mode){
// Blocking constructor
return deviceConstructorHelper<Device>(version, std::string(""), usb2Mode);
}), py::arg("version"), py::arg("usb2Mode"), DOC(dai, DeviceBase, DeviceBase, 11))
.def(py::init([](OpenVINO::Version version, const std::string& pathToCmd){
// Blocking constructor
return deviceConstructorHelper<Device>(version, pathToCmd);
}), py::arg("version"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 12))
.def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, bool usb2Mode){
// Non blocking constructor
py::gil_scoped_release release;
return std::make_unique<Device>(version, deviceInfo, usb2Mode);
}), py::arg("version"), py::arg("devInfo"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 15))
.def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, std::string pathToCmd){
// Non blocking constructor
py::gil_scoped_release release;
return std::make_unique<Device>(version, deviceInfo, pathToCmd);
}), py::arg("version"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 16))

.def("getOutputQueue", static_cast<std::shared_ptr<DataOutputQueue>(Device::*)(const std::string&)>(&Device::getOutputQueue), py::arg("name"), DOC(dai, Device, getOutputQueue))
.def("getOutputQueue", static_cast<std::shared_ptr<DataOutputQueue>(Device::*)(const std::string&, unsigned int, bool)>(&Device::getOutputQueue), py::arg("name"), py::arg("maxSize"), py::arg("blocking") = true, DOC(dai, Device, getOutputQueue, 2))
.def("getOutputQueueNames", &Device::getOutputQueueNames, DOC(dai, Device, getOutputQueueNames))
Expand Down
2 changes: 2 additions & 0 deletions src/pipeline/PipelineBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void PipelineBindings::bind(pybind11::module& m, void* pCallstack){
.def_readwrite("pipelineVersion", &GlobalProperties::pipelineVersion)
.def_readwrite("cameraTuningBlobSize", &GlobalProperties::cameraTuningBlobSize, DOC(dai, GlobalProperties, cameraTuningBlobSize))
.def_readwrite("cameraTuningBlobUri", &GlobalProperties::cameraTuningBlobUri, DOC(dai, GlobalProperties, cameraTuningBlobUri))
.def_readwrite("xlinkChunkSize", &GlobalProperties::xlinkChunkSize, DOC(dai, GlobalProperties, xlinkChunkSize))
;

// bind pipeline
Expand All @@ -95,6 +96,7 @@ void PipelineBindings::bind(pybind11::module& m, void* pCallstack){
.def("setOpenVINOVersion", &Pipeline::setOpenVINOVersion, py::arg("version") = Pipeline::DEFAULT_OPENVINO_VERSION, DOC(dai, Pipeline, setOpenVINOVersion))
.def("getOpenVINOVersion", &Pipeline::getOpenVINOVersion, DOC(dai, Pipeline, getOpenVINOVersion))
.def("setCameraTuningBlobPath", &Pipeline::setCameraTuningBlobPath, py::arg("path"), DOC(dai, Pipeline, setCameraTuningBlobPath))
.def("setXLinkChunkSize", &Pipeline::setXLinkChunkSize, py::arg("sizeBytes"), DOC(dai, Pipeline, setXLinkChunkSize))
.def("setCalibrationData", &Pipeline::setCalibrationData, py::arg("calibrationDataHandler"), DOC(dai, Pipeline, setCalibrationData))
.def("getCalibrationData", &Pipeline::getCalibrationData, DOC(dai, Pipeline, getCalibrationData))
// 'Template' create function
Expand Down