prepareResponsePackage static method

DataPackage prepareResponsePackage(
  1. RemoteFunctionStatus status,
  2. DataPackage rpcRequest
)

Implementation

static DataPackage prepareResponsePackage(RemoteFunctionStatus status, DataPackage rpcRequest)
{
  RemoteFunctionRequest executionRequest =
      rpcRequest.controlVal.remoteFunctionRequest;

  DataPackage responsePackage = DataPackage();

  responsePackage.sourceModule = rpcRequest.targetModule;
  responsePackage.targetModule = rpcRequest.sourceModule;

  ControlPackage ctrlPackage = ControlPackage();
  ctrlPackage.ctrlType = CtrlType.CTRL_REMOTE_FUNCTION_RESPONSE;
  ctrlPackage.remoteFunctionReturn =
      RemoteFunctionRunnable.makeRemoteFunctionReturn(status, executionRequest);

  // Send back to the runtime that made the RPC request.
  ctrlPackage.runtime = rpcRequest.controlVal.runtime;

  responsePackage.controlVal = ctrlPackage;

  return responsePackage;
}