CVB.Net 14.0
AcquisitionExtensions Class Reference

Async wrapper methods for IAcquisition objects. More...

Static Public Member Functions

static Task< StreamImageGetSnapshotAsync (this IAcquisition acq)
 Acquires a single image and returns it. More...
 
static Task< StreamImageGetTimedSnapshotAsync (this IAcquisition acq, UsTimeSpan timeSpan)
 Acquires a single image and returns it. More...
 
static Task< StreamImageWaitAsync (this IAcquisition acq)
 Waits infinitely for the next acquired image and returns it. More...
 
static Task< MultiPartImageWaitAsync (this ImageStream stream)
 Waits infinitely for the next acquired image and returns it. More...
 
static Task< MultiPartImageWaitAsync (this ImageStream stream, CancellationToken cancellationToken)
 Waits for the next acquired image and returns it, abortable by the cancellation token. More...
 
static Task< PointCloudWaitAsync (this PointCloudStream stream)
 Waits infinitely for the next acquired point cloud and returns it. More...
 
static Task< PointCloudWaitAsync (this PointCloudStream stream, CancellationToken cancellationToken)
 Waits for the next acquired point cloud and returns it, abortable by the cancellation token. More...
 
static Task< CompositeWaitAsync (this CompositeStream stream)
 Waits infinitely for the next acquired composite and returns it. More...
 
static Task< CompositeWaitAsync (this CompositeStream stream, CancellationToken cancellationToken)
 Waits for the next acquired composite and returns it, abortable by the cancellation token. More...
 
static Task< StreamImageWaitForAsync (this IAcquisition acq, UsTimeSpan timeSpan)
 Waits for the given timeSpan for the next acquired image. More...
 
static Task< MultiPartImageWaitForAsync (this ImageStream stream, UsTimeSpan timeout)
 Waits for the given timeout for the next acquired image. More...
 
static Task< MultiPartImageWaitForAsync (this ImageStream stream, UsTimeSpan timeout, CancellationToken cancellationToken)
 Waits for the given timeout for the next acquired image. More...
 
static Task< PointCloudWaitForAsync (this PointCloudStream stream, UsTimeSpan timeout)
 Waits for the given timeout for the next acquired point cloud. More...
 
static Task< PointCloudWaitForAsync (this PointCloudStream stream, UsTimeSpan timeout, CancellationToken cancellationToken)
 Waits for the given timeout for the next acquired point cloud. More...
 
static Task< CompositeWaitForAsync (this CompositeStream stream, UsTimeSpan timeout)
 Waits for the given timeout for the next acquired composite. More...
 
static Task< CompositeWaitForAsync (this CompositeStream stream, UsTimeSpan timeout, CancellationToken cancellationToken)
 Waits for the given timeout for the next acquired composite. More...
 

Detailed Description

Async wrapper methods for IAcquisition objects.

Member Function Documentation

◆ GetSnapshotAsync()

static Task< StreamImage > GetSnapshotAsync ( this IAcquisition  acq)
static

Acquires a single image and returns it.

The task waits infinitely for the image to be taken.

Attention: it is generally not possible to call this method while the acquisition has been started by IAcquisition.Start.

Dispose the returned Image when not needed anymore!

By default the returned image content is only guaranteed to stay unchanged until the next call to this method; afterwards the returned image is normally disposed. Thus it is normally not save to use this image in a display.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling IAcquisition.GetSnapshot directly.

Parameters
acqStream to work on.
Returns
Task to contain the grabbed image.

◆ GetTimedSnapshotAsync()

static Task< StreamImage > GetTimedSnapshotAsync ( this IAcquisition  acq,
UsTimeSpan  timeSpan 
)
static

Acquires a single image and returns it.

Waits for the given timeSpan for the image to be taken.

Attention: it is generally not possible to call this method while the acquisition has been started by IAcquisition.Start.

Dispose the returned Image when not needed anymore!

By default the returned image content is only guaranteed to stay unchanged until the next call to this method; afterwards the returned image is normally disposed. Thus it is normally not save to use this image in a display.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling IAcquisition.GetTimedSnapshot(UsTimeSpan) directly.

