Hi @Theo,
I will reply in two steps. In this post I describe the prefered way (GenApi). Use this if the camera supports it.
As per your example I assume you got the Cust::EventLine5PulseStartTimestamp
node via the camera’s device node map (NMHGetNodeMap
and then NMGetNode
). First we need the call back function that is called every time the node changes (in this case when a new GEV Event arrived):
void __stdcall Line5PulseStart(NODE Node, void *pPrivate);
Then you can call this code to register this callback :
NODE hLine5PulseStartTimestamp = /* get Cust::EventLine5PulseStartTimestamp node handle as described */;
NODECALLBACK unregisterToken = NULL;
cvbres_t result = NRegisterUpdate(hLine5PulseStartTimestamp, &Line5PulseStart, NULL, unregisterToken);
if(result < 0)
; // error handling
Instead of the NULL
in the register function, you can also give it a pointer to something that brings you back to your context (e.g. a class’ this
pointer).
Important Note
The hLine5PulseStartTimestamp
NODE
object stores the Line5PulseStart
callback function. If you release the hLine5PulseStartTimestamp
via ReleaseObject
, the also the callback is gone. Thus keep the hLine5PulseStartTimestamp
object alive as long as you need the callback.
Why is this preferred?
The GenICam Standard Features Naming Convention only standardizes the names, not the numeric values. Thus the vendors are free to change the numeric event IDs as they see fit. This normaly only happens between vendors or device series, but we have also see them change due to firmware updates. Names are safer because of the standard.