update OrbbecSDK version to 2.9.0

This commit is contained in:
ob-yalian
2026-06-18 12:20:49 +08:00
parent b775665850
commit 84b0f60a45
21 changed files with 724 additions and 15 deletions
@@ -21,3 +21,4 @@
#include <libobsensor/h/Version.h>
#include <libobsensor/h/TypeHelper.h>
#include <libobsensor/h/RecordPlayback.h>
#include <libobsensor/h/ApplicationConfig.h>
@@ -15,6 +15,7 @@
#include <libobsensor/hpp/Frame.hpp>
#include <libobsensor/hpp/Pipeline.hpp>
#include <libobsensor/hpp/RecordPlayback.hpp>
#include <libobsensor/hpp/ApplicationConfig.hpp>
#include <libobsensor/hpp/Sensor.hpp>
#include <libobsensor/hpp/StreamProfile.hpp>
#include <libobsensor/hpp/Version.hpp>
@@ -0,0 +1,253 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
#pragma once
#include "ObTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Application configuration key.
* Each key has a fixed value type and item usage.
* Keys must stay within the low 32 bits because @ref OBAppConfigItem stores the key in bits 0-31.
*/
typedef enum {
OB_APP_CONFIG_SENSORS = 0, /**< array, sensor list. Use @ref ob_application_config_get_count to get sensor count. */
OB_APP_CONFIG_SENSOR_TYPE = 1, /**< int32_t, sensor item: OBSensorType. */
OB_APP_CONFIG_STREAM_ENABLED = 2, /**< bool, sensor item: whether the sensor stream should be started. */
OB_APP_CONFIG_STREAM_PROFILE = 3, /**< ob_stream_profile, sensor item: stream profile. */
OB_APP_CONFIG_UNDISTORTION_ENABLED = 4, /**< bool, sensor item: whether undistortion should be enabled. */
OB_APP_CONFIG_DEVICE_DECIMATION_ENABLED = 5, /**< bool, global item: whether device-level decimation should be applied. */
OB_APP_CONFIG_DEVICE_DECIMATION = 6, /**< OBPresetResolutionConfig, global item: device-level decimation configuration. */
/**< Currently applied only by Gemini 435Le. */
// Point cloud
OB_APP_CONFIG_POINTCLOUD_ENABLED = 100, /**< bool, global item: whether point cloud output should be enabled. */
OB_APP_CONFIG_POINTCLOUD_FORMAT = 101, /**< int32_t, global item: OBFormat, point cloud output format. */
OB_APP_CONFIG_POINTCLOUD_DECIMATION_FACTOR = 102, /**< int32_t, global item: point cloud decimation factor. */
OB_APP_CONFIG_POINTCLOUD_ALIGN_MODE = 103, /**< int32_t, global item: OBAlignMode. */
OB_APP_CONFIG_POINTCLOUD_FRAME_SYNC = 104, /**< bool, global item: whether frame sync should be enabled. */
OB_APP_CONFIG_POINTCLOUD_ALL_FRAME_TYPE_REQUIRED = 105, /**< bool, global item: false: output on any situation, true: require all frame types. */
OB_APP_CONFIG_POINTCLOUD_MATCH_TARGET_RESOLUTION = 106, /**< bool, global item: whether to match target resolution. */
// HDR Merge
OB_APP_CONFIG_HDR_MERGE_ENABLED = 200, /**< bool, global item: whether HDR merge should be enabled. */
OB_APP_CONFIG_HDR_MERGE_IR_ENABLED = 201, /**< bool, global item: whether IR frame should be enabled for HDR merge. */
} OBAppConfigKey,
ob_app_config_key;
/**
* @brief Application configuration item.
* An item combines a configuration key and an optional array index.
* Non-array keys use @ref OB_APP_CONFIG_ITEM.
* Array keys use @ref OB_APP_CONFIG_ARRAY_ITEM.
* The key is stored in bits 0-31 and the index is stored in bits 32-63.
*/
typedef uint64_t OBAppConfigItem, ob_app_config_item;
#define OB_APP_CONFIG_INDEX_NONE (0u)
#define OB_APP_CONFIG_ITEM(key) ((OBAppConfigItem)(uint32_t)(key))
#define OB_APP_CONFIG_ARRAY_ITEM(key, index) ((((OBAppConfigItem)(uint32_t)(index)) << 32) | (OBAppConfigItem)(uint32_t)(key))
#define OB_APP_CONFIG_ITEM_KEY(item) ((OBAppConfigKey)((uint32_t)((item) & 0xFFFFFFFFu)))
#define OB_APP_CONFIG_ITEM_INDEX(item) ((uint32_t)(((item) >> 32) & 0xFFFFFFFFu))
/**
* @brief Application configuration value type.
*/
typedef enum {
OB_APP_CONFIG_VALUE_BOOL, /**< Boolean value. */
OB_APP_CONFIG_VALUE_INT, /**< int32_t value. */
OB_APP_CONFIG_VALUE_FLOAT, /**< float value. */
OB_APP_CONFIG_VALUE_STRING, /**< String value. The returned pointer is owned by the config object. */
OB_APP_CONFIG_VALUE_STRUCT, /**< Fixed-size SDK structure value. */
} OBAppConfigValueType,
ob_app_config_value_type;
/**
* @brief Get the application runtime configuration cache for the device.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_application_config* The application configuration object cached by the device.
* @attention If the device has no application configuration cache, the SDK creates one with default values.
* @attention Changes made through the returned config update the device cache directly.
* @attention The returned config should be released by calling @ref ob_delete_application_config.
*/
OB_EXPORT ob_application_config *ob_device_get_application_config(ob_device *device, ob_error **error);
/**
* @brief Delete an application configuration object.
*
* @param[in] config The application configuration object to be deleted.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_application_config(ob_application_config *config, ob_error **error);
/**
* @brief Check whether the current device supports application runtime configuration import/export.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool Return true if application configuration import/export is supported, false otherwise.
*/
OB_EXPORT bool ob_device_is_application_config_supported(ob_device *device, ob_error **error);
/**
* @brief Reset an application configuration object to default values.
*
* @param[in] config The application configuration object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_application_config_reset(ob_application_config *config, ob_error **error);
/**
* @brief Set a bool value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[in] value The bool value to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_application_config_set_bool(ob_application_config *config, OBAppConfigItem item, bool value, ob_error **error);
/**
* @brief Get a bool value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool The bool value.
*/
OB_EXPORT bool ob_application_config_get_bool(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
/**
* @brief Set an int32_t value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[in] value The int32_t value to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_application_config_set_int(ob_application_config *config, OBAppConfigItem item, int32_t value, ob_error **error);
/**
* @brief Get an int32_t value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return int32_t The int32_t value.
*/
OB_EXPORT int32_t ob_application_config_get_int(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
/**
* @brief Set a float value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[in] value The float value to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_application_config_set_float(ob_application_config *config, OBAppConfigItem item, float value, ob_error **error);
/**
* @brief Get a float value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return float The float value.
*/
OB_EXPORT float ob_application_config_get_float(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
/**
* @brief Set a string value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[in] value The string value to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_application_config_set_string(ob_application_config *config, OBAppConfigItem item, const char *value, ob_error **error);
/**
* @brief Get a string value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return const char* The string value.
* @attention The returned pointer is owned by the config object and becomes invalid after the config is modified or deleted.
*/
OB_EXPORT const char *ob_application_config_get_string(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
/**
* @brief Set a fixed-size SDK structure value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[in] value Pointer to the structure value to be copied.
* @param[in] valueSize Size of the structure value in bytes.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_application_config_set_struct(ob_application_config *config, OBAppConfigItem item, const void *value, uint32_t valueSize, ob_error **error);
/**
* @brief Get a fixed-size SDK structure value.
*
* @param[in] config The application configuration object.
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
* @param[out] value Pointer to the buffer that receives the structure value.
* @param[in] valueSize Size of the output buffer in bytes.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_application_config_get_struct(const ob_application_config *config, OBAppConfigItem item, void *value, uint32_t valueSize, ob_error **error);
/**
* @brief Set the stream profile for a sensor item.
*
* @param[in] config The application configuration object.
* @param[in] item The sensor stream profile item to update. Use @ref OB_APP_CONFIG_ARRAY_ITEM with @ref OB_APP_CONFIG_STREAM_PROFILE.
* @param[in] profile The stream profile to be copied into the config object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @attention The config object clones the profile. The caller still owns and should release the input profile.
*/
OB_EXPORT void ob_application_config_set_profile(ob_application_config *config, OBAppConfigItem item, const ob_stream_profile *profile, ob_error **error);
/**
* @brief Get the stream profile from a sensor item.
*
* @param[in] config The application configuration object.
* @param[in] item The sensor stream profile item to read. Use @ref OB_APP_CONFIG_ARRAY_ITEM with @ref OB_APP_CONFIG_STREAM_PROFILE.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_stream_profile* The stream profile stored in the sensor item.
* @attention The returned profile should be released by calling @ref ob_delete_stream_profile.
*/
OB_EXPORT ob_stream_profile *ob_application_config_get_profile(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
/**
* @brief Get the number of items in an array key.
*
* Currently only @ref OB_APP_CONFIG_SENSORS is supported.
*
* @param[in] config The application configuration object.
* @param[in] key The array key to count. Refer to @ref OBAppConfigKey for available keys.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return uint32_t The number of items in the array key.
*/
OB_EXPORT uint32_t ob_application_config_get_count(const ob_application_config *config, OBAppConfigKey key, ob_error **error);
#ifdef __cplusplus
}
#endif
@@ -184,6 +184,15 @@ OB_EXPORT void ob_unregister_device_changed_callback(ob_context *context, ob_cal
*/
OB_EXPORT void ob_enable_device_clock_sync(ob_context *context, uint64_t repeat_interval_msec, ob_error **error);
/**
* @brief Synchronize the device time (synchronize hardwarePPS time to all created devices)
*
* @param[in] context Pointer to the context object
* @param[in] hardware_pps_time unit: ms.
* @param[out] error Pointer to an error object that will be populated if an error occurs during execution
*/
OB_EXPORT void ob_sync_device_hardware_pps_time(ob_context *context, uint64_t hardware_pps_time, ob_error **error);
/**
* @brief Free idle memory from the internal frame memory pool
*
@@ -337,6 +337,17 @@ OB_EXPORT void ob_device_enable_heartbeat(ob_device *device, bool enable, ob_err
*/
OB_EXPORT void ob_device_enable_firmware_log(ob_device *device, bool enable, ob_error **error);
/**
* @brief Synchronize the device time (synchronize hardwarePPS time to device)
*
* @param[in] device The device object.
* @param[in] hardware_pps_time unit: ms.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool Whether the synchronisation is successful.
*/
OB_EXPORT bool ob_device_sync_hardware_pps_time(ob_device *device, uint64_t hardware_pps_time, ob_error **error);
/**
* @brief Send data to the device and receive data from the device.
* @brief This is a factory and debug function, which can be used to send and receive data from the device. The data format is secret and belongs to the device
@@ -66,7 +66,7 @@ OB_EXPORT ob_multi_device_sync_config ob_device_get_multi_device_sync_config(con
* number of frames per trigger can be set by @ref ob_multi_device_sync_config::framesPerTrigger.
* @attention For some models, receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling this
* function should not be too high, please refer to the product manual for the specific supported frequency.
* @attention If the device is not in the @ref OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING mode, device will ignore the capture command.
* @attention If the device is not in the @ref OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING mode, device will ignore the capture command.
*
* @param[in] device The device handle.
* @param[out] error Pointer to an error object that will be set if an error occurs.
@@ -35,6 +35,7 @@ typedef struct ob_filter_t ob_filter;
typedef struct ob_filter_list_t ob_filter_list;
typedef struct ob_pipeline_t ob_pipeline;
typedef struct ob_config_t ob_config;
typedef struct ob_application_config_t ob_application_config;
typedef struct ob_depth_work_mode_list_t ob_depth_work_mode_list;
typedef struct ob_device_preset_list_t ob_device_preset_list;
typedef struct ob_filter_config_schema_list_t ob_filter_config_schema_list;
@@ -574,6 +575,7 @@ typedef enum {
ALIGN_DISABLE, /**< Turn off alignment */
ALIGN_D2C_HW_MODE, /**< Hardware D2C alignment mode */
ALIGN_D2C_SW_MODE, /**< Software D2C alignment mode */
ALIGN_C2D_SW_MODE, /**< Software C2D alignment mode */
} OBAlignMode,
ob_align_mode;
@@ -638,11 +638,30 @@ typedef enum {
*/
OB_PROP_DEVICE_IP_MODE_INT = 260,
/**
/**
* @brief DHCP assign IP timeout, unit: second
*/
*/
OB_PROP_DHCP_ASSIGN_IP_TIMEOUT_INT = 261,
/**
* @brief USB sync I/O voltage level
*/
OB_PROP_USB_SYNC_VOLTAGE_LEVEL_INT = 270,
/**
* @brief Get the current disparity search range mode value
*
* @attention read only
*/
OB_PROP_CURRENT_DISP_SEARCH_RANGE_MODE_INT = 271,
/**
* @brief Get the current disparity search offset value
*
* @attention read only
*/
OB_PROP_CURRENT_DISP_SEARCH_OFFSET_INT = 272,
/**
* @brief Baseline calibration parameters
*/
@@ -0,0 +1,390 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
#pragma once
#include "Device.hpp"
#include "StreamProfile.hpp"
#include "Error.hpp"
#include "libobsensor/h/Advanced.h"
#include "libobsensor/h/ApplicationConfig.h"
#include <memory>
#include <stdexcept>
#include <vector>
namespace ob {
class ApplicationSensorConfig {
public:
explicit ApplicationSensorConfig(OBSensorType sensorType) : sensorType_(sensorType) {}
OBSensorType sensorType() const {
return sensorType_;
}
void enableStream(bool enabled) {
streamEnabled_ = enabled;
}
bool isStreamEnabled() const {
return streamEnabled_;
}
void setStreamProfile(const std::shared_ptr<StreamProfile> &profile) {
streamProfile_ = profile;
}
std::shared_ptr<StreamProfile> streamProfile() const {
return streamProfile_;
}
void enableUndistortion(bool enabled) {
undistortionEnabled_ = enabled;
}
bool isUndistortionEnabled() const {
return undistortionEnabled_;
}
private:
OBSensorType sensorType_{ OB_SENSOR_UNKNOWN };
bool streamEnabled_ = { false };
std::shared_ptr<StreamProfile> streamProfile_;
bool undistortionEnabled_ = { false };
};
class ApplicationPointCloudConfig {
public:
void enable(bool enabled) {
enabled_ = enabled;
}
bool isEnabled() const {
return enabled_;
}
void setFormat(OBFormat format) {
format_ = format;
}
OBFormat format() const {
return format_;
}
void setDecimationFactor(int32_t factor) {
decimationFactor_ = factor;
}
int32_t decimationFactor() const {
return decimationFactor_;
}
void setAlignMode(OBAlignMode mode) {
alignMode_ = mode;
}
OBAlignMode alignMode() const {
return alignMode_;
}
void enableFrameSync(bool enabled) {
frameSync_ = enabled;
}
bool isFrameSyncEnabled() const {
return frameSync_;
}
void setAllFrameTypeRequired(bool enabled) {
allFrameTypeRequired_ = enabled;
}
bool isAllFrameTypeRequired() const {
return allFrameTypeRequired_;
}
void enableMatchTargetResolution(bool enabled) {
matchTargetResolution_ = enabled;
}
bool isMatchTargetResolutionEnabled() const {
return matchTargetResolution_;
}
private:
bool enabled_{ false };
OBFormat format_{ OB_FORMAT_POINT };
int32_t decimationFactor_{ 0 };
OBAlignMode alignMode_{ ALIGN_DISABLE };
bool frameSync_{ false };
bool allFrameTypeRequired_{ false };
bool matchTargetResolution_{ false };
};
class ApplicationHDRMergeConfig {
public:
void enable(bool enabled) {
enabled_ = enabled;
}
bool isEnabled() const {
return enabled_;
}
void enableIR(bool enabled) {
enableIRforHDR_ = enabled;
}
bool isIREnabled() const {
return enableIRforHDR_;
}
private:
bool enabled_{ false };
bool enableIRforHDR_{ true };
};
class ApplicationDevDecimationConfig {
public:
void enable(bool enabled) {
enabled_ = enabled;
}
bool isEnabled() const {
return enabled_;
}
void setPresetResolutionConfig(const OBPresetResolutionConfig &config) {
config_ = config;
}
const OBPresetResolutionConfig &presetResolutionConfig() const {
return config_;
}
private:
bool enabled_{ false };
OBPresetResolutionConfig config_;
};
class ApplicationConfig {
public:
static bool isSupported(const std::shared_ptr<Device> &device) {
ob_error *error = nullptr;
auto ret = ob_device_is_application_config_supported(device->getImpl(), &error);
Error::handle(&error);
return ret;
}
static std::shared_ptr<ApplicationConfig> get(const std::shared_ptr<Device> &device) {
ob_error *error = nullptr;
auto handle = ob_device_get_application_config(device->getImpl(), &error);
Error::handle(&error);
return std::make_shared<ApplicationConfig>(handle);
}
explicit ApplicationConfig(ob_application_config *handle) : handle_(handle) {}
~ApplicationConfig() noexcept {
if(handle_) {
ob_error *error = nullptr;
ob_delete_application_config(handle_, &error);
Error::handle(&error, false);
}
}
ob_application_config *handle() const {
return handle_;
}
void reset() {
ob_error *error = nullptr;
ob_application_config_reset(handle_, &error);
Error::handle(&error);
}
std::vector<std::shared_ptr<ApplicationSensorConfig>> sensors() const {
std::vector<std::shared_ptr<ApplicationSensorConfig>> result;
ob_error *error = nullptr;
auto count = ob_application_config_get_count(handle_, OB_APP_CONFIG_SENSORS, &error);
Error::handle(&error);
for(uint32_t i = 0; i < count; ++i) {
auto sensorType = static_cast<OBSensorType>(ob_application_config_get_int(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_SENSOR_TYPE, i), &error));
Error::handle(&error);
auto sensorConfig = std::make_shared<ApplicationSensorConfig>(sensorType);
// enable
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_ENABLED, i), &error);
Error::handle(&error);
sensorConfig->enableStream(enable);
// profile
auto profile = ob_application_config_get_profile(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_PROFILE, i), &error);
Error::handle(&error);
sensorConfig->setStreamProfile(StreamProfileFactory::create(profile));
result.emplace_back(sensorConfig);
// undistortion
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_UNDISTORTION_ENABLED, i), &error);
Error::handle(&error, false); // optional
sensorConfig->enableUndistortion(enable);
}
return result;
}
void setSensors(const std::vector<std::shared_ptr<ApplicationSensorConfig>> &sensors) {
for(const auto &sensor: sensors) {
setSensor(sensor);
}
}
void setSensor(const std::shared_ptr<ApplicationSensorConfig> &sensor) {
if(!sensor) {
return;
}
ob_error *error = nullptr;
auto index = sensorIndex(sensor->sensorType());
// enable
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_ENABLED, index), sensor->isStreamEnabled(), &error);
Error::handle(&error);
// profile
auto profile = sensor->streamProfile();
if(!profile) {
throw std::runtime_error("ApplicationSensorConfig: stream profile must not be null");
}
ob_application_config_set_profile(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_PROFILE, index), profile->getImpl(), &error);
Error::handle(&error);
// undistortion
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_UNDISTORTION_ENABLED, index), sensor->isUndistortionEnabled(), &error);
Error::handle(&error);
}
std::shared_ptr<ApplicationDevDecimationConfig> deviceDecimation() const {
auto cfg = std::make_shared<ApplicationDevDecimationConfig>();
ob_error *error = nullptr;
// enable
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION_ENABLED), &error);
Error::handle(&error);
cfg->enable(enable);
if(enable) {
// Preset resolution
OBPresetResolutionConfig config{};
ob_application_config_get_struct(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION), &config, sizeof(config), &error);
Error::handle(&error);
cfg->setPresetResolutionConfig(config);
}
return cfg;
}
void setDeviceDecimation(const std::shared_ptr<ApplicationDevDecimationConfig> &config) {
if(!config) {
return;
}
ob_error *error = nullptr;
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION_ENABLED), config->isEnabled(), &error);
Error::handle(&error);
auto presetResConfig = config->presetResolutionConfig();
ob_application_config_set_struct(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION), &presetResConfig, sizeof(presetResConfig), &error);
Error::handle(&error);
}
std::shared_ptr<ApplicationPointCloudConfig> pointCloud() const {
auto cfg = std::make_shared<ApplicationPointCloudConfig>();
ob_error *error = nullptr;
// enable
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ENABLED), &error);
Error::handle(&error);
cfg->enable(enable);
// format
auto value = ob_application_config_get_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FORMAT), &error);
Error::handle(&error);
cfg->setFormat(static_cast<OBFormat>(value));
// decimation factor
value = ob_application_config_get_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_DECIMATION_FACTOR), &error);
Error::handle(&error);
cfg->setDecimationFactor(value);
// align mode
value = ob_application_config_get_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALIGN_MODE), &error);
Error::handle(&error);
cfg->setAlignMode(static_cast<OBAlignMode>(value));
// frame sync
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FRAME_SYNC), &error);
Error::handle(&error);
cfg->enableFrameSync(enable);
// frame aggregate mode
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALL_FRAME_TYPE_REQUIRED), &error);
Error::handle(&error);
cfg->setAllFrameTypeRequired(enable);
// match target resolution
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_MATCH_TARGET_RESOLUTION), &error);
Error::handle(&error);
cfg->enableMatchTargetResolution(enable);
return cfg;
}
void setPointCloud(const std::shared_ptr<ApplicationPointCloudConfig> &config) {
if(!config) {
return;
}
ob_error *error = nullptr;
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ENABLED), config->isEnabled(), &error);
Error::handle(&error);
ob_application_config_set_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FORMAT), static_cast<int32_t>(config->format()), &error);
Error::handle(&error);
ob_application_config_set_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_DECIMATION_FACTOR), config->decimationFactor(), &error);
Error::handle(&error);
ob_application_config_set_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALIGN_MODE), static_cast<int32_t>(config->alignMode()), &error);
Error::handle(&error);
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FRAME_SYNC), config->isFrameSyncEnabled(), &error);
Error::handle(&error);
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALL_FRAME_TYPE_REQUIRED), config->isAllFrameTypeRequired(), &error);
Error::handle(&error);
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_MATCH_TARGET_RESOLUTION), config->isMatchTargetResolutionEnabled(),
&error);
Error::handle(&error);
}
std::shared_ptr<ApplicationHDRMergeConfig> hdrMerge() const {
auto cfg = std::make_shared<ApplicationHDRMergeConfig>();
ob_error *error = nullptr;
// enable
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_ENABLED), &error);
Error::handle(&error);
cfg->enable(enable);
// IR enable
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_IR_ENABLED), &error);
Error::handle(&error);
cfg->enableIR(enable);
return cfg;
}
void setHDRMerge(const std::shared_ptr<ApplicationHDRMergeConfig> &config) {
if(!config) {
return;
}
ob_error *error = nullptr;
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_ENABLED), config->isEnabled(), &error);
Error::handle(&error);
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_IR_ENABLED), config->isIREnabled(), &error);
Error::handle(&error);
}
private:
uint32_t sensorIndex(OBSensorType sensorType) const {
ob_error *error = nullptr;
auto count = ob_application_config_get_count(handle_, OB_APP_CONFIG_SENSORS, &error);
Error::handle(&error);
for(uint32_t i = 0; i < count; ++i) {
auto current = static_cast<OBSensorType>(ob_application_config_get_int(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_SENSOR_TYPE, i), &error));
Error::handle(&error);
if(current == sensorType) {
return i;
}
}
throw std::runtime_error("Application sensor config not found");
}
ob_application_config *handle_ = nullptr;
};
using ApplicationConfigPtr = std::shared_ptr<ApplicationConfig>;
} // namespace ob
@@ -259,6 +259,17 @@ public:
Error::handle(&error);
}
/**
* @brief Activates synchronization time to all created devices (if supported).
*
* @param[in] hardwarePPSTime unit:ms.
*/
void syncDeviceHardwarePPSTime(uint64_t hardwarePPSTime) const {
ob_error *error = nullptr;
ob_sync_device_hardware_pps_time(impl_, hardwarePPSTime, &error);
Error::handle(&error);
}
/**
* @brief Frees idle memory from the internal frame memory pool.
* @brief The SDK includes an internal frame memory pool that caches memory allocated for frames received from devices.
@@ -535,6 +535,18 @@ public:
reboot();
}
/**
* @brief synchronization the device time (synchronize hardwarePPS time to device)
* @param[in] hardwarePPSTime unit:ms
* @return Whether the synchronisation is successful
*/
bool syncDeviceHardwarePPSTime(uint64_t hardwarePPSTime) const {
ob_error *error = nullptr;
bool success = ob_device_sync_hardware_pps_time(impl_, hardwarePPSTime, &error);
Error::handle(&error);
return success;
}
/**
* @brief Enable or disable the device heartbeat.
* @brief After enable the device heartbeat, the sdk will start a thread to send heartbeat signal to the device error every 3 seconds.
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "ob::OrbbecSDK" for configuration "Release"
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(ob::OrbbecSDK PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.8.8"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.9.0"
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
)
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.8.8" )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.9.0" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
@@ -9,19 +9,19 @@
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "2.8.8")
set(PACKAGE_VERSION "2.9.0")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("2.8.8" MATCHES "^([0-9]+)\\.")
if("2.9.0" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
endif()
else()
set(CVF_VERSION_MAJOR "2.8.8")
set(CVF_VERSION_MAJOR "2.9.0")
endif()
if(PACKAGE_FIND_VERSION_RANGE)
@@ -1 +1 @@
libOrbbecSDK.so.2.8.8
libOrbbecSDK.so.2.9.0
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "ob::OrbbecSDK" for configuration "Release"
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(ob::OrbbecSDK PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.8.8"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.9.0"
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
)
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.8.8" )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.9.0" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
@@ -9,19 +9,19 @@
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "2.8.8")
set(PACKAGE_VERSION "2.9.0")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("2.8.8" MATCHES "^([0-9]+)\\.")
if("2.9.0" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
endif()
else()
set(CVF_VERSION_MAJOR "2.8.8")
set(CVF_VERSION_MAJOR "2.9.0")
endif()
if(PACKAGE_FIND_VERSION_RANGE)
+1 -1
View File
@@ -1 +1 @@
libOrbbecSDK.so.2.8.8
libOrbbecSDK.so.2.9.0