Communication

This topic describes the concepts of internal and external communication and generated APIs.

This page discusses:

Internal and External Communication

This topic describes the concepts of internal and external communication.

Internal communication is the communication between internal components of a model. External communication is the communication between a component and the environment.

Internal Communication

All communications transit through the middleware. The figure below shows the communication between two components. Component A always communicates with component B through the middleware.

For a sender/receiver communication, the communication sequence is the following:

  1. During its execution, component A writes data D on its output port. Data D is stored in a buffer in the applicative middleware.
  2. During its execution, component B reads data D on its input port. Data D is extracted from the buffer in the applicative middleware.

For a client/server communication, the communication sequence is the following:

  1. During its execution, component A (client) invokes component B (server) through its output port. Calling the server begins its execution.
  2. Component B (server) executes itself to compute data and responds to the client.
  3. Component A (client) gets the execution result and continues its execution process.

External Communication

As shown in the figure below, a component can communicate with its environment by reading data from outside and writing data to outside. Contrary to internal communication, this communication is target-dependent.

Generated API Specification

RTE_Read

Prototype
void RTE_Read_<Port_Name>_<Data_Name>(Rte_Instance instance, <data_type>* data)
Description
You can use this function to read a data identified by its name on an input port of a component.
Arguments
Rte_Instance instance: current component instance.
Return
This function does not return any value.

RTE_Write

Prototype
void RTE_Write_<Port_Name>_<Data_Name>(Rte_Instance instance, <data_type>* dataName)
Description
You can use this function to write a data value transmitted to an output flow port to provide that value to another connected component.
Arguments
  • Rte_Instance instance: current component instance.
  • <data_type>* dataName.
Return
This function does not return any value.

RTE_Trigger

Prototype
void RTE_Trigger_<Port_Name>_<Event_Name>(Rte_Instance instance <, <data_type>* dataName>)
Description
This function fires an event identified by its name on an output port.
Arguments
  • Rte_Instance instance: current component instance.
  • <data_type>* dataName optional argument if an event references a type. This type informs that a data will be transmitted with the Event.
Return
This function does not return any value.

RTE_Call

Prototype
<return_type> RTE_Call_<Port_Name>_<Operation_Name>(Rte_Instance instance, <argument_type>* argumentName, …)
Description
You can use this function to invoke the server.
Arguments
  • Rte_Instance instance: current component instance.
  • <argument_type>* argumentName, list of arguments as defined in the software production model.
Return
This function returns a value if the operation defined in software production model is declared as returning a type.

RTE_GetTime

Prototype
double RTE_GetTime(Rte_Instance instance)
Description
You can use this function to retrieve the current time computed by the middleware.
Arguments
Rte_Instance instance: The current component instance.
Return
This function returns a double value corresponding to the elapsed time in seconds since the start-up of the application.