Euresys Coaxlink Series Programmer'S Manual Download Page 15

15

5.1. A first example

This example creates a grabber and displays basic information about the interface, device, and
remote device modules it contains:

#include <iostream>
#include <EGrabber.h>

// 1

static const uint32_t CARD_IX = 0;
static const uint32_t DEVICE_IX = 0;

void showInfo() {

Euresys::EGenTL gentl;

// 2

Euresys::EGrabber<> grabber(gentl, CARD_IX, DEVICE_IX);

// 3

std::string card = grabber.getString<Euresys::InterfaceModule>("InterfaceID");

// 4

std::string dev = grabber.getString<Euresys::DeviceModule>("DeviceID");

// 5

int64_t width = grabber.getInteger<Euresys::RemoteModule>("Width");

// 6

int64_t height = grabber.getInteger<Euresys::RemoteModule>("Height");

// 6

std::cout << "Interface:

" << card << std::endl;

std::cout << "Device:

" << dev

<< std::endl;

std::cout << "Resolution:

" << width << "x" << height << std::endl;

}

int main() {

try { 

// 7

showInfo();

} catch (const std::exception &e) { 

// 7

std::cout << "error: " << e.what() << std::endl;

}

}

1. Include

EGrabber.h

, which defines the

Euresys::EGrabber

class, and includes the other

header files we need (such as

EGenTL.h

and the standard

GenTL header file

).

2. Create a

Euresys::EGenTL

object. This involves the following operations:

n

locate and dynamically load the Coaxlink GenTL producer (

coaxlink.cti

);

n

retrieve pointers to the functions exported by

coaxlink.cti

, and make them available

via

Euresys::EGenTL

methods;

n

initialize

coaxlink.cti

(this is done by calling the GenTL initialization function

GCInitLib

).

3. Create a

Euresys::EGrabber

object. The constructor needs the

gentl

object created in

step 2. It also takes as optional arguments the indices of the interface and device to use.

The purpose of the angle brackets (

<>

) that come after

EGrabber

will become clear later. For

now, they can be safely ignored.

5. Euresys::EGrabber

Coaxlink

Programmer Guide

Summary of Contents for Coaxlink Series

Page 1: ...Coaxlink Coaxlink Driver Version 9 5 2 PROGRAMMER GUIDE EURESYS s a 2018 Document D204EN Programmer Guide Coaxlink 9 5 2 2015 built on 2018 03 28...

Page 2: ...d in this book is not allowed without prior notice EURESYS s a may modify the product specification or change the information given in this documentation at any time at its discretion and without prio...

Page 3: ...ant files 13 5 Euresys EGrabber 14 5 1 A first example 15 5 2 Acquiring images 16 5 3 Configuring the grabber 18 5 4 Events 20 Background 20 Counters 21 Notifications 21 Callback functions 22 Event id...

Page 4: ...oc builtins js 37 6 3 doc grabbers js 38 6 4 doc module1 js 40 7 EGrabber for MultiCam users 42 8 NET assembly 49 8 1 A first example 49 8 2 Differences between C and NET EGrabber 50 8 3 Single thread...

Page 5: ...f cameras and frame grabbers in a uniform and consistent way n GenTL is about data transport The TL suffix stands for Transport Layer The GenTL standard defines a set of C functions and data types for...

Page 6: ...nApi implementation is a software module that can read and interpret register description files The EMVA provides a reference implementation but it is fairly difficult to use and logging is very poor...

Page 7: ...don t have any associated value they have side effects Command features are meant to be executed When a command is executed some action happens in the camera e g a software trigger is generated Obvio...

Page 8: ...he system defines relevant pieces of information info commands that can be queried using get info functions allows exercising that module s functionality using specific functions Additionally all modu...

Page 9: ...eatures such as digital I O lines belong in the interface module This means that the GenApi features controlling the I O lines are attached to the interface Each interface also acts as parent to one o...

Page 10: ...re retrieved through info commands see BUFFER_INFO_CMD_LIST in the standard GenTL header file The buffer module is the only module that doesn t have read write port functions it doesn t have GenApi fe...

Page 11: ...he gcReadPort method and the TLOpenInterface function as the tlOpenInterface method n All GenTL functions return a GC_ERROR code indicating success or failure When a function returns a code other than...

Page 12: ...display their id include iostream include EGrabber h 1 static const uint32_t CARD_IX 0 static const uint32_t DEVICE_IX 0 void showInfo Euresys EGenTL gentl 2 Euresys EGrabber grabber gentl CARD_IX DE...

