FB_IotFunctions_Connector

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 as well as global settings exist as input parameters.

Syntax

FUNCTION_BLOCK FB_IotFunctions_Connector
VAR_INPUT
    sAmsNetId                        : STRING;
    nDefaultRequestTimeout           : UDINT;
    eDefaultMessageAckOption         : EIotFunctionsAckOption;
    nDefaultMessageRetryInterval     : UDINT;
    nDefaultMessageCumulativeTimeout : UDINT;
END_VAR
VAR_OUTPUT
    hrInitializationErrorCode : HRESULT;
    hrLastMessageErrorCode    : HRESULT;
    driverOTCID               : OTCID;
    fbTcResultEvent           : FB_TcIotFunctionsResultEvent;
    stIotFunctionsEvent       : ST_IotFunctionsEvent;
    pStIotFunctionsRequests   : POINTER TO ST_IotFunctionsRequestContainer;
END_VAR

FB_IotFunctions_Connector 1: Inputs

Name

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 (successfully receiving message data will prolong the containing request's timeout by this value) [0]

FB_IotFunctions_Connector 2: Outputs

Name

Type

Description

hrInitializationErrorCode

HRESULT

HRESULT of driver instantiation and configuration

hrLastMessageErrorCode

HRESULT

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

driverOTCID

OTCID

OTCID of the instantiated driver (passable to request and message FB input variables in multi data agent environments)

pStIotFunctionsRequests

POINTER TO ST_IotFunctionsRequestContainer

Description of latest error code.

FB_IotFunctions_Connector 3: Methods

Name

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