OrbbecSDK 2.8.6
OrbbecSDK: Software-Development-Kit for Orbbec 3D Cameras
Loading...
Searching...
No Matches
Device.hpp
Go to the documentation of this file.
1// Copyright (c) Orbbec Inc. All Rights Reserved.
2// Licensed under the MIT License.
3
9#pragma once
10#include "Types.hpp"
11
17
18#include "Error.hpp"
19#include <memory>
20#include <string>
21#include <vector>
22#include <thread>
23#include <chrono>
24
25namespace ob {
26
27class DeviceInfo;
28class SensorList;
31class CameraParamList;
34
35class Device {
36public:
44 typedef std::function<void(OBFwUpdateState state, const char *message, uint8_t percent)> DeviceFwUpdateCallback;
45
52 typedef std::function<void(OBDeviceState state, const char *message)> DeviceStateChangedCallback;
53
54protected:
55 ob_device *impl_ = nullptr;
58
59public:
63 explicit Device(ob_device_t *impl) : impl_(impl) {}
64
65 Device(Device &&other) noexcept : impl_(other.impl_) {
66 other.impl_ = nullptr;
67 }
68
69 Device &operator=(Device &&other) noexcept {
70 if(this != &other) {
71 ob_error *error = nullptr;
72 ob_delete_device(impl_, &error);
73 Error::handle(&error);
74 impl_ = other.impl_;
75 other.impl_ = nullptr;
76 }
77 return *this;
78 }
79
80 Device(const Device &) = delete;
81 Device &operator=(const Device &) = delete;
82
83 virtual ~Device() noexcept {
84 ob_error *error = nullptr;
85 ob_delete_device(impl_, &error);
86 Error::handle(&error, false);
87 }
88
89 ob_device_t *getImpl() const {
90 return impl_;
91 }
92
98 std::shared_ptr<DeviceInfo> getDeviceInfo() const {
99 ob_error *error = nullptr;
100 auto info = ob_device_get_device_info(impl_, &error);
101 Error::handle(&error);
102 return std::make_shared<DeviceInfo>(info);
103 }
104
112 bool isExtensionInfoExist(const std::string &infoKey) const {
113 ob_error *error = nullptr;
114 auto exist = ob_device_is_extension_info_exist(impl_, infoKey.c_str(), &error);
115 Error::handle(&error);
116 return exist;
117 }
118
126 const char *getExtensionInfo(const std::string &infoKey) const {
127 ob_error *error = nullptr;
128 const char *info = ob_device_get_extension_info(impl_, infoKey.c_str(), &error);
129 Error::handle(&error);
130 return info;
131 }
132
138 std::shared_ptr<SensorList> getSensorList() const {
139 ob_error *error = nullptr;
140 auto list = ob_device_get_sensor_list(impl_, &error);
141 Error::handle(&error);
142 return std::make_shared<SensorList>(list);
143 }
144
151 std::shared_ptr<Sensor> getSensor(OBSensorType type) const {
152 ob_error *error = nullptr;
153 auto sensor = ob_device_get_sensor(impl_, type, &error);
154 Error::handle(&error);
155 return std::make_shared<Sensor>(sensor);
156 }
157
164 void setIntProperty(OBPropertyID propertyId, int32_t value) const {
165 ob_error *error = nullptr;
166 ob_device_set_int_property(impl_, propertyId, value, &error);
167 Error::handle(&error);
168 }
169
176 void setFloatProperty(OBPropertyID propertyId, float value) const {
177 ob_error *error = nullptr;
178 ob_device_set_float_property(impl_, propertyId, value, &error);
179 Error::handle(&error);
180 }
181
188 void setBoolProperty(OBPropertyID propertyId, bool value) const {
189 ob_error *error = nullptr;
190 ob_device_set_bool_property(impl_, propertyId, value, &error);
191 Error::handle(&error);
192 }
193
201 int32_t getIntProperty(OBPropertyID propertyId) const {
202 ob_error *error = nullptr;
203 auto value = ob_device_get_int_property(impl_, propertyId, &error);
204 Error::handle(&error);
205 return value;
206 }
207
215 float getFloatProperty(OBPropertyID propertyId) const {
216 ob_error *error = nullptr;
217 auto value = ob_device_get_float_property(impl_, propertyId, &error);
218 Error::handle(&error);
219 return value;
220 }
221
229 bool getBoolProperty(OBPropertyID propertyId) const {
230 ob_error *error = nullptr;
231 auto value = ob_device_get_bool_property(impl_, propertyId, &error);
232 Error::handle(&error);
233 return value;
234 }
235
244 ob_error *error = nullptr;
245 auto range = ob_device_get_int_property_range(impl_, propertyId, &error);
246 Error::handle(&error);
247 return range;
248 }
249
258 ob_error *error = nullptr;
259 auto range = ob_device_get_float_property_range(impl_, propertyId, &error);
260 Error::handle(&error);
261 return range;
262 }
263
272 ob_error *error = nullptr;
273 auto range = ob_device_get_bool_property_range(impl_, propertyId, &error);
274 Error::handle(&error);
275 return range;
276 }
277
285 void setStructuredData(OBPropertyID propertyId, const uint8_t *data, uint32_t dataSize) const {
286 ob_error *error = nullptr;
287 ob_device_set_structured_data(impl_, propertyId, data, dataSize, &error);
288 Error::handle(&error);
289 }
290
298 void getStructuredData(OBPropertyID propertyId, uint8_t *data, uint32_t *dataSize) const {
299 ob_error *error = nullptr;
300 ob_device_get_structured_data(impl_, propertyId, data, dataSize, &error);
301 Error::handle(&error);
302 }
303
310 void writeCustomerData(const void *data, uint32_t dataSize) {
311 ob_error *error = nullptr;
312 ob_device_write_customer_data(impl_, data, dataSize, &error);
313 Error::handle(&error);
314 }
315
322 void readCustomerData(void *data, uint32_t *dataSize) {
323 ob_error *error = nullptr;
324 ob_device_read_customer_data(impl_, data, dataSize, &error);
325 Error::handle(&error);
326 }
327
334 ob_error *error = nullptr;
335 auto count = ob_device_get_supported_property_count(impl_, &error);
336 Error::handle(&error);
337 return count;
338 }
339
347 OBPropertyItem getSupportedProperty(uint32_t index) const {
348 ob_error *error = nullptr;
349 auto item = ob_device_get_supported_property_item(impl_, index, &error);
350 Error::handle(&error);
351 return item;
352 }
353
362 bool isPropertySupported(OBPropertyID propertyId, OBPermissionType permission) const {
363 ob_error *error = nullptr;
364 auto result = ob_device_is_property_supported(impl_, propertyId, permission, &error);
365 Error::handle(&error);
366 return result;
367 }
368
375 ob_error *error = nullptr;
376 auto result = ob_device_is_global_timestamp_supported(impl_, &error);
377 Error::handle(&error);
378 return result;
379 }
380
386 void enableGlobalTimestamp(bool enable) {
387 ob_error *error = nullptr;
389 Error::handle(&error);
390 }
391
399 void updateFirmware(const char *filePath, DeviceFwUpdateCallback callback, bool async = true) {
400 ob_error *error = nullptr;
401 fwUpdateCallback_ = callback;
402 ob_device_update_firmware(impl_, filePath, &Device::firmwareUpdateCallback, async, this, &error);
403 Error::handle(&error);
404 }
405
414 void updateFirmwareFromData(const uint8_t *firmwareData, uint32_t firmwareDataSize, DeviceFwUpdateCallback callback, bool async = true) {
415 ob_error *error = nullptr;
416 fwUpdateCallback_ = callback;
417 ob_device_update_firmware_from_data(impl_, firmwareData, firmwareDataSize, &Device::firmwareUpdateCallback, async, this, &error);
418 Error::handle(&error);
419 }
420
428 void updateOptionalDepthPresets(const char filePathList[][OB_PATH_MAX], uint8_t pathCount, DeviceFwUpdateCallback callback) {
429 ob_error *error = nullptr;
430 fwUpdateCallback_ = callback;
431 ob_device_update_optional_depth_presets(impl_, filePathList, pathCount, &Device::firmwareUpdateCallback, this, &error);
432 Error::handle(&error);
433 }
434
447
448 static void deviceStateChangedCallback(OBDeviceState state, const char *message, void *userData) {
449 auto device = static_cast<Device *>(userData);
450 device->deviceStateChangeCallback_(state, message);
451 }
452
459 ob_error *error = nullptr;
460 auto mode = ob_device_get_current_depth_work_mode(impl_, &error);
461 Error::handle(&error);
462 return mode;
463 }
464
472 ob_error *error = nullptr;
474 Error::handle(&error);
475 return name;
476 }
477
484 ob_error *error = nullptr;
485 auto status = ob_device_switch_depth_work_mode(impl_, &workMode, &error);
486 Error::handle(&error);
487 return status;
488 }
489
495 OBStatus switchDepthWorkMode(const char *modeName) const {
496 ob_error *error = nullptr;
497 auto status = ob_device_switch_depth_work_mode_by_name(impl_, modeName, &error);
498 Error::handle(&error);
499 return status;
500 }
501
507 std::shared_ptr<OBDepthWorkModeList> getDepthWorkModeList() const {
508 ob_error *error = nullptr;
509 auto list = ob_device_get_depth_work_mode_list(impl_, &error);
510 Error::handle(&error);
511 return std::make_shared<OBDepthWorkModeList>(list);
512 }
513
519 void reboot() const {
520 ob_error *error = nullptr;
521 ob_device_reboot(impl_, &error);
522 Error::handle(&error);
523 }
524
533 void reboot(uint32_t delayMs) const {
535 reboot();
536 }
537
546 void enableHeartbeat(bool enable) const {
547 ob_error *error = nullptr;
548 ob_device_enable_heartbeat(impl_, enable, &error);
549 Error::handle(&error);
550 }
551
557 void enableFirmwareLog(bool enable) const {
558 ob_error *error = nullptr;
559 ob_device_enable_firmware_log(impl_, enable, &error);
560 Error::handle(&error);
561 }
562
579 ob_error *error = nullptr;
581 Error::handle(&error);
582 return mode;
583 }
584
591 ob_error *error = nullptr;
593 Error::handle(&error);
594 }
595
602 ob_error *error = nullptr;
603 auto config = ob_device_get_multi_device_sync_config(impl_, &error);
604 Error::handle(&error);
605 return config;
606 }
607
619 void triggerCapture() const {
620 ob_error *error = nullptr;
622 Error::handle(&error);
623 }
624
629 ob_error *error = nullptr;
631 Error::handle(&error);
632 }
633
640 ob_error *error = nullptr;
641 auto config = ob_device_get_timestamp_reset_config(impl_, &error);
642 Error::handle(&error);
643 return config;
644 }
645
657 void timestampReset() const {
658 ob_error *error = nullptr;
660 Error::handle(&error);
661 }
662
666 inline void timerReset() const {
668 }
669
681 void timerSyncWithHost() const {
682 ob_error *error = nullptr;
684 Error::handle(&error);
685 }
686
693 const char *getCurrentPresetName() const {
694 ob_error *error = nullptr;
695 const char *name = ob_device_get_current_preset_name(impl_, &error);
696 Error::handle(&error);
697 return name;
698 }
699
706 void loadPreset(const char *presetName) const {
707 ob_error *error = nullptr;
708 ob_device_load_preset(impl_, presetName, &error);
709 Error::handle(&error);
710 }
711
719 std::shared_ptr<DevicePresetList> getAvailablePresetList() const {
720 ob_error *error = nullptr;
721 auto list = ob_device_get_available_preset_list(impl_, &error);
722 Error::handle(&error);
723 return std::make_shared<DevicePresetList>(list);
724 }
725
736 void loadPresetFromJsonFile(const char *filePath) const {
737 ob_error *error = nullptr;
739 Error::handle(&error);
740 }
741
754 void loadPresetFromJsonData(const char *presetName, const uint8_t *data, uint32_t size) {
755 ob_error *error = nullptr;
756 ob_device_load_preset_from_json_data(impl_, presetName, data, size, &error);
757 }
758
771 void exportSettingsAsPresetJsonData(const char *presetName, const uint8_t **data, uint32_t *dataSize) {
772 ob_error *error = nullptr;
773 ob_device_export_current_settings_as_preset_json_data(impl_, presetName, data, dataSize, &error);
774 }
775
783 void exportSettingsAsPresetJsonFile(const char *filePath) const {
784 ob_error *error = nullptr;
786 Error::handle(&error);
787 }
788
795 OBDeviceState state = {};
796 ob_error *error = nullptr;
797 state = ob_device_get_device_state(impl_, &error);
798 return state;
799 }
800
813 void sendAndReceiveData(const uint8_t *sendData, uint32_t sendDataSize, uint8_t *receiveData, uint32_t *receiveDataSize) const {
814 ob_error *error = nullptr;
815 ob_device_send_and_receive_data(impl_, sendData, sendDataSize, receiveData, receiveDataSize, &error);
816 Error::handle(&error);
817 }
818
825 ob_error *error = nullptr;
827 Error::handle(&error);
828 return ret;
829 }
830
836 void loadFrameInterleave(const char *frameInterleaveName) const {
837 ob_error *error = nullptr;
838 ob_device_load_frame_interleave(impl_, frameInterleaveName, &error);
839 Error::handle(&error);
840 }
841
847 std::shared_ptr<DeviceFrameInterleaveList> getAvailableFrameInterleaveList() const {
848 ob_error *error = nullptr;
850 Error::handle(&error);
851 return std::make_shared<DeviceFrameInterleaveList>(list);
852 }
853
859 std::shared_ptr<PresetResolutionConfigList> getAvailablePresetResolutionConfigList() const {
860 ob_error *error = nullptr;
862 Error::handle(&error);
863 return std::make_shared<PresetResolutionConfigList>(list);
864 }
865
866private:
867 static void firmwareUpdateCallback(ob_fw_update_state state, const char *message, uint8_t percent, void *userData) {
868 auto device = static_cast<Device *>(userData);
869 if(device && device->fwUpdateCallback_) {
870 device->fwUpdateCallback_(state, message, percent);
871 }
872 }
873
874public:
875 // The following interfaces are deprecated and are retained here for compatibility purposes.
876 void deviceUpgrade(const char *filePath, DeviceFwUpdateCallback callback, bool async = true) {
877 updateFirmware(filePath, callback, async);
878 }
879
880 void deviceUpgradeFromData(const uint8_t *firmwareData, uint32_t firmwareDataSize, DeviceFwUpdateCallback callback, bool async = true) {
881 updateFirmwareFromData(firmwareData, firmwareDataSize, callback, async);
882 }
883
884 std::shared_ptr<CameraParamList> getCalibrationCameraParamList() {
885 ob_error *error = nullptr;
887 Error::handle(&error);
888 return std::make_shared<CameraParamList>(impl);
889 }
890
891 void loadDepthFilterConfig(const char *filePath) {
892 // In order to compile, some high-version compilers will warn that the function parameters are not used.
893 (void)filePath;
894 }
895};
896
901private:
902 ob_device_info_t *impl_ = nullptr;
903
904public:
905 explicit DeviceInfo(ob_device_info_t *impl) : impl_(impl) {}
906 ~DeviceInfo() noexcept {
907 ob_error *error = nullptr;
908 ob_delete_device_info(impl_, &error);
909 Error::handle(&error, false);
910 }
911
917 const char *getName() const {
918 ob_error *error = nullptr;
919 const char *name = ob_device_info_get_name(impl_, &error);
920 Error::handle(&error);
921 return name;
922 }
923
929 int getPid() const {
930 ob_error *error = nullptr;
931 int pid = ob_device_info_get_pid(impl_, &error);
932 Error::handle(&error);
933 return pid;
934 }
935
941 int getVid() const {
942 ob_error *error = nullptr;
943 int vid = ob_device_info_get_vid(impl_, &error);
944 Error::handle(&error);
945 return vid;
946 }
947
953 const char *getUid() const {
954 ob_error *error = nullptr;
955 const char *uid = ob_device_info_get_uid(impl_, &error);
956 Error::handle(&error);
957 return uid;
958 }
959
965 const char *getSerialNumber() const {
966 ob_error *error = nullptr;
967 const char *sn = ob_device_info_get_serial_number(impl_, &error);
968 Error::handle(&error);
969 return sn;
970 }
971
977 const char *getFirmwareVersion() const {
978 ob_error *error = nullptr;
979 const char *version = ob_device_info_get_firmware_version(impl_, &error);
980 Error::handle(&error);
981 return version;
982 }
983
990 const char *getConnectionType() const {
991 ob_error *error = nullptr;
992 const char *type = ob_device_info_get_connection_type(impl_, &error);
993 Error::handle(&error);
994 return type;
995 }
996
1004 const char *getIpAddress() const {
1005 ob_error *error = nullptr;
1006 const char *ip = ob_device_info_get_ip_address(impl_, &error);
1007 Error::handle(&error);
1008 return ip;
1009 }
1010
1016 const char *getHardwareVersion() const {
1017 ob_error *error = nullptr;
1018 const char *version = ob_device_info_get_hardware_version(impl_, &error);
1019 Error::handle(&error);
1020 return version;
1021 }
1022
1028 const char *getSupportedMinSdkVersion() const {
1029 ob_error *error = nullptr;
1030 const char *version = ob_device_info_get_supported_min_sdk_version(impl_, &error);
1031 Error::handle(&error);
1032 return version;
1033 }
1034
1040 const char *getAsicName() const {
1041 ob_error *error = nullptr;
1042 const char *name = ob_device_info_get_asicName(impl_, &error);
1043 Error::handle(&error);
1044 return name;
1045 }
1046
1053 ob_error *error = nullptr;
1054 OBDeviceType type = ob_device_info_get_device_type(impl_, &error);
1055 Error::handle(&error);
1056 return type;
1057 }
1058
1064 const char *getDeviceSubnetMask() const {
1065 ob_error *error = nullptr;
1066 const char *subnetMask = ob_device_info_get_subnet_mask(impl_, &error);
1067 Error::handle(&error);
1068 return subnetMask;
1069 }
1070
1076 const char *getDeviceGateway() const {
1077 ob_error *error = nullptr;
1078 const char *subnetMask = ob_device_info_get_gateway(impl_, &error);
1079 Error::handle(&error);
1080 return subnetMask;
1081 }
1082
1083public:
1084 // The following interfaces are deprecated and are retained here for compatibility purposes.
1085 const char *getDevicegateway() {
1086 return getDeviceGateway();
1087 }
1088
1089 const char *name() const {
1090 return getName();
1091 }
1092
1093 int pid() const {
1094 return getPid();
1095 }
1096
1097 int vid() const {
1098 return getVid();
1099 }
1100
1101 const char *uid() const {
1102 return getUid();
1103 }
1104
1105 const char *serialNumber() const {
1106 return getSerialNumber();
1107 }
1108
1109 const char *firmwareVersion() const {
1110 return getFirmwareVersion();
1111 }
1112
1113 const char *connectionType() const {
1114 return getConnectionType();
1115 }
1116
1117 const char *ipAddress() const {
1118 return getIpAddress();
1119 }
1120
1121 const char *hardwareVersion() const {
1122 return getHardwareVersion();
1123 }
1124
1125 const char *supportedMinSdkVersion() const {
1127 }
1128
1129 const char *asicName() const {
1130 return getAsicName();
1131 }
1132
1134 return getDeviceType();
1135 }
1136};
1137
1142private:
1143 ob_device_list_t *impl_ = nullptr;
1144
1145public:
1146 explicit DeviceList(ob_device_list_t *impl) : impl_(impl) {}
1147 ~DeviceList() noexcept {
1148 ob_error *error = nullptr;
1149 ob_delete_device_list(impl_, &error);
1150 Error::handle(&error, false);
1151 }
1152
1158 uint32_t getCount() const {
1159 ob_error *error = nullptr;
1160 auto count = ob_device_list_get_count(impl_, &error);
1161 Error::handle(&error);
1162 return count;
1163 }
1164
1172 int getPid(uint32_t index) const {
1173 ob_error *error = nullptr;
1174 auto pid = ob_device_list_get_device_pid(impl_, index, &error);
1175 Error::handle(&error);
1176 return pid;
1177 }
1178
1186 int getVid(uint32_t index) const {
1187 ob_error *error = nullptr;
1188 auto vid = ob_device_list_get_device_vid(impl_, index, &error);
1189 Error::handle(&error);
1190 return vid;
1191 }
1192
1200 const char *getUid(uint32_t index) const {
1201 ob_error *error = nullptr;
1202 auto uid = ob_device_list_get_device_uid(impl_, index, &error);
1203 Error::handle(&error);
1204 return uid;
1205 }
1206
1214 const char *getSerialNumber(uint32_t index) const {
1215 ob_error *error = nullptr;
1216 auto sn = ob_device_list_get_device_serial_number(impl_, index, &error);
1217 Error::handle(&error);
1218 return sn;
1219 }
1220
1231 const char *getName(uint32_t index) const {
1232 ob_error *error = nullptr;
1233 auto name = ob_device_list_get_device_name(impl_, index, &error);
1234 Error::handle(&error);
1235 return name;
1236 }
1237
1246 const char *getConnectionType(uint32_t index) const {
1247 ob_error *error = nullptr;
1248 auto type = ob_device_list_get_device_connection_type(impl_, index, &error);
1249 Error::handle(&error);
1250 return type;
1251 }
1252
1262 const char *getIpAddress(uint32_t index) const {
1263 ob_error *error = nullptr;
1264 auto ip = ob_device_list_get_device_ip_address(impl_, index, &error);
1265 Error::handle(&error);
1266 return ip;
1267 }
1268
1278 const char *getSubnetMask(uint32_t index) const {
1279 ob_error *error = nullptr;
1280 auto subnetMask = ob_device_list_get_device_subnet_mask(impl_, index, &error);
1281 Error::handle(&error);
1282 return subnetMask;
1283 }
1284
1294 const char *getGateway(uint32_t index) const {
1295 ob_error *error = nullptr;
1296 auto gateway = ob_device_list_get_device_gateway(impl_, index, &error);
1297 Error::handle(&error);
1298 return gateway;
1299 }
1300
1310 const char *getLocalMacAddress(uint32_t index) const {
1311 ob_error *error = nullptr;
1312 auto mac = ob_device_list_get_device_local_mac(impl_, index, &error);
1313 Error::handle(&error);
1314 return mac;
1315 }
1316
1326 const char *getLocalIP(uint32_t index) const {
1327 ob_error *error = nullptr;
1328 auto ip = ob_device_list_get_device_local_ip(impl_, index, &error);
1329 Error::handle(&error);
1330 return ip;
1331 }
1332
1342 uint8_t getLocalSubnetLength(uint32_t index) const {
1343 ob_error *error = nullptr;
1344 auto subnetMask = ob_device_list_get_device_local_subnet_length(impl_, index, &error);
1345 Error::handle(&error);
1346 return subnetMask;
1347 }
1348
1358 const char *getLocalGateway(uint32_t index) const {
1359 ob_error *error = nullptr;
1360 auto gateway = ob_device_list_get_device_local_gateway(impl_, index, &error);
1361 Error::handle(&error);
1362 return gateway;
1363 }
1364
1374 const char* getLocalNetInterfaceName(uint32_t index) const {
1375 ob_error *error = nullptr;
1376 auto netItfName = ob_device_list_get_device_local_net_if_name(impl_, index, &error);
1377 Error::handle(&error);
1378 return netItfName;
1379 }
1380
1390 OBIpSourceType getIpSourceType(uint32_t index) const {
1391 ob_error *error = nullptr;
1392 auto ipSrcType = ob_device_list_get_device_ip_source_type(impl_, index, &error);
1393 Error::handle(&error);
1394 return ipSrcType;
1395 }
1396
1406 const char *getUserName(uint32_t index) const {
1407 ob_error *error = nullptr;
1408 auto userName = ob_device_list_get_device_user_name(impl_, index, &error);
1409 Error::handle(&error);
1410 return userName;
1411 }
1412
1425 std::shared_ptr<Device> getDevice(uint32_t index, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
1426 ob_error *error = nullptr;
1427 auto device = ob_device_list_get_device_ex(impl_, index, accessMode, &error);
1428 Error::handle(&error);
1429 return std::make_shared<Device>(device);
1430 }
1431
1444 std::shared_ptr<Device> getDeviceBySN(const char *serialNumber, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
1445 ob_error *error = nullptr;
1446 auto device = ob_device_list_get_device_by_serial_number_ex(impl_, serialNumber, accessMode, &error);
1447 Error::handle(&error);
1448 return std::make_shared<Device>(device);
1449 }
1450
1467 std::shared_ptr<Device> getDeviceByUid(const char *uid, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
1468 ob_error *error = nullptr;
1469 auto device = ob_device_list_get_device_by_uid_ex(impl_, uid, accessMode, &error);
1470 Error::handle(&error);
1471 return std::make_shared<Device>(device);
1472 }
1473
1474public:
1475 // The following interfaces are deprecated and are retained here for compatibility purposes.
1476 uint32_t deviceCount() const {
1477 return getCount();
1478 }
1479
1480 int pid(uint32_t index) const {
1481 return getPid(index);
1482 }
1483
1484 int vid(uint32_t index) const {
1485 return getVid(index);
1486 }
1487
1488 const char *uid(uint32_t index) const {
1489 return getUid(index);
1490 }
1491
1492 const char *serialNumber(uint32_t index) const {
1493 return getSerialNumber(index);
1494 }
1495
1496 const char *name(uint32_t index) const {
1497 return getName(index);
1498 }
1499
1500 const char *connectionType(uint32_t index) const {
1501 return getConnectionType(index);
1502 }
1503
1504 const char *ipAddress(uint32_t index) const {
1505 return getIpAddress(index);
1506 }
1507};
1508
1510private:
1511 ob_depth_work_mode_list_t *impl_ = nullptr;
1512
1513public:
1514 explicit OBDepthWorkModeList(ob_depth_work_mode_list_t *impl) : impl_(impl) {}
1516 ob_error *error = nullptr;
1517 ob_delete_depth_work_mode_list(impl_, &error);
1518 Error::handle(&error, false);
1519 }
1520
1526 uint32_t getCount() {
1527 ob_error *error = nullptr;
1528 auto count = ob_depth_work_mode_list_get_count(impl_, &error);
1529 Error::handle(&error);
1530 return count;
1531 }
1532
1541 ob_error *error = nullptr;
1542 auto mode = ob_depth_work_mode_list_get_item(impl_, index, &error);
1543 Error::handle(&error);
1544 return mode;
1545 }
1546
1554 OBDepthWorkMode operator[](uint32_t index) {
1555 return getOBDepthWorkMode(index);
1556 }
1557
1558public:
1559 // The following interfaces are deprecated and are retained here for compatibility purposes.
1560 uint32_t count() {
1561 return getCount();
1562 }
1563};
1564
1570private:
1571 ob_device_preset_list_t *impl_ = nullptr;
1572
1573public:
1574 explicit DevicePresetList(ob_device_preset_list_t *impl) : impl_(impl) {}
1576 ob_error *error = nullptr;
1577 ob_delete_preset_list(impl_, &error);
1578 Error::handle(&error, false);
1579 }
1580
1586 uint32_t getCount() {
1587 ob_error *error = nullptr;
1588 auto count = ob_device_preset_list_get_count(impl_, &error);
1589 Error::handle(&error);
1590 return count;
1591 }
1592
1600 const char *getName(uint32_t index) {
1601 ob_error *error = nullptr;
1602 const char *name = ob_device_preset_list_get_name(impl_, index, &error);
1603 Error::handle(&error);
1604 return name;
1605 }
1606
1613 bool hasPreset(const char *name) {
1614 ob_error *error = nullptr;
1615 auto result = ob_device_preset_list_has_preset(impl_, name, &error);
1616 Error::handle(&error);
1617 return result;
1618 }
1619
1620public:
1621 // The following interfaces are deprecated and are retained here for compatibility purposes.
1622 uint32_t count() {
1623 return getCount();
1624 }
1625};
1626
1631private:
1632 ob_camera_param_list_t *impl_ = nullptr;
1633
1634public:
1635 explicit CameraParamList(ob_camera_param_list_t *impl) : impl_(impl) {}
1636 ~CameraParamList() noexcept {
1637 ob_error *error = nullptr;
1638 ob_delete_camera_param_list(impl_, &error);
1639 Error::handle(&error, false);
1640 }
1641
1647 uint32_t getCount() {
1648 ob_error *error = nullptr;
1649 auto count = ob_camera_param_list_get_count(impl_, &error);
1650 Error::handle(&error);
1651 return count;
1652 }
1653
1662 ob_error *error = nullptr;
1663 auto param = ob_camera_param_list_get_param(impl_, index, &error);
1664 Error::handle(&error);
1665 return param;
1666 }
1667
1668public:
1669 // The following interfaces are deprecated and are retained here for compatibility purposes.
1670 uint32_t count() {
1671 return getCount();
1672 }
1673};
1674
1679private:
1680 ob_device_frame_interleave_list_t *impl_ = nullptr;
1681
1682public:
1683 explicit DeviceFrameInterleaveList(ob_device_frame_interleave_list_t *impl) : impl_(impl) {}
1685 ob_error *error = nullptr;
1686 ob_delete_frame_interleave_list(impl_, &error);
1687 Error::handle(&error, false);
1688 }
1689
1695 uint32_t getCount() {
1696 ob_error *error = nullptr;
1697 auto count = ob_device_frame_interleave_list_get_count(impl_, &error);
1698 Error::handle(&error);
1699 return count;
1700 }
1701
1709 const char *getName(uint32_t index) {
1710 ob_error *error = nullptr;
1711 const char *name = ob_device_frame_interleave_list_get_name(impl_, index, &error);
1712 Error::handle(&error);
1713 return name;
1714 }
1715
1723 bool hasFrameInterleave(const char *name) {
1724 ob_error *error = nullptr;
1725 auto result = ob_device_frame_interleave_list_has_frame_interleave(impl_, name, &error);
1726 Error::handle(&error);
1727 return result;
1728 }
1729};
1730
1735private:
1736 ob_preset_resolution_config_list_t *impl_ = nullptr;
1737
1738public:
1739 explicit PresetResolutionConfigList(ob_preset_resolution_config_list_t *impl) : impl_(impl) {}
1741 ob_error *error = nullptr;
1743 Error::handle(&error, false);
1744 }
1745
1749 uint32_t getCount() {
1750 ob_error *error = nullptr;
1751 auto count = ob_device_preset_resolution_config_get_count(impl_, &error);
1752 Error::handle(&error);
1753 return count;
1754 }
1755
1756 /*
1757 * @brief Get the device preset resolution ratio at the specified index
1758
1759 * @param[in] index the index of the device preset resolution ratio
1760 *
1761 * @return OBPresetResolutionConfig the corresponding device preset resolution ratio
1762 */
1764 ob_error *error = nullptr;
1765 auto config = ob_device_preset_resolution_config_list_get_item(impl_, index, &error);
1766 Error::handle(&error);
1767 return config;
1768 }
1769};
1770
1771} // namespace ob
OB_EXPORT const char * ob_device_get_current_preset_name(const ob_device *device, ob_error **error)
Get the current preset name.
OB_EXPORT bool ob_device_frame_interleave_list_has_frame_interleave(ob_device_frame_interleave_list *frame_interleave_list, const char *frame_interleave_name, ob_error **error)
Check if the interleave ae list has the interleave ae.
OB_EXPORT ob_status ob_device_switch_depth_work_mode(ob_device *device, const ob_depth_work_mode *work_mode, ob_error **error)
Switch the depth work mode by ob_depth_work_mode. Prefer to use ob_device_switch_depth_work_mode_by_n...
OB_EXPORT void ob_device_load_frame_interleave(ob_device *device, const char *frame_interleave_name, ob_error **error)
load the frame interleave mode according to frame interleavee name.
OB_EXPORT ob_depth_work_mode_list * ob_device_get_depth_work_mode_list(const ob_device *device, ob_error **error)
Request the list of supported depth work modes.
OB_EXPORT ob_preset_resolution_config_list * ob_device_get_available_preset_resolution_config_list(ob_device *device, ob_error **error)
Get the available preset resolution config list.
OB_EXPORT uint32_t ob_device_preset_list_get_count(const ob_device_preset_list *preset_list, ob_error **error)
Get the number of preset in the preset list.
OB_EXPORT void ob_device_export_current_settings_as_preset_json_data(ob_device *device, const char *presetName, const uint8_t **data, uint32_t *dataSize, ob_error **error)
Export current device settings as a preset json data.
OB_EXPORT void ob_device_load_preset_from_json_file(ob_device *device, const char *json_file_path, ob_error **error)
Load preset from json string.
OB_EXPORT void ob_delete_preset_list(ob_device_preset_list *preset_list, ob_error **error)
Delete the available preset list.
OB_EXPORT void ob_device_export_current_settings_as_preset_json_file(ob_device *device, const char *json_file_path, ob_error **error)
Export current settings as a preset json file.
OB_EXPORT const char * ob_device_frame_interleave_list_get_name(ob_device_frame_interleave_list *frame_interleave_list, uint32_t index, ob_error **error)
Get the name of frame interleave in the frame interleave list.
OB_EXPORT ob_device_frame_interleave_list * ob_device_get_available_frame_interleave_list(ob_device *device, ob_error **error)
Get the available frame interleave list.
OB_EXPORT const char * ob_device_get_current_depth_work_mode_name(const ob_device *device, ob_error **error)
Get current depth mode name.
OB_EXPORT void ob_device_load_preset(ob_device *device, const char *preset_name, ob_error **error)
Get the available preset list.
OB_EXPORT bool ob_device_preset_list_has_preset(const ob_device_preset_list *preset_list, const char *preset_name, ob_error **error)
Check if the preset list has the preset.
OB_EXPORT uint32_t ob_device_frame_interleave_list_get_count(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error)
Get the number of frame interleave in the frame interleave list.
OB_EXPORT OBPresetResolutionConfig ob_device_preset_resolution_config_list_get_item(const ob_preset_resolution_config_list *ob_preset_resolution_config_list, uint32_t index, ob_error **error)
Get the preset resolution in the preset resolution list.
OB_EXPORT ob_depth_work_mode ob_device_get_current_depth_work_mode(const ob_device *device, ob_error **error)
Get the current depth work mode.
OB_EXPORT bool ob_device_is_frame_interleave_supported(const ob_device *device, ob_error **error)
Check if the device supports the frame interleave feature.
OB_EXPORT void ob_delete_preset_resolution_config_list(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error)
Delete the available preset resolution list.
OB_EXPORT void ob_delete_frame_interleave_list(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error)
Delete the available frame interleave list.
OB_EXPORT void ob_device_load_preset_from_json_data(ob_device *device, const char *presetName, const uint8_t *data, uint32_t size, ob_error **error)
Load custom preset from data.
OB_EXPORT uint32_t ob_depth_work_mode_list_get_count(const ob_depth_work_mode_list *work_mode_list, ob_error **error)
Get the depth work mode count that ob_depth_work_mode_list hold.
OB_EXPORT ob_depth_work_mode ob_depth_work_mode_list_get_item(const ob_depth_work_mode_list *work_mode_list, uint32_t index, ob_error **error)
Get the index target of ob_depth_work_mode from work_mode_list.
OB_EXPORT ob_status ob_device_switch_depth_work_mode_by_name(ob_device *device, const char *mode_name, ob_error **error)
Switch the depth work mode by work mode name.
OB_EXPORT void ob_delete_depth_work_mode_list(ob_depth_work_mode_list *work_mode_list, ob_error **error)
Free the resources of ob_depth_work_mode_list.
OB_EXPORT const char * ob_device_preset_list_get_name(const ob_device_preset_list *preset_list, uint32_t index, ob_error **error)
Get the name of the preset in the preset list.
OB_EXPORT ob_device_preset_list * ob_device_get_available_preset_list(const ob_device *device, ob_error **error)
Get the available preset list.
OB_EXPORT uint32_t ob_device_preset_resolution_config_get_count(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error)
Get the number of preset resolution in the preset resolution list.
Device-related functions, including operations such as obtaining and creating a device,...
OB_EXPORT const char * ob_device_list_get_device_local_ip(const ob_device_list *list, uint32_t index, ob_error **error)
Get the IP address of the host network interface corresponding to the network device.
OB_EXPORT const char * ob_device_info_get_uid(const ob_device_info *info, ob_error **error)
Get device uid.
OB_EXPORT ob_ip_source_type ob_device_list_get_device_ip_source_type(const ob_device_list *list, uint32_t index, ob_error **error)
Get the current GVCP IP configuration status of the device at the specified index.
OB_EXPORT ob_device * ob_device_list_get_device_by_serial_number_ex(const ob_device_list *list, const char *serial_number, ob_device_access_mode accessMode, ob_error **error)
Create a device.
OB_EXPORT uint32_t ob_device_list_get_count(const ob_device_list *list, ob_error **error)
Get the number of devices.
OB_EXPORT void ob_device_enable_heartbeat(ob_device *device, bool enable, ob_error **error)
Enable or disable the device heartbeat.
OB_EXPORT ob_property_item ob_device_get_supported_property_item(const ob_device *device, uint32_t index, ob_error **error)
Get the type of property supported by the device.
OB_EXPORT const char * ob_device_list_get_device_local_net_if_name(const ob_device_list *list, uint32_t index, ob_error **error)
Get the name of the host network interface corresponding to the device.
OB_EXPORT void ob_device_set_structured_data(ob_device *device, ob_property_id property_id, const uint8_t *data, uint32_t data_size, ob_error **error)
Set structured data.
OB_EXPORT void ob_device_reboot(ob_device *device, ob_error **error)
Device reboot.
OB_EXPORT void ob_device_set_int_property(ob_device *device, ob_property_id property_id, int32_t value, ob_error **error)
Set an integer type of device property.
OB_EXPORT const char * ob_device_list_get_device_subnet_mask(const ob_device_list *list, uint32_t index, ob_error **error)
Get device subnet mask.
OB_EXPORT int ob_device_info_get_vid(const ob_device_info *info, ob_error **error)
Get device vid.
OB_EXPORT ob_device_state ob_device_get_device_state(const ob_device *device, ob_error **error)
Get the current device status.
OB_EXPORT const char * ob_device_info_get_name(const ob_device_info *info, ob_error **error)
Get device name.
OB_EXPORT bool ob_device_is_global_timestamp_supported(const ob_device *device, ob_error **error)
Check if the device supports global timestamp.
OB_EXPORT const char * ob_device_info_get_subnet_mask(const ob_device_info *info, ob_error **error)
Get the network device subnet mask.
OB_EXPORT ob_float_property_range ob_device_get_float_property_range(ob_device *device, ob_property_id property_id, ob_error **error)
Get the float type of device property range.
OB_EXPORT const char * ob_device_info_get_asicName(const ob_device_info *info, ob_error **error)
Get the chip name.
OB_EXPORT const char * ob_device_info_get_supported_min_sdk_version(const ob_device_info *info, ob_error **error)
Get the minimum SDK version number supported by the device.
OB_EXPORT uint8_t ob_device_list_get_device_local_subnet_length(const ob_device_list *list, uint32_t index, ob_error **error)
Get the subnet length of the host network interface corresponding to the network device.
OB_EXPORT const char * ob_device_list_get_device_local_mac(const ob_device_list *list, uint32_t index, ob_error **error)
Get the MAC address of the host network interface corresponding to the network device.
OB_EXPORT bool ob_device_get_bool_property(ob_device *device, ob_property_id property_id, ob_error **error)
Get a boolean type of device property.
OB_EXPORT const char * ob_device_get_extension_info(const ob_device *device, const char *info_key, ob_error **error)
Get the device extension information.
OB_EXPORT uint32_t ob_device_get_supported_property_count(const ob_device *device, ob_error **error)
Get the number of properties supported by the device.
OB_EXPORT ob_device * ob_device_list_get_device_by_uid_ex(const ob_device_list *list, const char *uid, ob_device_access_mode accessMode, ob_error **error)
Create device by uid.
OB_EXPORT void ob_delete_device_info(ob_device_info *info, ob_error **error)
Delete device information.
OB_EXPORT const char * ob_device_info_get_connection_type(const ob_device_info *info, ob_error **error)
Get the device connection type.
OB_EXPORT int ob_device_list_get_device_vid(const ob_device_list *list, uint32_t index, ob_error **error)
Get the vid of the specified device.
OB_EXPORT const char * ob_device_list_get_device_name(const ob_device_list *list, uint32_t index, ob_error **error)
Get device name.
OB_EXPORT int ob_device_info_get_pid(const ob_device_info *info, ob_error **error)
Get device pid.
OB_EXPORT bool ob_device_is_property_supported(const ob_device *device, ob_property_id property_id, ob_permission_type permission, ob_error **error)
Check if a device property permission is supported.
OB_EXPORT void ob_device_enable_firmware_log(ob_device *device, bool enable, ob_error **error)
Enable or disable the device firmware log.
OB_EXPORT void ob_device_set_float_property(ob_device *device, ob_property_id property_id, float value, ob_error **error)
Set a float type of device property.
OB_EXPORT ob_camera_param ob_camera_param_list_get_param(ob_camera_param_list *param_list, uint32_t index, ob_error **error)
Get camera parameters from the camera parameter list.
OB_EXPORT void ob_device_write_customer_data(ob_device *device, const void *data, uint32_t data_size, ob_error **error)
Set customer data.
OB_EXPORT ob_int_property_range ob_device_get_int_property_range(ob_device *device, ob_property_id property_id, ob_error **error)
Get the integer type of device property range.
OB_EXPORT ob_sensor * ob_device_get_sensor(ob_device *device, ob_sensor_type type, ob_error **error)
Get a device's sensor.
OB_EXPORT ob_camera_param_list * ob_device_get_calibration_camera_param_list(ob_device *device, ob_error **error)
Get the original parameter list of camera calibration saved on the device.
OB_EXPORT bool ob_device_is_extension_info_exist(const ob_device *device, const char *info_key, ob_error **error)
Check if the device extension information exists.
OB_EXPORT void ob_delete_camera_param_list(ob_camera_param_list *param_list, ob_error **error)
Delete the camera parameter list.
OB_EXPORT const char * ob_device_info_get_hardware_version(const ob_device_info *info, ob_error **error)
Get the hardware version number.
OB_EXPORT const char * ob_device_list_get_device_serial_number(const ob_device_list *list, uint32_t index, ob_error **error)
Get the serial number of the specified device.
OB_EXPORT void ob_device_send_and_receive_data(ob_device *device, const uint8_t *send_data, uint32_t send_data_size, uint8_t *receive_data, uint32_t *receive_data_size, ob_error **error)
Send data to the device and receive data from the device.
OB_EXPORT const char * ob_device_info_get_serial_number(const ob_device_info *info, ob_error **error)
Get device serial number.
OB_EXPORT ob_device_info * ob_device_get_device_info(const ob_device *device, ob_error **error)
Get device information.
OB_EXPORT void ob_device_enable_global_timestamp(ob_device *device, bool enable, ob_error **error)
Enable or disable global timestamp.
OB_EXPORT ob_device_type ob_device_info_get_device_type(const ob_device_info *info, ob_error **error)
Get the device type.
OB_EXPORT const char * ob_device_list_get_device_ip_address(const ob_device_list *list, uint32_t index, ob_error **error)
Get device ip address.
OB_EXPORT void ob_device_set_state_changed_callback(ob_device *device, ob_device_state_callback callback, void *user_data, ob_error **error)
Set the device state changed callback.
OB_EXPORT const char * ob_device_list_get_device_local_gateway(const ob_device_list *list, uint32_t index, ob_error **error)
Get the gateway of the host network interface corresponding to the network device.
OB_EXPORT void ob_device_update_optional_depth_presets(ob_device *device, const char file_path_list[][OB_PATH_MAX], uint8_t path_count, ob_device_fw_update_callback callback, void *user_data, ob_error **error)
Update the device optional depth presets.
OB_EXPORT ob_device * ob_device_list_get_device_ex(const ob_device_list *list, uint32_t index, ob_device_access_mode accessMode, ob_error **error)
Create a device.
OB_EXPORT const char * ob_device_info_get_ip_address(const ob_device_info *info, ob_error **error)
Get the device IP address.
OB_EXPORT void ob_delete_device(ob_device *device, ob_error **error)
Delete a device.
OB_EXPORT void ob_device_get_structured_data(ob_device *device, ob_property_id property_id, uint8_t *data, uint32_t *data_size, ob_error **error)
Get structured data of a device property.
OB_EXPORT ob_sensor_list * ob_device_get_sensor_list(const ob_device *device, ob_error **error)
List all sensors.
OB_EXPORT int ob_device_list_get_device_pid(const ob_device_list *list, uint32_t index, ob_error **error)
Get the pid of the specified device.
OB_EXPORT float ob_device_get_float_property(ob_device *device, ob_property_id property_id, ob_error **error)
Get a float type of device property.
OB_EXPORT uint32_t ob_camera_param_list_get_count(ob_camera_param_list *param_list, ob_error **error)
Get the number of camera parameter lists.
OB_EXPORT const char * ob_device_info_get_gateway(const ob_device_info *info, ob_error **error)
Get the network device gateway address.
OB_EXPORT ob_bool_property_range ob_device_get_bool_property_range(ob_device *device, ob_property_id property_id, ob_error **error)
Get the boolean type of device property range.
OB_EXPORT void ob_device_update_firmware(ob_device *device, const char *path, ob_device_fw_update_callback callback, bool async, void *user_data, ob_error **error)
Update the device firmware.
OB_EXPORT void ob_device_read_customer_data(ob_device *device, void *data, uint32_t *data_size, ob_error **error)
Get customer data of a device property.
OB_EXPORT const char * ob_device_list_get_device_uid(const ob_device_list *list, uint32_t index, ob_error **error)
Get the uid of the specified device.
OB_EXPORT void ob_device_set_bool_property(ob_device *device, ob_property_id property_id, bool value, ob_error **error)
Set a boolean type of device property.
OB_EXPORT int32_t ob_device_get_int_property(ob_device *device, ob_property_id property_id, ob_error **error)
Get an integer type of device property.
OB_EXPORT void ob_device_update_firmware_from_data(ob_device *device, const uint8_t *data, uint32_t data_size, ob_device_fw_update_callback callback, bool async, void *user_data, ob_error **error)
Update the device firmware from data.
OB_EXPORT const char * ob_device_list_get_device_connection_type(const ob_device_list *list, uint32_t index, ob_error **error)
Get device connection type.
OB_EXPORT const char * ob_device_list_get_device_user_name(const ob_device_list *list, uint32_t index, ob_error **error)
Get the user-defined name of the device at the specified index.
OB_EXPORT void ob_delete_device_list(ob_device_list *list, ob_error **error)
Delete a device list.
OB_EXPORT const char * ob_device_list_get_device_gateway(const ob_device_list *list, uint32_t index, ob_error **error)
Get device gateway.
OB_EXPORT const char * ob_device_info_get_firmware_version(const ob_device_info *info, ob_error **error)
Get the firmware version number.
This file defines the Error class, which describes abnormal errors within the SDK....
This file contains the Filter class, which is the processing unit of the SDK that can perform point c...
OB_EXPORT void ob_device_timer_sync_with_host(ob_device *device, ob_error **error)
synchronize the timer of the device with the host.
OB_EXPORT void ob_device_trigger_capture(ob_device *device, ob_error **error)
send the capture command to the device to trigger the capture.
OB_EXPORT ob_multi_device_sync_config ob_device_get_multi_device_sync_config(const ob_device *device, ob_error **error)
get the current multi device sync configuration of the device.
OB_EXPORT uint16_t ob_device_get_supported_multi_device_sync_mode_bitmap(const ob_device *device, ob_error **error)
Get the supported multi device sync mode bitmap of the device.
OB_EXPORT void ob_device_set_multi_device_sync_config(ob_device *device, const ob_multi_device_sync_config *config, ob_error **error)
set the multi device sync configuration of the device.
OB_EXPORT ob_device_timestamp_reset_config ob_device_get_timestamp_reset_config(ob_device *device, ob_error **error)
get the timestamp reset configuration of the device.
OB_EXPORT void ob_device_set_timestamp_reset_config(ob_device *device, const ob_device_timestamp_reset_config *config, ob_error **error)
set the timestamp reset configuration of the device.
OB_EXPORT void ob_device_timestamp_reset(ob_device *device, ob_error **error)
send the timestamp reset command to the device.
OBSensorType
Enumeration value describing the sensor type.
Definition ObTypes.h:179
OBStatus
error code
Definition ObTypes.h:76
@ OB_DEVICE_DEFAULT_ACCESS
Default access: control access for capable devices, ignored otherwise.
Definition ObTypes.h:2021
uint64_t OBDeviceState
Device state.
Definition ObTypes.h:729
enum OBUpgradeState OBFwUpdateState
OBDeviceType
Enumeration for device types.
Definition ObTypes.h:794
struct ob_device_t ob_device
Definition ObTypes.h:23
enum ob_ip_source_type OBIpSourceType
enum OBUpgradeState ob_fw_update_state
struct ob_device_timestamp_reset_config OBDeviceTimestampResetConfig
struct ob_multi_device_sync_config OBMultiDeviceSyncConfig
enum ob_device_access_mode OBDeviceAccessMode
OBPermissionType
the permission type of api or property
Definition ObTypes.h:64
#define OB_PATH_MAX
maximum path length
Definition ObTypes.h:59
Control command property list maintenance.
OBPropertyID
Enumeration value describing all attribute control commands of the device.
Definition Property.h:20
@ OB_PROP_DEVICE_REBOOT_DELAY_INT
Reboot device delay mode. Delay time unit: ms, range: [0, 8000).
Definition Property.h:383
Defines types related to sensors, which are used to obtain stream configurations, open and close stre...
Class representing a list of camera parameters.
Definition Device.hpp:1630
~CameraParamList() noexcept
Definition Device.hpp:1636
CameraParamList(ob_camera_param_list_t *impl)
Definition Device.hpp:1635
uint32_t getCount()
Get the number of camera parameters in the list.
Definition Device.hpp:1647
OBCameraParam getCameraParam(uint32_t index)
Get the camera parameters for the specified index.
Definition Device.hpp:1661
Class representing a list of device Frame Interleave.
Definition Device.hpp:1678
uint32_t getCount()
Get the number of device frame interleave in the list.
Definition Device.hpp:1695
DeviceFrameInterleaveList(ob_device_frame_interleave_list_t *impl)
Definition Device.hpp:1683
bool hasFrameInterleave(const char *name)
check if the frame interleave list contains the special name frame interleave.
Definition Device.hpp:1723
~DeviceFrameInterleaveList() noexcept
Definition Device.hpp:1684
const char * getName(uint32_t index)
Get the name of the device frame interleave at the specified index.
Definition Device.hpp:1709
DeviceStateChangedCallback deviceStateChangeCallback_
Definition Device.hpp:56
void deviceUpgradeFromData(const uint8_t *firmwareData, uint32_t firmwareDataSize, DeviceFwUpdateCallback callback, bool async=true)
Definition Device.hpp:880
void updateFirmwareFromData(const uint8_t *firmwareData, uint32_t firmwareDataSize, DeviceFwUpdateCallback callback, bool async=true)
Update the device firmware from data.
Definition Device.hpp:414
OBPropertyItem getSupportedProperty(uint32_t index) const
Get the supported properties of the device.
Definition Device.hpp:347
ob_device * impl_
Definition Device.hpp:55
std::shared_ptr< CameraParamList > getCalibrationCameraParamList()
Definition Device.hpp:884
const char * getCurrentPresetName() const
Get current preset name.
Definition Device.hpp:693
void timerSyncWithHost() const
synchronize the timer of the device with the host.
Definition Device.hpp:681
OBStatus switchDepthWorkMode(const char *modeName) const
Switch depth work mode by work mode name.
Definition Device.hpp:495
void loadPresetFromJsonData(const char *presetName, const uint8_t *data, uint32_t size)
Load custom preset from data.
Definition Device.hpp:754
Device(Device &&other) noexcept
Definition Device.hpp:65
void deviceUpgrade(const char *filePath, DeviceFwUpdateCallback callback, bool async=true)
Definition Device.hpp:876
OBFloatPropertyRange getFloatPropertyRange(OBPropertyID propertyId) const
Get float type device property range((including current value and default value)
Definition Device.hpp:257
DeviceFwUpdateCallback fwUpdateCallback_
Definition Device.hpp:57
void readCustomerData(void *data, uint32_t *dataSize)
Get the customer data type of a device property.
Definition Device.hpp:322
OBDeviceTimestampResetConfig getTimestampResetConfig() const
get the timestamp reset configuration of the device.
Definition Device.hpp:639
bool isFrameInterleaveSupported() const
Check if the device supports the frame interleave feature.
Definition Device.hpp:824
void setIntProperty(OBPropertyID propertyId, int32_t value) const
Set int type of device property.
Definition Device.hpp:164
void triggerCapture() const
send the capture command to the device.
Definition Device.hpp:619
Device & operator=(const Device &)=delete
void timestampReset() const
send the timestamp reset command to the device.
Definition Device.hpp:657
void setStructuredData(OBPropertyID propertyId, const uint8_t *data, uint32_t dataSize) const
Set the structured data type of a device property.
Definition Device.hpp:285
std::shared_ptr< SensorList > getSensorList() const
Get device sensor list.
Definition Device.hpp:138
Device(ob_device_t *impl)
Describe the entity of the RGBD camera, representing a specific model of RGBD camera.
Definition Device.hpp:63
void getStructuredData(OBPropertyID propertyId, uint8_t *data, uint32_t *dataSize) const
Get the structured data type of a device property.
Definition Device.hpp:298
int getSupportedPropertyCount() const
Get the number of properties supported by the device.
Definition Device.hpp:333
OBBoolPropertyRange getBoolPropertyRange(OBPropertyID propertyId) const
Get bool type device property range (including current value and default value)
Definition Device.hpp:271
std::shared_ptr< OBDepthWorkModeList > getDepthWorkModeList() const
Request support depth work mode list.
Definition Device.hpp:507
Device(const Device &)=delete
void updateOptionalDepthPresets(const char filePathList[][OB_PATH_MAX], uint8_t pathCount, DeviceFwUpdateCallback callback)
Update the device optional depth presets.
Definition Device.hpp:428
void loadFrameInterleave(const char *frameInterleaveName) const
load the frame interleave according to frame interleave name.
Definition Device.hpp:836
std::function< void(OBDeviceState state, const char *message)> DeviceStateChangedCallback
Callback function for device status updates.
Definition Device.hpp:52
int32_t getIntProperty(OBPropertyID propertyId) const
Get int type of device property.
Definition Device.hpp:201
Device & operator=(Device &&other) noexcept
Definition Device.hpp:69
void timerReset() const
Alias for timestampReset() since it is more accurate.
Definition Device.hpp:666
void sendAndReceiveData(const uint8_t *sendData, uint32_t sendDataSize, uint8_t *receiveData, uint32_t *receiveDataSize) const
Send data to the device and receive data from the device.
Definition Device.hpp:813
bool isExtensionInfoExist(const std::string &infoKey) const
Check if the extension information is exist.
Definition Device.hpp:112
OBIntPropertyRange getIntPropertyRange(OBPropertyID propertyId) const
Get int type device property range (including current value and default value)
Definition Device.hpp:243
void setFloatProperty(OBPropertyID propertyId, float value) const
Set float type of device property.
Definition Device.hpp:176
void exportSettingsAsPresetJsonFile(const char *filePath) const
Export current device settings as a preset json file.
Definition Device.hpp:783
void updateFirmware(const char *filePath, DeviceFwUpdateCallback callback, bool async=true)
Update the device firmware.
Definition Device.hpp:399
const char * getExtensionInfo(const std::string &infoKey) const
Get information about extensions obtained from SDK supported by the device.
Definition Device.hpp:126
OBStatus switchDepthWorkMode(const OBDepthWorkMode &workMode) const
Switch depth work mode by OBDepthWorkMode. Prefer invoke switchDepthWorkMode(const char *modeName) to...
Definition Device.hpp:483
void reboot(uint32_t delayMs) const
Device restart delay mode.
Definition Device.hpp:533
const char * getCurrentDepthModeName()
Get current depth mode name.
Definition Device.hpp:471
std::shared_ptr< DeviceInfo > getDeviceInfo() const
Get device information.
Definition Device.hpp:98
float getFloatProperty(OBPropertyID propertyId) const
Get float type of device property.
Definition Device.hpp:215
ob_device_t * getImpl() const
Definition Device.hpp:89
virtual ~Device() noexcept
Definition Device.hpp:83
bool isGlobalTimestampSupported() const
Check if the global timestamp is supported for the device.
Definition Device.hpp:374
void setTimestampResetConfig(const OBDeviceTimestampResetConfig &config) const
set the timestamp reset configuration of the device.
Definition Device.hpp:628
OBMultiDeviceSyncConfig getMultiDeviceSyncConfig() const
get the multi device sync configuration of the device.
Definition Device.hpp:601
void exportSettingsAsPresetJsonData(const char *presetName, const uint8_t **data, uint32_t *dataSize)
Export current device settings as a preset json data.
Definition Device.hpp:771
void enableGlobalTimestamp(bool enable)
Enable or disable the global timestamp.
Definition Device.hpp:386
void loadPresetFromJsonFile(const char *filePath) const
Load custom preset from file.
Definition Device.hpp:736
bool isPropertySupported(OBPropertyID propertyId, OBPermissionType permission) const
Check if a property permission is supported.
Definition Device.hpp:362
OBDeviceState getDeviceState()
Get the current device status.
Definition Device.hpp:794
void loadDepthFilterConfig(const char *filePath)
Definition Device.hpp:891
bool getBoolProperty(OBPropertyID propertyId) const
Get bool type of device property.
Definition Device.hpp:229
std::shared_ptr< DevicePresetList > getAvailablePresetList() const
Get available preset list.
Definition Device.hpp:719
void reboot() const
Device restart.
Definition Device.hpp:519
void writeCustomerData(const void *data, uint32_t dataSize)
Set the customer data type of a device property.
Definition Device.hpp:310
void enableHeartbeat(bool enable) const
Enable or disable the device heartbeat.
Definition Device.hpp:546
void setBoolProperty(OBPropertyID propertyId, bool value) const
Set bool type of device property.
Definition Device.hpp:188
uint16_t getSupportedMultiDeviceSyncModeBitmap() const
Get the supported multi device sync mode bitmap of the device.
Definition Device.hpp:578
std::shared_ptr< DeviceFrameInterleaveList > getAvailableFrameInterleaveList() const
Get available frame interleave list.
Definition Device.hpp:847
OBDepthWorkMode getCurrentDepthWorkMode() const
Get current depth work mode.
Definition Device.hpp:458
std::function< void(OBFwUpdateState state, const char *message, uint8_t percent)> DeviceFwUpdateCallback
Callback function for device firmware update progress.
Definition Device.hpp:44
void setDeviceStateChangedCallback(DeviceStateChangedCallback callback)
Set the device state changed callbacks.
Definition Device.hpp:441
void enableFirmwareLog(bool enable) const
Enable or disable the device firmware log.
Definition Device.hpp:557
static void deviceStateChangedCallback(OBDeviceState state, const char *message, void *userData)
Definition Device.hpp:448
void setMultiDeviceSyncConfig(const OBMultiDeviceSyncConfig &config) const
set the multi device sync configuration of the device.
Definition Device.hpp:590
std::shared_ptr< Sensor > getSensor(OBSensorType type) const
Get specific type of sensor if device not open, SDK will automatically open the connected device and ...
Definition Device.hpp:151
void loadPreset(const char *presetName) const
load the preset according to the preset name.
Definition Device.hpp:706
std::shared_ptr< PresetResolutionConfigList > getAvailablePresetResolutionConfigList() const
Get the available preset resolution config list.
Definition Device.hpp:859
A class describing device information, representing the name, id, serial number and other basic infor...
Definition Device.hpp:900
int vid() const
Definition Device.hpp:1097
const char * getSupportedMinSdkVersion() const
Get the minimum version number of the SDK supported by the device.
Definition Device.hpp:1028
const char * getHardwareVersion() const
Get the version number of the hardware.
Definition Device.hpp:1016
const char * getDeviceSubnetMask() const
Get the subnet mask of the device.
Definition Device.hpp:1064
const char * getIpAddress() const
Get the IP address of the device.
Definition Device.hpp:1004
DeviceInfo(ob_device_info_t *impl)
Definition Device.hpp:905
const char * getFirmwareVersion() const
Get the version number of the firmware.
Definition Device.hpp:977
OBDeviceType deviceType() const
Definition Device.hpp:1133
int getPid() const
Get the pid of the device.
Definition Device.hpp:929
const char * connectionType() const
Definition Device.hpp:1113
const char * uid() const
Definition Device.hpp:1101
const char * serialNumber() const
Definition Device.hpp:1105
const char * getDevicegateway()
Definition Device.hpp:1085
const char * getAsicName() const
Get chip type name.
Definition Device.hpp:1040
int pid() const
Definition Device.hpp:1093
const char * ipAddress() const
Definition Device.hpp:1117
const char * firmwareVersion() const
Definition Device.hpp:1109
const char * hardwareVersion() const
Definition Device.hpp:1121
const char * name() const
Definition Device.hpp:1089
~DeviceInfo() noexcept
Definition Device.hpp:906
OBDeviceType getDeviceType() const
Get the device type.
Definition Device.hpp:1052
const char * getDeviceGateway() const
Get the gateway address of the device.
Definition Device.hpp:1076
const char * asicName() const
Definition Device.hpp:1129
const char * getSerialNumber() const
Get the serial number of the device.
Definition Device.hpp:965
const char * supportedMinSdkVersion() const
Definition Device.hpp:1125
const char * getUid() const
Get system assigned uid for distinguishing between different devices.
Definition Device.hpp:953
int getVid() const
Get the vid of the device.
Definition Device.hpp:941
const char * getConnectionType() const
Get the connection type of the device.
Definition Device.hpp:990
const char * getName() const
Get device name.
Definition Device.hpp:917
const char * getLocalMacAddress(uint32_t index) const
Get the MAC address of the host network interface corresponding to the device at the specified index.
Definition Device.hpp:1310
const char * serialNumber(uint32_t index) const
Definition Device.hpp:1492
const char * getIpAddress(uint32_t index) const
get the ip address of the device at the specified index
Definition Device.hpp:1262
uint8_t getLocalSubnetLength(uint32_t index) const
Get the subnet length of the host network interface corresponding to the device at the specified inde...
Definition Device.hpp:1342
const char * getGateway(uint32_t index) const
get the gateway of the device at the specified index
Definition Device.hpp:1294
int pid(uint32_t index) const
Definition Device.hpp:1480
OBIpSourceType getIpSourceType(uint32_t index) const
Get the current IP configuration mode of the device at the specified index.
Definition Device.hpp:1390
std::shared_ptr< Device > getDeviceByUid(const char *uid, OBDeviceAccessMode accessMode=OB_DEVICE_DEFAULT_ACCESS) const
Get the specified device object from the device list by uid.
Definition Device.hpp:1467
const char * ipAddress(uint32_t index) const
Definition Device.hpp:1504
const char * uid(uint32_t index) const
Definition Device.hpp:1488
int vid(uint32_t index) const
Definition Device.hpp:1484
uint32_t getCount() const
Get the number of devices in the list.
Definition Device.hpp:1158
const char * getSubnetMask(uint32_t index) const
get the subnet mask of the device at the specified index
Definition Device.hpp:1278
const char * connectionType(uint32_t index) const
Definition Device.hpp:1500
const char * getUserName(uint32_t index) const
Get the user-defined name of the device at the specified index.
Definition Device.hpp:1406
uint32_t deviceCount() const
Definition Device.hpp:1476
const char * getLocalGateway(uint32_t index) const
Get the gateway of the host network interface corresponding to the device at the specified index.
Definition Device.hpp:1358
const char * getUid(uint32_t index) const
Get the UID of the device at the specified index.
Definition Device.hpp:1200
~DeviceList() noexcept
Definition Device.hpp:1147
const char * getSerialNumber(uint32_t index) const
Get the serial number of the device at the specified index.
Definition Device.hpp:1214
int getPid(uint32_t index) const
Get the PID of the device at the specified index.
Definition Device.hpp:1172
const char * getConnectionType(uint32_t index) const
Get device connection type.
Definition Device.hpp:1246
std::shared_ptr< Device > getDevice(uint32_t index, OBDeviceAccessMode accessMode=OB_DEVICE_DEFAULT_ACCESS) const
Get the device object at the specified index.
Definition Device.hpp:1425
std::shared_ptr< Device > getDeviceBySN(const char *serialNumber, OBDeviceAccessMode accessMode=OB_DEVICE_DEFAULT_ACCESS) const
Get the device object with the specified serial number.
Definition Device.hpp:1444
int getVid(uint32_t index) const
Get the VID of the device at the specified index.
Definition Device.hpp:1186
const char * getLocalIP(uint32_t index) const
Get the IP address of the host network interface corresponding to the device at the specified index.
Definition Device.hpp:1326
const char * getLocalNetInterfaceName(uint32_t index) const
Get the name of the host network interface corresponding to the device at the specified index.
Definition Device.hpp:1374
DeviceList(ob_device_list_t *impl)
Definition Device.hpp:1146
const char * getName(uint32_t index) const
Get the name of the device at the specified index in the device list.
Definition Device.hpp:1231
const char * name(uint32_t index) const
Definition Device.hpp:1496
Class representing a list of device presets.
Definition Device.hpp:1569
DevicePresetList(ob_device_preset_list_t *impl)
Definition Device.hpp:1574
uint32_t getCount()
Get the number of device presets in the list.
Definition Device.hpp:1586
~DevicePresetList() noexcept
Definition Device.hpp:1575
const char * getName(uint32_t index)
Get the name of the device preset at the specified index.
Definition Device.hpp:1600
bool hasPreset(const char *name)
check if the preset list contains the special name preset.
Definition Device.hpp:1613
static void handle(ob_error **error, bool throw_exception=true)
A static function to handle the ob_error and throw an exception if needed.
Definition Error.hpp:38
uint32_t getCount()
Get the number of OBDepthWorkMode objects in the list.
Definition Device.hpp:1526
OBDepthWorkModeList(ob_depth_work_mode_list_t *impl)
Definition Device.hpp:1514
OBDepthWorkMode getOBDepthWorkMode(uint32_t index)
Get the OBDepthWorkMode object at the specified index.
Definition Device.hpp:1540
OBDepthWorkMode operator[](uint32_t index)
Get the OBDepthWorkMode object at the specified index.
Definition Device.hpp:1554
Class representing a list of preset resolution config list.
Definition Device.hpp:1734
uint32_t getCount()
Get the number of device preset resolution ratio in the list.
Definition Device.hpp:1749
OBPresetResolutionConfig getPresetResolutionRatioConfig(uint32_t index)
Definition Device.hpp:1763
PresetResolutionConfigList(ob_preset_resolution_config_list_t *impl)
Definition Device.hpp:1739
Definition Context.hpp:22
Structure for boolean range.
Definition ObTypes.h:432
Structure for camera parameters.
Definition ObTypes.h:515
Depth work mode.
Definition ObTypes.h:1124
Structure for float range.
Definition ObTypes.h:399
Structure for integer range.
Definition ObTypes.h:388
Used to describe the characteristics of each property.
Definition Property.h:1112
The error class exposed by the SDK, users can get detailed error information according to the error.
Definition ObTypes.h:159