Impact Acquire SDK .NET
RequestReadyEventArgs Class Reference

A class containing data generated by a request ready event fired by instances of the class mv.impact.acquire.helper.RequestProvider. More...

Inheritance diagram for RequestReadyEventArgs:
[legend]

Properties

RequestReadyEventData data [get]
 Locks the data associated with this event so that the data can be accessed safely while holding the lock and returns a new instance of a lock object.
 

Detailed Description

A class containing data generated by a request ready event fired by instances of the class mv.impact.acquire.helper.RequestProvider.

To get notified by this type of events an application must register to the mv.impact.acquire.helper.RequestProvider.onRequestReady event. This can e.g. be done like this:

public class MyRequestListener
{
{
using (RequestReadyEventData data = e.data)
{
// consume the event data here
}
}
}
class Program
{
static void Main(string[] args)
{
mv.impact.acquire.LibraryPath.init(); // this will add the folders containing unmanaged libraries to the PATH variable.
RequestProvider rp = new RequestProvider(ExampleHelper.getDeviceFromUserInput());
MyRequestListener listener = new MyRequestListener();
rp.onRequestReady += listener.requestReady;
rp.acquisitionStart();
// now MyRequestListener.requestReady will be called for each request becoming ready
Console.WriteLine("Press [ENTER] to end the application");
Console.ReadLine();
rp.acquisitionStop();
}
}
A template class to represent 32 bit integer properties and 32 bit enumerated integer properties.
Definition EnumPropertyI.cs:61
A small helper class to administer various library search path related variables and paths.
Definition LibraryPath.cs:14
static void init()
Calling this method will add the folders containing unmanaged libraries to the systems library search...
Definition LibraryPath.cs:251
A class containing data generated by a request ready event fired by instances of the class mv....
Definition RequestReadyEventArgs.cs:45
A class containing data stored inside a mv.impact.acquire.helper.RequestReadyEventArgs event fired by...
Definition RequestReadyEventData.cs:18
This namespace contains classes and functions belonging to the image acquisition module of this SDK.
Definition Enumerations.cs:2
Definition Enumerations.cs:2
Definition Enumerations.cs:2
Attention
An application must NOT call mv.impact.acquire.Request.unlock manually when working with mv.impact.acquire.Request instances reported through this event!
Examples
ContinuousCaptureSimple.cs.

Property Documentation

◆ data

Locks the data associated with this event so that the data can be accessed safely while holding the lock and returns a new instance of a lock object.

This function will return a new instance of mv.impact.acquire.helper.RequestReadyEventData which will provide access to the data stored within this event. While holding at least one lock, the mv.impact.acquire.Request instance stored in the data of this event will not be unlocked to be used by the driver again. Each call to mv.impact.acquire.helper.RequestReadyEventArgs.data therefore requires a subsequent call to the mv.impact.acquire.helper.RequestReadyEventData.Dispose when the mv.impact.acquire.Request is no longer needed.

Note
mv.impact.acquire.helper.RequestReadyEventData does implement the System.IDisposable interface to return obtained locks automatically, so writing code like this
using (RequestReadyEventData data = e.data)
{
Console.WriteLine("Request {0} has been reported with status '{1}'.", data.request.number, data.request.requestResult.readS());
}
String readS()
Reads data from this property as a string.
Definition Property.cs:303
readonly EnumPropertyI< TRequestResult > requestResult
An enumerated integer property (read-only) defining the result of this request.
Definition Request.cs:1211
int number
Returns the number associated with this request.
Definition Request.cs:1194
Request request
A reference to the mv.impact.acquire.Request object that just became ready.
Definition RequestReadyEventData.cs:88
is essentially the same as
try
{
Console.WriteLine("Request {0} has been reported with status '{1}'.", data.request.number, data.request.requestResult.readS());
}
finally
{
data.Dispose();
}
void Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resourc...
Definition RequestReadyEventData.cs:69
However the first version can be consider as being better in terms of style.
Attention
An application should NOT rely on the garbage collector when dealing with instances of mv.impact.acquire.helper.RequestReadyEventData as this might led to images being lost because of the garbage collector running a a frequency that results in no more request objects being available. Therefore whenever the garbage collector encounters an instance of mv.impact.acquire.helper.RequestReadyEventData that still holds a lock on the mv.impact.acquire.Request associated with it an exception will be raised.
Returns
A new instance of mv.impact.acquire.helper.RequestReadyEventData
Examples
ContinuousCaptureSimple.cs.