EasyManua.ls Logo

Euresys Coaxlink - .NET Assembly for EGrabber; First Example and Differences

Euresys Coaxlink
45 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Coaxlink Programmer's Guide.NET assembly
.NET assembly
EGrabber can be used in .NET languages (C#, VB.NET, etc.) via a .NET assembly named Coaxlink_NetApi.dll
A first example
This example creates a grabber and displays basic information about the interface, device, and remote device modules
it contains. This is the C# version of the first C++ EGrabber example:
using System;
namespace FirstExample {
class ShowInfo {
const int CARD_IX = 0;
const int DEVICE_IX = 0;
static void showInfo() {
using (Euresys.EGenTL gentl = new Euresys.EGenTL()) { // 1
using (Euresys.EGrabberCallbackOnDemand grabber =
new Euresys.EGrabberCallbackOnDemand(gentl, CARD_IX, DEVICE_IX)) { // 2
String card = grabber.getStringInterfaceModule("InterfaceID"); // 3
String dev = grabber.getStringDeviceModule("DeviceID"); // 4
long width = grabber.getIntegerRemoteModule("Width"); // 5
long height = grabber.getIntegerRemoteModule("Height"); // 5
System.Console.WriteLine("Interface: {0}", card);
System.Console.WriteLine("Device: {0}", dev);
System.Console.WriteLine("Resolution: {0}x{1}", width, height);
}
}
}
static void Main() {
try { // 6
showInfo();
} catch (System.Exception e) { // 6
System.Console.WriteLine("error: {0}", e.Message);
}
}
}
}
1. Create a Euresys.EGenTL object. This involves the following operations:
locate and dynamically load the Coaxlink GenTL producer (coaxlink.cti);
retrieve pointers to the functions exported by coaxlink.cti;
initialize coaxlink.cti.
2. Create a Euresys.EGrabberCallbackOnDemand object. The constructor needs the gentl object we've just
created. It also takes as optional arguments the indices of the interface and device to use.
3. Use GenApi on page 6 to find out the ID of the Coaxlink card. Notice the InterfaceModule suffix in getString
InterfaceModule . This indicates that we want an answer from the interface module.
4. Similarly, find out the ID of the device. This time, we use getString DeviceModule to target the device
module.
5. Finally, read the camera resolution. This time, we use getInteger RemoteModule because values must be
read from the camera.
6. EGrabber uses exceptions to report errors, so we wrap our code inside a try ... catch block.
40

Related product manuals