mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 03:57:46 +08:00
update orbbec SDK install way
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Context.hpp
|
||||
* @brief The SDK context class, the entry to the underlying SDK, is used to query device lists,handle device callbacks,set the level of the log
|
||||
* \else
|
||||
* @file Context.hpp
|
||||
* @brief SDK上下文环境类,底层SDK的入口,用于获取设备列表,处理设备的回调,日志等级的设置操作
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
struct ContextImpl;
|
||||
|
||||
namespace ob {
|
||||
class Device;
|
||||
class DeviceInfo;
|
||||
class DeviceList;
|
||||
|
||||
class OB_EXTENSION_API Context {
|
||||
private:
|
||||
std::unique_ptr<ContextImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Context is a management class that describes the runtime of the SDK. It is responsible for the applying and releasing of resources for the SDK.
|
||||
* The context has the ability to manage multiple devices, is responsible for enumerating devices, monitoring device callbacks, and enabling functions such as multi-device synchronization.
|
||||
* \else
|
||||
* @brief context是描述SDK的runtime一个管理类,负责SDK的资源申请与释放
|
||||
* context具备多设备的管理能力,负责枚举设备,监听设备回调,启用多设备同步等功能
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
Context(const char *configPath = "");
|
||||
virtual ~Context() noexcept;
|
||||
|
||||
/**
|
||||
*\if English
|
||||
* @brief Query enumerated device list
|
||||
*
|
||||
* @return std::shared_ptr<DeviceList> returns a pointer to the device list class
|
||||
* \else
|
||||
* @brief 获取枚举到设备列表
|
||||
*
|
||||
* @return std::shared_ptr<DeviceList>返回设备列表类的指针
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DeviceList> queryDeviceList();
|
||||
|
||||
using DeviceChangedCallback = std::function<void(std::shared_ptr<DeviceList> removedList, std::shared_ptr<DeviceList> addedList)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set device plug-in callback function
|
||||
*
|
||||
* @param callback function triggered when the device is plugged and unplugged
|
||||
* \else
|
||||
* @brief 设置设备插拔回调函数
|
||||
*
|
||||
* @param callback 设备插拔时触发的回调函数
|
||||
* \endif
|
||||
*/
|
||||
void setDeviceChangedCallback(DeviceChangedCallback callback);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Activate the multi-device synchronization function to synchronize the clock of the created device(the device needs support this function)
|
||||
*
|
||||
* @param repeatInterval synchronization time interval (unit: ms; if repeatInterval=0, it means that it will only be synchronized once and will not be executed regularly)
|
||||
* \else
|
||||
* @brief 启动多设备同步功能,同步已创建设备的时钟(需要使用的设备支持该功能)
|
||||
*
|
||||
* @param repeatInterval 定时同步时间间隔(单位ms;如果repeatInterval=0,表示只同步一次,不再定时执行)
|
||||
* \endif
|
||||
*/
|
||||
void enableMultiDeviceSync(uint64_t repeatInterval);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the level of the global log will affect both the log level output to the terminal and output to the file
|
||||
*
|
||||
* @param severity log output level
|
||||
* \else
|
||||
* @brief 设置全局日志的等级,会同时作用于输出到终端和输出到文件的日志等级
|
||||
*
|
||||
* @param severity 日志输出等级
|
||||
* \endif
|
||||
*/
|
||||
static void setLoggerSeverity(OBLogSeverity severity);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set log output to file
|
||||
*
|
||||
* @param severity log level output to file
|
||||
* @param directory The log file output path. If the path is empty, the existing settings will continue to be used (if the existing configuration is also empty, the log will not be output to the file)
|
||||
* \else
|
||||
* @brief 设置日志输出到文件
|
||||
*
|
||||
* @param severity 输出到文件的日志等级
|
||||
* @param directory 日志文件输出路径,如果路径为空,则继续使用已有设置(已有配置也为空则不输出日志到文件)
|
||||
* \endif
|
||||
*/
|
||||
static void setLoggerToFile(OBLogSeverity severity, const char *directory);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set log output to terminal
|
||||
*
|
||||
* @param severity log level output to the terminal
|
||||
* \else
|
||||
* @brief 设置日志输出到终端
|
||||
*
|
||||
* @param severity 输出到终端的日志等级
|
||||
* \endif
|
||||
*/
|
||||
static void setLoggerToConsole(OBLogSeverity severity);
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,936 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Device.hpp
|
||||
* @brief Device related types, including operations such as getting and creating a device, setting and obtaining device attributes, and obtaining sensors
|
||||
* \else
|
||||
* @file Device.hpp
|
||||
* @brief 设备相关类型,包括获取创建设备,设置及获取设备属性,获取传感器等操作
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Types.hpp"
|
||||
|
||||
#include "libobsensor/h/Property.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
struct DeviceImpl;
|
||||
struct DeviceInfoImpl;
|
||||
struct DeviceListImpl;
|
||||
struct CameraParamListImpl;
|
||||
|
||||
namespace ob {
|
||||
class SensorList;
|
||||
class Context;
|
||||
class DeviceInfo;
|
||||
class Sensor;
|
||||
class CameraParamList;
|
||||
|
||||
class OB_EXTENSION_API Device {
|
||||
private:
|
||||
std::unique_ptr<DeviceImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Describe the entity of the RGBD camera, representing a specific model of RGBD camera
|
||||
* \else
|
||||
* @brief 描述RGBD相机的实体,代表一个具体型号的RGBD相机
|
||||
* \endif
|
||||
*/
|
||||
Device(std::unique_ptr<DeviceImpl> impl);
|
||||
virtual ~Device() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device information
|
||||
*
|
||||
* @return std::shared_ptr<DeviceInfo> returns device information
|
||||
* \else
|
||||
* @brief 获取设备信息
|
||||
*
|
||||
* @return std::shared_ptr<DeviceInfo> 返回设备的信息
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DeviceInfo> getDeviceInfo();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device sensor list
|
||||
*
|
||||
* @return std::shared_ptr<SensorList> returns the sensor list
|
||||
* \else
|
||||
* @brief 获取设备传感器列表
|
||||
*
|
||||
* @return std::shared_ptr<SensorList> 返回传感器列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<SensorList> getSensorList();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get specific type of sensor
|
||||
* if device not open, SDK will automatically open the connected device and return to the instance
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> eturns the sensor example, if the device does not have the device,returns nullptr
|
||||
* \else
|
||||
* @brief 获取指定类型传感器
|
||||
* 如果设备没有打开传感器,在SDK内部会自动打开设备并返回实例
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> 返回传感器示例,如果设备没有该设备,返回nullptr
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(OBSensorType type);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set int type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param property Property to be set
|
||||
* \else
|
||||
* @brief 设置int类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param property 要设置的属性
|
||||
* \endif
|
||||
*/
|
||||
void setIntProperty(OBPropertyID propertyId, int32_t property);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set float type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param property Property to be set
|
||||
* \else
|
||||
* @brief 设置float类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param property 要设置的属性
|
||||
* \endif
|
||||
*/
|
||||
void setFloatProperty(OBPropertyID propertyId, float property);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set bool type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param property Property to be set
|
||||
* \else
|
||||
* @brief 设置bool类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param property 要设置的属性
|
||||
* \endif
|
||||
*/
|
||||
void setBoolProperty(OBPropertyID propertyId, bool property);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get int type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return int32_t Property to get
|
||||
* \else
|
||||
* @brief 获取int类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return int32_t 获取的属性数据
|
||||
* \endif
|
||||
*/
|
||||
int32_t getIntProperty(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get float type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return float Property to get
|
||||
* \else
|
||||
* @brief 获取float类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return float 获取的属性数据
|
||||
* \endif
|
||||
*/
|
||||
float getFloatProperty(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get bool type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return bool Property to get
|
||||
* \else
|
||||
* @brief 获取bool类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return bool 获取的属性数据
|
||||
* \endif
|
||||
*/
|
||||
bool getBoolProperty(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get int type device property range (ncluding current valueand default value)
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return OBIntPropertyRange Property range
|
||||
* \else
|
||||
* @brief 获取int类型的设备属性的范围(包括当前值和默认值)
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return OBIntPropertyRange 属性的范围
|
||||
* \endif
|
||||
*/
|
||||
OBIntPropertyRange getIntPropertyRange(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get float type device property range((including current valueand default value)
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return OBFloatPropertyRange Property range
|
||||
* \else
|
||||
* @brief 获取float类型的设备属性的范围(包括当前值和默认值)
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return OBFloatPropertyRange 属性的范围
|
||||
* \endif
|
||||
*/
|
||||
OBFloatPropertyRange getFloatPropertyRange(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get bool type device property range (including current value anddefault value)
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return OBBoolPropertyRange Property range
|
||||
* \else
|
||||
* @brief 获取bool类型的设备属性的范围(包括当前值和默认值)
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return OBBoolPropertyRange 属性的范围
|
||||
* \endif
|
||||
*/
|
||||
OBBoolPropertyRange getBoolPropertyRange(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief AHB register write
|
||||
*
|
||||
* @param reg Register to be written
|
||||
* @param mask The mask to be writen
|
||||
* @param value The value to be written
|
||||
* \else
|
||||
* @brief AHB写寄存器
|
||||
*
|
||||
* @param reg 要写入的寄存器
|
||||
* @param mask 要写入的掩码
|
||||
* @param value 要写入的值
|
||||
* \endif
|
||||
*/
|
||||
void writeAHB(uint32_t reg, uint32_t mask, uint32_t value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief AHB AHB register read
|
||||
*
|
||||
* @param reg Register to be read
|
||||
* @param mask The mask to be read
|
||||
* @param value The value to be returned
|
||||
* \else
|
||||
* @brief AHB读寄存器
|
||||
*
|
||||
* @param reg 要读取的寄存器
|
||||
* @param mask 要读取的掩码
|
||||
* @param value 读取的值返回
|
||||
* \endif
|
||||
*/
|
||||
void readAHB(uint32_t reg, uint32_t mask, uint32_t *value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief I2C register write
|
||||
*
|
||||
* @param reg I2C module ID to be written
|
||||
* @param reg Register to be written
|
||||
* @param mask The mask to be written
|
||||
* @param value he value to be written
|
||||
* \else
|
||||
* @brief I2C写寄存器
|
||||
*
|
||||
* @param reg 要写入的I2C模块ID
|
||||
* @param reg 要写入的寄存器
|
||||
* @param mask 要写入的掩码
|
||||
* @param value 要写入的值
|
||||
* \endif
|
||||
*/
|
||||
void writeI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief I2C registers read
|
||||
*
|
||||
* @param reg I2C module ID to be read
|
||||
* @param reg Register to be read
|
||||
* @param mask The mask to be read
|
||||
* @param value The value to be returned
|
||||
* \else
|
||||
* @brief I2C读寄存器
|
||||
*
|
||||
* @param reg 要读取的I2C模块ID
|
||||
* @param reg 要读取的寄存器
|
||||
* @param mask 要读取的掩码
|
||||
* @param value 读取的值返回
|
||||
* \endif
|
||||
*/
|
||||
void readI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t *value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the properties of writing to Flash
|
||||
*
|
||||
* @param offset flash offset address
|
||||
* @param data Property data to be written
|
||||
* @param dataSize The size of the property to be written
|
||||
* @param callback Write flash progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 设置写入Flash的属性
|
||||
*
|
||||
* @param offset flash 偏移地址
|
||||
* @param data 要写入的属性数据
|
||||
* @param dataSize 要写入的属性大小
|
||||
* @param callback 写flash进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void writeFlash(uint32_t offset, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Read Flash property
|
||||
*
|
||||
* @param offset flash offset address
|
||||
* @param data Property data to be read
|
||||
* @param dataSize The size of the property to get
|
||||
* @param callback Read data returned by flash and progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 读取Flash的属性
|
||||
*
|
||||
* @param offset flash 偏移地址
|
||||
* @param data 读取的属性数据
|
||||
* @param dataSize 获取的属性大小
|
||||
* @param callback 读flash返回的数据及进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void readFlash(uint32_t offset, uint32_t dataSize, GetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set raw data type of device property [Asynchronous callback]
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data to be set
|
||||
* @param dataSize The size of the property data to be set
|
||||
* @param callback rawdata set progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 设置raw data类型的设备属性数据[异步回调]
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 要设置的属性数据
|
||||
* @param dataSize 要设置的属性数据大小
|
||||
* @param callback rawdata设置进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void setRawData(OBPropertyID propertyId, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get raw data type of device property [Asynchronous callback]
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data obtained
|
||||
* @param dataSize Get the size of the property
|
||||
* @param callback Get the returned data and progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 获取raw data类型的设备属性数据[异步回调]
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 获取的属性数据
|
||||
* @param dataSize 获取的属性大小
|
||||
* @param callback 获取返回的数据及进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void getRawData(OBPropertyID propertyId, GetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set structured data type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data to be set
|
||||
* @param dataSize The size of the attribute to be set
|
||||
* \else
|
||||
* @brief 设置structured data类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 要设置的属性数据
|
||||
* @param dataSize 要设置的属性大小
|
||||
* \endif
|
||||
*/
|
||||
void setStructuredData(OBPropertyID propertyId, const void *data, uint32_t dataSize);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get structured data type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data obtained
|
||||
* @param dataSize Get the size of the attribute
|
||||
* \else
|
||||
* @brief 获取structured data类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 获取的属性数据
|
||||
* @param dataSize 获取的属性大小
|
||||
* \endif
|
||||
*/
|
||||
void getStructuredData(OBPropertyID propertyId, void *data, uint32_t *dataSize);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get number of devices supported property
|
||||
*
|
||||
* @return uint32_t returns the number of supported attributes
|
||||
* \else
|
||||
* @brief 获取设备支持的属性的数量
|
||||
*
|
||||
* @return uint32_t 返回支持的属性的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t getSupportedPropertyCount();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device supported properties
|
||||
*
|
||||
* @param uint32_t Property index
|
||||
* @return OBPropertyItem returns the type of supported properties
|
||||
* \else
|
||||
* @brief 获取设备支持的属性
|
||||
*
|
||||
* @param uint32_t 属性的index
|
||||
* @return OBPropertyItem 返回支持的属性的类型
|
||||
* \endif
|
||||
*/
|
||||
OBPropertyItem getSupportedProperty(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Judge property permission support
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param permission Types of read and write permissions that need to be interpreted
|
||||
* @return bool returns whether it is supported
|
||||
* \else
|
||||
* @brief 判断属性权限支持情况
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param permission 需要判读的读写权限类型
|
||||
* @return bool 返回是否支持
|
||||
* \endif
|
||||
*/
|
||||
bool isPropertySupported(OBPropertyID propertyId, OBPermissionType permission);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Synchronize device time (synchronize local systemtime to device)
|
||||
* @return uint64_t command (round trip time, rtt)
|
||||
* \else
|
||||
* @brief 同步设备时间(向设备授时,同步本地系统时间到设备)
|
||||
* @return uint64_t 命令往返时间延时(round trip time, rtt)
|
||||
* \endif
|
||||
*/
|
||||
uint64_t syncDeviceTime();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Upgrade the device firmware
|
||||
*
|
||||
* @param filePath Firmware path
|
||||
* @param callback Firmware upgrade progress and status callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 升级设备固件
|
||||
*
|
||||
* @param filePath 固件的路径
|
||||
* @param callback 固件升级进度及状态回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void deviceUpgrade(const char *filePath, DeviceUpgradeCallback callback, bool async = true);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Send files to the specified path on the device side [Asynchronouscallback]
|
||||
*
|
||||
* @param filePath Original file path
|
||||
* @param dstPath Accept the save path on the device side
|
||||
* @param callback File transfer callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 发送文件到设备端指定路径[异步回调]
|
||||
*
|
||||
* @param filePath 原文件路径
|
||||
* @param dstPath 设备端接受保存路径
|
||||
* @param callback 文件传输回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void sendFile(const char *filePath, const char *dstPath, SendFileCallback callback, bool async = true);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the current state
|
||||
* @return OBDeviceState device state information
|
||||
* \else
|
||||
* @brief 获取当前设备状态
|
||||
* @return OBDeviceState 设备状态信息
|
||||
* \endif
|
||||
*/
|
||||
OBDeviceState getDeviceState();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the device state changed callbacks
|
||||
*
|
||||
* @param callback The callback function that is triggered when the device status changes (for example, the frame rate is automatically reduced or the stream is closed due to high temperature, etc.)
|
||||
* \else
|
||||
* @brief 设置设备状态改变回调函数
|
||||
*
|
||||
* @param callback 设备状态改变(如,由于温度过高自动降低帧率或关流等)时触发的回调函数
|
||||
* \endif
|
||||
*/
|
||||
void setDeviceStateChangedCallback(DeviceStateChangedCallback callback);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Verify device authorization code
|
||||
* @param authCode Authorization code
|
||||
* @return bool whether the activation is successfu
|
||||
* \else
|
||||
* @brief 验证设备授权码
|
||||
* @param authCode 授权码
|
||||
* @return bool 激活是否成功
|
||||
* \endif
|
||||
*/
|
||||
bool activateAuthorization(const char *authCode);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Write authorization code
|
||||
* @param authCode Authorization code
|
||||
* \else
|
||||
* @brief 写入设备授权码
|
||||
* @param authCode 授权码
|
||||
* \endif
|
||||
*/
|
||||
void writeAuthorizationCode(const char *authCodeStr);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the original parameter list of camera calibration saved in the device. The parameters in the list do not correspond to the current open-current configuration.
|
||||
* You need to select the parameters according to the actual situation, and may need to do scaling, mirroring and other processing. Non-professional users are recommended to use the Pipeline::getCameraParam() interface.
|
||||
*
|
||||
* @return std::shared_ptr<CameraParamList> camera parameter list
|
||||
* \else
|
||||
* @brief 获取设备内保存的相机标定的原始参数列表,列表内参数不与当前开流配置相对应,
|
||||
* 需要自行根据实际情况选用参数并可能需要做缩放、镜像等处理。非专业用户建议使用Pipeline::getCameraParam()接口。
|
||||
*
|
||||
* @return std::shared_ptr<CameraParamList> 相机参数列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<CameraParamList> getCalibrationCameraParamList();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Device restart
|
||||
* @attention The device will be disconnected and reconnected. After the device is disconnected, the access to the Device object interface may be abnormal.
|
||||
* Please delete the object directly and obtain it again after the device is reconnected.
|
||||
* \else
|
||||
* @brief 设备重启
|
||||
* @attention 设备会掉线重连,设备掉线后对Device对象接口访问可能会发生异常,请直接删除该对象,
|
||||
* 待设备重连后可重新获取。
|
||||
* \endif
|
||||
*/
|
||||
void reboot();
|
||||
|
||||
friend class Pipeline;
|
||||
friend class Recorder;
|
||||
};
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief A class describing device information, representing the name, id, serial number and other basic information of an RGBD camera.
|
||||
* \else
|
||||
* @brief 描述设备信息的类,代表一个RGBD相机的名称,id,序列号等其他设备自身基本信息。
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
class OB_EXTENSION_API DeviceInfo {
|
||||
private:
|
||||
std::unique_ptr<DeviceInfoImpl> impl_;
|
||||
|
||||
public:
|
||||
DeviceInfo(std::unique_ptr<DeviceInfoImpl> impl);
|
||||
virtual ~DeviceInfo() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device name
|
||||
*
|
||||
* @return const char * returns the device name
|
||||
* \else
|
||||
* @brief 获取设备名称
|
||||
*
|
||||
* @return const char * 返回设备名称
|
||||
* \endif
|
||||
*/
|
||||
const char *name();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the pid of the device
|
||||
*
|
||||
* @return int returns the pid of the device
|
||||
* \else
|
||||
* @brief 获取设备的pid
|
||||
*
|
||||
* @return int 返回设备的pid
|
||||
* \endif
|
||||
*/
|
||||
int pid();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the vid of the device
|
||||
*
|
||||
* @return int returns the vid of the device
|
||||
* \else
|
||||
* @brief 获取设备的vid
|
||||
*
|
||||
* @return int 返回设备的vid
|
||||
* \endif
|
||||
*/
|
||||
int vid();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get system assigned uid for distinguishing between different devices
|
||||
*
|
||||
* @return const char * returns the uid of the device
|
||||
* \else
|
||||
* @brief 获取设备的uid,该uid标识设备接入os操作系统时,给当前设备分派的唯一id,用来区分不同的设备
|
||||
*
|
||||
* @return const char * 返回设备的uid
|
||||
* \endif
|
||||
*/
|
||||
const char *uid();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the serial number of the device
|
||||
*
|
||||
* @return const char * returns the serial number of the device
|
||||
* \else
|
||||
* @brief 获取设备的序列号
|
||||
*
|
||||
* @return const char * 返回设备的序列号
|
||||
* \endif
|
||||
*/
|
||||
const char *serialNumber();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the version number of the firmware
|
||||
*
|
||||
* @return const char* returns the version number of the firmware
|
||||
* \else
|
||||
* @brief 获取固件的版本号
|
||||
*
|
||||
* @return const char* 返回固件的版本号
|
||||
* \endif
|
||||
*/
|
||||
const char *firmwareVersion();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get usb connection type
|
||||
*
|
||||
* @return const char* returns usb connection type
|
||||
* \else
|
||||
* @brief 获取usb连接类型
|
||||
*
|
||||
* @return const char* 返回usb连接类型
|
||||
* \endif
|
||||
*/
|
||||
DEPRECATED const char *usbType();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device connection type
|
||||
*
|
||||
* @return const char* returns connection type
|
||||
* \else
|
||||
* @brief 获取设备连接类型
|
||||
*
|
||||
* @return const char* 返回连接类型
|
||||
* \endif
|
||||
*/
|
||||
const char *connectionType();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the version number of the hardware
|
||||
*
|
||||
* @return const char* returns the version number of the hardware
|
||||
* \else
|
||||
* @brief 获取硬件的版本号
|
||||
*
|
||||
* @return const char* 返回硬件的版本号
|
||||
* \endif
|
||||
*/
|
||||
const char *hardwareVersion();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the minimum version number of the SDK supported by the device
|
||||
*
|
||||
* @return const char* returns the minimum SDK version number supported by the device
|
||||
* \else
|
||||
* @brief 获取设备支持的SDK最小版本号
|
||||
*
|
||||
* @return const char* 返回设备支持的SDK最小版本号
|
||||
* \endif
|
||||
*/
|
||||
const char *supportedMinSdkVersion();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get chip type name
|
||||
*
|
||||
* @return const char* returns the chip type name
|
||||
* \else
|
||||
* @brief 获取芯片类型名称
|
||||
*
|
||||
* @return const char* 返回芯片类型名称
|
||||
* \endif
|
||||
*/
|
||||
const char *asicName();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device type
|
||||
*
|
||||
* @return OBDeviceType returns the device type
|
||||
* \else
|
||||
* @brief 获取设备类型
|
||||
*
|
||||
* @return OBDeviceType 返回设备类型
|
||||
* \endif
|
||||
*/
|
||||
OBDeviceType deviceType();
|
||||
|
||||
friend class Context;
|
||||
friend class DeviceList;
|
||||
friend class Pipeline;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API DeviceList {
|
||||
private:
|
||||
std::unique_ptr<DeviceListImpl> impl_;
|
||||
|
||||
public:
|
||||
DeviceList(std::unique_ptr<DeviceListImpl> impl);
|
||||
~DeviceList() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device count
|
||||
*
|
||||
* @return uint32_t returns the number of devices
|
||||
* \else
|
||||
* @brief 获取设备数量
|
||||
*
|
||||
* @return uint32_t 返回设备的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t deviceCount();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the name of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return int returns the name of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的名称
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return int 返回设备的名称
|
||||
* \endif
|
||||
*/
|
||||
const char *name(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the pid of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return int returns the pid of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的pid
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return int 返回设备的pid
|
||||
* \endif
|
||||
*/
|
||||
int pid(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the vid of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return int returns the vid of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的vid
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return int 返回设备的vid
|
||||
* \endif
|
||||
*/
|
||||
int vid(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the uid of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return const char * returns the uid of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的uid
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return const char * 返回设备的uid
|
||||
* \endif
|
||||
*/
|
||||
const char *uid(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the serial number of the specified device
|
||||
*
|
||||
* @param index device index
|
||||
* @return const char * returns the serial number of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的序列号
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return const char * 返回设备的序列号
|
||||
* \endif
|
||||
*/
|
||||
const char *serialNumber(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the specified device object from the device list
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @param index index of the device to create
|
||||
* @return std::shared_ptr<Device> returns the device object
|
||||
* \else
|
||||
* @brief 从设备列表中获取指定设备对象,
|
||||
* @attention 如果设备有在其他地方被获取创建,重复获取将会抛异常
|
||||
* @param index 要创建设备的索引
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDevice(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the specified device object from the device list
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @param serialNumber The serial number of the device to be created
|
||||
* @return std::shared_ptr<Device> returns the device object
|
||||
* \else
|
||||
* @brief 从设备列表中获取指定设备对象
|
||||
* @attention 如果设备有在其他地方被获取创建,重复获取将会抛异常
|
||||
* @param serialNumber 要创建设备的序列号
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDeviceBySN(const char *serialNumber);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the specified device object from the device list
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @param uid If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @return std::shared_ptr<Device> If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* \else
|
||||
* @brief 从设备列表中获取指定设备对象
|
||||
* @attention 如果设备有在其他地方被获取创建,重复获取将会抛异常
|
||||
* @param uid 要创建设备的uid
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDeviceByUid(const char *uid);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API CameraParamList {
|
||||
private:
|
||||
std::unique_ptr<CameraParamListImpl> impl_;
|
||||
|
||||
public:
|
||||
CameraParamList(std::unique_ptr<CameraParamListImpl> impl);
|
||||
~CameraParamList() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Number of camera parameter groups
|
||||
*
|
||||
* @return uint32_t returns the number of camera parameter groups
|
||||
* \else
|
||||
* @brief 相机参数组数
|
||||
*
|
||||
* @return uint32_t 返回相机参数组数
|
||||
* \endif
|
||||
*/
|
||||
uint32_t count();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get camera parameters
|
||||
*
|
||||
* @param index parameter index
|
||||
* @return OBCameraParam returns the corresponding group parameters
|
||||
* \else
|
||||
* @brief 获取相机参数
|
||||
*
|
||||
* @param index 参数索引
|
||||
* @return OBCameraParam 返回对应组参数
|
||||
* \endif
|
||||
*/
|
||||
OBCameraParam getCameraParam(uint32_t index);
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Error.hpp
|
||||
* @brief Error describes the abnormal error within the SDK, and the detailed information of the exception can be realized through this class.
|
||||
* \else
|
||||
* @file Error.hpp
|
||||
* @brief Error描述SDK内部的异常错误,通过该类可以实现异常的详细信息。
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include <memory>
|
||||
|
||||
struct ErrorImpl;
|
||||
|
||||
namespace ob {
|
||||
class OB_EXTENSION_API Error {
|
||||
private:
|
||||
std::unique_ptr<ErrorImpl> impl_;
|
||||
|
||||
public:
|
||||
Error(std::unique_ptr<ErrorImpl> impl) noexcept;
|
||||
|
||||
Error(const Error &error) noexcept;
|
||||
|
||||
~Error() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Obtain detailed error logs of SDK internal exceptions.
|
||||
* \else
|
||||
* @brief 获取SDK内部异常的详细错误日志。
|
||||
* \endif
|
||||
*/
|
||||
const char *getMessage() const noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the exception type of the error, and determine which module is abnormal.
|
||||
* @return OBExceptionType
|
||||
* \else
|
||||
* @brief 获取该错误的异常类型,判断是具体哪个模块异常。
|
||||
* @return OBExceptionType
|
||||
*/
|
||||
OBExceptionType getExceptionType() const noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the name of the error function.
|
||||
* \else
|
||||
* @brief 获取SDK内部异常的错误接口函数名称。
|
||||
* \endif
|
||||
*/
|
||||
const char *getName() const noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the parameter passed in to the error interface.
|
||||
* \else
|
||||
* @brief 获取SDK内部异常的错误接口函数传入参数。
|
||||
* \endif
|
||||
*/
|
||||
const char *getArgs() const noexcept;
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Filter.hpp
|
||||
* @brief The processing unit of the SDK can perform point cloud generation, format conversion and other functions.
|
||||
* \else
|
||||
* @file Filter.hpp
|
||||
* @brief SDK的处理单元,可以进行点云的生成,格式转换等功能
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
class Frame;
|
||||
|
||||
typedef std::function<void(std::shared_ptr<Frame>)> FilterCallback;
|
||||
|
||||
class OB_EXTENSION_API Filter {
|
||||
public:
|
||||
Filter();
|
||||
|
||||
virtual ~Filter() = default;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief filter reset, free the internal cache, stop the processing thread and clear the pending buffer frame when asynchronous processing
|
||||
* \else
|
||||
* @brief filter重置,释放内部缓存,异步处理时停止处理线程并清空待处理的缓存帧
|
||||
* \endif
|
||||
*/
|
||||
virtual void reset();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Processing frames (synchronous interface)
|
||||
*
|
||||
* @param frame frame to be processed
|
||||
* @return std::shared_ptr< Frame > processed frame
|
||||
* \else
|
||||
* @brief 处理帧(同步接口)
|
||||
*
|
||||
* @param frame 需要处理的frame
|
||||
* @return std::shared_ptr< Frame > 处理后的frame
|
||||
* \endif
|
||||
*/
|
||||
virtual std::shared_ptr<Frame> process(std::shared_ptr<Frame> frame);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Push the pending frame into the cache (asynchronous callback interface)
|
||||
*
|
||||
* @param frame The pending frame processing result is returned by the callback function
|
||||
* \else
|
||||
* @brief 压入待处理frame到缓存(异步回调接口)
|
||||
*
|
||||
* @param frame 待处理的frame处理结果通过回调函数返回
|
||||
* \endif
|
||||
*/
|
||||
|
||||
virtual void pushFrame(std::shared_ptr<Frame> frame);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the callback function (asynchronous callback interface)
|
||||
*
|
||||
* @param callback Processing result callback
|
||||
* \else
|
||||
* @brief 设置回调函数(异步回调接口)
|
||||
*
|
||||
* @param callback 处理结果回调
|
||||
* \endif
|
||||
*/
|
||||
virtual void setCallBack(FilterCallback callback);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<FilterImpl> impl_;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API PointCloudFilter : public Filter {
|
||||
public:
|
||||
PointCloudFilter();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set point cloud type parameters
|
||||
*
|
||||
* @param type Point cloud type depth point cloud or RGBD point cloud
|
||||
* \else
|
||||
* @brief 设置点云类型参数
|
||||
*
|
||||
* @param type 点云类型 深度点云或RGBD点云
|
||||
* \endif
|
||||
*/
|
||||
void setCreatePointFormat(OBFormat type);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set camera parameters
|
||||
*
|
||||
* @param param Camera internal and external parameters
|
||||
* \else
|
||||
* @brief 设置相机参数
|
||||
*
|
||||
* @param param 相机内外参数
|
||||
* \endif
|
||||
*/
|
||||
void setCameraParam(OBCameraParam param);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the frame alignment state that will be input to generate point cloud (it needs to be enabled in D2C mode, as the basis for the algorithm to select the set of camera internal parameters)
|
||||
*
|
||||
* @param state Alignment status, True: enable alignment; False: disable alignment
|
||||
* \else
|
||||
* @brief 设置将要输入的用于生成点云的帧对齐状态(D2C模式下需要开启,作为算法选用那组相机内参的依据)
|
||||
*
|
||||
* @param state 对齐状态,True:开启对齐; False:关闭对齐
|
||||
* \endif
|
||||
*/
|
||||
void setFrameAlignState(bool state);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API FormatConvertFilter : public Filter {
|
||||
public:
|
||||
FormatConvertFilter();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set format conversion type
|
||||
*
|
||||
* @param type Format conversion type
|
||||
* \else
|
||||
* @brief 设置格式转化类型
|
||||
*
|
||||
* @param type 格式转化类型
|
||||
* \endif
|
||||
*/
|
||||
void setFormatConvertType(OBConvertFormat type);
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,483 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Frame.hpp
|
||||
* @brief Frame related type, which is mainly used to obtain frame data and frame information.
|
||||
* \else
|
||||
* @file Frame.hpp
|
||||
* @brief 帧相关类型,主要用于获取帧数据及帧的信息
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
|
||||
/**
|
||||
* Frame类继承关系:
|
||||
* Frame
|
||||
* |
|
||||
* +------+----------+----------+-----------+
|
||||
* | | | | |
|
||||
* VideoFrame PointFrame AccelFrame GyroFrame FrameSet
|
||||
* |
|
||||
* +--+------+---------+
|
||||
* | | |
|
||||
* ColorFrame DepthFrame IRFrame
|
||||
*
|
||||
*/
|
||||
|
||||
struct FrameImpl;
|
||||
|
||||
namespace ob {
|
||||
class StreamProfile;
|
||||
class Filter;
|
||||
|
||||
class OB_EXTENSION_API Frame : public std::enable_shared_from_this<Frame> {
|
||||
protected:
|
||||
std::unique_ptr<FrameImpl> impl_;
|
||||
|
||||
public:
|
||||
Frame(std::unique_ptr<FrameImpl> impl);
|
||||
Frame(Frame &frame);
|
||||
|
||||
virtual ~Frame() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the type of frame
|
||||
*
|
||||
* @return OBFrameType returns the type of frame
|
||||
* \else
|
||||
* @brief 获取帧的类型
|
||||
*
|
||||
* @return OBFrameType 返回帧的类型
|
||||
* \endif
|
||||
*/
|
||||
virtual OBFrameType type();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the format of the frame
|
||||
*
|
||||
* @return OBFormat returns the format of the frame
|
||||
* \else
|
||||
* @brief 获取帧的格式
|
||||
*
|
||||
* @return OBFormat 返回帧的格式
|
||||
* \endif
|
||||
*/
|
||||
virtual OBFormat format();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the sequence number of the frame
|
||||
*
|
||||
* @return uint64_t returns the sequence number of the frame
|
||||
* \else
|
||||
* @brief 获取帧的序号
|
||||
*
|
||||
* @return uint64_t 返回帧的序号
|
||||
* \endif
|
||||
*/
|
||||
virtual uint64_t index();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame data
|
||||
*
|
||||
* @return void* returns frame data
|
||||
* \else
|
||||
* @brief 获取帧数据
|
||||
*
|
||||
* @return void* 返回帧数据
|
||||
* \endif
|
||||
*/
|
||||
virtual void *data();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the frame data size
|
||||
*
|
||||
* @return uint32_t returns the frame data size
|
||||
* If it is point cloud data, it returns the number of bytes occupied by all point sets. If you need to find the number of points, you need to divide the dataSize by the structure size of the corresponding point type.
|
||||
* \else
|
||||
* @brief 获取帧数据大小
|
||||
*
|
||||
* @return uint32_t 返回帧数据的大小
|
||||
* 如果是点云数据返回的是所有点集合占的字节数,若需要求出点的个数需要将dataSize除以对应的点类型的结构体大小
|
||||
* \endif
|
||||
*/
|
||||
virtual uint32_t dataSize();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the hardware timestamp of the frame
|
||||
*
|
||||
* @return uint64_t returns the time stamp of the frame hardware
|
||||
* \else
|
||||
* @brief 获取帧的硬件时间戳
|
||||
*
|
||||
* @return uint64_t 返回帧硬件的时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t timeStamp();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the hardware timestamp of the frame us
|
||||
*
|
||||
* @return uint64_t returns the time stamp of the frame hardware, unit us
|
||||
* \else
|
||||
* @brief 获取帧的硬件时间戳
|
||||
*
|
||||
* @return uint64_t 返回帧硬件的时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t timeStampUs();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame system timestamp
|
||||
*
|
||||
* @return uint64_t returns the time stamp of the frame hardware
|
||||
* \else
|
||||
* @brief 获取帧的系统时间戳
|
||||
*
|
||||
* @return uint64_t 返回帧的系统时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t systemTimeStamp();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Check if the runtime type of the frame object is compatible with a given type
|
||||
*
|
||||
* @tparam T Given type
|
||||
* @return bool returns result
|
||||
* \else
|
||||
* @brief 检查帧对象的运行时类型是否与给定类型兼容
|
||||
*
|
||||
* @tparam T 给定的类型
|
||||
* @return bool 返回结果
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> bool is();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Frame object type conversion
|
||||
*
|
||||
* @tparam T Target type
|
||||
* @return std::shared_ptr<T> returns the result, if it cannot be converted, an exception will be thrown
|
||||
* \else
|
||||
* @brief 帧对象类型转换
|
||||
*
|
||||
* @tparam T 目标类型
|
||||
* @return std::shared_ptr<T> 返回结果, 如果不能够转换,将抛异常
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> std::shared_ptr<T> as() {
|
||||
if(!is<T>())
|
||||
throw "unsupported operation, object's type is not require type";
|
||||
|
||||
return std::static_pointer_cast<T>(std::const_pointer_cast<Frame>(shared_from_this()));
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Filter;
|
||||
friend class Recorder;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API VideoFrame : public Frame {
|
||||
public:
|
||||
VideoFrame(Frame &frame);
|
||||
virtual ~VideoFrame() noexcept {};
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame width
|
||||
*
|
||||
* @return uint32_t returns the width of the frame
|
||||
* \else
|
||||
* @brief 获取帧的宽
|
||||
*
|
||||
* @return uint32_t 返回帧的宽
|
||||
* \endif
|
||||
*/
|
||||
uint32_t width();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame height
|
||||
*
|
||||
* @return uint32_t returns the height of the frame
|
||||
* \else
|
||||
* @brief 获取帧的高
|
||||
*
|
||||
* @return uint32_t 返回帧的高
|
||||
* \endif
|
||||
*/
|
||||
uint32_t height();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the metadata of the frame
|
||||
*
|
||||
* @return void* returns the metadata of the frame
|
||||
* \else
|
||||
* @brief 获取帧的元数据
|
||||
*
|
||||
* @return void* 返回帧的元数据
|
||||
* \endif
|
||||
*/
|
||||
void *metadata();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the metadata size of the frame
|
||||
*
|
||||
* @return uint32_t returns the metadata size of the frame
|
||||
* \else
|
||||
* @brief 获取帧的元数据大小
|
||||
*
|
||||
* @return uint32_t 返回帧的元数据大小
|
||||
* \endif
|
||||
*/
|
||||
uint32_t metadataSize();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are valid bits, and the upper 6 bits are filled with 0)
|
||||
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
|
||||
*
|
||||
* @return uint8_t returns the effective number of pixels in the pixel, or 0 if it is an unsupported format
|
||||
* \else
|
||||
* @brief 获取像素有效位数(如Y16格式帧,每个像素占16bit,但实际只有低10位是有效位,高6位填充0)
|
||||
* @attention 仅对Y8/Y10/Y11/Y12/Y14/Y16格式有效
|
||||
*
|
||||
* @return uint8_t 返回像素有效位数,如果是不支持的格式,返回0
|
||||
* \endif
|
||||
*/
|
||||
uint8_t pixelAvailableBitSize();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API ColorFrame : public VideoFrame {
|
||||
public:
|
||||
ColorFrame(Frame &frame);
|
||||
~ColorFrame() noexcept {};
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API DepthFrame : public VideoFrame {
|
||||
public:
|
||||
DepthFrame(Frame &frame);
|
||||
~DepthFrame() noexcept {};
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the value scale of the depth frame, the unit is mm/step,
|
||||
* such as valueScale=0.1, and a certain coordinate pixel value is pixelValue=10000,
|
||||
* then the depth value value = pixelValue*valueScale = 10000*0.1=1000mm.
|
||||
*
|
||||
* @return float
|
||||
* \else
|
||||
* @brief 获取深度帧的值刻度,单位为 mm/step,
|
||||
* 如valueScale=0.1, 某坐标像素值为pixelValue=10000,
|
||||
* 则表示深度值value = pixelValue*valueScale = 10000*0.1=1000mm。
|
||||
*
|
||||
* @return float
|
||||
* \endif
|
||||
*/
|
||||
float getValueScale();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API IRFrame : public VideoFrame {
|
||||
public:
|
||||
IRFrame(Frame &frame);
|
||||
virtual ~IRFrame() noexcept {};
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API PointsFrame : public Frame {
|
||||
public:
|
||||
PointsFrame(Frame &frame);
|
||||
~PointsFrame() noexcept {};
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API FrameSet : public Frame {
|
||||
|
||||
public:
|
||||
// FrameSet();
|
||||
FrameSet(Frame &frame);
|
||||
~FrameSet() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame count
|
||||
*
|
||||
* @return uint32_t returns the number of frames
|
||||
* \else
|
||||
* @brief 帧集合中包含的帧数量
|
||||
*
|
||||
* @return uint32_t 返回帧的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t frameCount();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get depth frame
|
||||
*
|
||||
* @return std::shared_ptr<DepthFrame> returns the depth frame
|
||||
* \else
|
||||
* @brief 获取深度帧
|
||||
*
|
||||
* @return std::shared_ptr<DepthFrame> 返回深度帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DepthFrame> depthFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get color frame
|
||||
*
|
||||
* @return std::shared_ptr<ColorFrame> returns the color frame
|
||||
* \else
|
||||
* @brief 获取彩色帧
|
||||
*
|
||||
* @return std::shared_ptr<ColorFrame> 返回彩色帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<ColorFrame> colorFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get infrared frame
|
||||
*
|
||||
* @return std::shared_ptr<IRFrame> returns infrared frame
|
||||
* \else
|
||||
* @brief 获取红外帧
|
||||
*
|
||||
* @return std::shared_ptr<IRFrame> 返回红外帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<IRFrame> irFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get point cloud frame
|
||||
*
|
||||
* @return std::shared_ptr<PointsFrame> returns the point cloud data frame
|
||||
* \else
|
||||
* @brief 获取点云帧
|
||||
*
|
||||
* @return std::shared_ptr<PointsFrame> 返回点云帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<PointsFrame> pointsFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame by sensor type
|
||||
*
|
||||
* @param frameType Type of sensor
|
||||
* @return std::shared_ptr<Frame> returns the corresponding type of frame
|
||||
* \else
|
||||
* @brief 通过传感器类型获取帧
|
||||
*
|
||||
* @param frameType 传感器的类型
|
||||
* @return std::shared_ptr<Frame> 返回相应类型的帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Frame> getFrame(OBSensorType sensorType);
|
||||
|
||||
friend class Pipeline;
|
||||
friend class Filter;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API AccelFrame : public Frame {
|
||||
public:
|
||||
AccelFrame(Frame &frame);
|
||||
~AccelFrame() noexcept = default;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Accelerometer frame data
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \else
|
||||
* @brief 获取加速度帧X数据
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \endif
|
||||
*/
|
||||
OBAccelValue value();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the temperature when the frame is sampled
|
||||
*
|
||||
* @return float temperature value
|
||||
* \else
|
||||
* @brief 获取帧采样时的温度
|
||||
*
|
||||
* @return float 温度值
|
||||
* \endif
|
||||
*/
|
||||
float temperature();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API GyroFrame : public Frame {
|
||||
public:
|
||||
GyroFrame(Frame &frame);
|
||||
~GyroFrame() noexcept = default;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get gyro frame data
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \else
|
||||
* @brief 获取陀螺仪帧数据
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \endif
|
||||
*/
|
||||
OBGyroValue value();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get temperature when the frame is sampled.
|
||||
*
|
||||
* @return float temperature value
|
||||
* \else
|
||||
* @brief 获取帧采样时的温度
|
||||
*
|
||||
* @return float 温度值
|
||||
* \endif
|
||||
*/
|
||||
float temperature();
|
||||
};
|
||||
|
||||
template <typename T> bool Frame::is() {
|
||||
switch(this->type()) {
|
||||
case OB_FRAME_IR:
|
||||
return (typeid(T) == typeid(IRFrame) || typeid(T) == typeid(VideoFrame));
|
||||
case OB_FRAME_DEPTH:
|
||||
return (typeid(T) == typeid(DepthFrame) || typeid(T) == typeid(VideoFrame));
|
||||
case OB_FRAME_COLOR:
|
||||
return (typeid(T) == typeid(ColorFrame) || typeid(T) == typeid(VideoFrame));
|
||||
case OB_FRAME_GYRO:
|
||||
return (typeid(T) == typeid(GyroFrame));
|
||||
case OB_FRAME_ACCEL:
|
||||
return (typeid(T) == typeid(AccelFrame));
|
||||
case OB_FRAME_SET:
|
||||
return (typeid(T) == typeid(FrameSet));
|
||||
case OB_FRAME_POINTS:
|
||||
return (typeid(T) == typeid(PointsFrame));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,349 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Pipeline.hpp
|
||||
* @brief The SDK's advanced API type can quickly implement switching streaming, frame synchronization, software filtering, and generating point cloud operations.
|
||||
* \else
|
||||
* @file Pipeline.hpp
|
||||
* @brief SDK的高级API类型,可以快速实现开关流,帧同步,软件滤波,生成点云等操作
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
struct PipelineImpl;
|
||||
struct ConfigImpl;
|
||||
|
||||
namespace ob {
|
||||
class FrameSet;
|
||||
class Frame;
|
||||
class Device;
|
||||
class Playback;
|
||||
class DeviceInfo;
|
||||
class Config;
|
||||
class StreamProfile;
|
||||
class StreamProfileList;
|
||||
|
||||
typedef std::function<void(std::shared_ptr<FrameSet> frame)> FrameSetCallback;
|
||||
|
||||
class OB_EXTENSION_API Pipeline {
|
||||
private:
|
||||
std::unique_ptr<PipelineImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Pipeline is a high-level interface for applications, algorithms related RGBD data streams. Pipeline can provide alignment inside and synchronized FrameSet.
|
||||
* Pipeline() no parameter version, which opens the first device in the list of devices connected to the OS by default. If the application has obtained the device through the DeviceList,
|
||||
* opening the Pipeline() at this time will throw an exception that the device has been created.
|
||||
* \else
|
||||
* @brief Pipeline 是SDK的高级接口,适用于应用,算法等重点关注RGBD数据流常见,Pipeline在SDK内部可以提供对齐,同步后的FrameSet桢集合
|
||||
* 直接方便客户使用。
|
||||
* Pipeline()无参数版本,默认打开连接到OS的设备列表中的第一个设备。若应用已经通过DeviceList获取设备,此时打开Pipeline()会抛出设备已经创建异常。
|
||||
* 需要开发者捕获异常处理。
|
||||
* \endif
|
||||
*/
|
||||
Pipeline();
|
||||
/**
|
||||
* \if English
|
||||
* @brief
|
||||
* Pipeline(std::shared_ptr< Device > device ) Function for multi-device operations. Multiple devices need to be obtained through DeviceList, and the device and pipeline are bound through this interface.
|
||||
* \else
|
||||
* @brief
|
||||
* Pipeline(std::shared_ptr< Device > device )函数,适用于多设备操作常见,此时需要通过DeviceList获取多个设备,通过该接口实现device和pipeline绑定。
|
||||
* \endif
|
||||
*/
|
||||
Pipeline(std::shared_ptr<Device> device);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a pipeline for playback of recorded stream files
|
||||
*
|
||||
* @param filename Playback file path
|
||||
* \else
|
||||
* @brief 创建pipeline用于回放录制好的流文件
|
||||
*
|
||||
* @param filename 回放文件路径
|
||||
* \endif
|
||||
*/
|
||||
Pipeline(const char *filename);
|
||||
~Pipeline() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start the pipeline with configuration parameters
|
||||
*
|
||||
* @param config Parameter configuration of pipeline
|
||||
* \else
|
||||
* @brief 启动pipeline并配置参数
|
||||
*
|
||||
* @param config pipeline的参数配置
|
||||
* \endif
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start the pipeline and set the frameset data callback
|
||||
*
|
||||
* @param config parameter configuration of pipeline
|
||||
* @param callback Set the callback to be triggered when all frame data in the frame set arrives
|
||||
* \else
|
||||
* @brief 启动pipeline并设置帧集合数据回调
|
||||
*
|
||||
* @param config pipeline的参数配置
|
||||
* @param callback 设置帧集合中的所有帧数据都到达时触发回调
|
||||
* \endif
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config, FrameSetCallback callback);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop pipeline
|
||||
* \else
|
||||
* @brief 停止pipeline
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get pipeline configuration parameters
|
||||
*
|
||||
* @return std::shared_ptr<Config> returns the configured parameters
|
||||
* \else
|
||||
* @brief 获取pipeline的配置参数
|
||||
*
|
||||
* @return std::shared_ptr<Config> 返回配置的参数
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Config> getConfig();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Waiting for frame set data
|
||||
*
|
||||
* @param timeout_ms Waiting timeout (ms)
|
||||
* @return std::shared_ptr<FrameSet> returns the waiting frame set data
|
||||
* \else
|
||||
* @brief 等待帧集合数据
|
||||
*
|
||||
* @param timeout_ms 等待超时时间(毫秒)
|
||||
* @return std::shared_ptr<FrameSet> 返回等待的帧集合数据
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<FrameSet> waitForFrames(uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device object
|
||||
*
|
||||
* @return std::shared_ptr<Device> returns the device object
|
||||
* \else
|
||||
* @brief 获取设备对象
|
||||
*
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDevice();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get playback object
|
||||
*
|
||||
* @return std::shared_ptr<Playback> returns the playback object
|
||||
* \else
|
||||
* @brief 获取回放对象
|
||||
*
|
||||
* @return std::shared_ptr<Playback> 返回回放对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Playback> getPlayback();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the stream profile of specified sensor
|
||||
*
|
||||
* @param sensorType Type of sensor
|
||||
|
||||
* @return std::shared_ptr<StreamProfileList> returns the stream configuration list
|
||||
* \else
|
||||
* @brief 获取指定传感器的流配置
|
||||
*
|
||||
* @param sensorType 传感器的类型
|
||||
* @return std::shared_ptr<StreamProfileList> 返回流配置列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getStreamProfileList(OBSensorType sensorType);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Turn on frame synchronization
|
||||
* \else
|
||||
* @brief 打开帧同步功能
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
void enableFrameSync();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Turn off frame synchronization
|
||||
* \else
|
||||
* @brief 关闭帧同步功能
|
||||
* \endif
|
||||
*/
|
||||
void disableFrameSync();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get camera parameters
|
||||
* @attention If D2C is enabled, it will return the camera parameters after D2C, if not, it will return to the default parameters
|
||||
*
|
||||
* @return OBCameraParam returns camera parameters
|
||||
* \else
|
||||
* @brief 获取相机参数
|
||||
* @attention 如果开启了D2C将返回D2C后的相机参数,如果没有将返回默认参数
|
||||
*
|
||||
* @return OBCameraParam返回相机参数
|
||||
* \endif
|
||||
*/
|
||||
OBCameraParam getCameraParam();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Return a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution
|
||||
* @param colorProfile Input color sensor resolution
|
||||
* @param alignMode Input align mode
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> returns a list of depth sensor resolutions
|
||||
* \else
|
||||
* @brief 返回与输入的彩色传感器分辨率对应的支持D2C的深度传感器分辨率列表
|
||||
* @param colorProfile 输入的彩色传感器分辨率
|
||||
* @param alignMode 输入的对齐模式
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> 返回深度传感器分辨率列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getD2CDepthProfileList(std::shared_ptr<StreamProfile> colorProfile,OBAlignMode alignMode);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Valid area after getting D2C
|
||||
*
|
||||
* @param depthDistance working distance
|
||||
* @return OBRect returns the area information valid after D2C at the working distance
|
||||
* \else
|
||||
* @brief 获取D2C后有效的区域
|
||||
*
|
||||
* @param depthDistance 工作距离
|
||||
* @return OBRect 返回在工作距离下D2C后有效的区域信息
|
||||
* \endif
|
||||
*/
|
||||
OBRect getD2CValidArea(uint32_t depthDistance);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Dynamically switch the corresponding config configuration
|
||||
*
|
||||
* @param config Updated config configuration
|
||||
* \else
|
||||
* @brief 动态切换对应的config配置
|
||||
*
|
||||
* @param config 更新后的config配置
|
||||
* \endif
|
||||
*/
|
||||
void switchConfig(std::shared_ptr<Config> config);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief start recording
|
||||
*
|
||||
* @param filename Record file name
|
||||
* \else
|
||||
* @brief 开始录制
|
||||
*
|
||||
* @param filename 录制文件名
|
||||
* \endif
|
||||
*/
|
||||
void startRecord(const char *filename);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop recording
|
||||
* \else
|
||||
* @brief 停止录制
|
||||
* \endif
|
||||
*/
|
||||
void stopRecord();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API Config {
|
||||
private:
|
||||
std::unique_ptr<ConfigImpl> impl_;
|
||||
|
||||
public:
|
||||
Config();
|
||||
~Config() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure the stream to be enabled
|
||||
*
|
||||
* @param streamProfile Stream configuration
|
||||
* \else
|
||||
* @brief 设置要打开的流配置
|
||||
*
|
||||
* @param streamProfile 流的配置
|
||||
* \endif
|
||||
*/
|
||||
void enableStream(std::shared_ptr<StreamProfile> streamProfile);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure all streams to be enabled
|
||||
* \else
|
||||
* @brief 设置打开所有的流
|
||||
* \endif
|
||||
*/
|
||||
void enableAllStream();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure the stream to be disabled
|
||||
*
|
||||
* @param streamType Stream configuration
|
||||
* \else
|
||||
* @brief 设置要关闭的流配置
|
||||
*
|
||||
* @param streamType 流的配置
|
||||
* \endif
|
||||
*/
|
||||
void disableStream(OBStreamType streamType);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure all streams to be disabled
|
||||
* \else
|
||||
* @brief 设置关闭所有的流
|
||||
* \endif
|
||||
*/
|
||||
void disableAllStream();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the alignment mode
|
||||
*
|
||||
* @param mode Align State Mode
|
||||
* \else
|
||||
* @brief 设置对齐模式
|
||||
*
|
||||
* @param mode 对齐状态模式
|
||||
* \endif
|
||||
*/
|
||||
void setAlignMode(OBAlignMode mode);
|
||||
|
||||
friend class Pipeline;
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief For recording and playback functions
|
||||
* \else
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief 用于录制和回放功能
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include <memory>
|
||||
|
||||
struct RecorderImpl;
|
||||
struct PlaybackImpl;
|
||||
|
||||
namespace ob {
|
||||
class Device;
|
||||
class Frame;
|
||||
class DeviceInfo;
|
||||
|
||||
using PlaybackCallback = std::function<void(std::shared_ptr<Frame> frame, void *pCookies)>;
|
||||
using MediaStateCallback = std::function<void(OBMediaState state)>;
|
||||
|
||||
class OB_EXTENSION_API Recorder {
|
||||
private:
|
||||
std::unique_ptr<RecorderImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a recorder for data recording
|
||||
* \else
|
||||
* @brief 创建录制器用于数据的录制
|
||||
* \endif
|
||||
*/
|
||||
Recorder();
|
||||
Recorder(std::unique_ptr<RecorderImpl> impl);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a recorder for data recording
|
||||
* @param device Devices that need to record device information
|
||||
* \else
|
||||
* @brief 创建录制器用于数据的录制
|
||||
* @param device 需要录制设备信息的设备
|
||||
* \endif
|
||||
*/
|
||||
Recorder(std::shared_ptr<Device> device);
|
||||
|
||||
virtual ~Recorder() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enable the recorder, throw an exception after failure
|
||||
*
|
||||
* @param filename Recorded file name
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 开启录制器,失败后抛出异常
|
||||
*
|
||||
* @param filename 录制的文件名称
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void start(const char *filename, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop the recorder, throw an exception on failure
|
||||
* \else
|
||||
* @brief 停止录制器,失败后抛出异常
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Write frame data to the recorder
|
||||
*
|
||||
* @param frame Write frame data
|
||||
* \else
|
||||
* @brief 向录制器内写入帧数据
|
||||
*
|
||||
* @param frame 写入的帧数据
|
||||
* \endif
|
||||
*/
|
||||
void write(std::shared_ptr<Frame> frame);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API Playback {
|
||||
private:
|
||||
std::unique_ptr<PlaybackImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create playback object
|
||||
* @param filename Playback filename
|
||||
* \else
|
||||
* @brief 创建回放对象
|
||||
* @param filename 回放的文件名
|
||||
* \endif
|
||||
*/
|
||||
Playback(const char *filename);
|
||||
Playback(std::unique_ptr<PlaybackImpl> impl);
|
||||
virtual ~Playback() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start playback, the playback data is returned from the callback, and an exception is thrown after failure
|
||||
* @param filename Playback filename
|
||||
* @param callback Callback for playback data
|
||||
* @param type Type of playback data
|
||||
* \else
|
||||
* @brief 开启回放,回放数据从回调中返回,失败后抛出异常
|
||||
* @param filename 回放的文件名
|
||||
* @param callback 回放数据的回调
|
||||
* @param type 回放数据的类型
|
||||
* \endif
|
||||
*/
|
||||
void start(PlaybackCallback callback, OBMediaType type = OB_MEDIA_ALL);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop playback and throw an exception if it fails
|
||||
* \else
|
||||
* @brief 停止回放,失败后抛出异常
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set playback state
|
||||
* @param state playback status callback
|
||||
* \else
|
||||
* @brief 设置回放状态
|
||||
* @param state 回放状态回调
|
||||
* \endif
|
||||
*/
|
||||
void setPlaybackStateCallback(MediaStateCallback state);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the device information in the recording file
|
||||
*
|
||||
* @return DeviceInfo returns device information
|
||||
* \else
|
||||
* @brief 获取录制文件内的设备信息
|
||||
*
|
||||
* @return DeviceInfo 返回的设备信息
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DeviceInfo> getDeviceInfo();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the intrinsic and extrinsic parameter information in the recording file
|
||||
*
|
||||
* @return OBCameraParam returns internal and external parameter information
|
||||
* \else
|
||||
* @brief 获取录制文件内的内外参信息
|
||||
*
|
||||
* @return OBCameraParam 返回的内外参信息
|
||||
* \endif
|
||||
*/
|
||||
OBCameraParam getCameraParam();
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Sensor.hpp
|
||||
* @brief Sensor related types, used to obtain stream configuration, open and close streams, set and get sensor properties.
|
||||
* \else
|
||||
* @file Sensor.hpp
|
||||
* @brief 传感器相关类型,用于获取流配置,开关流,设置及获取传感器属性等操作
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
struct SensorImpl;
|
||||
struct SensorListImpl;
|
||||
|
||||
namespace ob {
|
||||
class StreamProfile;
|
||||
class StreamProfileList;
|
||||
class Device;
|
||||
class Frame;
|
||||
class ImuFrame;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief frame data callback
|
||||
*
|
||||
* @param frame frame data
|
||||
* \else
|
||||
* @brief 帧数据回调
|
||||
*
|
||||
* @param frame 帧数据
|
||||
* \endif
|
||||
*/
|
||||
using FrameCallback = std::function<void(std::shared_ptr<Frame> frame)>;
|
||||
|
||||
class OB_EXTENSION_API Sensor {
|
||||
protected:
|
||||
std::unique_ptr<SensorImpl> impl_;
|
||||
|
||||
public:
|
||||
Sensor(std::unique_ptr<SensorImpl> impl);
|
||||
virtual ~Sensor() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief sensor type
|
||||
*
|
||||
* @return OBSensorType returns the sensor type
|
||||
* \else
|
||||
* @brief 传感器类型
|
||||
*
|
||||
* @return OBSensorType 返回传感器类型
|
||||
* \endif
|
||||
*/
|
||||
OBSensorType type();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the list of stream profiles
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> returns the stream configuration list
|
||||
* \else
|
||||
* @brief 获取传感器的流配置列表
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> 返回流配置列表
|
||||
* \endif
|
||||
*/
|
||||
const std::shared_ptr<StreamProfileList> getStreamProfileList();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Open frame data stream and set up a callback
|
||||
*
|
||||
* @param streamProfile Stream configuration
|
||||
* @param callback Set the callback when frame data arrives
|
||||
* \else
|
||||
* @brief 开启流并设置帧数据回调
|
||||
*
|
||||
* @param streamProfile 流的配置
|
||||
* @param callback 设置帧数据到达时的回调
|
||||
* \endif
|
||||
*/
|
||||
void start(std::shared_ptr<StreamProfile> streamProfile, FrameCallback callback);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop stream
|
||||
* \else
|
||||
* @brief 停止流
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Dynamically switch resolutions
|
||||
*
|
||||
* @param streamProfile Resolution to switch
|
||||
* \else
|
||||
* @brief 动态切换分辨率
|
||||
*
|
||||
* @param streamProfile 需要切换的分辨率
|
||||
* \endif
|
||||
*/
|
||||
void switchProfile(std::shared_ptr<StreamProfile> streamProfile);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API SensorList {
|
||||
private:
|
||||
std::unique_ptr<SensorListImpl> impl_;
|
||||
|
||||
public:
|
||||
SensorList(std::unique_ptr<SensorListImpl> impl);
|
||||
|
||||
virtual ~SensorList() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sensor count
|
||||
*
|
||||
* @return uint32_t returns the number of Sensors
|
||||
* \else
|
||||
* @brief 获取Sensor数量
|
||||
*
|
||||
* @return uint32_t 返回Sensor的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t count();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the type of the specified Sensor
|
||||
*
|
||||
* @param index Sensor index
|
||||
* @return OBSensorType returns the Sensor type
|
||||
* \else
|
||||
* @brief 获取指定Sensor的类型
|
||||
*
|
||||
* @param index Sensor索引
|
||||
* @return OBSensorType 返回Sensor类型
|
||||
* \endif
|
||||
*/
|
||||
OBSensorType type(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get Sensor by index number
|
||||
*
|
||||
* @param index To create a device cable, the range is [0, count-1], if the index exceeds the range, an exception will be thrown
|
||||
|
||||
* @return std::shared_ptr<Sensor> returns the Sensor object
|
||||
* \else
|
||||
* @brief 通过索引号获取Sensor
|
||||
*
|
||||
* @param index 要创建设备的索,范围 [0, count-1],如果index超出范围将抛异常
|
||||
* @return std::shared_ptr<Sensor> 返回Sensor对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Obtain the Sensor through the Sensor type
|
||||
*
|
||||
* @param sensorType Sensor type to be obtained
|
||||
* @return std::shared_ptr<Sensor> returns a Sensor object, if the specified type of Sensor does not exist, it will return empty
|
||||
* \else
|
||||
* @brief 通过Sensor类型获取Sensor
|
||||
*
|
||||
* @param sensorType 要获取的Sensor类型
|
||||
* @return std::shared_ptr<Sensor> 返回Sensor对象,如果指定类型Sensor不存在,将返回空
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(OBSensorType sensorType);
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,282 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file StreamProfile.hpp
|
||||
* @brief The stream configuration related type is used to get information such as the width, height, frame rate, and format of the stream.
|
||||
* \else
|
||||
* @file StreamProfile.hpp
|
||||
* @brief 流配置相关类型,用于获取流的宽、高、帧率及格式等信息
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct StreamProfileImpl;
|
||||
struct StreamProfileListImpl;
|
||||
|
||||
namespace ob {
|
||||
|
||||
class VideoStreamProfile;
|
||||
class GyroStreamProfile;
|
||||
class AccelStreamProfile;
|
||||
class Config;
|
||||
|
||||
class OB_EXTENSION_API StreamProfile : public std::enable_shared_from_this<StreamProfile> {
|
||||
protected:
|
||||
std::unique_ptr<StreamProfileImpl> impl_;
|
||||
|
||||
public:
|
||||
StreamProfile(std::unique_ptr<StreamProfileImpl> impl);
|
||||
StreamProfile(StreamProfile &streamProfile);
|
||||
~StreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the format of the stream
|
||||
*
|
||||
* @return OBFormat returns the format of the stream
|
||||
* \else
|
||||
* @brief 获取流的格式
|
||||
*
|
||||
* @return OBFormat 返回流的格式
|
||||
* \endif
|
||||
*/
|
||||
OBFormat format();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the type of stream
|
||||
*
|
||||
* @return OBStreamType returns the type of the stream
|
||||
* \else
|
||||
* @brief 获取流的类型
|
||||
*
|
||||
* @return OBStreamType 返回流的类型
|
||||
* \endif
|
||||
*/
|
||||
OBStreamType type();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Check if frame object is compatible with the given type
|
||||
*
|
||||
* @tparam T Given type
|
||||
* @return bool return result
|
||||
* \else
|
||||
* @brief 检查帧对象的运行时类型是否与给定类型兼容
|
||||
*
|
||||
* @tparam T 给定的类型
|
||||
* @return bool 返回结果
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> bool is();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Object type conversion
|
||||
*
|
||||
* @tparam T Target type
|
||||
* @return std::shared_ptr<T> returns the result, if it cannot be converted, an exception will be thrown
|
||||
* \else
|
||||
* @brief 对象类型转换
|
||||
*
|
||||
* @tparam T 目标类型
|
||||
* @return std::shared_ptr<T> 返回结果, 如果不能够转换,将抛异常
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> std::shared_ptr<T> as() {
|
||||
if(!is<T>())
|
||||
throw "unsupported operation, object's type is not require type";
|
||||
|
||||
return std::static_pointer_cast<T>(std::const_pointer_cast<StreamProfile>(shared_from_this()));
|
||||
}
|
||||
|
||||
friend class Sensor;
|
||||
friend class Config;
|
||||
friend class Pipeline;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API VideoStreamProfile : public StreamProfile {
|
||||
public:
|
||||
VideoStreamProfile(StreamProfile &profile);
|
||||
~VideoStreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream frame rate
|
||||
*
|
||||
* @return uint32_t returns the frame rate of the stream
|
||||
* \else
|
||||
* @brief 获取流的帧率
|
||||
*
|
||||
* @return uint32_t 返回流的帧率
|
||||
* \endif
|
||||
*/
|
||||
uint32_t fps();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream width
|
||||
*
|
||||
* @return uint32_t returns the width of the stream
|
||||
* \else
|
||||
* @brief 获取流的宽
|
||||
*
|
||||
* @return uint32_t 返回流的宽
|
||||
* \endif
|
||||
*/
|
||||
uint32_t width();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream height
|
||||
*
|
||||
* @return uint32_t returns the high of the stream
|
||||
* \else
|
||||
* @brief 获取流的高
|
||||
*
|
||||
* @return uint32_t 返回流的高
|
||||
* \endif
|
||||
*/
|
||||
uint32_t height();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API AccelStreamProfile : public StreamProfile {
|
||||
public:
|
||||
AccelStreamProfile(StreamProfile &profile);
|
||||
~AccelStreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get full scale range
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the scale range value
|
||||
* \else
|
||||
* @brief 获取满量程范围
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回量程范围值
|
||||
* \endif
|
||||
*/
|
||||
OBAccelFullScaleRange fullScaleRange();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sampling frequency
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the sampling frequency
|
||||
* \else
|
||||
* @brief 获取采样频率
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回采样频率
|
||||
* \endif
|
||||
*/
|
||||
OBAccelSampleRate sampleRate();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API GyroStreamProfile : public StreamProfile {
|
||||
public:
|
||||
GyroStreamProfile(StreamProfile &profile);
|
||||
~GyroStreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get full scale range
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the scale range value
|
||||
* \else
|
||||
* @brief 获取满量程范围
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回量程范围值
|
||||
* \endif
|
||||
*/
|
||||
OBGyroFullScaleRange fullScaleRange();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sampling frequency
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the sampling frequency
|
||||
* \else
|
||||
* @brief 获取采样频率
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回采样频率
|
||||
* \endif
|
||||
*/
|
||||
OBGyroSampleRate sampleRate();
|
||||
};
|
||||
|
||||
template <typename T> bool StreamProfile::is() {
|
||||
switch(this->type()) {
|
||||
case OB_STREAM_VIDEO:
|
||||
case OB_STREAM_IR:
|
||||
case OB_STREAM_COLOR:
|
||||
case OB_STREAM_DEPTH:
|
||||
return typeid(T) == typeid(VideoStreamProfile);
|
||||
case OB_STREAM_ACCEL:
|
||||
return typeid(T) == typeid(AccelStreamProfile);
|
||||
case OB_STREAM_GYRO:
|
||||
return typeid(T) == typeid(GyroStreamProfile);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class OB_EXTENSION_API StreamProfileList {
|
||||
protected:
|
||||
std::unique_ptr<StreamProfileListImpl> impl_;
|
||||
|
||||
public:
|
||||
StreamProfileList(std::unique_ptr<StreamProfileListImpl> impl);
|
||||
~StreamProfileList() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream profile count
|
||||
*
|
||||
* @return uint32_t returns the number of StreamProfile
|
||||
* \else
|
||||
* @brief 获取StreamProfile数量
|
||||
*
|
||||
* @return uint32_t 返回StreamProfile的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t count();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get StreamProfile by index number
|
||||
*
|
||||
* @param index Device index to be created,the range is [0, count-1],if the index exceeds the range, an exception will be thrown
|
||||
* @return std::shared_ptr<StreamProfile> returns StreamProfile object
|
||||
* \else
|
||||
* @brief 通过索引号获取StreamProfile
|
||||
*
|
||||
* @param index 要创建设备的索,范围 [0, count-1],如果index超出范围将抛异常
|
||||
* @return std::shared_ptr<StreamProfile> 返回StreamProfile对象
|
||||
* \endif
|
||||
*/
|
||||
const std::shared_ptr<StreamProfile> getProfile(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Match the corresponding streamprofile through the passed in parameters. If there are multiple matches, the first one in the list will be returned by default.
|
||||
*
|
||||
* @param width Width. If no matching condition is required, it can be passed to 0
|
||||
* @param height Height. If no matching condition is required, it can be passed to 0
|
||||
* @param format Type. If no matching condition is required, it can be passed to OB_FORMAT_UNKNOWN
|
||||
* @param fps Frame rate. If no matching condition is required, it can be passed to 0
|
||||
* @return std::shared_ptr<StreamProfile> Returns the matching resolution
|
||||
* \else
|
||||
* @brief 通过传入的参数进行匹配对应的StreamProfile,若有多个匹配项默认返回列表中的第一个
|
||||
*
|
||||
* @param width 宽度,如不要求加入匹配条件,可传0
|
||||
* @param height 高度,如不要求加入匹配条件,可传0
|
||||
* @param format 类型,如不要求加入匹配条件,可传OB_FORMAT_UNKNOWN
|
||||
* @param fps 帧率,如不要求加入匹配条件,可传0
|
||||
* @return std::shared_ptr<StreamProfile> 返回匹配的分辨率
|
||||
* \endif
|
||||
*/
|
||||
const std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(int width = 0, int height = 0, OBFormat format = OB_FORMAT_UNKNOWN, int fps = 0);
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* \if English
|
||||
* \file Types.hpp
|
||||
* \brief Provide SDK structure and enumeration constant definition (depending on libobsensor/h/ObTypes.h)
|
||||
* \else
|
||||
* \file Types.hpp
|
||||
* \brief 提供SDK的结构体、枚举常量定义(依赖libobsensor/h/ObTypes.h)
|
||||
*
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "libobsensor/h/ObTypes.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief file transfer callbacks
|
||||
*
|
||||
* @param state file transfer status
|
||||
* @param message status information
|
||||
* \else
|
||||
* @brief 文件传输回调
|
||||
*
|
||||
* @param state 文件传输状态
|
||||
* @param message 状态信息
|
||||
* \endif
|
||||
*/
|
||||
using SendFileCallback = std::function<void(OBFileTranState state, const char *message, uint8_t percent)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief device upgrade callback
|
||||
*
|
||||
* @param state upgrade status
|
||||
* @param message status information
|
||||
* \else
|
||||
* @brief 设备升级回调
|
||||
*
|
||||
* @param state 升级状态
|
||||
* @param message 状态信息
|
||||
* \endif
|
||||
*/
|
||||
using DeviceUpgradeCallback = std::function<void(OBUpgradeState state, const char *message, uint8_t percent)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief device status callback
|
||||
*
|
||||
* @param state device status
|
||||
* @param message status information
|
||||
* \else
|
||||
* @brief 设备状态回调
|
||||
*
|
||||
* @param state 设备状态
|
||||
* @param message 状态信息
|
||||
* \endif
|
||||
*/
|
||||
using DeviceStateChangedCallback = std::function<void(OBDeviceState state, const char *message)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief get raw data property data when data and progress callbacks
|
||||
*
|
||||
* @param dataChunk data chunk
|
||||
* @param state get the data status
|
||||
* \else
|
||||
* @brief 获取raw data属性数据时数据及进度回调
|
||||
*
|
||||
* @param dataChunk 数据块
|
||||
* @param state 获取数据状态
|
||||
* \endif
|
||||
*/
|
||||
using GetDataCallback = std::function<void(OBDataTranState state, OBDataChunk *dataChunk)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief set the raw data property when the progress callback is made
|
||||
*
|
||||
* @param percent progress percentage
|
||||
* @param state set the data status
|
||||
* \else
|
||||
* @brief 设置raw data属性数据时进度回调
|
||||
*
|
||||
* @param percent 进度百分比
|
||||
* @param state 设置数据状态
|
||||
* \endif
|
||||
*/
|
||||
using SetDataCallback = std::function<void(OBDataTranState state, uint8_t percent)>;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Version.hpp
|
||||
* @brief Get the SDK version information
|
||||
* \else
|
||||
* @file Version.hpp
|
||||
* @brief 获取SDK版本号相关信息的类
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace ob {
|
||||
class OB_EXTENSION_API Version {
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK major version number
|
||||
*
|
||||
* @return int returns the SDK major version number
|
||||
* \else
|
||||
* @brief 获取SDK主版本号
|
||||
*
|
||||
* @return int 返回SDK主版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getMajor();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK minor version number
|
||||
*
|
||||
* @return int returns the SDK minor version number
|
||||
* \else
|
||||
* @brief 获取SDK副版本号
|
||||
*
|
||||
* @return int 返回SDK副版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getMinor();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK revision number
|
||||
*
|
||||
* @return int returns the SDK revision number
|
||||
* \else
|
||||
* @brief 获取SDK修订版本号
|
||||
*
|
||||
* @return int 返回SDK修订版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getPatch();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK version number
|
||||
*
|
||||
* @return int returns the SDK version number
|
||||
* \else
|
||||
* @brief 获取SDK版本号
|
||||
*
|
||||
* @return int 返回SDK版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getVersion();
|
||||
};
|
||||
} // namespace ob
|
||||
Reference in New Issue
Block a user