Home > Back-end >  How function call can implement between SWC's in AUTOSAR
How function call can implement between SWC's in AUTOSAR

Time:09-07

I want a particular function to be executed and return a value to another SWC in AUTOSAR architecture. for example :

SWC-1

boolean operation(int a, int b)
{
   if (a == b)
    return true;
  else
    return false;
}

SWC - 2

int main()
{
  int a = 2, b = 3;

  boolean ret = false;

  ret = operation(2,3);
  
  if(ret == true)
  {
    //perform some activity 
  }
}

I want to a perform operation function call in SWC-2. The function is defined in SWC-1. In AUTOSAR architecture, how can i configure these functions? Can i do it as sender receiver method or client- server method ? Which is the best way to design in AUTOSAR ?

CodePudding user response:

This is obviously a case for client/server communication. The function operation has to be modeled as a ClientServerOperation inside a ClientServerInterface. Also, an RPortPrototype (typed by the ClientServerInterface) is required to exist on SWC2 for calling the operation using the Rte_Call API for calling the operation.

The server side is a bit more complicated to configure and it would take some effort to explain everything in detail. I‘d recommend having a look at the AUTOSAR specification documents „TPS Software Component Template“ and „SWS RTE“ to understand how the interaction between the software-components works.

  • Related