The ARXF-CP supports communication via asynchronous messages, also known as events. This is a strong mechanism for decoupling object-oriented software in run time behavior.
Event receptions in a UML model are usually consumed by classes, which have their behavior modeled via a statechart. An event can for example
be perfectly used to trigger a transition to another state.
UML events can be sent from any part of the SW-C to any Rhapsody generated part of the same SW-C instance:
- from Rhapsody generated code to Rhapsody generated code
- from AUTOSAR Legacy code to Rhapsody generated code
The reason that a UML event can not be send from one SW-C to another SW-C (or instance of the same SW-C) is that communication between SW-Cs is
handled via AUTOSAR Ports using RTE generated APIs.
Sending and receiving a UML event would require serialization and de-serialization of some data representing the UML event and an RTE API for transport.
ARXF_CP_V8.00 does not support this.
Dynamic Events vs Static Events
Events can either be dynamic or static with respect to allocation:
- dynamic events are used unless you specify a static event yourselves: dynamic events are commonly used.
Rhapsody will generate code to allocate an event XX in the form of RiC_Create_XX() which uses RXF_MemoryManager_getMemory()
to allocate space in one of the static memory pools.
Every SW-C instance uses its own memory for data (code is shared) so the macro RXF_MemoryManager_getMemory() uses an argument to reach the proper storage.
In order to prevent you to add an extra argument to every event, during code generation this argument is added automatically.
- static events are statically allocated. In non-AUTOSAR environments these are typically sent from Interrupt Service Routines.
In AUTOSAR environments, a typical use is legacy code: you might want to send a UML event from existing code into your model.
For this, you can use the CGEN_ISR macro.