mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-09 14:27:02 +08:00
update to v2.0.7
This commit is contained in:
@@ -632,7 +632,7 @@ OB_EXPORT void ob_delete_camera_param_list(ob_camera_param_list *param_list, ob_
|
||||
#define ob_device_info_uid ob_device_info_get_uid
|
||||
#define ob_device_info_serial_number ob_device_info_get_serial_number
|
||||
#define ob_device_info_firmware_version ob_device_info_get_firmware_version
|
||||
#define ob_device_info_connection_type ob_device_list_get_device_connection_type
|
||||
#define ob_device_info_connection_type ob_device_info_get_connection_type
|
||||
#define ob_device_info_ip_address ob_device_info_get_ip_address
|
||||
#define ob_device_info_hardware_version ob_device_info_get_hardware_version
|
||||
#define ob_device_info_supported_min_sdk_version ob_device_info_get_supported_min_sdk_version
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
* @brief Creates a network device with the specified IP address and port.
|
||||
*
|
||||
* @param[in] address The IP address, ipv4 only. such as "192.168.1.10"
|
||||
* @param[in] port The port number.
|
||||
* @param[in] port The port number, currently only support 8090
|
||||
* @return std::shared_ptr<Device> The created device object.
|
||||
*/
|
||||
std::shared_ptr<Device> createNetDevice(const char *address, uint16_t port) const {
|
||||
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_frame_get_stream_profile(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfile>(profile);
|
||||
return StreamProfileFactory::create(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "libobsensor/h/StreamProfile.h"
|
||||
#include "libobsensor/h/Error.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
@@ -19,9 +20,7 @@ protected:
|
||||
const ob_stream_profile_t *impl_ = nullptr;
|
||||
|
||||
public:
|
||||
explicit StreamProfile(const ob_stream_profile_t *impl) : impl_(impl) {}
|
||||
|
||||
StreamProfile(StreamProfile &streamProfile) = delete;
|
||||
StreamProfile(StreamProfile &streamProfile) = delete;
|
||||
StreamProfile &operator=(StreamProfile &streamProfile) = delete;
|
||||
|
||||
StreamProfile(StreamProfile &&streamProfile) noexcept : impl_(streamProfile.impl_) {
|
||||
@@ -106,7 +105,7 @@ public:
|
||||
throw std::runtime_error("Unsupported operation. Object's type is not the required type.");
|
||||
}
|
||||
|
||||
return std::static_pointer_cast<T>(shared_from_this());
|
||||
return std::dynamic_pointer_cast<T>(shared_from_this());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +122,6 @@ public:
|
||||
return std::static_pointer_cast<const T>(shared_from_this());
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBFormat format() const {
|
||||
return getFormat();
|
||||
@@ -132,6 +130,9 @@ public:
|
||||
OBStreamType type() const {
|
||||
return getType();
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit StreamProfile(const ob_stream_profile_t *impl) : impl_(impl) {}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -351,6 +352,33 @@ template <typename T> bool StreamProfile::is() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
class StreamProfileFactory {
|
||||
public:
|
||||
static std::shared_ptr<StreamProfile> create(const ob_stream_profile_t *impl) {
|
||||
ob_error *error = nullptr;
|
||||
const auto type = ob_stream_profile_get_type(impl, &error);
|
||||
Error::handle(&error);
|
||||
switch(type) {
|
||||
case OB_STREAM_IR:
|
||||
case OB_STREAM_IR_LEFT:
|
||||
case OB_STREAM_IR_RIGHT:
|
||||
case OB_STREAM_DEPTH:
|
||||
case OB_STREAM_COLOR:
|
||||
case OB_STREAM_VIDEO:
|
||||
return std::make_shared<VideoStreamProfile>(impl);
|
||||
case OB_STREAM_ACCEL:
|
||||
return std::make_shared<AccelStreamProfile>(impl);
|
||||
case OB_STREAM_GYRO:
|
||||
return std::make_shared<GyroStreamProfile>(impl);
|
||||
default: {
|
||||
ob_error *err = ob_create_error(OB_STATUS_ERROR, "Unsupported stream type.", "StreamProfileFactory::create", "", OB_EXCEPTION_TYPE_INVALID_VALUE);
|
||||
Error::handle(&err);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class StreamProfileList {
|
||||
protected:
|
||||
const ob_stream_profile_list_t *impl_;
|
||||
@@ -385,7 +413,7 @@ public:
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_profile(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfile>(profile);
|
||||
return StreamProfileFactory::create(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -403,7 +431,8 @@ public:
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_video_stream_profile(impl_, width, height, format, fps, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<VideoStreamProfile>(profile);
|
||||
auto vsp = StreamProfileFactory::create(profile);
|
||||
return vsp->as<VideoStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,7 +446,8 @@ public:
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_accel_stream_profile(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<AccelStreamProfile>(profile);
|
||||
auto asp = StreamProfileFactory::create(profile);
|
||||
return asp->as<AccelStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,7 +461,8 @@ public:
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_gyro_stream_profile(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<GyroStreamProfile>(profile);
|
||||
auto gsp = StreamProfileFactory::create(profile);
|
||||
return gsp->as<GyroStreamProfile>();
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -442,4 +473,3 @@ public:
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user