UA_MethodCall

This function block calls a method on a remote UA Server. The method is determined by a connection and a method handle. The former can be queried by UA_Connect, the latter by UA_MethodGetHandle.
Inputs
VAR_INPUT
Execute : BOOL;
ConnectionHdl : DWORD;
MethodHdl : DWORD;
nNumberOfInputArguments : UDINT;
pInputArgInfo : POINTER TO ST_UAMethodArgInfo;
cbInputArgInfo : UDINT;
pInputArgData : PVOID;
cbInputArgData : UDINT;
pInputWriteData : PVOID;
cbInputWriteData : UDINT;
nNumberOfOutputArguments : UDINT;
pOutputArgInfo : POINTER TO ST_UAMethodArgInfo;
cbOutputArgInfo : UDINT;
pOutputArgInfoAndData : PVOID;
cbOutputArgInfoAndData : UDINT;
Timeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
Name | Type | Description |
---|---|---|
Execute | BOOL | The command is triggered by a rising edge at this input. |
ConnectionHdl | DWORD | Connection handle previously output by the function block UA_Connect. |
MethodHdl | DWORD | Method handle, previously output by the function block UA_MethodGetHandle. |
nNumberOfInputArguments | UDINT | Number of input parameters. |
pInputArgInfo | POINTER TO ST_UAMethodArgInfo | Points to the buffer address where input parameter information is stored in the form of an array ST_UAMethodArgInfo. |
cbInputArgInfo | UDINT | Size of the buffer where the input parameter information is stored. |
pInputArgData | PVOID | Points to the buffer address where input parameters (constant length) are stored. |
cbInputArgData | UDINT | Size of the input buffer where input parameters (with constant length) are stored. |
pInputWriteData | PVOID | Pointer to buffer address where input parameters (dynamic length) are stored. |
cbInputWriteData | UDINT | Size of the input buffer where input parameters (with dynamic length) are stored. |
nNumberOfOutputArguments | UDINT | Number of output parameters. |
pOutputArgInfo | POINTER TO ST_UAMethodArgInfo | Points to the buffer address where output parameter information is stored as array ST_UAMethodArgInfo. nLenData is required to determine the target memory of the individual output parameters. The other elements can be set in such a way that a type check of the returned parameters takes place or remains undefined. |
cbOutputArgInfo | UDINT | Size of the buffer where the output parameter information is stored. |
pOutputArgInfoAndData | PVOID | Points to the buffer address where the output parameters are to be saved as a BYTE array. The BYTE array contains the number of output parameters as DINT, four reserved bytes and parameter information as ARRAY OF ST_UAMethodArgInfo (with the length of the output parameters), followed by pure data. Note that the data is packed as 1-byte alignment. |
cbOutputArgInfoAndData | UDINT | Size of the buffer in which the output parameters are to be saved as a BYTE array. |
Timeout | TIME | Time until the function is aborted. DEFAULT_ADS_TIMEOUT is a global constant, set to 5 seconds. |
Outputs
VAR_OUTPUT
cbRead_R : UDINT;
Done : BOOL;
Busy : BOOL;
Error : BOOL;
ErrorID : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
cbRead_R | UDINT | Counts all the bytes received. |
Done | BOOL | Switches to TRUE if the function block was executed successfully. |
Busy | BOOL | TRUE until the function block has executed a command, at the most for the duration of the "Timeout" at the input. The inputs accept no new command as long as Busy = TRUE. It is not the connection time that is monitored but the reception time. |
Error | BOOL | Switches to TRUE if an error occurs while executing a command. The command-specific error code is contained in nErrID. |
ErrorID | UDINT | Contains the command-specific error code of the most recently executed command. |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT 3.1 | Win32, Win64, CE-X86, CE-Arm® | Tc3_PLCopen_OpcUa |