async2v.event module

Summary

Classes:

Event Envelope for all data passed between components.

Reference

REGISTER_EVENT = 'async2v.register'
Type:str

Internal event key. Components to be registered are published as payload on this key.

Don’t use directly - To register a component, use the register method on the Application.

DEREGISTER_EVENT = 'async2v.deregister'
Type:str

Internal event key. Components to be de-registered are published as payload on this key.

Don’t use directly - To de-register a component, use the deregister method on the Application.

SHUTDOWN_EVENT = 'async2v.shutdown'
Type:str

Internal event key used to trigger application shutdown.

Don’t use directly - To shutdown, call shutdown from within a component.

SHUTDOWN_DUE_TO_ERROR = 'async2v.shutdown_due_to_error'
Type:str

Internal event key used to trigger application shutdown due to an uncaught exception in one of the components.

Don’t use directly. From a EventDrivenComponent or IteratingComponent, shutdown can be triggered by raising an exception within the processing logic.

OPENCV_FRAME_EVENT = 'async2v.opencv.frame'
Type:str

Event key to collect debug frames. Push events containing Frame payload to this key to have them displayed in the OpenCvDebugDisplay.

DURATION_EVENT = 'async2v.duration'
Type:str

Metric events containing Duration payload are pushed on this event key by the framework.

FPS_EVENT = 'async2v.fps'
Type:str

Metric events containing Fps payload are pushed on this event key by the framework.

class Event(key, value=None, timestamp=None)

Bases: typing.Generic

Envelope for all data passed between components.

The key serves as an address: Events are delivered to all input fields that listen to the key specified in the event. There is no need to explicitly construct events in production code, as the Output field takes care of that.

Event is a generic type, use Event[T] to denote an event with a value of type T.

Parameters:
  • key (str) – Address that connects output to input fields
  • value (Optional[~T]) – Payload
  • timestamp (Optional[float]) – Set to current time if not provided
key
Type:str

Address that connects output to input fields

timestamp
Type:float

Timestamp of the event in seconds since the epoch

value
Type:T

Payload