An event is a small packet of data that when processed causes some change in state.

All events have the following attributes:

  • id (str) : the unique id of the event.
  • src (str) : the source of the event (unique id).
  • dst (str) : the destination of the event (unique id).
  • time (float) : current time.
  • data (dict) : a collection of additional values that may be used in processing the event.

Component Events

A component displays part of the internal state to a user, they may also receive events. Events are generated by the various event sources in the ICU system, and may be generated by an interfacing external system. Each internal event source can be set up in the config.json file, for more details see Configuration.

Internal events will change the state of ICU and may trigger a component to update.

In the tables below,

System Monitoring

event(WarningLightEventGenerator, <WarningLight:i>, label=switch) switch warning light i on/off
event(ScaleEventGenerator, <Scale:i>, label=slide, slide=<n>) slide a scale up or down by (+, -) n units

Fuel Monitoring

event(PumpEventGenerator, <Pump:i>, label=<repair/fail>) enables/disables a pump
event(<FuelTank:i>, Global, label=burn, value=<value>) burns an amount of fuel in a tank
event(<FuelTank:i>, Global, label=fuel, acceptable=True/False) triggered when a fuel level moves in/out of the acceptable range
event(<Pump:ij>, Global, label=transfer, value=<value>) transfer some fuel from tank i to tank j

Tracking

event(TargetEventGenerator, Target:0, label=move, dx=<dx>, dy=<dy>) move the tracking component target by (dx,dy)
event(Target:0, Global, label=move, dx=<dx>, dy=<dy>, x=<x>, y=<y>) triggered when the target moves

Highlight

All components have an associated highlighter which may receive highlight events. The id of a highlighter is derived from it associated component Highlight:<Component ID>, for example, Highlight:WarningLight:0.

event(Highlight:<Component:i>, Global, label=highlight, value=True/False) turn on/off the highlight of the given component.

Input

Inpput events apply to different components and may trigger some behaviour, for example clicking on a warning light will turn it on/off.

event(Canvas, <Component:i>), label=click, x=<x>, y=<y>) click on a component
event(Keyhandler, Target:0, label=key, key=<key>, keycode=<keycode>, action=<hold/release>) keyboard input for the tracking task
event(<eye tracker>, Overlay:0, label=<label>, x=<x>, y=<y>) eyetracking input, <label> may be gaze or saccade

Overlay

The overlay component can display graphics on top of other components.

event('<src>', 'Overlay:Overlay', label='overlay', x=<x>, y=<y>, text='<text>', graphic='<graphic_label>') Overlay text or predefined graphic at location (x,y) - pixel coordinates

Custom overlay graphics must be registered with the overlay to associate a label (TODO). Text formatting options should also be specified as part of the configuration.

External Events

Events are generated by event sources and received by event sinks, all components are both a source and sink. Events can be generated and sent automatically to ICU by sub-classing the event.ExternalEventSource class and received by a sub-class of event.ExternalEventSink.