FireSync API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kEventManager Class Reference

Description

Represents event manager configuration.

Event managers provide signals ("events") to trigger other modules such as cameras, lights, and digital outputs. Multiple devices can be driven by a single event manager, providing one approach for inter-module synchronization.

Event managers provide a Control setting to support different methods of generating events (kEventControl). Methods range from continuous/periodic events, to software-scheduled events, to input-triggered events.

Event managers support time and encoder domains (kSyncDomain). A single Domain setting per event manager determines how units are interpreted for other event manager settings (i.e., encoder ticks vs. FireSync time units). If the encoder domain is selected, an additional EncoderMode setting determines how the event mangager responds to the encoder (kEventEncoder).

Event managers provide an event request queue with a minimum depth of 256 elements, enabling multiple event-generation requests to be enqueued for future processing. This enables software-scheduled and input-triggered events to be generated far ahead of time, with multiple requests enqueued before the first request is serviced.

Each enqueued event request can generate a sequence of events. An event sequence is characterized by the Count setting (number of events in the sequence) and the Period setting (time/distance between each event). Additionally, for input-triggered events, the Offset setting determines the distance (time/encoder) between the trigger (e.g., digital input) and the generated event sequence.

If the Period setting is too low, modules such as cameras and lights may drop exposures (e.g., kHEALTH_ID_CAMERA_EXPOSURE_DROPS). To avoid this problem, the event Period should be large enough to accomodate the minimum time required by any modules driven by the event manager. For time-based events, the minimum event Period can be calculated and applied automatically using the EnableAutoPeriod option.

For input-triggered and software-scheduled event sequences, it is possible for an entire event sequence to be dropped if the next sequence is scheduled to start before the previous sequence has completed (kHEALTH_ID_EVENT_SEQUENCE_DROP_COUNT). In any control mode, it is possible for individual events to be dropped due to FireSync synchronization protocol glitches (kHEALTH_ID_EVENT_DROP_COUNT).

The following example illustrates how to configure a single event manager to trigger both a camera and a light in a continuous/periodic time sequence:

kStatus ConfigureContinuous(kSystem system, kNode node)
{
const k64u PERIOD_NS = 100000 * 1000; //~100000 us period (in FireSync nanoseconds)
const k64u EXPOSURE_NS = 10000 * 1000; //~10000 us exposure (in FireSync nanoseconds)
kEventManager eventManager = kNode_EventManagerAt(node, 0);
kCamera camera = kNode_CameraAt(node, 0);
kCameraState cameraState = kNULL;
kLight light = kNode_LightAt(node, 0);
kLightState lightState = kNULL;
//configure the event manaager
kCheck(kEventManager_Clear(eventManager));
kCheck(kEventManager_Enable(eventManager, kTRUE));
kCheck(kEventManager_SetControl(eventManager, kEVENT_CONTROL_CONTINUOUS));
kCheck(kEventManager_SetDomain(eventManager, kSYNC_DOMAIN_TIME));
kCheck(kEventManager_SetPeriod(eventManager, PERIOD_NS));
//configure the camera to respond to event manager 0
kCheck(kCamera_Clear(camera, 1));
kCheck(kCamera_Enable(camera, kTRUE));
kCheck(kCamera_SetControl(camera, kCAMERA_CONTROL_TRIGGERED_BY_EVENT));
kCheck(kCamera_SetControlId(camera, 0)); //event manager index 0
//set camera Exposure (by default, Delay will be zero, and Gap will be determined automatically)
cameraState = kCamera_StateAt(camera, 0);
kCheck(kCameraState_SetExposureNs(cameraState, EXPOSURE_NS));
//configure the light to respond to event manager 0
kCheck(kLight_Clear(light, 1));
kCheck(kLight_Enable(light, kTRUE));
kCheck(kLight_SetControl(light, kLIGHT_CONTROL_TRIGGERED_BY_EVENT));
kCheck(kLight_SetControlId(light, 0)); //event manager index 0
//set light Exposure (by default, Delay will be zero, and Gap will be determined automatically)
lightState = kLight_StateAt(light, 0);
kCheck(kLightState_SetExposureNs(lightState, EXPOSURE_NS));
return kOK;
}
Inheritance diagram for kEventManager:
Inheritance graph

Public Member Functions

kBool kEventManager_AutoPeriodEnabled (kEventManager state)
 Reports whether automatic period is enabled for the event manager. More...
 
kStatus kEventManager_AutoPeriodEnabledInfo (kEventManager state, kInfoBool *info)
 Reports constraint and validity information for the AutoPeriodEnabled setting. More...
 