Parameters
acqStream to work on.
timeSpanTime span to wait for (millisecond granularity).
Returns
Task to contain the grabbed image.

◆ WaitAsync() [1/7]

static Task< Composite > WaitAsync ( this CompositeStream  stream)
static

Waits infinitely for the next acquired composite and returns it.

Dispose the returned Composite when not needed anymore!

The returned composite is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected composite buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling CompositeStream.Wait() directly.

Parameters
streamStream to work on.
Returns
Task to contain the grabbed image.

◆ WaitAsync() [2/7]

static Task< Composite > WaitAsync ( this CompositeStream  stream,
CancellationToken  cancellationToken 
)
static

Waits for the next acquired composite and returns it, abortable by the cancellation token.

Dispose the returned Composite when not needed anymore!

The returned composite is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected composite buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling CompositeStream.Wait() directly.

Parameters
streamStream to work on.
cancellationTokenToken to cancel the wait.
Returns
Task to contain the grabbed composite.

◆ WaitAsync() [3/7]

static Task< StreamImage > WaitAsync ( this IAcquisition  acq)
static

Waits infinitely for the next acquired image and returns it.

Dispose the returned Image when not needed anymore!

By default the returned image content is only guaranteed to stay unchanged until the next call to this method; afterwards the returned image is normally disposed. Thus it is normally not save to use this image in a display.

The returned image is not necessary the newest. If more images where acquired since the last call to this method, the content is the oldest not collected image buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling IAcquisition.Wait() directly.

Parameters
acqStream to work on.
Returns
Task to contain the grabbed image.

◆ WaitAsync() [4/7]

static Task< MultiPartImage > WaitAsync ( this ImageStream  stream)
static

Waits infinitely for the next acquired image and returns it.

Dispose the returned MultiPartImage when not needed anymore!

The returned image is not necessary the newest. If more images where acquired since the last call to this method, the content is the oldest not collected image buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling ImageStream.Wait() directly.

Parameters
streamStream to work on.
Returns
Task to contain the grabbed image.

◆ WaitAsync() [5/7]

static Task< MultiPartImage > WaitAsync ( this ImageStream  stream,
CancellationToken  cancellationToken 
)
static

Waits for the next acquired image and returns it, abortable by the cancellation token.

Dispose the returned MultiPartImage when not needed anymore!

The returned image is not necessary the newest. If more images where acquired since the last call to this method, the content is the oldest not collected image buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling ImageStream.Wait() directly.

Parameters
streamStream to work on.
cancellationTokenToken to cancel the wait.
Returns
Task to contain the grabbed image.

◆ WaitAsync() [6/7]

static Task< PointCloud > WaitAsync ( this PointCloudStream  stream)
static

Waits infinitely for the next acquired point cloud and returns it.

Dispose the returned PointCloud when not needed anymore!

The returned point cloud is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected point cloud buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling PointCloudStream.Wait() directly.

Parameters
streamStream to work on.
Returns
Task to contain the grabbed image.

◆ WaitAsync() [7/7]

static Task< PointCloud > WaitAsync ( this PointCloudStream  stream,
CancellationToken  cancellationToken 
)
static

Waits for the next acquired point cloud and returns it, abortable by the cancellation token.

Dispose the returned PointCloud when not needed anymore!

The returned point cloud is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected point cloud buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling PointCloudStream.Wait() directly.

Parameters
streamStream to work on.
cancellationTokenToken to cancel the wait.
Returns
Task to contain the grabbed point cloud.

◆ WaitForAsync() [1/7]

static Task< Composite > WaitForAsync ( this CompositeStream  stream,
UsTimeSpan  timeout 
)
static

Waits for the given timeout for the next acquired composite.

Attention: it is generally not safe to call the wait method from different threads on the same object!

Dispose the returned Composite when not needed anymore!

The returned composite is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected composite buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling CompositeStream.WaitFor(UsTimeSpan) directly.

Parameters
streamStream to work on.
timeoutTime to wait before timeout.
Returns
Task to contain the grabbed image.

◆ WaitForAsync() [2/7]

