What are you looking for?

Notifications

As we've just seen, when an event occurs, a dedicated counter is incremented. Coaxlink can also notify the application of this event by having Euresys::EGrabber execute a user-defined callback function. But first, it is required to enable notifications of one or more events:

grabber.setString<DeviceModule>("EventSelector", "CameraTriggerRisingEdge");
grabber.setInteger<DeviceModule>("EventNotification", true);
grabber.setString<DeviceModule>("EventSelector", "CameraTriggerFallingEdge");
grabber.setInteger<DeviceModule>("EventNotification", true);
...

or:

grabber.setInteger<DeviceModule>("EventNotification[CameraTriggerRisingEdge]", true);
grabber.setInteger<DeviceModule>("EventNotification[CameraTriggerFallingEdge]", true);
...

Using a configuration script, it is easy to enable notifications for all events:

function enableAllEvents(p) {                           // 1
    var events = p.$ee('EventSelector');                // 2
    for (var e of events) {
        p.set('EventNotification[' + e + ']', true);    // 3
    }
}

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.