0

What are the function return types available in CAPL? Is it possible to return a diagnostic object from a function? I am getting error in CAPL when trying to have diagnostic object(Req/Resp) as return type for the function and I couldn't find anything about the function return types in CAPL help document

suryadevi
  • 77
  • 3

1 Answers1

1

You can only return native types from functions (long, int, etc.) However, you can declare your function to take a pointer argument that will contain the result (think C). The following can be done from a CAPL Test Module (compiled but untested):

void sendAndReceive(diagRequest * request, diagResponse * responseOut){
  request.SendRequest();
  testWaitForDiagRequestSent(request, 1000);
  testWaitForDiagResponse(request, 1000);
  request.GetLastResponse(responseOut);
}

void testSendReceive(){
  diagRequest SecurityAccess::SecuritySeed::Request request;
  diagResponse SecurityAccess::SecuritySeed::Request response;
  sendAndReceive(request, response);
  //do something with response here
}
cj.burrow
  • 119
  • 1
  • 7