QP/C  7.4.0-rc.2
Real-Time Embedded Framework
Loading...
Searching...
No Matches
Events

Active ObjectsState Machines

Concepts & Definitions

An Event is the specification of some occurrence that may potentially have significance to the system under consideration. Upon such an occurrence, a corresponding Event (class) is instantiated, and the generated Event Instance (object) outlives the instantaneous occurrence that generated it.

Event Instances (a.k.a. Messages) are objects specifically designed for communication and synchronization within an event-driven system, such as a QP Application. Once generated, an Event Instance (a.k.a. Message) is propagated to the system, where it can trigger various Actions. These Actions might involve generating secondary Event Instances.

Remarks
This section describes events from the perspective of using them in State Machines and Active Objects. Additional concepts and requirements related to event management in QP Framework are discussed in sections Event Delivery Mechanisms and Event Memory Management.

Event Signal

An Event always has information about the type of occurrence that generated the Event Instance ("what happened"), which will be called Signal in this document. Event Signals are typically enumerated constants that indicate which specific occurrence out of a set of all possible (enumerated) occurrences has generated the Event Instance.

Figure SRS-EVT-SIG: Relationship between Event-Signals and Events. A Signal must unambiguously identify an Event type.

Event Parameters

An Event can have (optionally) associated Parameters, allowing the Event Instance to convey the quantitative information regarding that occurrence. For example, a Keystroke event generated by pressing a key on a computer keyboard might have associated parameters that carry the character scan code and the status of the Shift, Ctrl, and Alt keys.

Requirements

SRS-QP-EVT_00

SRS-QP-EVT_00
QP Framework shall provide Event abstraction to QP Application
Description
The QP Framework shall define a common Event abstraction, so that it can be instantiated, exchanged, and correctly interpreted by both the QP Application and QP Framework.

SRS-QP-EVT_20

SRS-QP-EVT_20
Each event instance shall contain the event Signal
Description
The event Signal carries the information about the occurrence that generated the given event instance. The Signal needs to be easily accessible to the QP Application to determine how to handle a given event.

SRS-QP-EVT_21

SRS-QP-EVT_21
The dynamic range of the event signal shall be compile-time configurable
Description
QP Framework should be compile-time configurable to allow choosing the optimal dynamic range for the event signals while minimizing the size of the event instances. The following dynamic range of event signals should be configurable: 255 signals (1 byte of memory per Signal), 64K signals (2 bytes of memory per Signal), and 4G signals (4 bytes of memory per Signal).

SRS-QP-EVT_22

SRS-QP-EVT_22
QP Framework may reserve some signals for its internal use
Description
QP Framework may need some reserved signals to implement features inside hierarchical state machines. The reserved signals shall have the lowest numerical values.

SRS-QP-EVT_23

SRS-QP-EVT_23
QP Framework shall provide the lowest numerical value of signals allowed in the Application
Description
To avoid conflicts around any reserved event signals, QP Framework shall provide the lowest numerical limit for Application-level signals. In other words, the reserved signals will have numerical values 0 .. (SIGNAL_OFFSET - 1), and the Application-level signals will have values SIGNAL_OFFSET .. SIGNAL_DYNAMIC_RANGE.

SRS-QP-EVT_30

SRS-QP-EVT_30
QP Framework shall allow Application to create event instances with Parameters defined by the Application
Description
The Event abstraction shall provide a mechanism for QP Application to define event parameters useful for the QP Application, and then to create event instances with these parameters.

SRS-QP-EVT_31

SRS-QP-EVT_31
Event abstraction may contain other data items for internal event management inside QP Framework
Description
Event management in QP Framework might require additional information to be stored inside each event instance. Please see Event Memory Management for requirements related to event management inside QP Framework.

SRS-QP-EVT_40

SRS-QP-EVT_40
QP Framework may be compile-time configurable to allow customized constructor and other custom operations on event instances
Description
When such customization is configured, QP Framework shall invoke the custom construction upon instantiation of an event.

SRS-QP-EVT_41

SRS-QP-EVT_41
QP Framework may be compile-time configurable to allow customized destructor of event instances
Description
When such customization is configured, QP Framework shall invoke the custom destructor right before recycling the event instance.

Active ObjectsState Machines