FB_IotFunctions_Connector

FB_IotFunctions_Connector 1:

The function block enables communication with a local/remote TC3 IoT Data Agent installation. The Execute method of the function block must be called cyclically in order to ensure the background communication with the TC3 IoT Data Agent to facilitate the reception of messages. All connection parameters and global settings are available as input parameters.

Syntax

FUNCTION_BLOCK FB_IotFunctions_Connector
VAR_INPUT
    sAmsNetId                        : STRING;
    nDefaultRequestTimeout           : UDINT;
    nDefaultMessageRetryInterval     : UDINT;
    nDefaultMessageCumulativeTimeout : UDINT;
END_VAR
VAR_OUTPUT
    hrInitializationErrorCode        : HRESULT;
    hrLastMessageErrorCode           : HRESULT;
    driverOTCID                      : OTCID;
    pStIotFunctionsRequests          : POINTER TO ST_IotFunctionsRequestContainer;
END_VAR

FB_IotFunctions_Connector 2: Inputs

Designation

Type

Description

sAmsNetId

STRING

Target Data Agent Instance AmsNetId [127.0.0.1.1.1]

nDefaultRequestTimeout

UDINT

Default timeout value in milliseconds [10000]

nDefaultMessageRetryInterval

UDINT

Default message retry interval in milliseconds (0 disables retries) [0]

nDefaultMessageCumulativeTimeout

UDINT

Default cumulative timeout in milliseconds (if message data is successfully received, the timeout of the relevant request is extended by this value) [0]

FB_IotFunctions_Connector 3: Outputs

Designation

Type

Description

hrInitializationErrorCode

HRESULT

HRESULT of driver instantiation and configuration

hrLastMessageErrorCode

HRESULT

HRESULT of latest reported error occurred in any message during the Execute call.

driverOTCID

OTCID

OTCID of the instantiated driver (can be passed on to FB input variables for requests and messages in environments with multiple data agents)

pStIotFunctionsRequests

POINTER TO ST_IotFunctionsRequestContainer

Description of latest error code.

FB_IotFunctions_Connector 4: Methods

Designation

Description

Execute

Enables background communication with TC3 IoT Data Agent. The method must be called cyclically.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4022.14

IPC or CX (c86, x64, ARM)

Tc3_IotFunctions