Skip to content

Commit c5fc08a

Browse files
authored
Merge pull request #346 from luxonis/xlink_chunk_size
Configure XLink chunk size
2 parents 8a5c50d + dd6f40d commit c5fc08a

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

src/DeviceBindings.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
155155
// Non blocking constructor
156156
py::gil_scoped_release release;
157157
return std::make_unique<DeviceBase>(version, deviceInfo, usb2Mode);
158-
}), py::arg("version"), py::arg("deviceDesc"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 15))
158+
}), py::arg("version"), py::arg("devInfo"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 15))
159159
.def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, std::string pathToCmd){
160160
// Non blocking constructor
161161
py::gil_scoped_release release;
162162
return std::make_unique<DeviceBase>(version, deviceInfo, pathToCmd);
163-
}), py::arg("version"), py::arg("deviceDesc"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 16))
163+
}), py::arg("version"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 16))
164164

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

203205

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

227+
// Device constructor - OpenVINO version
228+
.def(py::init([](OpenVINO::Version version){ return deviceConstructorHelper<Device>(version); }), py::arg("version") = Pipeline::DEFAULT_OPENVINO_VERSION, DOC(dai, DeviceBase, DeviceBase, 10))
229+
.def(py::init([](OpenVINO::Version version, bool usb2Mode){
230+
// Blocking constructor
231+
return deviceConstructorHelper<Device>(version, std::string(""), usb2Mode);
232+
}), py::arg("version"), py::arg("usb2Mode"), DOC(dai, DeviceBase, DeviceBase, 11))
233+
.def(py::init([](OpenVINO::Version version, const std::string& pathToCmd){
234+
// Blocking constructor
235+
return deviceConstructorHelper<Device>(version, pathToCmd);
236+
}), py::arg("version"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 12))
237+
.def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, bool usb2Mode){
238+
// Non blocking constructor
239+
py::gil_scoped_release release;
240+
return std::make_unique<Device>(version, deviceInfo, usb2Mode);
241+
}), py::arg("version"), py::arg("devInfo"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 15))
242+
.def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, std::string pathToCmd){
243+
// Non blocking constructor
244+
py::gil_scoped_release release;
245+
return std::make_unique<Device>(version, deviceInfo, pathToCmd);
246+
}), py::arg("version"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 16))
247+
225248
.def("getOutputQueue", static_cast<std::shared_ptr<DataOutputQueue>(Device::*)(const std::string&)>(&Device::getOutputQueue), py::arg("name"), DOC(dai, Device, getOutputQueue))
226249
.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))
227250
.def("getOutputQueueNames", &Device::getOutputQueueNames, DOC(dai, Device, getOutputQueueNames))

src/pipeline/PipelineBindings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void PipelineBindings::bind(pybind11::module& m, void* pCallstack){
7272
.def_readwrite("pipelineVersion", &GlobalProperties::pipelineVersion)
7373
.def_readwrite("cameraTuningBlobSize", &GlobalProperties::cameraTuningBlobSize, DOC(dai, GlobalProperties, cameraTuningBlobSize))
7474
.def_readwrite("cameraTuningBlobUri", &GlobalProperties::cameraTuningBlobUri, DOC(dai, GlobalProperties, cameraTuningBlobUri))
75+
.def_readwrite("xlinkChunkSize", &GlobalProperties::xlinkChunkSize, DOC(dai, GlobalProperties, xlinkChunkSize))
7576
;
7677

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

0 commit comments

Comments
 (0)