| 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
9#include "libobsensor/h/Property.h"
10#include "libobsensor/hpp/Filter.hpp"
11#include <memory>
12#include <string>
13#include <vector>
14
15 struct DeviceImpl;
16 struct DeviceInfoImpl;
17 struct DeviceListImpl;
18 struct CameraParamListImpl;
19
20 namespace ob {
21 class SensorList;
22 class Context;
23 class DeviceInfo;
24 class Sensor;
25 class CameraParamList;
26 class OBDepthWorkModeList;
27 class DevicePresetList;
28
29 class OB_EXTENSION_API Device {
30 protected:
31 std::unique_ptr<DeviceImpl> impl_;
32
33 Device(Device &&device);
34
35 public:
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
441 DEPRECATED OBDeviceSyncConfig getSyncConfig();
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
541 void timerSyncWithHost();
542
547 void loadDepthFilterConfig(const char *filePath);
548
552 void resetDefaultDepthFilterConfig();
553
559 const char *getCurrentPresetName();
560
566 const char *getCurrentDepthModeName();
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;
634 friend class CoordinateTransformHelper;
635};
636
640 class OB_EXTENSION_API DeviceInfo {
641 private:
642 std::unique_ptr<DeviceInfoImpl> impl_;
643
644 public:
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
757class OB_EXTENSION_API DeviceList {
758 private:
759 std::unique_ptr<DeviceListImpl> impl_;
760
761 public:
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
867class OB_EXTENSION_API CameraParamList {
868 private:
869 std::unique_ptr<CameraParamListImpl> impl_;
870
871 public:
872 CameraParamList(std::unique_ptr<CameraParamListImpl> impl);
873 ~CameraParamList() noexcept;
874
880 uint32_t count();
881
888 OBCameraParam getCameraParam(uint32_t index);
889};
890
894class OB_EXTENSION_API OBDepthWorkModeList {
895 private:
896 std::unique_ptr<OBDepthWorkModeListImpl> impl_;
897
898 public:
899 OBDepthWorkModeList(std::unique_ptr<OBDepthWorkModeListImpl> impl_);
900 ~OBDepthWorkModeList();
901
907 uint32_t count();
908
915 OBDepthWorkMode getOBDepthWorkMode(uint32_t index);
916
923 const char *getName(uint32_t index);
924
931 OBDepthWorkMode operator[](uint32_t index);
932};
933
938 class OB_EXTENSION_API DevicePresetList {
939 private:
940 std::unique_ptr<DevicePresetListImpl> impl_;
941
942 public:
943 DevicePresetList(std::unique_ptr<DevicePresetListImpl> impl);
944 ~DevicePresetList() noexcept;
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
Filter.hpp
This file contains the Filter class, which is the processing unit of the SDK that can perform point c...
OBSensorType
OBSensorType
Enumeration value describing the sensor type.
Definition ObTypes.h:162
OBStatus
OBStatus
error code
Definition ObTypes.h:111
OBDeviceState
uint64_t OBDeviceState
Device state.
Definition ObTypes.h:644
OBDeviceType
OBDeviceType
Enumeration for device types.
Definition ObTypes.h:676
OB_EXTENSION_API
#define OB_EXTENSION_API
Definition ObTypes.h:28
OBPermissionType
OBPermissionType
the permission type of api or property
Definition ObTypes.h:99
OBCmdVersion
enum OB_CMD_VERSION OBCmdVersion
DEPRECATED
#define DEPRECATED
Definition ObTypes.h:42
Property.h
Control command property list maintenance.
OBPropertyID
OBPropertyID
Enumeration value describing all attribute control commands of the device.
Definition Property.h:24
Types.hpp
Provides SDK structure and enumeration constant definitions (depending on libobsensor/h/ObTypes....
DeviceStateChangedCallback
std::function< void(OBDeviceState state, const char *message)> DeviceStateChangedCallback
Callback function for device status updates.
Definition Types.hpp:40
SetDataCallback
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
DeviceUpgradeCallback
std::function< void(OBUpgradeState state, const char *message, uint8_t percent)> DeviceUpgradeCallback
Callback function for device upgrade status updates.
Definition Types.hpp:32
GetDataCallback
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
SendFileCallback
std::function< void(OBFileTranState state, const char *message, uint8_t percent)> SendFileCallback
Callback function for file transfer status updates.
Definition Types.hpp:23
ob::CameraParamList
Class representing a list of camera parameters.
Definition Device.hpp:867
ob::CameraParamList::~CameraParamList
~CameraParamList() noexcept
ob::CameraParamList::CameraParamList
CameraParamList(std::unique_ptr< CameraParamListImpl > impl)
ob::Context
Definition Context.hpp:21
ob::CoordinateTransformHelper
Definition Utils.hpp:13
ob::DeviceInfo
A class describing device information, representing the name, id, serial number and other basic infor...
Definition Device.hpp:640
ob::DeviceInfo::DeviceInfo
DeviceInfo(std::unique_ptr< DeviceInfoImpl > impl)
ob::DeviceInfo::~DeviceInfo
virtual ~DeviceInfo() noexcept
ob::DeviceList
Class representing a list of devices.
Definition Device.hpp:757
ob::DeviceList::DeviceList
DeviceList(std::unique_ptr< DeviceListImpl > impl)
ob::DeviceList::~DeviceList
~DeviceList() noexcept
ob::DevicePresetList
Class representing a list of device presets @breif A device preset is a set of parameters or configur...
Definition Device.hpp:938
ob::DevicePresetList::DevicePresetList
DevicePresetList(std::unique_ptr< DevicePresetListImpl > impl)
ob::DevicePresetList::~DevicePresetList
~DevicePresetList() noexcept
ob::Device
Definition Device.hpp:29
ob::Device::Device
Device(Device &&device)
ob::Device::timerSyncWithHost
void timerSyncWithHost()
synchronize the timer of the device with the host.
ob::Device::loadPresetFromJsonData
void loadPresetFromJsonData(const char *presetName, const uint8_t *data, uint32_t size)
Load custom preset from data.
ob::Device::exportSettingsAsPresetJsonFile
void exportSettingsAsPresetJsonFile(const char *filePath)
Export current device settings as a preset json file.
ob::Device::Device
Device(std::unique_ptr< DeviceImpl > impl)
Describe the entity of the RGBD camera, representing a specific model of RGBD camera.
ob::Device::resetDefaultDepthFilterConfig
void resetDefaultDepthFilterConfig()
Reset depth filter config to device default define.
ob::Device::getCurrentPresetName
const char * getCurrentPresetName()
Get current preset name.
ob::Device::getCurrentDepthModeName
const char * getCurrentDepthModeName()
Get current depth mode name.
ob::Device::loadPresetFromJsonFile
void loadPresetFromJsonFile(const char *filePath)
Load custom preset from file.
ob::Device::loadPreset
void loadPreset(const char *presetName)
load the preset according to the preset name.
ob::Device::~Device
virtual ~Device() noexcept
ob::Device::exportSettingsAsPresetJsonData
void exportSettingsAsPresetJsonData(const char *presetName, const uint8_t **data, uint32_t *dataSize)
Export current device settings as a preset json data.
ob::Device::loadDepthFilterConfig
void loadDepthFilterConfig(const char *filePath)
Load depth filter config from file.
ob::Device::getAvailablePresetList
std::shared_ptr< DevicePresetList > getAvailablePresetList()
Get available preset list.
ob::Device::impl_
std::unique_ptr< DeviceImpl > impl_
Definition Device.hpp:31
ob::OBDepthWorkModeList
Class representing a list of OBDepthWorkMode.
Definition Device.hpp:894
ob::OBDepthWorkModeList::count
uint32_t count()
Get the number of OBDepthWorkMode objects in the list.
ob::OBDepthWorkModeList::getName
const char * getName(uint32_t index)
Get the name of the depth work mode at the specified index.
ob::OBDepthWorkModeList::OBDepthWorkModeList
OBDepthWorkModeList(std::unique_ptr< OBDepthWorkModeListImpl > impl_)
ob::OBDepthWorkModeList::~OBDepthWorkModeList
~OBDepthWorkModeList()
ob::OBDepthWorkModeList::getOBDepthWorkMode
OBDepthWorkMode getOBDepthWorkMode(uint32_t index)
Get the OBDepthWorkMode object at the specified index.
ob::OBDepthWorkModeList::operator[]
OBDepthWorkMode operator[](uint32_t index)
Get the OBDepthWorkMode object at the specified index.
ob::Pipeline
Definition Pipeline.hpp:28
ob::Recorder
Definition RecordPlayback.hpp:23
ob::SensorList
Definition Sensor.hpp:80
ob::Sensor
Definition Sensor.hpp:31
ob
Definition Context.hpp:16
OBBoolPropertyRange
Structure for boolean range.
Definition ObTypes.h:369
OBCameraParam
Structure for camera parameters.
Definition ObTypes.h:462
OBDataBundle
Internal API for future publication.
Definition ObTypes.h:1083
OBDepthWorkMode
Depth work mode.
Definition ObTypes.h:954
OBDeviceSyncConfig
Device synchronization configuration.
Definition ObTypes.h:898
OBFloatPropertyRange
Structure for float range.
Definition ObTypes.h:336
OBIntPropertyRange
Structure for integer range.
Definition ObTypes.h:325
OBPropertyItem
Used to describe the characteristics of each property.
Definition Property.h:764
OBProtocolVersion
Control command protocol version number.
Definition ObTypes.h:1037
ob_device_timestamp_reset_config
The timestamp reset configuration of the device.
Definition ObTypes.h:1408
ob_multi_device_sync_config
The synchronization configuration of the device.
Definition ObTypes.h:1344