UA_MethodGetHandle

UA_MethodGetHandle 1:

This function block collects a handle for a UA method, which can then be used to call a method using UA_MethodCall.

UA_MethodGetHandle 2: Inputs

VAR_INPUT
    Execute          : BOOL;
    ConnectionHdl    : DWORD;
    ObjectNodeID     : ST_UANodeID;
    MethodNodeID     : ST_UANodeID;
    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.

ObjectNodeID

ST_UANodeID

Object node ID of the method to be called. (Type: ST_UANodeID).

MethodNodeID

ST_UANodeID

Method node ID of the method to be called. Corresponds to the ID attribute in the UA namespace. (Type: UA_Connect).

Timeout

TIME

Time until the function is aborted. DEFAULT_ADS_TIMEOUT is a global constant, set to 5 seconds.

UA_MethodGetHandle 3: Outputs

VAR_OUTPUT
    MethodHdl   : DWORD;
    Done        : BOOL;
    Busy        : BOOL;
    Error       : BOOL;
    ErrorID     : UDINT;
END_VAR

Name

Type

Description

MethodHdl

DWORD

Returns a method handle that can be used to call a method via UA_MethodCall.

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