Skip to content

Commit fac4983

Browse files
Fetching USB speed and Myriad X serial number (#56)
* updated for usb fetch wip * updated wrapper to write usb speed * modified hunter config in depthai-core for build fix * updating submodule linking * added is_usb3() check function * updated for usb fetch wip * added is_usb3() check function * updated device commit id * linked to the upadted depthai core and added api to get myriad x serial id * update depthai-core * linking updated depthai-core in usb-testing * added eeprom loaded check * added destructor to python not tested * changing link to depthai-core * updated link to depthai-core * linking to the updated depthai-core with multi device xlink support * updated device side config on depthai-core * updated linking to depthai-core * updated link to xlink * updated link to xlink * updated link to xlink * updated link to xlink * added print statement on calibration file path to verify with mx id * updated depthai-core link * added device change check on swapping devices for testing * added api to check cameras connection * added api to write to eeprom and fetch existing pipeline * renamed api to write_eeprom_data * changed xlink path * added wrapper for xlinkConnect to make it threadsafe in depthai-shared * updated device side commit id and xlinkwrapper * removed text.txt * updated depthai-core Co-authored-by: alex-luxonis <[email protected]>
1 parent aeda4a9 commit fac4983

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed

src/device_bindings.cpp

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,76 @@ void init_binding_device(pybind11::module& m){
124124
"Returns a vector defining how much the right camera is translated w.r.t left camera."
125125
)
126126

127+
.def(
128+
"is_usb3",
129+
&Device::is_usb3,
130+
"Return true if connected over usb3 or else false."
131+
)
132+
133+
.def(
134+
"get_mx_id",
135+
&Device::get_mx_id,
136+
"Return the Myraid X serial number of the device."
137+
)
138+
139+
.def(
140+
"is_eeprom_loaded",
141+
&Device::is_eeprom_loaded,
142+
"Return true if EEPROM has both intrinsic matrixes."
143+
)
127144

145+
.def(
146+
"is_device_changed",
147+
&Device::is_device_changed,
148+
"Return true if device is swapped while running over watchdog thread."
149+
)
150+
151+
.def(
152+
"reset_device_changed",
153+
&Device::reset_device_changed,
154+
"Sets device_changed var to false to detect the next swap while running over watchdog thread."
155+
)
156+
157+
.def(
158+
"is_rgb_connected",
159+
&Device::is_rgb_connected,
160+
"Returns true if RGB camera is connected."
161+
)
162+
163+
.def(
164+
"is_left_connected",
165+
&Device::is_left_connected,
166+
"Returns true if left stereo camera is connected."
167+
)
128168

129-
;
169+
.def(
170+
"is_right_connected",
171+
&Device::is_right_connected,
172+
"Returns true if right stereo camera is connected."
173+
)
174+
.def(
175+
"write_eeprom_data",
176+
[](Device& device, py::dict config)
177+
{
178+
// str(dict) for string representation uses ['] , but JSON requires ["]
179+
// fast & dirty solution:
180+
std::string str = py::str(config);
181+
boost::replace_all(str, "\'", "\"");
182+
boost::replace_all(str, "None", "null");
183+
boost::replace_all(str, "True", "true");
184+
boost::replace_all(str, "False", "false");
185+
// TODO: make better json serialization
186+
187+
return device.write_eeprom_data(str);
188+
},
189+
"Takes board config and calibration data as input and writes to eeprom",
190+
py::arg("config") = py::dict()
191+
)
192+
.def(
193+
"get_pipeline",
194+
&Device::get_pipeline,
195+
"Returns shared ptr of CNNHostPipeline created using cerate_pipeline."
196+
);
130197

131198

132199
py::enum_<CaptureMetadata::AutofocusMode>(m, "AutofocusMode")

0 commit comments

Comments
 (0)