Page 13: ...ace is defined in the standard GenTL header file which has been automatically included by EGenTL h in step 1 4 Find out how many cards are present in the system 5 Retrieve the id of the n th card 6 Eu...

Page 14: ...the most important of which is also named Euresys EGrabber namespace Euresys class EGrabber In this text we ll refer to this class as a grabber A grabber encapsulates a set of related GenTL modules n...

Page 15: ...ry 7 showInfo catch const std exception e 7 std cout error e what std endl 1 Include EGrabber h which defines the Euresys EGrabber class and includes the other header files we need such as EGenTL h an...

Page 16: ...EGrabber to acquire images from a camera connected to a Coaxlink card include iostream include EGrabber h void grab Euresys EGenTL gentl Euresys EGrabber grabber gentl 1 grabber reallocBuffers 3 2 gra...

Page 17: ...amp the buffer was acquired other BUFFER_INFO definitions omitted BUFFER_INFO_CUSTOM_ID 1000 Starting value for GenTL Producer custom IDs typedef int32_t BUFFER_INFO_CMD Notice that getInfo is a templ...

Page 18: ...grabber both have to be configured according to the application requirements n The camera configuration must be compatible with the frame grabber configuration and vice versa Configuration basically...

Page 19: ...grabber gentl grabber runScript config js int main try configure catch const std exception e std cout error e what std endl and the configuration script is var grabber grabbers 0 var FPS 150 camera c...

Page 20: ...ols n CoaXPress interface events events also coming from the interface related to the CoaXPress interface New buffer events are standard in GenTL They occur when a buffer is filled by the frame grabbe...

Page 21: ...lector CameraTriggerRisingEdge grabber setInteger DeviceModule EventNotification true grabber setString DeviceModule EventSelector CameraTriggerFallingEdge grabber setInteger DeviceModule EventNotific...

Page 22: ...public private callback function for new buffer events virtual void onNewBufferEvent const NewBufferData data callback function for data stream events virtual void onDataStreamEvent const DataStreamDa...

Page 23: ..._NUMID_CIC_STROBE_FALLING_EDGE End of light strobe EVENT_CUSTOM_DATASTREAM EVENT_DATA_NUMID_DATASTREAM_START_OF_CAMERA_READOUT Start of camera readout EVENT_DATA_NUMID_DATASTREAM_END_OF_CAMERA_READOUT...

Page 24: ...that the context in which callback functions are executed This is the subject of the next section 5 5 EGrabber flavors When should the callback functions be called From which context i e which thread...

Page 25: ...so the need for synchronization is present as it is in the single thread model Of course the application must also be aware that it might receive notifications for events of type X that are older than...

Page 26: ...data numid 6 getEventDescription data numid std endl int main try EGenTL gentl MyGrabber grabber gentl while true grabber processEvent CicData 1000 7 catch const std exception e std cout error e what...

Page 27: ...8043 Start of light strobe timestamp 1502092879 us numid 0x8044 End of light strobe timestamp 1502097279 us numid 0x8042 End of camera trigger timestamp 1502097284 us numid 0x8048 Received acknowledge...

Page 28: ...rabber grabber gentl while true 3 catch const std exception e std cout error e what std endl There are very few differences between this program and the CallbackOnDemand version 1 MyGrabber is derived...

Page 29: ...td endl 1 In onNewBufferEvent create a temporary ScopedBuffer object buf The ScopedBuffer constructor takes two arguments n the grabber owning the buffer since we are in a class derived from EGrabber...

Page 30: ...uffer timestamp 77186019809 us event timestamp 77186051614 us buffer timestamp 77186039810 us event timestamp 77186071611 us buffer timestamp 77186059811 us event timestamp 77186091602 us buffer times...

Page 31: ...to coaxlink scripts dir doc basics js or more simply gentl script coaxlink doc basics js Euresys GenApi Script is case sensitive Statements are always separated by semicolons JavaScript is more permis...

Page 32: ...ction Arrays Construction var empty var x 3 14159 2 71828 var mix 1 false abc Access to array elements var sum x 0 x 1 bracket notation Adding elements x 2 1 61803 x 3 14159 2 71828 1 61803 x 4 1 4142...

Page 33: ...lity assertEqual true 1 2 2 assertEqual true 1 2 Equality and inequality JavaScript operators lead to confusing and inconsistent conversions of their operands They are not implemented in Euresys GenAp...

Page 34: ...rtEqual inner x x function Nested assertEqual outer x x var y not accessible outside Nested x changed in Nested function NoBlockScope var x 1 assertEqual 1 x if true The scope of variables is the func...

