Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

CallMethodAsync example

  • Last UpdatedJul 22, 2024
  • 1 minute read

inputArgs[1] = new aaMethods.MethodArgument("x",

aaMethods.Value.Create(aaMethods.ValueType.Double, Me.X));

inputArgs[2] = new aaMethods.MethodArgument("y",

aaMethods.Value.Create(aaMethods.ValueType.Double, Me.Y));

if(methodCallStatus == null ) or (methodCallStatus.RunStatus == aMethods.MethodCallState.NotStarted) then

methodCallStatus = client.CallMethodAsync("ScriptName",” OPCUA_DeviceGroup”,

"/DemoServer/s=Demo.Method", "Multiply", "Joe Operator", inputArgs);

endif;

outputArgs = methodCallStatus. OutputArguments;

The script stores the result of the method call in the object attribute Result of type double:

multiplyResult = outputArgs[1][0]

Me.Result = multiplyResult.GetAsDouble();

The CallMethodAsync() arguments are:

  • ScriptName is the name of the userCallerID. Value of the CallerID, which can be any identifier string/scriptname. It can also be empty.

  • OPCUA_DeviceGroup and OPCUA_DeviceGroup./DemoServer/s=Demo.Method uniquely identify the object in the OPC UA server hosting the method to be called. Refer to the Gateway Communication Driver User Guide for details.

  • Multiply is the name of the method exposed by the OPC UA server object.

  • JoeOperator is the name of the user calling the method.

  • inputArgs is the array containing the method input arguments.

  • outputArgs is the array containing the arguments returned from the method call.

TitleResults for “How to create a CRG?”Also Available in