Coaxlink Programmer's Guide Euresys::EGrabber
}
}
var grabber = grabbers[0];
enableAllEvents(grabber.InterfacePort); // 4
enableAllEvents(grabber.DevicePort); // 5
enableAllEvents(grabber.StreamPort); // 6
1. Define a helper function named enableAllEvents and taking as argument a module (or port) p.
2. Use the $ee function to retrieve the list of values EventSelector can take. This is the list of events generated
by module p. (ee stands for enum entry.)
3. For each event, enable notifications. (The + operator concatenates strings, so if e is 'LIN1', the expression
'EventNotification[' + e + ']' evaluates to 'EventNotification[LIN1]'.)
4. Call the enableAllEvents function defined in step 1 for the interface module. This will enable notifications for
all events in the I/O toolbox and CoaXPress interface categories.
5. Likewise, enable notifications for all events coming from the device module (CIC events).
6. Finally, enable notifications for all data stream events.
Callback functions
When an event occurs, and event notification is enabled for that event, Euresys::EGrabber executes one of
several callback functions.
These callback functions are defined in overridden virtual methods:
class MyGrabber : public Euresys::EGrabber<>
{
public:
...
private:
// callback function for new buffer events
virtual void onNewBufferEvent(const NewBufferData& data) {
...
}
// callback function for data stream events
virtual void onDataStreamEvent(const DataStreamData &data) {
...
}
// callback function for CIC events
virtual void onCicEvent(const CicData &data) {
...
}
// callback function for I/O toolbox events
virtual void onIoToolboxEvent(const IoToolboxData &data) {
...
}
// callback function for CoaXPress interface events
virtual void onCxpInterfaceEvent(const CxpInterfaceData &data) {
...
}
};
As you can see, a different callback function can be defined for each category of events.
In .NET, callback functions are defined by creating delegates rather than overriding virtual methods. An example will
be given in the chapter about the .NET assembly.
18