Below is the list of RTE API functions
- Rte_Ports
- Rte_NPorts
- Rte_Port
- Rte_Write
- Rte_Send
- Rte_Switch
- Rte_Invalidate
- Rte_Feedback
- Rte_SwitchAck
- Rte_Read
- Rte_DRead
- Rte_Receive
- Rte_Call
- Rte_Result
- Rte_Pim
- Rte_CData
- Rte_Prm
- Rte_IRead
- Rte_IWrite
- Rte_IWriteRef
- Rte_IInvalidate
- Rte_IStatus
- Rte_IrvIRead
- Rte_IrvIWrite
- Rte_IrvIWriteRef
- Rte_IrvRead
- Rte_IrvWrite
- Rte_Enter
- Rte_Exit
- Rte_Mode
- EnhancedRte_Mode
- Rte_Trigger
- Rte_IrTrigger
- Rte_IFeedback
- Rte_IsUpdated
- Rte_PBCon
1. Rte_Ports: Provides an array of the ports of a given interface type and a given provide/require usage
Syntax: Rte_Ports_<i>_<R/P>
Where here <i> is the port interface type and ‘P’ or ‘R’ are literals to indicate provide or require ports respectively
Where here <i> is the port interface type and ‘P’ or ‘R’ are literals to indicate provide or require ports respectively
Eg: You have a component which has two receive ports with type temperature_sens
typedef struct {
int temperature_value;
int error_factor;
}temperature_sens;
Port A -> position A temperature sensor
Port B -> position B temperature sensor
RTE_API: Rte_Ports_temperature_sens_R(self)
A hypothetical example code:
void tempsens_runnable()
{
int posA_temp;
int posA_temp_err;
int PosB_temp;
int posB_temp_err;
ptr = Rte_Ports_temperature_sens_R(self);
posA_temp = *ptr++; // assuming that A is the first port
posA_temp_err = *ptr++;
posB_temp = *ptr++;
posB_temp_err = *ptr;
}
Note: For any port to be accessed in this way, the particular port(s) property "indirectAPI" should be set to TRUE(port properties will be covered in a separate article)
2.Rte_Nports: Provide the number of ports of a given interface type and provide /
require usage that can be accessed through the indirect API.
It is similar to the Rte_Ports API discussed above, but it will return only the count of the ports of the particular type and send/receive type. Considering the same example as above
Rte_NPorts_temperature_sens_R(self) will return a value of 2.
3.Rte_port: Provide access to the port data structure for a single port of a particular
software component instance
Syntax:Rte_PortHandle_<i>_<R/P>
Eg: Going back to the first example you could have noticed that I used pointer operation and this is not allowed in application SW. This was because that example was only hypothetical and it is incomplete without using the Rte_PortHandle_ API. Combining this API we will have a full implementation on how to access individual ports (indirectly - I will explain on this later - for now don't focus on it)
void tempsens_runnable()
{
int posA_temp;
int posA_temp_err;
int PosB_temp;
int posB_temp_err;
Rte_PortHandle_temperature_sens port_ary = Rte_Ports_temperature_sens_R(self);
posA_temp = port_ary[0].temperature_value; // assuming that A is the first port
posA_temp_err = port_ary[0]..error_factor;
posB_temp = port_ary[1].temperature_value;
posB_temp_err = port_ary[1].temperature_value;
}
4.Rte_Write: Initiates transmission of data of a send port.
Syntax: Std_ReturnType Rte_Write_<port>_<o>(Rte_Instance <inst>,<data>)
Where <p> is the port name and <o> the VariableDataPrototype(data type of element inside a port) within the sender-receiver interface
Eg:
Port -> cruisecontrol{
velocity
brake
distance
......
}
VariableDataPrototype -> velocity;
ret_val = Rte_Write_cruisecontrol_velocity (self,80);
if(ret_val == RTE_E_OK)
{
printf("data passed to communication service succesfully");
}
5.Rte_Send: It is similar to Rte_write, the difference is that this API is used to transmit data to a queue type data
ret_val = Rte_Write_infotainment_addsong2queue (self,80);
6.Rte_Switch: Initiate a mode switch. The Rte_Switch API call is used for ‘explicit’
sending of a mode switch notification. Application SW can create and maintain certain modes so that certain features are available and running at only certain conditions thereby reducing runtime , battery consumption, etc.. Using this API application SW-Cs can cause mode switch
Syntax: Std_ReturnType Rte_Switch_<port>_<item>( Rte_Instance <inst>, <data>)
Eg:
if(vehicle speed ==0 && engine speed < 900 rpm)
{
ret_val = Rte_Switch_EngStateGoverner_EngineModes( Rte_Instance_EngStateGoverner , Idling ) ;
if (ret_val==RTE_E_OK)
{
printf("mode switch passed successfully to communication service");
}
}
7.Rte_Invalidate: Invalidate a data element for an “explicit” sender-receiver transmission.
Changes the value of the specified element of the port to invalid values. The invalid values will be specified in the port configuration
Syntax: Std_ReturnType Rte_Invalidate_<p>_<o>(Rte_Instance <inst>)
Where <p> is the port name and <o> the VariableDataPrototype within the sender-receiver interface categorizing the port.
eg:
while(com_initialization == pending)
{
Rte_Invalidate_canvalues_airpressure(self);
}
8.Rte_Feedback: Provides a mechanism for the Rte explicit sender communication(Rte_write, Rte_Send..) to get feedback that data has reached the intended destination. The Rte_Write, Rte_Send, etc.. will have only return values indicating that the data has been passed on to the communication services, whether it has reached the intended place is not known by return value, rather we have to use thsi function
Syntax:Std_ReturnType Rte_Write_<p>_<o>(Rte_Instance <instance>)
Eg: Rte_Write_cruisecontrol_velocity(self, 23);
if (Rte_Feedback_pa_cruisecontrol_velocity(self) == RTE_E_TRANSMIT_ACK)
{
/* Transmit okay */
}
9. Rte_SwitchAck: Similar to Rte_Feedback, difference is this function is used to get acknowledgement for Rte_Switch request
Syntax:Std_ReturnType Rte_SwitchAck_<p>_<o>(Rte_Instance <instance>)
Eg:
if(vehicle speed ==0 && engine speed < 900 rpm)
{
ret_val = Rte_Switch_EngStateGoverner_EngineModes( Rte_Instance_EngStateGoverner , Idling ) ;
if (ret_val==RTE_E_OK)
{
printf("mode switched successfully ");
}
}
10. Rte_Read: Performs an “explicit” read on a sender-receiver communication data
element
Syntax: Std_ReturnType Rte_Read_<p>_<o>(Rte_Instance <instance>,OUT <data>)
Where <p> is the port name and <o> the VariableDataPrototype
Eg:
Port -> cruisecontrol{
velocity
brake
distance
......
}
ret_val = Rte_Read_cruisecontrol_brake (self,brake);
if(ret_val == RTE_E_OK)
{
printf("data read succesfully");
}
To be continued ....
Syntax: Std_ReturnType Rte_Write_<port>_<o>(Rte_Instance <inst>,<data>)
Where <p> is the port name and <o> the VariableDataPrototype(data type of element inside a port) within the sender-receiver interface
Eg:
Port -> cruisecontrol{
velocity
brake
distance
......
}
VariableDataPrototype -> velocity;
ret_val = Rte_Write_cruisecontrol_velocity (self,80);
if(ret_val == RTE_E_OK)
{
printf("data passed to communication service succesfully");
}
5.Rte_Send: It is similar to Rte_write, the difference is that this API is used to transmit data to a queue type data
ret_val = Rte_Write_infotainment_addsong2queue (self,80);
6.Rte_Switch: Initiate a mode switch. The Rte_Switch API call is used for ‘explicit’
sending of a mode switch notification. Application SW can create and maintain certain modes so that certain features are available and running at only certain conditions thereby reducing runtime , battery consumption, etc.. Using this API application SW-Cs can cause mode switch
Syntax: Std_ReturnType Rte_Switch_<port>_<item>( Rte_Instance <inst>, <data>)
Eg:
if(vehicle speed ==0 && engine speed < 900 rpm)
{
ret_val = Rte_Switch_EngStateGoverner_EngineModes( Rte_Instance_EngStateGoverner , Idling ) ;
if (ret_val==RTE_E_OK)
{
printf("mode switch passed successfully to communication service");
}
}
7.Rte_Invalidate: Invalidate a data element for an “explicit” sender-receiver transmission.
Changes the value of the specified element of the port to invalid values. The invalid values will be specified in the port configuration
Syntax: Std_ReturnType Rte_Invalidate_<p>_<o>(Rte_Instance <inst>)
Where <p> is the port name and <o> the VariableDataPrototype within the sender-receiver interface categorizing the port.
eg:
while(com_initialization == pending)
{
Rte_Invalidate_canvalues_airpressure(self);
}
8.Rte_Feedback: Provides a mechanism for the Rte explicit sender communication(Rte_write, Rte_Send..) to get feedback that data has reached the intended destination. The Rte_Write, Rte_Send, etc.. will have only return values indicating that the data has been passed on to the communication services, whether it has reached the intended place is not known by return value, rather we have to use thsi function
Syntax:Std_ReturnType Rte_Write_<p>_<o>(Rte_Instance <instance>)
Eg: Rte_Write_cruisecontrol_velocity(self, 23);
if (Rte_Feedback_pa_cruisecontrol_velocity(self) == RTE_E_TRANSMIT_ACK)
{
/* Transmit okay */
}
9. Rte_SwitchAck: Similar to Rte_Feedback, difference is this function is used to get acknowledgement for Rte_Switch request
Syntax:Std_ReturnType Rte_SwitchAck_<p>_<o>(Rte_Instance <instance>)
Eg:
if(vehicle speed ==0 && engine speed < 900 rpm)
{
ret_val = Rte_Switch_EngStateGoverner_EngineModes( Rte_Instance_EngStateGoverner , Idling ) ;
if (ret_val==RTE_E_OK)
{
printf("mode switched successfully ");
}
}
10. Rte_Read: Performs an “explicit” read on a sender-receiver communication data
element
Syntax: Std_ReturnType Rte_Read_<p>_<o>(Rte_Instance <instance>,OUT <data>)
Where <p> is the port name and <o> the VariableDataPrototype
Eg:
Port -> cruisecontrol{
velocity
brake
distance
......
}
ret_val = Rte_Read_cruisecontrol_brake (self,brake);
if(ret_val == RTE_E_OK)
{
printf("data read succesfully");
}
To be continued ....
No comments:
Post a Comment