Receiving from a Port – ESDL
Note |
|---|
This instruction applies only to SWCs specified in ESDL code. |
If your software component uses a SenderReceiver or NVData interface as Rport, at least one runnable entity must receive data over the interface. Use one of the following possibilities to specify receiving data:
- Implicit
- Explicit (without status)
- Explicit with status
Rules and restrictions are listed here: Sender-Receiver Communication -Rules
- Open the SWC you want to edit.
Enter the following code to use implicit read:
<variable> = <SRinterface>.<data element>;
- <variable> is the element that reads the interface element
- <SRinterface> is the SenderReceiver/NVData interface used as Rport
- <data_element> is the SenderReceiver/NVData interface element you want to read
- Open the SWC you want to edit.
Enter the following code to use explicit read:
<SRinterface>.<data element>.explicitRead(<variable>);
- <variable> is the element that reads the interface element
- <SRinterface> is the SenderReceiver/NVData interface used as Rport
- <data_element> is the SenderReceiver/NVData interface element you want to read
- Open the SWC you want to edit.
Declare a method-/runnable-local variable of type Std_ReturnType.
This variable will hold the status from the explicit read procedure.
Enter the following code to use explicit read with status information:
<status_variable> = <SRinterface>.<data_element>.explicitRead(<variable>);
- <status_variable> is the variable of type Std_ReturnType that holds the returned status
- <SRinterface> is the SenderReceiver/NVData interface used as Rport
- <data_element> is the SenderReceiver/NVData interface element you want to read
- <variable> is the element that reads the interface element
Specify the status inquiry as follows:
if (<status_variable> != RTE_E_OK)
{
... // your statement or statement block
}
See also