[orx-realsense2] Add timeOut parameter to Sensor.waitForFrames

This commit is contained in:
Edwin Jakobs
2024-09-23 13:03:46 +02:00
parent 3f734e6f8d
commit fb3bb6f7a6

View File

@@ -142,7 +142,7 @@ abstract class Sensor {
/** /**
* wait for frames to arrives * wait for frames to arrives
*/ */
abstract fun waitForFrames() abstract fun waitForFrames(timeOut: Int = 15000)
/** /**
* destroy the sensor * destroy the sensor
@@ -153,7 +153,7 @@ abstract class Sensor {
class DummySensor : Sensor() { class DummySensor : Sensor() {
override val serial: String = "DummySensor-${System.identityHashCode(this)}" override val serial: String = "DummySensor-${System.identityHashCode(this)}"
override fun waitForFrames() { override fun waitForFrames(timeOut: Int) {
} }
override fun destroy() { override fun destroy() {
@@ -179,9 +179,9 @@ class RS2Sensor(
serial serial
} }
override fun waitForFrames() { override fun waitForFrames(timeOut: Int) {
val error = rs2_error() val error = rs2_error()
val frames = rs2_pipeline_wait_for_frames(pipeline, RS2_DEFAULT_TIMEOUT, error) val frames = rs2_pipeline_wait_for_frames(pipeline, timeOut, error)
error.check() error.check()
val frameCount = rs2_embedded_frames_count(frames, error) val frameCount = rs2_embedded_frames_count(frames, error)