| OrbbecSDK 1.5.7 OrbbecSDK: Software-Development-Kit for Orbbec 3D-Sensor devices

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Device.hpp
Go to the documentation of this file.
1
11 #pragma once
12 #include "Types.hpp"
13
14 #include "libobsensor/h/Property.h"
15
16 #include <memory>
17 #include <string>
18 #include <vector>
19
20 struct DeviceImpl;
21 struct DeviceInfoImpl;
22 struct DeviceListImpl;
23 struct CameraParamListImpl;
24
25 namespace ob {
26 class SensorList;
27 class Context;
28 class DeviceInfo;
29 class Sensor;
30 class CameraParamList;
31 class OBDepthWorkModeList;
32
33 class OB_EXTENSION_API Device {
34 private:
35 std::unique_ptr<DeviceImpl> impl_;
36
37 public:
45 Device(std::unique_ptr<DeviceImpl> impl);
46 virtual ~Device() noexcept;
58 std::shared_ptr<DeviceInfo> getDeviceInfo();
59
71 std::shared_ptr<SensorList> getSensorList();
72
86 std::shared_ptr<Sensor> getSensor(OBSensorType type);
100 void setIntProperty(OBPropertyID propertyId, int32_t property);
101
115 void setFloatProperty(OBPropertyID propertyId, float property);
116
130 void setBoolProperty(OBPropertyID propertyId, bool property);
131
145 int32_t getIntProperty(OBPropertyID propertyId);
146
160 float getFloatProperty(OBPropertyID propertyId);
161
175 bool getBoolProperty(OBPropertyID propertyId);
176
190 OBIntPropertyRange getIntPropertyRange(OBPropertyID propertyId);
191
205 OBFloatPropertyRange getFloatPropertyRange(OBPropertyID propertyId);
206
220 OBBoolPropertyRange getBoolPropertyRange(OBPropertyID propertyId);
221
237 void writeAHB(uint32_t reg, uint32_t mask, uint32_t value);
238
254 void readAHB(uint32_t reg, uint32_t mask, uint32_t *value);
255
273 void writeI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t value);
274
292 void readI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t *value);
293
313 void writeFlash(uint32_t offset, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
314
334 void readFlash(uint32_t offset, uint32_t dataSize, GetDataCallback callback, bool async = false);
335
355 void setRawData(OBPropertyID propertyId, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
356
376 void getRawData(OBPropertyID propertyId, GetDataCallback callback, bool async = false);
377
393 void setStructuredData(OBPropertyID propertyId, const void *data, uint32_t dataSize);
394
410 void getStructuredData(OBPropertyID propertyId, void *data, uint32_t *dataSize);
411
427 void setStructuredDataExt(OBPropertyID propertyId, std::shared_ptr<OBDataBundle> dataBundle, SetDataCallback callback);
428
442 std::shared_ptr<OBDataBundle> getStructuredDataExt(OBPropertyID propertyId);
443
455 OBProtocolVersion getProtocolVersion();
456
470 OBCmdVersion getCmdVersion(OBPropertyID propertyId);
471
483 uint32_t getSupportedPropertyCount();
484
498 OBPropertyItem getSupportedProperty(uint32_t index);
499
515 bool isPropertySupported(OBPropertyID propertyId, OBPermissionType permission);
516
526 uint64_t syncDeviceTime();
527
543 void deviceUpgrade(const char *filePath, DeviceUpgradeCallback callback, bool async = true);
544
562 void sendFile(const char *filePath, const char *dstPath, SendFileCallback callback, bool async = true);
563
573 OBDeviceState getDeviceState();
574
586 void setDeviceStateChangedCallback(DeviceStateChangedCallback callback);
587
599 bool activateAuthorization(const char *authCode);
600
610 void writeAuthorizationCode(const char *authCodeStr);
611
626 std::shared_ptr<CameraParamList> getCalibrationCameraParamList();
627
639 OBDepthWorkMode getCurrentDepthWorkMode();
640
654 OBStatus switchDepthWorkMode(const OBDepthWorkMode &workMode);
655
669 OBStatus switchDepthWorkMode(const char *modeName);
670
681 std::shared_ptr<OBDepthWorkModeList> getDepthWorkModeList();
682
694 void reboot();
695
702 OBDeviceSyncConfig getSyncConfig();
703
712 void setSyncConfig(const OBDeviceSyncConfig &deviceSyncConfig);
713
714 friend class Pipeline;
715 friend class Recorder;
716 };
717
726 class OB_EXTENSION_API DeviceInfo {
727 private:
728 std::unique_ptr<DeviceInfoImpl> impl_;
729
730 public:
731 DeviceInfo(std::unique_ptr<DeviceInfoImpl> impl);
732 virtual ~DeviceInfo() noexcept;
744 const char *name();
745
757 int pid();
758
770 int vid();
771
783 const char *uid();
784
796 const char *serialNumber();
797
809 const char *firmwareVersion();
810
822 DEPRECATED const char *usbType();
823
835 const char *connectionType();
836
848 const char *hardwareVersion();
849
861 const char *supportedMinSdkVersion();
862
874 const char *asicName();
875
887 OBDeviceType deviceType();
888
889 friend class Context;
890 friend class DeviceList;
891 friend class Pipeline;
892 };
893
894 class OB_EXTENSION_API DeviceList {
895 private:
896 std::unique_ptr<DeviceListImpl> impl_;
897
898 public:
899 DeviceList(std::unique_ptr<DeviceListImpl> impl);
900 ~DeviceList() noexcept;
901
913 uint32_t deviceCount();
914
928 DEPRECATED const char *name(uint32_t index);
929
943 int pid(uint32_t index);
944
958 int vid(uint32_t index);
959
973 const char *uid(uint32_t index);
974
988 const char *serialNumber(uint32_t index);
989
1003 std::shared_ptr<Device> getDevice(uint32_t index);
1004
1018 std::shared_ptr<Device> getDeviceBySN(const char *serialNumber);
1019
1033 std::shared_ptr<Device> getDeviceByUid(const char *uid);
1034 };
1035
1036 class OB_EXTENSION_API CameraParamList {
1037 private:
1038 std::unique_ptr<CameraParamListImpl> impl_;
1039
1040 public:
1041 CameraParamList(std::unique_ptr<CameraParamListImpl> impl);
1042 ~CameraParamList() noexcept;
1054 uint32_t count();
1055
1069 OBCameraParam getCameraParam(uint32_t index);
1070 };
1071
1080 class OB_EXTENSION_API OBDepthWorkModeList {
1081 private:
1082 std::unique_ptr<OBDepthWorkModeListImpl> impl_;
1083
1084 public:
1085 OBDepthWorkModeList(std::unique_ptr<OBDepthWorkModeListImpl> impl_);
1086 ~OBDepthWorkModeList();
1098 uint32_t count();
1099
1114 OBDepthWorkMode getOBDepthWorkMode(uint32_t index);
1115
1128 std::string getName(uint32_t index);
1129
1144 OBDepthWorkMode operator[](uint32_t index);
1145 };
1146
1147 } // namespace ob
OBStatus
OBStatus
error code
Definition: ObTypes.h:86
DEPRECATED
#define DEPRECATED
Definition: ObTypes.h:35
ob::Recorder
Definition: RecordPlayback.hpp:27
OBFloatPropertyRange
Float range structure.
Definition: ObTypes.h:358
Property.h
Control command property list maintenance.
ob::OBDepthWorkModeList
Type contain list of OBDepthWorkMode.
Definition: Device.hpp:1080
OBProtocolVersion
Command version of device property.
Definition: ObTypes.h:1083
ob::CameraParamList
Definition: Device.hpp:1036
SetDataCallback
std::function< void(OBDataTranState state, uint8_t percent)> SetDataCallback
set the raw data property when the progress callback is made
Definition: Types.hpp:95
SendFileCallback
std::function< void(OBFileTranState state, const char *message, uint8_t percent)> SendFileCallback
file transfer callbacks
Definition: Types.hpp:35
ob
Definition: Context.hpp:20
ob::Device
Definition: Device.hpp:33
DeviceUpgradeCallback
std::function< void(OBUpgradeState state, const char *message, uint8_t percent)> DeviceUpgradeCallback
device upgrade callback
Definition: Types.hpp:50
OBPropertyID
OBPropertyID
Enumeration value describing all attribute control commands of the device.
Definition: Property.h:33
OBCmdVersion
enum OB_CMD_VERSION OBCmdVersion
OBPermissionType
OBPermissionType
the permission type of api or property
Definition: ObTypes.h:71
OBSensorType
OBSensorType
Enumeration value describing the sensor type.
Definition: ObTypes.h:159
OBCameraParam
Camera parameters.
Definition: ObTypes.h:434
Types.hpp
Provide SDK structure and enumeration constant definition (depending on libobsensor/h/ObTypes.h)
DeviceStateChangedCallback
std::function< void(OBDeviceState state, const char *message)> DeviceStateChangedCallback
device status callback
Definition: Types.hpp:65
OBDeviceType
OBDeviceType
device type enumeration
Definition: ObTypes.h:668
GetDataCallback
std::function< void(OBDataTranState state, OBDataChunk *dataChunk)> GetDataCallback
get raw data property data when data and progress callbacks
Definition: Types.hpp:80
OBDepthWorkMode
Depth work mode.
Definition: ObTypes.h:1070
ob::DeviceInfo
A class describing device information, representing the name, id, serial number and other basic infor...
Definition: Device.hpp:726
OBPropertyItem
Used to describe the characteristics of each property.
Definition: Property.h:189
ob::DeviceList
Definition: Device.hpp:894
ob::Pipeline
Definition: Pipeline.hpp:32
ob::Context
Definition: Context.hpp:25
OBBoolPropertyRange
Boolean-scoped structure.
Definition: ObTypes.h:373
OBDeviceState
uint64_t OBDeviceState
Device state.
Definition: ObTypes.h:624
OBDeviceSyncConfig
Device synchronization configuration.
Definition: ObTypes.h:959
OB_EXTENSION_API
#define OB_EXTENSION_API
Definition: ObTypes.h:25
OBIntPropertyRange
Int range structure.
Definition: ObTypes.h:343