kStatus kEventManager_Clear (kEventManager manager)
 Resets event manager mode settings. More...
 
kEventControl kEventManager_Control (kEventManager manager)
 Reports the event manager control mode. More...
 
k32u kEventManager_ControlId (kEventManager manager)
 Gets the control source id for an event manager. More...
 
kStatus kEventManager_ControlIdInfo (kEventManager manager, kInfo *info)
 Reports constraint and validity information for the ControlId setting. More...
 
kStatus kEventManager_ControlInfo (kEventManager manager, kInfoBits *info)
 Reports constraint and validity information for the Control setting. More...
 
k64u kEventManager_Count (kEventManager manager)
 Reports the event manager sequence length. More...
 
kStatus kEventManager_CountInfo (kEventManager manager, kInfo64u *info)
 Reports constraint and validity information for the Count setting. More...
 
kSyncDomain kEventManager_Domain (kEventManager manager)
 Reports the event manager synchronization domain. More...
 
kStatus kEventManager_DomainInfo (kEventManager manager, kInfoBits *info)
 Reports constraint and validity information for the Domain setting. More...
 
kStatus kEventManager_Enable (kEventManager manager, kBool enable)
 Enables or disables the event manager. More...
 
kStatus kEventManager_EnableAutoPeriod (kEventManager state, kBool enabled)
 Enables automatic period calculation for the event manager. More...
 
kStatus kEventManager_EnableGate (kEventManager manager, kBool enabled)
 Enables or disables event gating. More...
 
kEventEncoder kEventManager_EncoderMode (kEventManager manager)
 Reports the event manager encoder mode. More...
 
kStatus kEventManager_EncoderModeInfo (kEventManager manager, kInfoBits *info)
 Reports constraint and validity information for the EncoderMode setting. More...
 
kBool kEventManager_GateEnabled (kEventManager manager)
 Reports whether event gating is enabled. More...
 
kStatus kEventManager_GateEnabledInfo (kEventManager manager, kInfoBool *info)
 Reports constraint and validity information for the GateEnabled setting. More...
 
kSize kEventManager_Id (kEventManager manager)
 Gets the id of the event manager module. More...
 
kBool kEventManager_IsEnabled (kEventManager manager)
 Reports whether the event manager is currently enabled. More...
 
k64u kEventManager_MinimumPeriod (kEventManager manager)
 Reports the minimum time period at which events can be generated without causing missed events. More...
 
k64u kEventManager_Offset (kEventManager manager)
 Reports the event manager offset amount. More...
 
kStatus kEventManager_OffsetInfo (kEventManager manager, kInfo64u *info)
 Reports constraint and validity information for the Offset setting. More...
 
k64u kEventManager_Period (kEventManager manager)
 Reports the event manager period. More...
 
kStatus kEventManager_PeriodInfo (kEventManager manager, kInfo64u *info)
 Reports constraint and validity information for the Period setting. More...
 
kStatus kEventManager_Schedule (kEventManager manager, k64s target)
 Schedules an event sequence to begin at a future time or position. More...
 
kStatus kEventManager_SetControl (kEventManager manager, kEventControl type)
 Sets the event manager control mode. More...
 
kStatus kEventManager_SetControlId (kEventManager manager, k32u id)
 Sets the control source id for an event manager. More...
 
kStatus kEventManager_SetCount (kEventManager manager, k64u count, kAdjust adjustment=kADJUST_NONE)
 Sets the event manager sequence length. More...
 
kStatus kEventManager_SetDomain (kEventManager manager, kSyncDomain domain)
 Sets the event manager synchronization domain. More...
 
kStatus kEventManager_SetEncoderMode (kEventManager manager, kEventEncoder mode)
 Sets the event manager encoder mode. More...
 
kStatus kEventManager_SetOffset (kEventManager manager, k64u offset, kAdjust adjustment=kADJUST_NONE)
 Sets the event manager offset amount. More...
 
kStatus kEventManager_SetPeriod (kEventManager manager, k64u period, kAdjust adjustment=kADJUST_NONE)
 Sets the event manager period. More...
 
kStatus kEventManager_Stats (kEventManager manager, kEventStats *stats)
 Gets current event manager statistics. More...
 
kStatus kEventManager_Trigger (kEventManager manager)
 Provides a software trigger to an event manager. More...
 
kEventManagerType kEventManager_Type (kEventManager manager)
 Gets the event manager type. More...
 

The documentation for this class was generated from the following file: