OrbbecSDK 1.10.18
OrbbecSDK: Software-Development-Kit for Orbbec 3D Cameras
Loading...
Searching...
No Matches
Device.hpp
Go to the documentation of this file.
1
6#pragma once
7#include "Types.hpp"
8
11#include <memory>
12#include <string>
13#include <vector>
14
15struct DeviceImpl;
16struct DeviceInfoImpl;
17struct DeviceListImpl;
18struct CameraParamListImpl;
19
20namespace ob {
21class SensorList;
22class Context;
23class DeviceInfo;
24class Sensor;
25class CameraParamList;
26class OBDepthWorkModeList;
27class DevicePresetList;
28
30protected:
31 std::unique_ptr<DeviceImpl> impl_;
32
33 Device(Device &&device);
34
35public:
39 Device(std::unique_ptr<DeviceImpl> impl);
40 virtual ~Device() noexcept;
41
47 std::shared_ptr<DeviceInfo> getDeviceInfo();
48
54 std::shared_ptr<SensorList> getSensorList();
55
62 std::shared_ptr<Sensor> getSensor(OBSensorType type);
63
70 void setIntProperty(OBPropertyID propertyId, int32_t property);
71
78 void setFloatProperty(OBPropertyID propertyId, float property);
79
86 void setBoolProperty(OBPropertyID propertyId, bool property);
87
94 int32_t getIntProperty(OBPropertyID propertyId);
95
102 float getFloatProperty(OBPropertyID propertyId);
103
110 bool getBoolProperty(OBPropertyID propertyId);
111
118 OBIntPropertyRange getIntPropertyRange(OBPropertyID propertyId);
119
126 OBFloatPropertyRange getFloatPropertyRange(OBPropertyID propertyId);
127
134 OBBoolPropertyRange getBoolPropertyRange(OBPropertyID propertyId);
135
143 void writeAHB(uint32_t reg, uint32_t mask, uint32_t value);
144
152 void readAHB(uint32_t reg, uint32_t mask, uint32_t *value);
153
162 void writeI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t value);
163
172 void readI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t *value);
173
183 void writeFlash(uint32_t offset, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
184
193 void readFlash(uint32_t offset, uint32_t dataSize, GetDataCallback callback, bool async = false);
194
201 void writeCustomerData(const void *data, uint32_t dataSize);
202
209 void readCustomerData(void *data, uint32_t *dataSize);
210
220 void setRawData(OBPropertyID propertyId, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
221
229 void getRawData(OBPropertyID propertyId, GetDataCallback callback, bool async = false);
230
238 void setStructuredData(OBPropertyID propertyId, const void *data, uint32_t dataSize);
239
247 void getStructuredData(OBPropertyID propertyId, void *data, uint32_t *dataSize);
248
256 void setStructuredDataExt(OBPropertyID propertyId, std::shared_ptr<OBDataBundle> dataBundle, SetDataCallback callback);
257
264 std::shared_ptr<OBDataBundle> getStructuredDataExt(OBPropertyID propertyId);
265
271 OBProtocolVersion getProtocolVersion();
272
279 OBCmdVersion getCmdVersion(OBPropertyID propertyId);
280
286 uint32_t getSupportedPropertyCount();
287
294 OBPropertyItem getSupportedProperty(uint32_t index);
295
303 bool isPropertySupported(OBPropertyID propertyId, OBPermissionType permission);
304
310 bool isGlobalTimestampSupported();
311
319 void deviceUpgrade(const char *filePath, DeviceUpgradeCallback callback, bool async = true);
320
330 void deviceUpgradeFromData(const char *fileData, uint32_t fileSize, DeviceUpgradeCallback callback, bool async = true);
331
340 void sendFile(const char *filePath, const char *dstPath, SendFileCallback callback, bool async = true);
341
346 OBDeviceState getDeviceState();
347
354 void setDeviceStateChangedCallback(DeviceStateChangedCallback callback);
355
362 bool activateAuthorization(const char *authCode);
363
368 void writeAuthorizationCode(const char *authCodeStr);
369
379 std::shared_ptr<CameraParamList> getCalibrationCameraParamList();
380
386 OBDepthWorkMode getCurrentDepthWorkMode();
387
393 OBStatus switchDepthWorkMode(const OBDepthWorkMode &workMode);
394
400 OBStatus switchDepthWorkMode(const char *modeName);
401
406 std::shared_ptr<OBDepthWorkModeList> getDepthWorkModeList();
407
413 void reboot();
414
423 void reboot(uint32_t delayMs);
424
430 DEPRECATED uint64_t syncDeviceTime();
431
442
454 DEPRECATED void setSyncConfig(const OBDeviceSyncConfig &deviceSyncConfig);
455
471 uint16_t getSupportedMultiDeviceSyncModeBitmap();
472
478 void setMultiDeviceSyncConfig(const OBMultiDeviceSyncConfig &config);
479
485 OBMultiDeviceSyncConfig getMultiDeviceSyncConfig();
486
498 void triggerCapture();
499
503 void setTimestampResetConfig(const OBDeviceTimestampResetConfig &config);
504
510 OBDeviceTimestampResetConfig getTimestampResetConfig();
511
523 void timestampReset();
524
528#define timerReset timestampReset
529
542
547 void loadDepthFilterConfig(const char *filePath);
548
553
559 const char *getCurrentPresetName();
560
567
574 void loadPreset(const char *presetName);
575
583 std::shared_ptr<DevicePresetList> getAvailablePresetList();
584
595 void loadPresetFromJsonFile(const char *filePath);
596
608 void loadPresetFromJsonData(const char *presetName, const uint8_t *data, uint32_t size);
609
617 void exportSettingsAsPresetJsonFile(const char *filePath);
618
630 void exportSettingsAsPresetJsonData(const char *presetName, const uint8_t **data, uint32_t *dataSize);
631
632 friend class Pipeline;
633 friend class Recorder;
635};
636
641private:
642 std::unique_ptr<DeviceInfoImpl> impl_;
643
644public:
645 DeviceInfo(std::unique_ptr<DeviceInfoImpl> impl);
646 virtual ~DeviceInfo() noexcept;
647
653 const char *name();
654
660 int pid();
661
667 int vid();
668
674 const char *uid();
675
681 const char *serialNumber();
682
688 const char *firmwareVersion();
689
695 DEPRECATED const char *usbType();
696
703 const char *connectionType();
704
712 const char *ipAddress();
713
719 const char *hardwareVersion();
720
726 const char *supportedMinSdkVersion();
727
733 const char *extensionInfo();
734
740 const char *asicName();
741
747 OBDeviceType deviceType();
748
749 friend class Context;
750 friend class DeviceList;
751 friend class Pipeline;
752};
753
758private:
759 std::unique_ptr<DeviceListImpl> impl_;
760
761public:
762 DeviceList(std::unique_ptr<DeviceListImpl> impl);
763 ~DeviceList() noexcept;
764
770 uint32_t deviceCount();
771
778 DEPRECATED const char *name(uint32_t index);
779
786 int pid(uint32_t index);
787
794 int vid(uint32_t index);
795
802 const char *uid(uint32_t index);
803
810 const char *serialNumber(uint32_t index);
811
818 const char *connectionType(uint32_t index);
819
828 const char *ipAddress(uint32_t index);
829
838 std::shared_ptr<Device> getDevice(uint32_t index);
839
848 std::shared_ptr<Device> getDeviceBySN(const char *serialNumber);
849
861 std::shared_ptr<Device> getDeviceByUid(const char *uid);
862};
863
868private:
869 std::unique_ptr<CameraParamListImpl> impl_;
870
871public:
872 CameraParamList(std::unique_ptr<CameraParamListImpl> impl);
874
880 uint32_t count();
881
888 OBCameraParam getCameraParam(uint32_t index);
889};
890
895private:
896 std::unique_ptr<OBDepthWorkModeListImpl> impl_;
897
898public:
899 OBDepthWorkModeList(std::unique_ptr<OBDepthWorkModeListImpl> impl_);
901
907 uint32_t count();
908
916
923 const char *getName(uint32_t index);
924
932};
933
939private:
940 std::unique_ptr<DevicePresetListImpl> impl_;
941
942public:
943 DevicePresetList(std::unique_ptr<DevicePresetListImpl> impl);
945
951 uint32_t count();
952
959 const char *getName(uint32_t index);
960
966 bool hasPreset(const char *name);
967};
968
969} // namespace ob
This file contains the Filter class, which is the processing unit of the SDK that can perform point c...
OBSensorType
Enumeration value describing the sensor type.
Definition ObTypes.h:162
OBStatus
error code
Definition ObTypes.h:111
uint64_t OBDeviceState
Device state.
Definition ObTypes.h:644
OBDeviceType
Enumeration for device types.
Definition ObTypes.h:676
#define OB_EXTENSION_API
Definition ObTypes.h:28
OBPermissionType
the permission type of api or property
Definition ObTypes.h:99
enum OB_CMD_VERSION OBCmdVersion
#define DEPRECATED
Definition ObTypes.h:42
Control command property list maintenance.
OBPropertyID
Enumeration value describing all attribute control commands of the device.
Definition Property.h:24
Provides SDK structure and enumeration constant definitions (depending on libobsensor/h/ObTypes....
std::function< void(OBDeviceState state, const char *message)> DeviceStateChangedCallback
Callback function for device status updates.
Definition Types.hpp:40
std::function< void(OBDataTranState state, uint8_t percent)> SetDataCallback
Callback function for setting the raw data property when progress callbacks are made.
Definition Types.hpp:56
std::function< void(OBUpgradeState state, const char *message, uint8_t percent)> DeviceUpgradeCallback
Callback function for device upgrade status updates.
Definition Types.hpp:32
std::function< void(OBDataTranState state, OBDataChunk *dataChunk)> GetDataCallback
Callback function for getting raw data property data when data and progress callbacks are made.
Definition Types.hpp:48
std::function< void(OBFileTranState state, const char *message, uint8_t percent)> SendFileCallback
Callback function for file transfer status updates.
Definition Types.hpp:23
Class representing a list of camera parameters.
Definition Device.hpp:867
~CameraParamList() noexcept
CameraParamList(std::unique_ptr< CameraParamListImpl > impl)
A class describing device information, representing the name, id, serial number and other basic infor...
Definition Device.hpp:640
DeviceInfo(std::unique_ptr< DeviceInfoImpl > impl)
virtual ~DeviceInfo() noexcept
Class representing a list of devices.
Definition Device.hpp:757
DeviceList(std::unique_ptr< DeviceListImpl > impl)
~DeviceList() noexcept
Class representing a list of device presets @breif A device preset is a set of parameters or configur...
Definition Device.hpp:938
DevicePresetList(std::unique_ptr< DevicePresetListImpl > impl)
~DevicePresetList() noexcept
Device(Device &&device)
void timerSyncWithHost()
synchronize the timer of the device with the host.
void loadPresetFromJsonData(const char *presetName, const uint8_t *data, uint32_t size)
Load custom preset from data.
void exportSettingsAsPresetJsonFile(const char *filePath)
Export current device settings as a preset json file.
Device(std::unique_ptr< DeviceImpl > impl)
Describe the entity of the RGBD camera, representing a specific model of RGBD camera.
void resetDefaultDepthFilterConfig()
Reset depth filter config to device default define.
const char * getCurrentPresetName()
Get current preset name.
const char * getCurrentDepthModeName()
Get current depth mode name.
void loadPresetFromJsonFile(const char *filePath)
Load custom preset from file.
void loadPreset(const char *presetName)
load the preset according to the preset name.
virtual ~Device() noexcept
void exportSettingsAsPresetJsonData(const char *presetName, const uint8_t **data, uint32_t *dataSize)
Export current device settings as a preset json data.
void loadDepthFilterConfig(const char *filePath)
Load depth filter config from file.
std::shared_ptr< DevicePresetList > getAvailablePresetList()
Get available preset list.
std::unique_ptr< DeviceImpl > impl_
Definition Device.hpp:31
Class representing a list of OBDepthWorkMode.
Definition Device.hpp:894
uint32_t count()
Get the number of OBDepthWorkMode objects in the list.
const char * getName(uint32_t index)
Get the name of the depth work mode at the specified index.
OBDepthWorkModeList(std::unique_ptr< OBDepthWorkModeListImpl > impl_)
OBDepthWorkMode getOBDepthWorkMode(uint32_t index)
Get the OBDepthWorkMode object at the specified index.
OBDepthWorkMode operator[](uint32_t index)
Get the OBDepthWorkMode object at the specified index.
Definition Context.hpp:16
Structure for boolean range.
Definition ObTypes.h:369
Structure for camera parameters.
Definition ObTypes.h:462
Internal API for future publication.
Definition ObTypes.h:1083
Depth work mode.
Definition ObTypes.h:954
Device synchronization configuration.
Definition ObTypes.h:898
Structure for float range.
Definition ObTypes.h:336
Structure for integer range.
Definition ObTypes.h:325
Used to describe the characteristics of each property.
Definition Property.h:764
Control command protocol version number.
Definition ObTypes.h:1037
The timestamp reset configuration of the device.
Definition ObTypes.h:1408
The synchronization configuration of the device.
Definition ObTypes.h:1344