mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 20:17:47 +08:00
update OrbbecSDK version to 2.8.1
This commit is contained in:
@@ -26,7 +26,7 @@ private:
|
||||
*/
|
||||
explicit Error(ob_error *error) : impl_(error) {};
|
||||
|
||||
Error& operator=(const Error&) = default;
|
||||
Error &operator=(const Error &) = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -106,6 +106,15 @@ public:
|
||||
return impl_->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the error status code of the exception.
|
||||
*
|
||||
* @return OBStatus The error status code.
|
||||
*/
|
||||
OBStatus getStatus() const noexcept {
|
||||
return impl_->status;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
const char *getName() const noexcept {
|
||||
@@ -113,4 +122,3 @@ public:
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
|
||||
@@ -289,8 +289,9 @@ public:
|
||||
typedef std::function<void(std::shared_ptr<FrameSet> frame)> FrameSetCallback;
|
||||
|
||||
private:
|
||||
ob_pipeline_t *impl_;
|
||||
FrameSetCallback callback_;
|
||||
ob_pipeline_t *impl_;
|
||||
FrameSetCallback callback_;
|
||||
std::function<void(OBPipelineStatus status)> statusCallback_;
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -354,6 +355,13 @@ public:
|
||||
pipeline->callback_(std::make_shared<FrameSet>(frameSet));
|
||||
}
|
||||
|
||||
static void healthMonitorCallback(ob_pipeline_status status, void *userData) {
|
||||
auto pipeline = static_cast<Pipeline *>(userData);
|
||||
if(pipeline->statusCallback_) {
|
||||
pipeline->statusCallback_(status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop the pipeline
|
||||
*/
|
||||
@@ -454,6 +462,40 @@ public:
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current pipeline status observed during streaming.
|
||||
*
|
||||
* @return OBPipelineStatus The accumulated status since the last call or pipeline start. Status is reset after each call.
|
||||
*/
|
||||
OBPipelineStatus getStatus() const {
|
||||
ob_error *error = nullptr;
|
||||
OBPipelineStatus status = ob_pipeline_get_status(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable pipeline health monitor with periodic status polling.
|
||||
*
|
||||
* @param[in] callback The callback function invoked when abnormal status is detected (from internal thread, avoid blocking).
|
||||
* @param[in] intervalMs Polling interval in milliseconds (recommended: 3000-5000, default: 3000).
|
||||
*/
|
||||
void enableHealthMonitor(std::function<void(OBPipelineStatus status)> callback, uint32_t intervalMs = 3000) {
|
||||
statusCallback_ = callback;
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_enable_health_monitor(impl_, &Pipeline::healthMonitorCallback, this, intervalMs, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable pipeline health monitor.
|
||||
*/
|
||||
void disableHealthMonitor() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_disable_health_monitor(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user