Impact Acquire SDK .NET
IRequestFactory Interface Reference

A default request factory. More...

Public Member Functions

Request createRequest (Device device, int requestNr)
 

Detailed Description

A default request factory.

Applications need to derive from this class and must re-implement the function mv.impact.acquire.IRequestFactory.createRequest to work with custom objects derived from mv.impact.acquire.Request.

Deriving from mv.impact.acquire.Request can be useful when a certain device driver or device offers a custom feature that is returned as part of the request object that can not be accessed using the mv.impact.acquire.Request class offered by this interface.

Example

This shows how a request factory could be used to create custom request objects from within a mv.impact.acquire.FunctionInterface instance.

//-----------------------------------------------------------------------------
// Example for a derived request object. It doesn't introduce new functionality
// but rebinds an existing property. Custom properties could bound in a similar
// way.
public class MyRequest : Request
//-----------------------------------------------------------------------------
{
private void init()
{
DeviceComponentLocator locator = getComponentLocator();
locator.bindComponent(myRequestResult, "Result");
}
{
init();
}
public readonly EnumPropertyI<TRequestResult> myRequestResult = new EnumPropertyI<TRequestResult>();
}
public class MyRequestFactory : IRequestFactory
{
public mv.impact.acquire.Request createRequest(Device pDev, int requestNr) { return new MyRequest(pDev, requestNr); }
}
A class to locate components within the driver.
Definition DeviceComponentLocator.cs:74
This class and its functions represent an actual device detected by this interface in the current sys...
Definition Device.cs:91
A template class to represent 32 bit integer properties and 32 bit enumerated integer properties.
Definition EnumPropertyI.cs:61
Contains information about a captured buffer.
Definition Request.cs:77

Now the request factory must be passed to the constructor of the function interface

//-----------------------------------------------------------------------------
public void fn( mv.impact.acquire.Device pDev )
//-----------------------------------------------------------------------------
{
// ... some code ...
// ... more additional code
// assuming we got back a request from the driver at this point:
if( pRequest.isOK )
{
Console.WriteLine( "{0}: {1}", pMyRequest.myRequestResult.name, pMyRequest.myRequestResult.readS() );
}
// ... probably even more additional code
}
String name
Returns the name of the component referenced by this object.
Definition ComponentAccess.cs:167
The function interface to devices supported by this interface.
Definition FunctionInterface.cs:21
String readS()
Reads data from this property as a string.
Definition Property.cs:303
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
Since
1.12.56

Member Function Documentation

◆ createRequest()

Request createRequest ( Device device,
int requestNr )
Parameters
[in]deviceA pointer to a mv.impact.acquire.Device object obtained from a mv.impact.acquire.DeviceManager object.
[in]requestNrThe request number that internally has been assigned to this request by the device driver.