Skip to content

Commit

Permalink
update SDK to v2.0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
jian-dong committed Nov 30, 2024
1 parent 407464e commit 2433296
Show file tree
Hide file tree
Showing 24 changed files with 366 additions and 115 deletions.
67 changes: 67 additions & 0 deletions sdk/include/libobsensor/h/Advanced.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,73 @@ OB_EXPORT const char *ob_device_preset_list_get_name(const ob_device_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);

/**
* @brief Check if the device supports the frame interleave feature.
*
* @param device The device object.
* @param error Pointer to an error object that will be set if an error occurs.
* @return bool Returns true if the device supports the frame interleave feature.
*/
OB_EXPORT bool ob_device_is_frame_interleave_supported(const ob_device *device, ob_error **error);
/**
*
* @brief load the frame interleave mode according to frame interleavee name.
*
* @param device The device object.
* @param interleave_ae_name The name should be one of the frame interleave names returned by @ref ob_device_get_available_frame_interleave_list.
* @param error Log error messages.
*/
OB_EXPORT void ob_device_load_frame_interleave(ob_device *device, const char *frame_interleave_name, ob_error **error);

/**
* @brief Get the available frame interleave list.
*
* @param device The device object.
* @param error Log error messages.
* @return The available frame interleave list.
*/
OB_EXPORT ob_device_frame_interleave_list *ob_device_get_available_frame_interleave_list(ob_device *device, ob_error **error);


/**
* @brief Delete the available frame interleave list.
*
* @param interleave_ae_list The available frame interleave list.
* @param error Log error messages.
*/
OB_EXPORT void ob_delete_frame_interleave_list(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);

/**
* @brief Get the number of frame interleave in the frame interleave list.
*
* @param interleave_ae_list The available frame interleave list.
* @param error Log error messages.
* @return The number of frame interleave in the frame interleave list.
*/
OB_EXPORT uint32_t ob_device_frame_interleave_list_get_count(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);

/**
* @brief Get the name of frame interleave in the frame interleave list.
*
* @param interleave_ae_list The available frame interleave list.
* @param index The index of frame interleave in the frame interleave list.
* @param error Log error messages.
* @return The name of frame interleave in the frame interleave list..
*/
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);

/**
* @brief Check if the interleave ae list has the interleave ae.
*
* @param interleave_ae_list The available interleave ae list.
* @param interleave_ae_name The name of the interleave ae.
* @param error Log error messages.
* @return Whether the interleave ae list has the interleave ae. If true, the interleave ae list has the interleave ae. If false, the interleave ae list does
* not have the interleave ae.
*/
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);

// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_depth_work_mode_list_count ob_depth_work_mode_list_get_count
#define ob_device_preset_list_count ob_device_preset_list_get_count
Expand Down
12 changes: 12 additions & 0 deletions sdk/include/libobsensor/h/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ OB_EXPORT void ob_enable_device_clock_sync(ob_context *context, uint64_t repeat_
*/
OB_EXPORT void ob_free_idle_memory(ob_context *context, ob_error **error);

/**
* @brief For linux, there are two ways to enable the UVC backend: libuvc and libusb. This function is used to set the backend type.
* @brief It is effective when the new device is created.
*
* @attention This interface is only available for Linux.
*
* @param[in] context Pointer to the context object
* @param[in] backend_type The backend type to be used.
* @param[out] error Pointer to an error object that will be populated if an error occurs during backend type setting
*/
OB_EXPORT void ob_set_uvc_backend_type(ob_context *context, ob_uvc_backend_type backend_type, ob_error **error);

/**
* @brief Set the global log level
*
Expand Down
63 changes: 21 additions & 42 deletions sdk/include/libobsensor/h/Export.h
Original file line number Diff line number Diff line change
@@ -1,64 +1,43 @@

#ifndef OB_EXPORT_H
#define OB_EXPORT_H

#ifdef OB_STATIC_DEFINE
#define OB_EXPORT
#define OB_NO_EXPORT
#else
#ifdef _WIN32
/* Windows platform */
#ifndef OB_EXPORT
#ifdef OrbbecSDK_EXPORTS
/* We are building this library */
#define OB_EXPORT __declspec(dllexport)
# define OB_EXPORT
# define OB_NO_EXPORT
#else
/* We are using this library */
#define OB_EXPORT __declspec(dllimport)
#endif
#endif
# ifndef OB_EXPORT
# ifdef OrbbecSDK_EXPORTS
/* We are building this library */
# define OB_EXPORT __attribute__((visibility("default")))
# else
/* We are using this library */
# define OB_EXPORT __attribute__((visibility("default")))
# endif
# endif

#ifndef OB_NO_EXPORT
#define OB_NO_EXPORT
#endif
#else
/* Unix-like platforms (Linux, macOS, etc.) */
#ifndef OB_EXPORT
#ifdef OrbbecSDK_EXPORTS
/* We are building this library */
#define OB_EXPORT __attribute__((visibility("default")))
#else
/* We are using this library */
#define OB_EXPORT __attribute__((visibility("default")))
#endif
#endif

#ifndef OB_NO_EXPORT
#define OB_NO_EXPORT __attribute__((visibility("hidden")))
#endif
#endif
# ifndef OB_NO_EXPORT
# define OB_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif

#ifndef OB_DEPRECATED
#ifdef _WIN32
#define OB_DEPRECATED __declspec(deprecated)
#else
#define OB_DEPRECATED __attribute__((__deprecated__))
#endif
# define OB_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef OB_DEPRECATED_EXPORT
#define OB_DEPRECATED_EXPORT OB_EXPORT OB_DEPRECATED
# define OB_DEPRECATED_EXPORT OB_EXPORT OB_DEPRECATED
#endif

#ifndef OB_DEPRECATED_NO_EXPORT
#define OB_DEPRECATED_NO_EXPORT OB_NO_EXPORT OB_DEPRECATED
# define OB_DEPRECATED_NO_EXPORT OB_NO_EXPORT OB_DEPRECATED
#endif

/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
#ifndef OB_NO_DEPRECATED
#define OB_NO_DEPRECATED
#endif
# ifndef OB_NO_DEPRECATED
# define OB_NO_DEPRECATED
# endif
#endif

#endif /* OB_EXPORT_H */
121 changes: 77 additions & 44 deletions sdk/include/libobsensor/h/ObTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ extern "C" {
#include <stdbool.h>
#include <stdint.h>

typedef struct ob_context_t ob_context;
typedef struct ob_device_t ob_device;
typedef struct ob_device_info_t ob_device_info;
typedef struct ob_device_list_t ob_device_list;
typedef struct ob_camera_param_list_t ob_camera_param_list;
typedef struct ob_sensor_t ob_sensor;
typedef struct ob_sensor_list_t ob_sensor_list;
typedef struct ob_stream_profile_t ob_stream_profile;
typedef struct ob_stream_profile_list_t ob_stream_profile_list;
typedef struct ob_frame_t ob_frame;
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_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;
typedef struct ob_context_t ob_context;
typedef struct ob_device_t ob_device;
typedef struct ob_device_info_t ob_device_info;
typedef struct ob_device_list_t ob_device_list;
typedef struct ob_camera_param_list_t ob_camera_param_list;
typedef struct ob_sensor_t ob_sensor;
typedef struct ob_sensor_list_t ob_sensor_list;
typedef struct ob_stream_profile_t ob_stream_profile;
typedef struct ob_stream_profile_list_t ob_stream_profile_list;
typedef struct ob_frame_t ob_frame;
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_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;
typedef struct ob_device_frame_interleave_list_t ob_device_frame_interleave_list;

#define OB_WIDTH_ANY 0
#define OB_HEIGHT_ANY 0
Expand Down Expand Up @@ -543,21 +544,23 @@ typedef enum {
*/
typedef enum {
OB_SAMPLE_RATE_UNKNOWN = 0,
OB_SAMPLE_RATE_1_5625_HZ = 1, /**< 1.5625Hz */
OB_SAMPLE_RATE_3_125_HZ, /**< 3.125Hz */
OB_SAMPLE_RATE_6_25_HZ, /**< 6.25Hz */
OB_SAMPLE_RATE_12_5_HZ, /**< 12.5Hz */
OB_SAMPLE_RATE_25_HZ, /**< 25Hz */
OB_SAMPLE_RATE_50_HZ, /**< 50Hz */
OB_SAMPLE_RATE_100_HZ, /**< 100Hz */
OB_SAMPLE_RATE_200_HZ, /**< 200Hz */
OB_SAMPLE_RATE_500_HZ, /**< 500Hz */
OB_SAMPLE_RATE_1_KHZ, /**< 1KHz */
OB_SAMPLE_RATE_2_KHZ, /**< 2KHz */
OB_SAMPLE_RATE_4_KHZ, /**< 4KHz */
OB_SAMPLE_RATE_8_KHZ, /**< 8KHz */
OB_SAMPLE_RATE_16_KHZ, /**< 16KHz */
OB_SAMPLE_RATE_32_KHZ, /**< 32Hz */
OB_SAMPLE_RATE_1_5625_HZ = 1, /**< 1.5625Hz */
OB_SAMPLE_RATE_3_125_HZ = 2, /**< 3.125Hz */
OB_SAMPLE_RATE_6_25_HZ = 3, /**< 6.25Hz */
OB_SAMPLE_RATE_12_5_HZ = 4, /**< 12.5Hz */
OB_SAMPLE_RATE_25_HZ = 5, /**< 25Hz */
OB_SAMPLE_RATE_50_HZ = 6, /**< 50Hz */
OB_SAMPLE_RATE_100_HZ = 7, /**< 100Hz */
OB_SAMPLE_RATE_200_HZ = 8, /**< 200Hz */
OB_SAMPLE_RATE_500_HZ = 9, /**< 500Hz */
OB_SAMPLE_RATE_1_KHZ = 10, /**< 1KHz */
OB_SAMPLE_RATE_2_KHZ = 11, /**< 2KHz */
OB_SAMPLE_RATE_4_KHZ = 12, /**< 4KHz */
OB_SAMPLE_RATE_8_KHZ = 13, /**< 8KHz */
OB_SAMPLE_RATE_16_KHZ = 14, /**< 16KHz */
OB_SAMPLE_RATE_32_KHZ = 15, /**< 32Hz */
OB_SAMPLE_RATE_400_HZ = 16, /**< 400Hz*/
OB_SAMPLE_RATE_800_HZ = 17, /**< 800Hz*/
} OBIMUSampleRate,
OBGyroSampleRate, ob_gyro_sample_rate, OBAccelSampleRate, ob_accel_sample_rate, OB_SAMPLE_RATE;

Expand All @@ -566,14 +569,16 @@ typedef enum {
*/
typedef enum {
OB_GYRO_FS_UNKNOWN = -1,
OB_GYRO_FS_16dps = 1, /**< 16 degrees per second */
OB_GYRO_FS_31dps, /**< 31 degrees per second */
OB_GYRO_FS_62dps, /**< 62 degrees per second */
OB_GYRO_FS_125dps, /**< 125 degrees per second */
OB_GYRO_FS_250dps, /**< 250 degrees per second */
OB_GYRO_FS_500dps, /**< 500 degrees per second */
OB_GYRO_FS_1000dps, /**< 1000 degrees per second */
OB_GYRO_FS_2000dps, /**< 2000 degrees per second */
OB_GYRO_FS_16dps = 1, /**< 16 degrees per second */
OB_GYRO_FS_31dps = 2, /**< 31 degrees per second */
OB_GYRO_FS_62dps = 3, /**< 62 degrees per second */
OB_GYRO_FS_125dps = 4, /**< 125 degrees per second */
OB_GYRO_FS_250dps = 5, /**< 250 degrees per second */
OB_GYRO_FS_500dps = 6, /**< 500 degrees per second */
OB_GYRO_FS_1000dps = 7, /**< 1000 degrees per second */
OB_GYRO_FS_2000dps = 8, /**< 2000 degrees per second */
OB_GYRO_FS_400dps = 9, /**< 400 degrees per second */
OB_GYRO_FS_800dps = 10, /**< 800 degrees per second */
} OBGyroFullScaleRange,
ob_gyro_full_scale_range, OB_GYRO_FULL_SCALE_RANGE;

Expand All @@ -583,9 +588,13 @@ typedef enum {
typedef enum {
OB_ACCEL_FS_UNKNOWN = -1,
OB_ACCEL_FS_2g = 1, /**< 1x the acceleration of gravity */
OB_ACCEL_FS_4g, /**< 4x the acceleration of gravity */
OB_ACCEL_FS_8g, /**< 8x the acceleration of gravity */
OB_ACCEL_FS_16g, /**< 16x the acceleration of gravity */
OB_ACCEL_FS_4g = 2, /**< 4x the acceleration of gravity */
OB_ACCEL_FS_8g = 3, /**< 8x the acceleration of gravity */
OB_ACCEL_FS_16g = 4, /**< 16x the acceleration of gravity */
OB_ACCEL_FS_3g = 5, /**< 3x the acceleration of gravity */
OB_ACCEL_FS_6g = 6, /**< 6x the acceleration of gravity */
OB_ACCEL_FS_12g = 7, /**< 12x the acceleration of gravity */
OB_ACCEL_FS_24g = 8, /**< 24x the acceleration of gravity */
} OBAccelFullScaleRange,
ob_accel_full_scale_range, OB_ACCEL_FULL_SCALE_RANGE;

Expand Down Expand Up @@ -1590,6 +1599,31 @@ typedef enum {
} ob_frame_metadata_type,
OBFrameMetadataType;

/**
* @brief For Linux, there are two ways to access the UVC device, libuvc and v4l2. The backend type is used to select the backend to access the device.
*
*/
typedef enum {
/**
* @brief Auto detect system capabilities and device hint to select backend
*
*/
OB_UVC_BACKEND_TYPE_AUTO,

/**
* @brief Use libuvc backend to access the UVC device
*
*/
OB_UVC_BACKEND_TYPE_LIBUVC,

/**
* @brief Use v4l2 backend to access the UVC device
*
*/
OB_UVC_BACKEND_TYPE_V4L2,
} ob_uvc_backend_type,
OBUvcBackendType;

// For compatibility
#define OB_FRAME_METADATA_TYPE_LASER_POWER_MODE OB_FRAME_METADATA_TYPE_LASER_POWER_LEVEL
#define OB_FRAME_METADATA_TYPE_EMITTER_MODE OB_FRAME_METADATA_TYPE_LASER_STATUS
Expand Down Expand Up @@ -1753,4 +1787,3 @@ typedef void(ob_log_callback)(ob_log_severity severity, const char *message, voi
#endif

#pragma pack(pop)

Loading

0 comments on commit 2433296

Please sign in to comment.