static Task< Composite > WaitForAsync ( this CompositeStream  stream,
UsTimeSpan  timeout,
CancellationToken  cancellationToken 
)
static

Waits for the given timeout for the next acquired composite.

Attention: it is generally not safe to call the wait method from different threads on the same object!

Dispose the returned Composite when not needed anymore!

The returned composite is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected composite buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling CompositeStream.WaitFor(UsTimeSpan) directly.

Parameters
streamStream to work on.
timeoutTime to wait before timeout.
cancellationTokenToken to cancel the wait.
Returns
Task to contain the grabbed image.

◆ WaitForAsync() [3/7]

static Task< StreamImage > WaitForAsync ( this IAcquisition  acq,
UsTimeSpan  timeSpan 
)
static

Waits for the given timeSpan for the next acquired image.

Attention: it is generally not safe to call the wait method from different threads on the same object!

Dispose the returned Image when not needed anymore!

By default the returned image content is only guaranteed to stay unchanged until the next call to this method; afterwards the returned image is normally disposed. Thus it is normally not save to use this image in a display.

The returned image is not necessary the newest. If more images where acquired since the last call to this method, the content is the oldest not collected image buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling IAcquisition.WaitFor(UsTimeSpan) directly.

Parameters
acqStream to work on.
timeSpanTime span to wait for (millisecond granularity).
Returns
Task to contain the grabbed image.

◆ WaitForAsync() [4/7]

static Task< MultiPartImage > WaitForAsync ( this ImageStream  stream,
UsTimeSpan  timeout 
)
static

Waits for the given timeout for the next acquired image.

Attention: it is generally not safe to call the wait method from different threads on the same object!

Dispose the returned MultiPartImage when not needed anymore!

The returned image is not necessary the newest. If more images where acquired since the last call to this method, the content is the oldest not collected image buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling ImageStream.WaitFor(UsTimeSpan) directly.

Parameters
streamStream to work on.
timeoutTime to wait before timeout.
Returns
Task to contain the grabbed image.

◆ WaitForAsync() [5/7]

static Task< MultiPartImage > WaitForAsync ( this ImageStream  stream,
UsTimeSpan  timeout,
CancellationToken  cancellationToken 
)
static

Waits for the given timeout for the next acquired image.

Attention: it is generally not safe to call the wait method from different threads on the same object!

Dispose the returned MultiPartImage when not needed anymore!

The returned image is not necessary the newest. If more images where acquired since the last call to this method, the content is the oldest not collected image buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling ImageStream.WaitFor(UsTimeSpan) directly.

Parameters
streamStream to work on.
timeoutTime to wait before timeout.
cancellationTokenToken to cancel the wait.
Returns
Task to contain the grabbed image.

◆ WaitForAsync() [6/7]

static Task< PointCloud > WaitForAsync ( this PointCloudStream  stream,
UsTimeSpan  timeout 
)
static

Waits for the given timeout for the next acquired point cloud.

Attention: it is generally not safe to call the wait method from different threads on the same object!

Dispose the returned PointCloud when not needed anymore!

The returned point cloud is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected point cloud buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling PointCloudStream.WaitFor(UsTimeSpan) directly.

Parameters
streamStream to work on.
timeoutTime to wait before timeout.
Returns
Task to contain the grabbed image.

◆ WaitForAsync() [7/7]

static Task< PointCloud > WaitForAsync ( this PointCloudStream  stream,
UsTimeSpan  timeout,
CancellationToken  cancellationToken 
)
static

Waits for the given timeout for the next acquired point cloud.

Attention: it is generally not safe to call the wait method from different threads on the same object!

Dispose the returned PointCloud when not needed anymore!

The returned point cloud is not necessary the newest. If more point clouds where acquired since the last call to this method, the content is the oldest not collected point cloud buffer by default.

This method uses an asynchronous wrapper to make asynchronous handling easier with the CVB acquisition engine. As a side effect using this interface is not as efficient as calling PointCloudStream.WaitFor(UsTimeSpan) directly.

Parameters
streamStream to work on.
timeoutTime to wait before timeout.
cancellationTokenToken to cancel the wait.
Returns
Task to contain the grabbed image.