What are you looking for?

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 to find out the ID of the Coaxlink card. Notice the InterfaceModule suffix in getStringInterfaceModule. This indicates that we want an answer from the interface module.
  4. Similarly, find out the ID of the device. This time, we use getStringDeviceModule to target the device module.
  5. Finally, read the camera resolution. This time, we use getIntegerRemoteModule 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.

Example of program output:

Interface:    PC1633 - Coaxlink Quad G3 (2-camera) - KQG00014
Device:       Device0
Resolution:   4096x4096