Page 35: ...of xs sum x assertEqual 1111 sum var obj one 1 two 2 var sum 0 for var x of obj sum x assertEqual 3 sum var str Coaxlink var sum for var c of str sum c assertEqual Coaxlink sum function ContinueAndBre...

Page 36: ...exit before the end of the try block finallyDone true f fail assertEqual 1 x assertEqual fail caught assert finallyDone f return assertEqual 1 x assert caught assert finallyDone f assertEqual 2 x ass...

Page 37: ...ber 0x16 Number 0x16 22 console log Number 1e 9 Number 1e 9 1e 9 console log String false String false false console log String true String true true console log String 3 14 String 3 14 3 14 console l...

Page 38: ...scribes the grabbers object of Euresys GenApi Script It can be executed by running gentl script coaxlink doc grabbers js The builtin object grabbers is a list of objects giving access to the available...

Page 39: ...ated by pIsAvailable GenICam node elements if grabbers length var port grabbers 0 InterfacePort console log Playing with port tag get f console log InterfaceID port get InterfaceID set f v port set Li...

Page 40: ...ort if port console log Playing with port tag var brStandard 0x00000000 var brRevision 0x00000004 var standard port brRead brStandard var revision port brRead brRevision if 0xc0a79ae5 standard console...

Page 41: ...log Hello from module filename console log module exports contains for var e in module exports console log e typeof module exports e console log Completed execution of module filename 6 Euresys GenAp...

Page 42: ...ommands CAM file Euresys GenApi script CallbackOnDemand Callback functions CallbackSingleThread CallbackMultiThread Initialization MultiCam MCSTATUS status McOpenDriver NULL if status MC_OK EGrabber E...

Page 43: ...tus void mem malloc BUFFER_SIZE if mem status McCreate MC_DEFAULT_SURFACE_HANDLE surface if status MC_OK status McSetParamInt surface MC_SurfaceSize BUFFER_SIZE if status MC_OK status McSetParamPtr su...

Page 44: ...nScript script McSetParamInt H id value or McSetParamNmInt H name value grabber setInteger M name value McSetParamFloat H id value or McSetParamNmFloat H name value grabber setFloat M name value McSet...

Page 45: ...e MC_ChannelState_ACTIVE stop McSetParamInt channel MC_ChannelState MC_ChannelState_IDLE grab 10 images McSetParamInt channel MC_GrabCount 10 McSetParamInt channel MC_ChannelState MC_ChannelState_ACTI...

Page 46: ...status McSetParamInt channel MC_SignalEnable MC_SIG_SURFACE_ PROCESSING MC_SignalEnable_ON if status MC_OK enable END_EXPOSURE events status McSetParamInt channel MC_SignalEnable MC_SIG_END_EXPOSURE M...

Page 47: ...al void onNewBufferEvent const NewBufferData data ScopedBuffer buffer this data process buffer virtual void onCicEvent const CicData data handle Cic event Synchronous blocking event handling MultiCam...

Page 48: ...ntl configure grabber enable Cic events enableEvent CicData void waitForEvent uint64_t timeout wait for an event processEvent CicData timeout private onCicEvent is called by processEvent when a Cic ev...

Page 49: ...sys EGenTL gentl new Euresys EGenTL 1 using Euresys EGrabberCallbackOnDemand grabber new Euresys EGrabberCallbackOnDemand gentl CARD_IX DEVICE_ IX 2 String card grabber getStringInterfaceModule Interf...

Page 50: ...he 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...

Page 51: ...ent delegate grabber onDataStreamEvent delegate grabber onCicEvent delegate grabber onIoToolboxEvent delegate grabber onCxpInterfaceEvent delegate A complete example is given in the next section 8 3 S...

Page 52: ...of the callback function simply display basic information about the event 4 This ends the definition of the onCicEvent callback function 5 Enable onCicEvent callbacks 6 Start the grabber and enter an...

Page 53: ...on SFNC Standard Features Naming Convention Glossary Buffer module GenTL module that represents a memory buffer Buffers must be announced to the data stream that will fill them with image data Callbac...

Page 54: ...le that contains the frame grabber settings relating to the camera Parent of the data stream module Sibling of the remote device GenApi The GenICam standard that deals with camera and frame grabber co...

Page 55: ...implements tools such as rate converters delay lines etc Hosted in the interface module Register description XML file mapping low level hardware registers to camera or frame grabber features Remote d...

Reviews: